|
@@ -0,0 +1,107 @@
|
|
|
+def remote = [:]
|
|
|
+remote.name = "dind-ssh"
|
|
|
+remote.host = "dind"
|
|
|
+remote.port = 22
|
|
|
+remote.user = " "
|
|
|
+remote.password = " "
|
|
|
+remote.allowAnyHosts = true
|
|
|
+
|
|
|
+pipeline {
|
|
|
+ agent any
|
|
|
+
|
|
|
+ environment {
|
|
|
+ //APPNAME = "Sers"
|
|
|
+ APPNAME = "$buildEnv_APPNAME"
|
|
|
+ stageName = "develop"
|
|
|
+ versionSuffix = "-${stageName}${env.build_number}"
|
|
|
+
|
|
|
+ basePath = "/root/docker-cache/jenkins/jenkins_home/workspace/${APPNAME}/${stageName}/${env.build_number}"
|
|
|
+ // set to " " if want to skip copy
|
|
|
+ releasePath = "/root/docker-cache/jenkins/jenkins_home/jenkinsReleaseFile/${stageName}/${APPNAME}"
|
|
|
+
|
|
|
+
|
|
|
+ SVN_PATH = "$buildEnv_SVN_PATH"
|
|
|
+ //svn_USR = " "
|
|
|
+ //svn_PSW = " "
|
|
|
+ svn = credentials("svn_account")
|
|
|
+
|
|
|
+ NUGET_PATH = "/root/docker-cache/jenkins/jenkins_home/workspace/.nuget"
|
|
|
+
|
|
|
+ NUGET_SERVER = "http://nuget.lith.cloud:8"
|
|
|
+ //NUGET_KEY = " "
|
|
|
+ NUGET_KEY = credentials("nuget_key")
|
|
|
+
|
|
|
+ DOCKER_ImagePrefix = "docker.lith.cloud:8/develop/"
|
|
|
+ DOCKER_Buildx = false
|
|
|
+ DOCKER_USERNAME = " "
|
|
|
+ DOCKER_PASSWORD = " "
|
|
|
+
|
|
|
+ build_crossPlatform = "no"
|
|
|
+ svn_createReleaseBranch = "no"
|
|
|
+ svn_changeToNextTempVersion = "no"
|
|
|
+
|
|
|
+ dind_ssh_account = credentials("dind_ssh_account")
|
|
|
+ }
|
|
|
+
|
|
|
+ stages {
|
|
|
+ stage('#1 deploy ?') {
|
|
|
+ steps {
|
|
|
+ timeout(time:600,unit:'SECONDS') {
|
|
|
+ script {
|
|
|
+ remote.user = "${dind_ssh_account_USR}"
|
|
|
+ remote.password = "${dind_ssh_account_PSW}"
|
|
|
+
|
|
|
+ env.codePath = "$basePath/build"
|
|
|
+
|
|
|
+ env.inputChoice = "no"
|
|
|
+ env.inputChoice = input message: "deploy ?",
|
|
|
+ ok: 'Proceed?',
|
|
|
+ parameters: [choice(choices:["yes","no"], description: 'if not please select no', name: 'choice')]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ stage('#2 pull code') {
|
|
|
+ when { expression { env.inputChoice == "yes" } }
|
|
|
+ steps {
|
|
|
+ script {
|
|
|
+ echo "#1.1 pull code from svn to Path: $codePath, APPNAME: $APPNAME "
|
|
|
+ sshCommand remote: remote, command: "sh -c 'set -e; mkdir -p $codePath;chmod 777 $codePath; docker run -i --rm -v $codePath:/root/svn serset/svn-client svn checkout \"$SVN_PATH/branches/develop\" /root/svn --username \"$svn_USR\" --password \"$svn_PSW\" --no-auth-cache > /dev/null; '"
|
|
|
+
|
|
|
+ echo "#1.2 change-app-version"
|
|
|
+ sshCommand remote: remote, command: "sh -c 'set -e; export versionSuffix=$versionSuffix; cd $codePath/Publish/DevOps2/build-bash; sh 20.change-app-version.bash; '"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ post {
|
|
|
+ always {
|
|
|
+ timeout(time:3600,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.",
|
|
|
+ ok: 'Proceed',
|
|
|
+ parameters: [choice(choices:["yes","no"], name: 'choice')]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ script {
|
|
|
+ if ( inputChoice == "yes" ) {
|
|
|
+ echo "clean temp files"
|
|
|
+ sshCommand remote: remote, command: "rm -rf $basePath"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ success {
|
|
|
+ echo "build success !"
|
|
|
+ }
|
|
|
+ failure {
|
|
|
+ echo "build failure !"
|
|
|
+ }
|
|
|
+ aborted {
|
|
|
+ echo "build aborted !"
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|