Compare commits
15 Commits
feature/pa
...
jenkins-sh
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7e9360e2c | ||
|
|
6b1d998791 | ||
|
|
922c8df4c6 | ||
|
|
946909a1b0 | ||
|
|
5aab8caed6 | ||
|
|
63a5e576a8 | ||
|
|
aa6f394e65 | ||
|
|
15a05dc886 | ||
|
|
81b557f424 | ||
|
|
6e6e1fdcb6 | ||
|
|
75f780bd0c | ||
|
|
6a5572a5f7 | ||
|
|
d7839d4033 | ||
|
|
af78bcdf1e | ||
|
|
5a4e789475 |
8
Dockerfile
Normal file
8
Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
FROM openjdk:8-jre-alpine
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
COPY ./target/java-maven-app-1.0-SNAPSHOT.jar /usr/app/
|
||||||
|
WORKDIR /usr/app
|
||||||
|
|
||||||
|
ENTRYPOINT ["java", "-jar", "java-maven-app-1.0-SNAPSHOT.jar"]
|
||||||
51
Jenkinsfile
vendored
51
Jenkinsfile
vendored
@@ -1,35 +1,48 @@
|
|||||||
|
#!/usr/bin/env groovy
|
||||||
|
|
||||||
|
library identifier: 'jenkins-shared-library@master', retriever: modernSCM(
|
||||||
|
[$class: 'GitSCMSource',
|
||||||
|
remote: 'https://gitlab.com/nanuchi/jenkins-shared-library.git',
|
||||||
|
credentialsId: 'gitlab-credentials'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def gv
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent none
|
agent any
|
||||||
|
tools {
|
||||||
|
maven 'Maven'
|
||||||
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('test') {
|
stage("init") {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
echo "Testing the application..."
|
gv = load "script.groovy"
|
||||||
echo "Executing pipeline for branch $BRANCH_NAME"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('build') {
|
stage("build jar") {
|
||||||
when {
|
|
||||||
expression {
|
|
||||||
BRANCH_NAME == 'master'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
echo "Building the application..."
|
buildJar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('deploy') {
|
stage("build and push image") {
|
||||||
when {
|
|
||||||
expression {
|
|
||||||
BRANCH_NAME == 'master'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
echo "Deploying the application..."
|
buildImage 'nanajanashia/demo-app:jma-3.0'
|
||||||
|
dockerLogin()
|
||||||
|
dockerPush 'nanajanashia/demo-app:jma-3.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage("deploy") {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
gv.deployApp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
script.groovy
Normal file
5
script.groovy
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
def deployApp() {
|
||||||
|
echo 'deploying the application...'
|
||||||
|
}
|
||||||
|
|
||||||
|
return this
|
||||||
Reference in New Issue
Block a user