|
@@ -10,7 +10,7 @@ node {
|
|
|
def registryCredential
|
|
def registryCredential
|
|
|
try {
|
|
try {
|
|
|
// environment {
|
|
// environment {
|
|
|
- registryAddress = "https://000-sidali.kemdiktisaintek.go.id"
|
|
|
|
|
|
|
+ registryAddress = "https://000-dev-sidali.kemdiktisaintek.go.id"
|
|
|
registryCredential = 'DockerRegistry-ID'
|
|
registryCredential = 'DockerRegistry-ID'
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
@@ -28,6 +28,7 @@ node {
|
|
|
echo "Branch: master"
|
|
echo "Branch: master"
|
|
|
sh 'docker -v'
|
|
sh 'docker -v'
|
|
|
sh 'printenv'
|
|
sh 'printenv'
|
|
|
|
|
+ sh 'docker-compose -v'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
stage('Test Build'){
|
|
stage('Test Build'){
|
|
@@ -35,18 +36,6 @@ node {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
stage('Build Deploy '){
|
|
stage('Build Deploy '){
|
|
|
- // // now you are on slave labeled with 'label'
|
|
|
|
|
- // def workspace = WORKSPACE
|
|
|
|
|
- // // ${workspace} will now contain an absolute path to job workspace on slave
|
|
|
|
|
-
|
|
|
|
|
- // workspace = env.WORKSPACE
|
|
|
|
|
- // // ${workspace} will still contain an absolute path to job workspace on slave
|
|
|
|
|
-
|
|
|
|
|
- // // When using a GString at least later Jenkins versions could only handle the env.WORKSPACE variant:
|
|
|
|
|
- // echo "Current workspace is ${env.WORKSPACE}"
|
|
|
|
|
-
|
|
|
|
|
- // // the current Jenkins instances will support the short syntax, too:
|
|
|
|
|
- // echo "Current workspace is $WORKSPACE"
|
|
|
|
|
docker.withTool("myDocker"){
|
|
docker.withTool("myDocker"){
|
|
|
docker.withRegistry(registryAddress, registryCredential) {
|
|
docker.withRegistry(registryAddress, registryCredential) {
|
|
|
|
|
|
|
@@ -55,30 +44,23 @@ node {
|
|
|
/* Push the container to the custom Registry */
|
|
/* Push the container to the custom Registry */
|
|
|
dockerImage.push()
|
|
dockerImage.push()
|
|
|
dockerImage.push('latest')
|
|
dockerImage.push('latest')
|
|
|
|
|
+
|
|
|
|
|
+ def imageName = "000-dev-sidali.kemdiktisaintek.go.id/ptb-be:latest"
|
|
|
|
|
+ def composeDir = '/workdir/production'
|
|
|
|
|
+
|
|
|
|
|
+ sh "docker pull ${imageName}"
|
|
|
|
|
+
|
|
|
|
|
+ sh "docker stop ptb-Backend"
|
|
|
|
|
+ sh "docker rm ptb-Backend"
|
|
|
|
|
+
|
|
|
|
|
+ sh """cd ${composeDir} &&
|
|
|
|
|
+ docker-compose stop ptb-be &&
|
|
|
|
|
+ docker-compose rm -f ptb-be &&
|
|
|
|
|
+ docker-compose up -d ptb-be"""
|
|
|
|
|
+
|
|
|
|
|
+ echo "Deploy completed successfully"
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // echo 'env.BRANCH_NAME : ' + env.BRANCH_NAME
|
|
|
|
|
- // if(env.BRANCH_NAME == 'master'){
|
|
|
|
|
- // script {
|
|
|
|
|
- // app = docker.build("ptb-be:latest")
|
|
|
|
|
- // echo 'app content : ' + app
|
|
|
|
|
- // dockerImage = registryAddress + ":$BUILD_NUMBER"
|
|
|
|
|
- // echo 'dockerImage : ' + dockerImage
|
|
|
|
|
- // echo 'registryCredential : ' + registryCredential
|
|
|
|
|
- // echo 'registryAddress : ' + registryAddress
|
|
|
|
|
- // echo 'withRegistry running...'
|
|
|
|
|
- // docker.withRegistry( "http://"+registryAddress, registryCredential ) {
|
|
|
|
|
- // echo 'withRegistry inside... app.push start'
|
|
|
|
|
- // //app.push("${BUILD_NUMBER}")
|
|
|
|
|
- // app.push('ptb-be:latest')
|
|
|
|
|
- // echo 'app.push done'
|
|
|
|
|
- // echo 'withRegistry inside... app.push latest start'
|
|
|
|
|
- // app.push(latest)
|
|
|
|
|
- // echo 'withRegistry inside... app.push latest done'
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|