|
@@ -42,6 +42,7 @@ pipeline {
|
|
|
}
|
|
|
|
|
|
stages {
|
|
|
+
|
|
|
stage('#1 deploy ?') {
|
|
|
steps {
|
|
|
timeout(time:600,unit:'SECONDS') {
|
|
@@ -56,17 +57,24 @@ pipeline {
|
|
|
echo "-------- DOCKER_ImagePrefix: [$DOCKER_ImagePrefix]"
|
|
|
echo "-------- codePath: [$codePath]"
|
|
|
|
|
|
- env.inputChoice = "no"
|
|
|
- env.inputChoice = input message: "deploy ?",
|
|
|
- ok: 'Proceed?',
|
|
|
- parameters: [choice(choices:["yes","no"], description: 'if not please select no', name: 'choice')]
|
|
|
+ if ( fileExists("Publish/DevOps3/environment/jenkins_NoNeedApprovalForBuild.txt") ) {
|
|
|
+ echo "-------- do not need approval for build"
|
|
|
+ env.ApprovalForBuild = "yes"
|
|
|
+ } else {
|
|
|
+ echo "-------- waiting approval for build"
|
|
|
+ env.ApprovalForBuild = "no"
|
|
|
+ env.ApprovalForBuild = input message: "deploy ?",
|
|
|
+ ok: 'Proceed?',
|
|
|
+ parameters: [choice(choices:["yes","no"], description: 'if not please select no', name: 'choice')]
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
stage('#2 change version') {
|
|
|
- when { expression { env.inputChoice == "yes" } }
|
|
|
+ when { expression { env.ApprovalForBuild == "yes" } }
|
|
|
steps {
|
|
|
script {
|
|
|
echo "#2.1 change-app-version"
|
|
@@ -79,8 +87,17 @@ pipeline {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ stage('#3.0 build - run test') {
|
|
|
+ when { expression { env.ApprovalForBuild == "yes" } }
|
|
|
+ steps {
|
|
|
+ script {
|
|
|
+ sshCommand remote: remote, command: "sh -c 'set -e; export APPNAME=$APPNAME; export NUGET_PATH=$NUGET_PATH; cd $codePath/Publish/DevOps3/build-bash; sh 10.Test.bash; '"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
stage('#3.1 build - single platflorm') {
|
|
|
- when { expression { env.inputChoice == "yes" } }
|
|
|
+ when { expression { env.ApprovalForBuild == "yes" } }
|
|
|
steps {
|
|
|
script {
|
|
|
sshCommand remote: remote, command: "sh -c 'set -e; export APPNAME=$APPNAME; export NUGET_PATH=$NUGET_PATH; cd $codePath/Publish/DevOps3/build-bash; sh startup.bash; '"
|
|
@@ -89,7 +106,7 @@ pipeline {
|
|
|
}
|
|
|
|
|
|
stage('#3.2 build - cross platform') {
|
|
|
- when { expression { env.inputChoice == "yes" && env.build_crossPlatform == "yes" } }
|
|
|
+ when { expression { env.ApprovalForBuild == "yes" && env.build_crossPlatform == "yes" } }
|
|
|
steps {
|
|
|
script {
|
|
|
sshCommand remote: remote, command: "sh -c 'set -e; export APPNAME=$APPNAME; export NUGET_PATH=$NUGET_PATH; cd $codePath/Publish/DevOps3/build-bash; sh 40.Station-publish-multiple.bash; '"
|
|
@@ -98,7 +115,7 @@ pipeline {
|
|
|
}
|
|
|
|
|
|
stage('#4 publish') {
|
|
|
- when { expression { env.inputChoice == "yes" } }
|
|
|
+ when { expression { env.ApprovalForBuild == "yes" } }
|
|
|
steps {
|
|
|
script {
|
|
|
sshCommand remote: remote, command: "sh -c 'set -e; export APPNAME=$APPNAME;export NUGET_PATH=$NUGET_PATH; export NUGET_SERVER=$NUGET_SERVER;export NUGET_KEY=$NUGET_KEY; export DOCKER_Buildx=${env.DOCKER_Buildx};export DOCKER_ImagePrefix=${env.DOCKER_ImagePrefix};export DOCKER_USERNAME=${env.DOCKER_USERNAME};export DOCKER_PASSWORD=${env.DOCKER_PASSWORD};export DOCKER_BuildxExtArgs=\"--output=type=registry,registry.insecure=true\"; cd $codePath/Publish/DevOps3/release-bash; sh startup.bash; '"
|
|
@@ -107,7 +124,7 @@ pipeline {
|
|
|
}
|
|
|
|
|
|
stage('#5 save releaseFiles') {
|
|
|
- when { expression { env.inputChoice == "yes" && env.WebDav_BaseUrl != " " } }
|
|
|
+ when { expression { env.ApprovalForBuild == "yes" && env.WebDav_BaseUrl != " " } }
|
|
|
steps {
|
|
|
script {
|
|
|
sshCommand remote: remote, command: "sh -c 'set -e; export basePath=\"$codePath\"; export APPNAME=$APPNAME; export appVersion=\"$appVersion\"; export WebDav_BaseUrl=\"$WebDav_BaseUrl\"; export WebDav_User=\"$WebDav_User\"; cd $codePath/Publish/DevOps3/release-bash; sh 78.push-releaseFiles-to-webdav.bash; '"
|
|
@@ -115,36 +132,20 @@ pipeline {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- stage('#6 deploy') {
|
|
|
- when { expression { env.inputChoice == "yes" && env.build_deploy == "yes" } }
|
|
|
- steps {
|
|
|
- script {
|
|
|
-
|
|
|
- remote.name = "k8s-ssh"
|
|
|
- remote.host = "k8s.lith.cloud"
|
|
|
-
|
|
|
- remote.user = "${k8s_ssh_account_USR}"
|
|
|
- remote.password = "${k8s_ssh_account_PSW}"
|
|
|
-
|
|
|
- sshCommand remote: remote, command: "sh -c 'set -e; cd /home/DataStore/Local/Data/2000/200.flowtea-prod/helm; helm upgrade flowtea --set appNum=200 --set debug=true --set resources.limits=false --set image.host=\"\" --set image.tag=\"${env.appVersion}\" --set storageClass.ssd=nfs-prod-ssd --set storageClass.hdd=nfs-prod-hdd ./flowtea -n flowtea; '"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
post {
|
|
|
always {
|
|
|
- timeout(time:3600,unit:'SECONDS') {
|
|
|
+ timeout(time:600,unit:'SECONDS') {
|
|
|
script {
|
|
|
- env.inputChoice = "yes"
|
|
|
- env.inputChoice = input message: "Clean temp files, \n will wait for 3600 seconds. \n click abort to skip clean.",
|
|
|
+ env.CleanFiles = "yes"
|
|
|
+ env.CleanFiles = input message: "Clean temp files, \n will wait for 3600 seconds. \n click abort to skip clean.",
|
|
|
ok: 'Proceed',
|
|
|
parameters: [choice(choices:["yes","no"], name: 'choice')]
|
|
|
}
|
|
|
}
|
|
|
script {
|
|
|
- if ( inputChoice == "yes" ) {
|
|
|
+ if ( CleanFiles == "yes" ) {
|
|
|
echo "clean up workspace directory"
|
|
|
cleanWs()
|
|
|
|