15 Commits

Author SHA1 Message Date
Nana Janashia
d7e9360e2c fix 2020-11-08 17:28:39 +01:00
Nana Janashia
6b1d998791 add library def inside Jenkinsfile 2020-11-08 17:25:26 +01:00
Nana Janashia
922c8df4c6 add ind commands 2020-11-08 17:12:58 +01:00
Nana Janashia
946909a1b0 add param to dockerbuild 2020-11-08 16:41:07 +01:00
Nana Janashia
5aab8caed6 fix lib call 2020-11-08 16:30:28 +01:00
Nana Janashia
63a5e576a8 fix lib call 2020-11-08 16:27:28 +01:00
Nana Janashia
aa6f394e65 fix lib call 2020-11-08 16:20:19 +01:00
Nana Janashia
15a05dc886 Update Jenkinsfile 2020-11-08 15:15:26 +00:00
Nana Janashia
81b557f424 Update Jenkinsfile 2020-11-08 15:14:14 +00:00
Nana Janashia
6e6e1fdcb6 Update Jenkinsfile 2020-11-08 15:12:19 +00:00
Nana Janashia
75f780bd0c fix lib call 2020-11-08 16:05:48 +01:00
Nana Janashia
6a5572a5f7 call library functions in jenkinsfile 2020-11-08 15:58:31 +01:00
Nana Janashia
d7839d4033 Update Jenkinsfile 2020-11-07 16:28:59 +00:00
Nana Janashia
af78bcdf1e Add new file 2020-11-07 15:45:27 +00:00
Nana Janashia
5a4e789475 Update Jenkinsfile 2020-11-07 15:44:58 +00:00
3 changed files with 45 additions and 19 deletions

8
Dockerfile Normal file
View 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"]

49
Jenkinsfile vendored
View File

@@ -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 {
agent none
agent any
tools {
maven 'Maven'
}
stages {
stage('test') {
stage("init") {
steps {
script {
echo "Testing the application..."
echo "Executing pipeline for branch $BRANCH_NAME"
gv = load "script.groovy"
}
}
}
stage('build') {
when {
expression {
BRANCH_NAME == 'master'
}
}
stage("build jar") {
steps {
script {
echo "Building the application..."
buildJar()
}
}
}
stage('deploy') {
when {
expression {
BRANCH_NAME == 'master'
}
}
stage("build and push image") {
steps {
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
View File

@@ -0,0 +1,5 @@
def deployApp() {
echo 'deploying the application...'
}
return this