From e615b1e023c8b796b5564f5bb0f960cdd27fdf97 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Tue, 14 Jan 2020 16:48:14 -0500 Subject: [PATCH 01/18] Do not do deploy in production, it is no longer needed Signed-off-by: 1000TurquoisePogs --- production.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/production.xml b/production.xml index 57894ba..f7762d6 100644 --- a/production.xml +++ b/production.xml @@ -40,7 +40,6 @@ - From d86abbc4a908af9b52152def618399a8cd386bab Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Wed, 14 Apr 2021 11:36:09 -0400 Subject: [PATCH 02/18] Fixing whitespace before long-term use Signed-off-by: 1000TurquoisePogs --- Jenkinsfile | 248 +++++++++++++++++----------------- Jenkinsfile.release | 320 ++++++++++++++++++++++---------------------- 2 files changed, 288 insertions(+), 280 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 395cdb8..c988015 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -109,27 +109,27 @@ node(JENKINS_NODE) { stage("Prepare") { zoweVersion = getZoweVersion() - zluxbuildpr = env.BRANCH_NAME - if (zluxbuildpr.startsWith("PR-")){ - pullRequests['zlux-build'] = getPullRequest(GITHUB_TOKEN, 'zlux-build', zluxbuildpr.drop(3)) - } else { - echo "building staging" - } - - zluxParameters.each { - key, value -> - if (key.startsWith("PR_")) { - if (value) { - def repoName = key[3..-1].toLowerCase().replaceAll('_', '-') - pullRequests[repoName] = getPullRequest(GITHUB_TOKEN, repoName, value) - } - + zluxbuildpr = env.BRANCH_NAME + if (zluxbuildpr.startsWith("PR-")){ + pullRequests['zlux-build'] = getPullRequest(GITHUB_TOKEN, 'zlux-build', zluxbuildpr.drop(3)) + } else { + echo "building staging" + } + + zluxParameters.each { + key, value -> + if (key.startsWith("PR_")) { + if (value) { + def repoName = key[3..-1].toLowerCase().replaceAll('_', '-') + pullRequests[repoName] = getPullRequest(GITHUB_TOKEN, repoName, value) } + } - + } + setGithubStatus(GITHUB_TOKEN, pullRequests, "pending", "This commit is being built") - } + sshagent(credentials: [GITHUB_SSH_KEY]) { stage("Checkout") { sh \ @@ -149,14 +149,15 @@ node(JENKINS_NODE) { } pullRequests.each { repoName, pullRequest -> - sh \ - """ - cd zlux/${repoName} - git fetch origin pull/${pullRequest['number']}/head:pr - git merge pr - """ + sh \ + """ + cd zlux/${repoName} + git fetch origin pull/${pullRequest['number']}/head:pr + git merge pr + """ } } + stage("Set version") { def (majorVersion, minorVersion, microVersion) = zoweVersion.tokenize(".") sh \ @@ -184,21 +185,23 @@ node(JENKINS_NODE) { fi """ } + stage("Build") { sh "bash -c 'cd zlux/zlux-build && set -o pipefail && ant testing 2>&1 | grep -vE \"^\\s+\\[exec\\]\\s+0\\% compiling\"'" } + stage("Test") { pullRequests.each { repoName, pullRequest -> if (repoName != "zlux-app-server") { sh \ """ - cd dist - packages=\$(find ./${repoName} -name package.json | { grep -v node_modules || true; }) - for package in \$packages - do - sh -c "cd `dirname \$package` && npm run test --if-present" - done + cd dist + packages=\$(find ./${repoName} -name package.json | { grep -v node_modules || true; }) + for package in \$packages + do + sh -c "cd `dirname \$package` && npm run test --if-present" + done """ } } @@ -206,99 +209,79 @@ node(JENKINS_NODE) { sh "cd zlux/zlux-build && ant -Dcapstone=../../dist removeSource" } stage("Package") { - sh \ + sh \ + """ + chmod +x dist/zlux-build/*.sh + cd dist + tar cf ../zlux.tar -H ustar * + cd .. + git clone -b feature/tag-script https://github.com/1000TurquoisePogs/zowe-install-packaging.git + """ + withCredentials([usernamePassword( + credentialsId: PAX_CREDENTIALS, + usernameVariable: "PAX_USERNAME", + passwordVariable: "PAX_PASSWORD" + )]) { + def PAX_SERVER = [ + name : PAX_HOSTNAME, + host : PAX_HOSTNAME, + port : PAX_SSH_PORT, + user : PAX_USERNAME, + password : PAX_PASSWORD, + allowAnyHosts: true + ] + sshCommand remote: PAX_SERVER, command: \ + "rm -rf ${paxPackageDir} && mkdir -p ${paxPackageDir}" + sshPut remote: PAX_SERVER, from: "zlux.tar", into: "${paxPackageDir}/" + sshPut remote: PAX_SERVER, from: "zowe-install-packaging/scripts/tag-files.sh", into: "${paxPackageDir}/" + sshCommand remote: PAX_SERVER, command: \ """ - chmod +x dist/zlux-build/*.sh - cd dist - tar cf ../zlux.tar -H ustar * + export _BPXK_AUTOCVT=ON && + cd ${paxPackageDir} && + chtag -tc iso8859-1 tag-files.sh && + chmod +x tag-files.sh && + mkdir -p zlux/share && cd zlux && + mkdir bin && cd share && + tar xpoUf ../../zlux.tar && + ../../tag-files.sh . && + cd zlux-server-framework && + rm -rf node_modules && + ${NODE_ENV_VARS} PATH=${NODE_HOME}/bin:$PATH npm install && + cd .. && + iconv -f iso8859-1 -t 1047 zlux-app-server/defaults/serverConfig/server.json > zlux-app-server/defaults/serverConfig/server.json.1047 && + mv zlux-app-server/defaults/serverConfig/server.json.1047 zlux-app-server/defaults/serverConfig/server.json && + chtag -tc 1047 zlux-app-server/defaults/serverConfig/server.json && + cd zlux-app-server/bin && + cp start.sh configure.sh ../../../bin && + if [ -e "validate.sh" ]; then + cp validate.sh ../../../bin + fi cd .. - git clone -b feature/tag-script https://github.com/1000TurquoisePogs/zowe-install-packaging.git - """ - withCredentials([usernamePassword( - credentialsId: PAX_CREDENTIALS, - usernameVariable: "PAX_USERNAME", - passwordVariable: "PAX_PASSWORD" - )]) { - def PAX_SERVER = [ - name : PAX_HOSTNAME, - host : PAX_HOSTNAME, - port : PAX_SSH_PORT, - user : PAX_USERNAME, - password : PAX_PASSWORD, - allowAnyHosts: true - ] - sshCommand remote: PAX_SERVER, command: \ - "rm -rf ${paxPackageDir} && mkdir -p ${paxPackageDir}" - sshPut remote: PAX_SERVER, from: "zlux.tar", into: "${paxPackageDir}/" - sshPut remote: PAX_SERVER, from: "zowe-install-packaging/scripts/tag-files.sh", into: "${paxPackageDir}/" + if [ -e "manifest.yaml" ]; then + cp manifest.yaml ../../ + fi + cd ../../ + pax -x os390 -pp -wf ../zlux.pax * + """ + sshGet remote: PAX_SERVER, from: "${paxPackageDir}/zlux.pax", into: "zlux.pax" + if (mergedComponent) { sshCommand remote: PAX_SERVER, command: \ """ - export _BPXK_AUTOCVT=ON && cd ${paxPackageDir} && - chtag -tc iso8859-1 tag-files.sh && - chmod +x tag-files.sh && - mkdir -p zlux/share && cd zlux && - mkdir bin && cd share && - tar xpoUf ../../zlux.tar && - ../../tag-files.sh . && - cd zlux-server-framework && - rm -rf node_modules && - ${NODE_ENV_VARS} PATH=${NODE_HOME}/bin:$PATH npm install && - cd .. && - iconv -f iso8859-1 -t 1047 zlux-app-server/defaults/serverConfig/server.json > zlux-app-server/defaults/serverConfig/server.json.1047 && - mv zlux-app-server/defaults/serverConfig/server.json.1047 zlux-app-server/defaults/serverConfig/server.json && - chtag -tc 1047 zlux-app-server/defaults/serverConfig/server.json && - cd zlux-app-server/bin && - cp start.sh configure.sh ../../../bin && - if [ -e "validate.sh" ]; then - cp validate.sh ../../../bin - fi - cd .. - if [ -e "manifest.yaml" ]; then - cp manifest.yaml ../../ - fi - cd ../../ - pax -x os390 -pp -wf ../zlux.pax * - """ - sshGet remote: PAX_SERVER, from: "${paxPackageDir}/zlux.pax", into: "zlux.pax" - if (mergedComponent) { - sshCommand remote: PAX_SERVER, command: \ - """ - cd ${paxPackageDir} && - cd zlux && - pax -x os390 -pp -wf ../${mergedComponent}.pax ${mergedComponent} - """ - sshGet remote: PAX_SERVER, from: "${paxPackageDir}/${mergedComponent}.pax", into: "${mergedComponent}.pax" - } - sshCommand remote: PAX_SERVER, command: "rm -rf ${paxPackageDir}" + cd zlux && + pax -x os390 -pp -wf ../${mergedComponent}.pax ${mergedComponent} + """ + sshGet remote: PAX_SERVER, from: "${paxPackageDir}/${mergedComponent}.pax", into: "${mergedComponent}.pax" } - + sshCommand remote: PAX_SERVER, command: "rm -rf ${paxPackageDir}" + } } + stage("Deploy") { def artifactoryServer = Artifactory.server ARTIFACTORY_SERVER def timestamp = (new Date()).format("yyyyMMdd.HHmmss") def target = null - if (mergedComponent) { - target = "${ARTIFACTORY_REPO}/${mergedComponent}/" + - "${zoweVersion}${branchName.toUpperCase()}/" + - "${mergedComponent}-${zoweVersion}-${timestamp}" - ["tar", "pax"].each { - def uploadSpec = """{"files": [{"pattern": "${mergedComponent}.${it}", "target": "${target}.${it}"}]}""" - def buildInfo = Artifactory.newBuildInfo() - artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo - artifactoryServer.publishBuildInfo buildInfo - } - } - - target = "${ARTIFACTORY_REPO}/zlux-core/" + - "${zoweVersion}${branchName.toUpperCase()}/" + - "zlux-core-${zoweVersion}-${timestamp}" - ["tar", "pax"].each { - def uploadSpec = """{"files": [{"pattern": "zlux.${it}", "target": "${target}.${it}"}]}""" - def buildInfo = Artifactory.newBuildInfo() - artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo - artifactoryServer.publishBuildInfo buildInfo - } + if (mergedComponent) { target = "${ARTIFACTORY_REPO}/${mergedComponent}/" + "${zoweVersion}${branchName.toUpperCase()}/" + "${mergedComponent}-${zoweVersion}-${timestamp}" @@ -308,6 +291,27 @@ node(JENKINS_NODE) { artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo artifactoryServer.publishBuildInfo buildInfo } + } + + target = "${ARTIFACTORY_REPO}/zlux-core/" + + "${zoweVersion}${branchName.toUpperCase()}/" + + "zlux-core-${zoweVersion}-${timestamp}" + ["tar", "pax"].each { + def uploadSpec = """{"files": [{"pattern": "zlux.${it}", "target": "${target}.${it}"}]}""" + def buildInfo = Artifactory.newBuildInfo() + artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo + artifactoryServer.publishBuildInfo buildInfo + } + + target = "${ARTIFACTORY_REPO}/${mergedComponent}/" + + "${zoweVersion}${branchName.toUpperCase()}/" + + "${mergedComponent}-${zoweVersion}-${timestamp}" + ["tar", "pax"].each { + def uploadSpec = """{"files": [{"pattern": "${mergedComponent}.${it}", "target": "${target}.${it}"}]}""" + def buildInfo = Artifactory.newBuildInfo() + artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo + artifactoryServer.publishBuildInfo buildInfo + } } } } catch (FlowInterruptedException e) { @@ -345,17 +349,17 @@ node(JENKINS_NODE) { [$class: "UpstreamComitterRecipientProvider"] ], body: \ - """ -

${currentBuild.result}

-
- -
- """ + """ +

${currentBuild.result}

+
+ +
+ """ } } } diff --git a/Jenkinsfile.release b/Jenkinsfile.release index 14a1ec1..23990c2 100644 --- a/Jenkinsfile.release +++ b/Jenkinsfile.release @@ -50,22 +50,22 @@ NODE_HOME = "/ZOWE/node/node-${NODE_VERSION}-os390-s390x" NODE_ENV_VARS = "_TAG_REDIR_ERR=txt _TAG_REDIR_IN=txt _TAG_REDIR_OUT=txt __UNTAGGED_READ_MODE=V6" properties([ - parameters([ - string( - name: "RELEASE_VERSION", - defaultValue: "", - description: "Version of release (X.X.X)", - trim: true - ) - ]) + parameters([ + string( + name: "RELEASE_VERSION", + defaultValue: "", + description: "Version of release (X.X.X)", + trim: true + ) + ]) ]) def getZoweVersion() { - return params.RELEASE_VERSION - // def response = httpRequest url: ZOWE_MANIFEST_URL - // echo "Zowe manifest template:\n${response.content}" - // return (response.content =~ /"version"\s*:\s*"(.*)"/)[0][1] + return params.RELEASE_VERSION + // def response = httpRequest url: ZOWE_MANIFEST_URL + // echo "Zowe manifest template:\n${response.content}" + // return (response.content =~ /"version"\s*:\s*"(.*)"/)[0][1] } def zoweVersion = null @@ -73,155 +73,159 @@ def paxPackageDir = "/ZOWE/tmp/~${env.BUILD_TAG}" node(JENKINS_NODE) { - currentBuild.result = "SUCCESS" - try { + currentBuild.result = "SUCCESS" + try { - stage("Prepare") { - zoweVersion = getZoweVersion() - env.BRANCH_NAME = DEFAULT_BRANCH - } - sshagent(credentials: [GITHUB_SSH_KEY]) { - stage("Checkout") { - sh \ - """ - mkdir zlux - git config --global user.email "zowe-robot@zowe.org" - git config --global user.name "Zowe Robot" - """ - ZLUX_CORE_PLUGINS.each { - sh \ - """ - cd zlux - git clone https://github.com/zowe/${it}.git - cd ${it} - git checkout ${DEFAULT_BRANCH} - """ - } - } - stage("Set version") { - def (majorVersion, minorVersion, microVersion) = zoweVersion.tokenize(".") - sh \ - """ - cd zlux/zlux-build - sed -i -e "s/MAJOR_VERSION=0/MAJOR_VERSION=${majorVersion}/" \\ - -e "s/MINOR_VERSION=8/MINOR_VERSION=${minorVersion}/" \\ - -e "s/REVISION=4/REVISION=${microVersion}/" \\ - version.properties - echo "Set version to:" - cat version.properties - """ - } - stage("Build") { - sh "bash -c 'cd zlux/zlux-build && set -o pipefail && ant production 2>&1 | grep -vE \"^\\s+\\[exec\\]\\s+0\\% compiling\"'" - } - - stage("Package") { - sh \ - """ - chmod +x dist/zlux-build/*.sh - cd dist - tar cf ../zlux.tar -H ustar * - cd .. - git clone -b feature/tag-script https://github.com/1000TurquoisePogs/zowe-install-packaging.git - """ - - withCredentials([usernamePassword( - credentialsId: PAX_CREDENTIALS, - usernameVariable: "PAX_USERNAME", - passwordVariable: "PAX_PASSWORD" - )]) { - def PAX_SERVER = [ - name : PAX_HOSTNAME, - host : PAX_HOSTNAME, - port : PAX_SSH_PORT, - user : PAX_USERNAME, - password : PAX_PASSWORD, - allowAnyHosts: true - ] - sshCommand remote: PAX_SERVER, command: \ - "rm -rf ${paxPackageDir} && mkdir -p ${paxPackageDir}" - sshPut remote: PAX_SERVER, from: "zlux.tar", into: "${paxPackageDir}/" - sshPut remote: PAX_SERVER, from: "zowe-install-packaging/scripts/tag-files.sh", into: "${paxPackageDir}/" - sshCommand remote: PAX_SERVER, command: \ - """ - export _BPXK_AUTOCVT=ON && - cd ${paxPackageDir} && - chtag -tc iso8859-1 tag-files.sh && - chmod +x tag-files.sh && - mkdir -p zlux/share && cd zlux && - mkdir bin && cd share && - tar xpoUf ../../zlux.tar && - ../../tag-files.sh . && - cd zlux-server-framework && - rm -rf node_modules && - ${NODE_ENV_VARS} PATH=${NODE_HOME}/bin:$PATH npm install && - cd .. && - iconv -f iso8859-1 -t 1047 zlux-app-server/defaults/serverConfig/server.json > zlux-app-server/defaults/serverConfig/server.json.1047 && - mv zlux-app-server/defaults/serverConfig/server.json.1047 zlux-app-server/defaults/serverConfig/server.json && - chtag -tc 1047 zlux-app-server/defaults/serverConfig/server.json && - cd zlux-app-server/bin && - cp start.sh configure.sh ../../../bin && - if [ -e "validate.sh" ]; then - cp validate.sh ../../../bin - fi - cd .. - if [ -e "manifest.yaml" ]; then - cp manifest.yaml ../../ - fi - cd ../../ - pax -x os390 -pp -wf ../zlux.pax * - """ - sshGet remote: PAX_SERVER, from: "${paxPackageDir}/zlux.pax", into: "zlux.pax" - } - } - stage("Deploy") { - def artifactoryServer = Artifactory.server ARTIFACTORY_SERVER - def timestamp = (new Date()).format("yyyyMMdd.HHmmss") - def target = "${ARTIFACTORY_REPO}/zlux-core/" + - "${zoweVersion}-${env.BRANCH_NAME.toUpperCase()}/" + - "zlux-core-${zoweVersion}-${timestamp}" - - ["tar", "pax"].each { - def uploadSpec = """{"files": [{"pattern": "zlux.${it}", "target": "${target}.${it}"}]}""" - def buildInfo = Artifactory.newBuildInfo() - artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo - artifactoryServer.publishBuildInfo buildInfo - } - } + stage("Prepare") { + zoweVersion = getZoweVersion() + env.BRANCH_NAME = DEFAULT_BRANCH + } + + sshagent(credentials: [GITHUB_SSH_KEY]) { + stage("Checkout") { + sh \ + """ + mkdir zlux + git config --global user.email "zowe-robot@zowe.org" + git config --global user.name "Zowe Robot" + """ + ZLUX_CORE_PLUGINS.each { + sh \ + """ + cd zlux + git clone https://github.com/zowe/${it}.git + cd ${it} + git checkout ${DEFAULT_BRANCH} + """ } - } catch (FlowInterruptedException e) { - currentBuild.result = "ABORTED" - throw e - } catch (e) { - if (e.getMessage() != 'nothing to build') { - currentBuild.result = "FAILURE" - throw e + } + + stage("Set version") { + def (majorVersion, minorVersion, microVersion) = zoweVersion.tokenize(".") + sh \ + """ + cd zlux/zlux-build + sed -i -e "s/MAJOR_VERSION=0/MAJOR_VERSION=${majorVersion}/" \\ + -e "s/MINOR_VERSION=8/MINOR_VERSION=${minorVersion}/" \\ + -e "s/REVISION=4/REVISION=${microVersion}/" \\ + version.properties + echo "Set version to:" + cat version.properties + """ + } + + stage("Build") { + sh "bash -c 'cd zlux/zlux-build && set -o pipefail && ant production 2>&1 | grep -vE \"^\\s+\\[exec\\]\\s+0\\% compiling\"'" + } + + stage("Package") { + sh \ + """ + chmod +x dist/zlux-build/*.sh + cd dist + tar cf ../zlux.tar -H ustar * + cd .. + git clone -b feature/tag-script https://github.com/1000TurquoisePogs/zowe-install-packaging.git + """ + + withCredentials([usernamePassword( + credentialsId: PAX_CREDENTIALS, + usernameVariable: "PAX_USERNAME", + passwordVariable: "PAX_PASSWORD" + )]) { + def PAX_SERVER = [ + name : PAX_HOSTNAME, + host : PAX_HOSTNAME, + port : PAX_SSH_PORT, + user : PAX_USERNAME, + password : PAX_PASSWORD, + allowAnyHosts: true + ] + sshCommand remote: PAX_SERVER, command: \ + "rm -rf ${paxPackageDir} && mkdir -p ${paxPackageDir}" + sshPut remote: PAX_SERVER, from: "zlux.tar", into: "${paxPackageDir}/" + sshPut remote: PAX_SERVER, from: "zowe-install-packaging/scripts/tag-files.sh", into: "${paxPackageDir}/" + sshCommand remote: PAX_SERVER, command: \ + """ + export _BPXK_AUTOCVT=ON && + cd ${paxPackageDir} && + chtag -tc iso8859-1 tag-files.sh && + chmod +x tag-files.sh && + mkdir -p zlux/share && cd zlux && + mkdir bin && cd share && + tar xpoUf ../../zlux.tar && + ../../tag-files.sh . && + cd zlux-server-framework && + rm -rf node_modules && + ${NODE_ENV_VARS} PATH=${NODE_HOME}/bin:$PATH npm install && + cd .. && + iconv -f iso8859-1 -t 1047 zlux-app-server/defaults/serverConfig/server.json > zlux-app-server/defaults/serverConfig/server.json.1047 && + mv zlux-app-server/defaults/serverConfig/server.json.1047 zlux-app-server/defaults/serverConfig/server.json && + chtag -tc 1047 zlux-app-server/defaults/serverConfig/server.json && + cd zlux-app-server/bin && + cp start.sh configure.sh ../../../bin && + if [ -e "validate.sh" ]; then + cp validate.sh ../../../bin + fi + cd .. + if [ -e "manifest.yaml" ]; then + cp manifest.yaml ../../ + fi + cd ../../ + pax -x os390 -pp -wf ../zlux.pax * + """ + sshGet remote: PAX_SERVER, from: "${paxPackageDir}/zlux.pax", into: "zlux.pax" } - } finally { - stage("Report") { - def prettyParams = "n/a" - emailext \ - subject: """${env.JOB_NAME} [${env.BUILD_NUMBER}]: ${currentBuild.result}""", - attachLog: true, - mimeType: "text/html", - recipientProviders: [ - [$class: "RequesterRecipientProvider"], - [$class: "CulpritsRecipientProvider"], - [$class: "DevelopersRecipientProvider"], - [$class: "UpstreamComitterRecipientProvider"] - ], - body: \ - """ -

${currentBuild.result}

-
- -
- """ + } + + stage("Deploy") { + def artifactoryServer = Artifactory.server ARTIFACTORY_SERVER + def timestamp = (new Date()).format("yyyyMMdd.HHmmss") + def target = "${ARTIFACTORY_REPO}/zlux-core/" + + "${zoweVersion}-${env.BRANCH_NAME.toUpperCase()}/" + + "zlux-core-${zoweVersion}-${timestamp}" + + ["tar", "pax"].each { + def uploadSpec = """{"files": [{"pattern": "zlux.${it}", "target": "${target}.${it}"}]}""" + def buildInfo = Artifactory.newBuildInfo() + artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo + artifactoryServer.publishBuildInfo buildInfo } + } + } + } catch (FlowInterruptedException e) { + currentBuild.result = "ABORTED" + throw e + } catch (e) { + if (e.getMessage() != 'nothing to build') { + currentBuild.result = "FAILURE" + throw e + } + } finally { + stage("Report") { + def prettyParams = "n/a" + emailext \ + subject: """${env.JOB_NAME} [${env.BUILD_NUMBER}]: ${currentBuild.result}""", + attachLog: true, + mimeType: "text/html", + recipientProviders: [ + [$class: "RequesterRecipientProvider"], + [$class: "CulpritsRecipientProvider"], + [$class: "DevelopersRecipientProvider"], + [$class: "UpstreamComitterRecipientProvider"] + ], + body: \ + """ +

${currentBuild.result}

+
+ +
+ """ } + } } From 30b097f1fa5e9d0c5fe881edeac3cfc45238f3c9 Mon Sep 17 00:00:00 2001 From: James Struga Date: Thu, 15 Apr 2021 15:30:32 -0400 Subject: [PATCH 03/18] pr for Nakul Signed-off-by: James Struga --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 395cdb8..d637689 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,9 +17,9 @@ def zluxParameters = [ "PR_ZLUX_APP_MANAGER" : "", - "PR_ZLUX_APP_SERVER" : "", - "PR_ZLUX_PLATFORM" : "", - "PR_ZLUX_SERVER_FRAMEWORK" : "", + "PR_ZLUX_APP_SERVER" : "158", + "PR_ZLUX_PLATFORM" : "79", + "PR_ZLUX_SERVER_FRAMEWORK" : "279", "PR_ZLUX_SHARED" : "", "PR_ZLUX_BUILD" : "" ] From a38d3e02b5fa7f6581c3a5a19212e4c9f8d4ea26 Mon Sep 17 00:00:00 2001 From: James Struga Date: Thu, 15 Apr 2021 15:35:39 -0400 Subject: [PATCH 04/18] add missing pr Signed-off-by: James Struga --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d637689..0c7a717 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ def zluxParameters = [ "PR_ZLUX_APP_MANAGER" : "", "PR_ZLUX_APP_SERVER" : "158", - "PR_ZLUX_PLATFORM" : "79", + "PR_ZLUX_PLATFORM" : "73", "PR_ZLUX_SERVER_FRAMEWORK" : "279", "PR_ZLUX_SHARED" : "", "PR_ZLUX_BUILD" : "" From 05a5ee7972511eb1ae6786570e0e2f51a7159bc9 Mon Sep 17 00:00:00 2001 From: James Struga Date: Fri, 16 Apr 2021 21:38:30 -0400 Subject: [PATCH 05/18] fix naming of pax Signed-off-by: James Struga --- Jenkinsfile | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0c7a717..e627804 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,13 +17,15 @@ def zluxParameters = [ "PR_ZLUX_APP_MANAGER" : "", - "PR_ZLUX_APP_SERVER" : "158", - "PR_ZLUX_PLATFORM" : "73", - "PR_ZLUX_SERVER_FRAMEWORK" : "279", + "PR_ZLUX_APP_SERVER" : "", + "PR_ZLUX_PLATFORM" : "", + "PR_ZLUX_SERVER_FRAMEWORK" : "", "PR_ZLUX_SHARED" : "", "PR_ZLUX_BUILD" : "" ] +DEFAULT_BRANCH = "staging" + properties([ parameters(zluxParameters) ]) @@ -45,7 +47,6 @@ ZLUX_CORE_PLUGINS = [ "zlux-server-framework", "zlux-shared" ] -DEFAULT_BRANCH = "staging" ZOWE_MANIFEST_URL = \ "https://raw.githubusercontent.com/zowe/zowe-install-packaging/staging/manifest.json.template" ARTIFACTORY_SERVER = "zoweArtifactory" @@ -113,7 +114,8 @@ node(JENKINS_NODE) { if (zluxbuildpr.startsWith("PR-")){ pullRequests['zlux-build'] = getPullRequest(GITHUB_TOKEN, 'zlux-build', zluxbuildpr.drop(3)) } else { - echo "building staging" + DEFAULT_BRANCH = env.BRANCH_NAME.toLowerCase() + echo "building ${DEFAULT_BRANCH}" } zluxParameters.each { @@ -261,15 +263,6 @@ node(JENKINS_NODE) { pax -x os390 -pp -wf ../zlux.pax * """ sshGet remote: PAX_SERVER, from: "${paxPackageDir}/zlux.pax", into: "zlux.pax" - if (mergedComponent) { - sshCommand remote: PAX_SERVER, command: \ - """ - cd ${paxPackageDir} && - cd zlux && - pax -x os390 -pp -wf ../${mergedComponent}.pax ${mergedComponent} - """ - sshGet remote: PAX_SERVER, from: "${paxPackageDir}/${mergedComponent}.pax", into: "${mergedComponent}.pax" - } sshCommand remote: PAX_SERVER, command: "rm -rf ${paxPackageDir}" } @@ -278,17 +271,18 @@ node(JENKINS_NODE) { def artifactoryServer = Artifactory.server ARTIFACTORY_SERVER def timestamp = (new Date()).format("yyyyMMdd.HHmmss") def target = null - if (mergedComponent) { - target = "${ARTIFACTORY_REPO}/${mergedComponent}/" + - "${zoweVersion}${branchName.toUpperCase()}/" + - "${mergedComponent}-${zoweVersion}-${timestamp}" - ["tar", "pax"].each { - def uploadSpec = """{"files": [{"pattern": "${mergedComponent}.${it}", "target": "${target}.${it}"}]}""" - def buildInfo = Artifactory.newBuildInfo() - artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo - artifactoryServer.publishBuildInfo buildInfo - } + #env.BRANCH_NAME + if (zluxbuildpr.startsWith("PR-")){ + target = "${ARTIFACTORY_REPO}/zlux-core/" + + "${zoweVersion}${zluxbuildpr}/" + + "zlux-core-${zoweVersion}-${timestamp}" + ["tar", "pax"].each { + def uploadSpec = """{"files": [{"pattern": "zlux.${it}", "target": "${target}.${it}"}]}""" + def buildInfo = Artifactory.newBuildInfo() + artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo + artifactoryServer.publishBuildInfo buildInfo } + } target = "${ARTIFACTORY_REPO}/zlux-core/" + "${zoweVersion}${branchName.toUpperCase()}/" + From 14305eb84e2e762c6b01ef297ad3585e187173ec Mon Sep 17 00:00:00 2001 From: James Struga Date: Fri, 16 Apr 2021 21:39:24 -0400 Subject: [PATCH 06/18] remove bad comment Signed-off-by: James Struga --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e627804..17737cc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -271,7 +271,6 @@ node(JENKINS_NODE) { def artifactoryServer = Artifactory.server ARTIFACTORY_SERVER def timestamp = (new Date()).format("yyyyMMdd.HHmmss") def target = null - #env.BRANCH_NAME if (zluxbuildpr.startsWith("PR-")){ target = "${ARTIFACTORY_REPO}/zlux-core/" + "${zoweVersion}${zluxbuildpr}/" + From 1d8701f6d7cce107c12eb69c08cbd7a8b5c388b3 Mon Sep 17 00:00:00 2001 From: James Struga Date: Mon, 19 Apr 2021 10:29:36 -0400 Subject: [PATCH 07/18] fix deployment Signed-off-by: James Struga --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 17737cc..00a1e7a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -271,9 +271,9 @@ node(JENKINS_NODE) { def artifactoryServer = Artifactory.server ARTIFACTORY_SERVER def timestamp = (new Date()).format("yyyyMMdd.HHmmss") def target = null - if (zluxbuildpr.startsWith("PR-")){ - target = "${ARTIFACTORY_REPO}/zlux-core/" + - "${zoweVersion}${zluxbuildpr}/" + + if (zluxbuildpr.startsWith("PR-")){ + target = "${ARTIFACTORY_REPO}/zlux-core/" + + "${zoweVersion}-${zluxbuildpr}/" + "zlux-core-${zoweVersion}-${timestamp}" ["tar", "pax"].each { def uploadSpec = """{"files": [{"pattern": "zlux.${it}", "target": "${target}.${it}"}]}""" @@ -281,8 +281,7 @@ node(JENKINS_NODE) { artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo artifactoryServer.publishBuildInfo buildInfo } - } - + }else{ target = "${ARTIFACTORY_REPO}/zlux-core/" + "${zoweVersion}${branchName.toUpperCase()}/" + "zlux-core-${zoweVersion}-${timestamp}" @@ -301,6 +300,7 @@ node(JENKINS_NODE) { artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo artifactoryServer.publishBuildInfo buildInfo } + } } } } catch (FlowInterruptedException e) { From 3f403aec6b93a901e5a9f449513715f04dc55742 Mon Sep 17 00:00:00 2001 From: James Struga Date: Thu, 6 May 2021 14:37:04 -0400 Subject: [PATCH 08/18] test params Signed-off-by: James Struga --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9b9aeb7..3b613b6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -107,6 +107,10 @@ def zluxbuildpr = null node(JENKINS_NODE) { currentBuild.result = "SUCCESS" try { + stage("paramTest"){ + echo " FOOBAR value: ${params.'FOOBAR'}" + + } stage("Prepare") { zoweVersion = getZoweVersion() From 56dd193dbf89edb6b4a8599d8484971d7c22bb41 Mon Sep 17 00:00:00 2001 From: James Struga Date: Fri, 7 May 2021 11:21:32 -0400 Subject: [PATCH 09/18] test Signed-off-by: James Struga --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3b613b6..c829d30 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -108,7 +108,7 @@ node(JENKINS_NODE) { currentBuild.result = "SUCCESS" try { stage("paramTest"){ - echo " FOOBAR value: ${params.'FOOBAR'}" + echo " REPO_NAME value: ${params.'REPO_NAME'}" } From 5681b62b0348ab8b488499b5e3f6cbc4bca11f4b Mon Sep 17 00:00:00 2001 From: James Struga Date: Fri, 7 May 2021 11:32:42 -0400 Subject: [PATCH 10/18] test Signed-off-by: James Struga --- Jenkinsfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c829d30..bb50ecc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -107,11 +107,6 @@ def zluxbuildpr = null node(JENKINS_NODE) { currentBuild.result = "SUCCESS" try { - stage("paramTest"){ - echo " REPO_NAME value: ${params.'REPO_NAME'}" - - } - stage("Prepare") { zoweVersion = getZoweVersion() zluxbuildpr = env.BRANCH_NAME From 6fcf3b6473cdec85d948fcdae3518e53915a18f9 Mon Sep 17 00:00:00 2001 From: James Struga Date: Fri, 7 May 2021 11:48:41 -0400 Subject: [PATCH 11/18] test Signed-off-by: James Struga --- Jenkinsfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index bb50ecc..83c008d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -107,6 +107,14 @@ def zluxbuildpr = null node(JENKINS_NODE) { currentBuild.result = "SUCCESS" try { + stage("paramTest"){ + if (params.'STARTED_JOB'){ + echo "hey it worked" + } + echo " REPO_NAME value: ${params.'REPO_NAME'}" + + } + stage("Prepare") { zoweVersion = getZoweVersion() zluxbuildpr = env.BRANCH_NAME From de29701b7b551549e33ad912af0e036663121526 Mon Sep 17 00:00:00 2001 From: James Struga Date: Fri, 7 May 2021 12:58:42 -0400 Subject: [PATCH 12/18] fix all pipeline changes Signed-off-by: James Struga --- Jenkinsfile | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 83c008d..8cccdbb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -107,13 +107,6 @@ def zluxbuildpr = null node(JENKINS_NODE) { currentBuild.result = "SUCCESS" try { - stage("paramTest"){ - if (params.'STARTED_JOB'){ - echo "hey it worked" - } - echo " REPO_NAME value: ${params.'REPO_NAME'}" - - } stage("Prepare") { zoweVersion = getZoweVersion() @@ -165,8 +158,17 @@ node(JENKINS_NODE) { git merge pr """ } + if (params.'STARTED_JOB'){ + sh \ + """ + cd zlux/${params.'REPO_NAME'} + git fetch origin pull/${params.'PR_NUMBER'}/head:pr + git merge pr + """ + } + } - + stage("Set version") { def (majorVersion, minorVersion, microVersion) = zoweVersion.tokenize(".") sh \ @@ -291,7 +293,17 @@ node(JENKINS_NODE) { artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo artifactoryServer.publishBuildInfo buildInfo } - }else{ + } else if(params.'STARTED_JOB'){ + target = "${ARTIFACTORY_REPO}/zlux-core/" + + "${zoweVersion}-${params.'PR_NUMBER'}-${params.'REPO_NAME}/" + + "zlux-core-${zoweVersion}-${timestamp}" + ["tar", "pax"].each { + def uploadSpec = """{"files": [{"pattern": "zlux.${it}", "target": "${target}.${it}"}]}""" + def buildInfo = Artifactory.newBuildInfo() + artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo + artifactoryServer.publishBuildInfo buildInfo + } + } else { target = "${ARTIFACTORY_REPO}/zlux-core/" + "${zoweVersion}${branchName.toUpperCase()}/" + "zlux-core-${zoweVersion}-${timestamp}" From 9a9da990fec5a27b376e035076f1b3f78498cec8 Mon Sep 17 00:00:00 2001 From: James Struga Date: Fri, 7 May 2021 13:04:03 -0400 Subject: [PATCH 13/18] fix all pipeline changes Signed-off-by: James Struga --- Jenkinsfile | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8cccdbb..be4b84e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -158,17 +158,16 @@ node(JENKINS_NODE) { git merge pr """ } - if (params.'STARTED_JOB'){ - sh \ - """ - cd zlux/${params.'REPO_NAME'} - git fetch origin pull/${params.'PR_NUMBER'}/head:pr - git merge pr + if (params.'STARTED_JOB'){ + sh \ + """ + cd zlux/${params.'REPO_NAME'} + git fetch origin pull/${params.'PR_NUMBER'}/head:pr + git merge pr """ - } - + } } - + stage("Set version") { def (majorVersion, minorVersion, microVersion) = zoweVersion.tokenize(".") sh \ @@ -294,8 +293,8 @@ node(JENKINS_NODE) { artifactoryServer.publishBuildInfo buildInfo } } else if(params.'STARTED_JOB'){ - target = "${ARTIFACTORY_REPO}/zlux-core/" + - "${zoweVersion}-${params.'PR_NUMBER'}-${params.'REPO_NAME}/" + + target = "${ARTIFACTORY_REPO}/zlux-core/" + + "${zoweVersion}-${params.'PR_NUMBER'}-${params.'REPO_NAME'}/" + "zlux-core-${zoweVersion}-${timestamp}" ["tar", "pax"].each { def uploadSpec = """{"files": [{"pattern": "zlux.${it}", "target": "${target}.${it}"}]}""" @@ -303,7 +302,7 @@ node(JENKINS_NODE) { artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo artifactoryServer.publishBuildInfo buildInfo } - } else { + } else { target = "${ARTIFACTORY_REPO}/zlux-core/" + "${zoweVersion}${branchName.toUpperCase()}/" + "zlux-core-${zoweVersion}-${timestamp}" From 9cbfa75a6edf25928e8146a61e4e0dd7ed1c7932 Mon Sep 17 00:00:00 2001 From: James Struga Date: Tue, 11 May 2021 00:37:39 -0400 Subject: [PATCH 14/18] final fix Signed-off-by: James Struga --- Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index be4b84e..3f42c97 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -113,7 +113,10 @@ node(JENKINS_NODE) { zluxbuildpr = env.BRANCH_NAME if (zluxbuildpr.startsWith("PR-")){ pullRequests['zlux-build'] = getPullRequest(GITHUB_TOKEN, 'zlux-build', zluxbuildpr.drop(3)) - } else { + } else if (params.'BUILD_DEFAULT'){ + DEFAULT_BRANCH = params.'REPO_NAME' + echo "building ${DEFAULT_BRANCH}" + } else { DEFAULT_BRANCH = env.BRANCH_NAME.toLowerCase() echo "building ${DEFAULT_BRANCH}" } From c75f0de09ee8268d1220eb801f084c4fb1cc706a Mon Sep 17 00:00:00 2001 From: James Struga Date: Tue, 11 May 2021 11:24:09 -0400 Subject: [PATCH 15/18] debugging deployment script Signed-off-by: James Struga --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3f42c97..b07f305 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -285,6 +285,8 @@ node(JENKINS_NODE) { def artifactoryServer = Artifactory.server ARTIFACTORY_SERVER def timestamp = (new Date()).format("yyyyMMdd.HHmmss") def target = null + echo "${params.'STARTED_JOB'}" + echo "${zluxbuildpr}" if (zluxbuildpr.startsWith("PR-")){ target = "${ARTIFACTORY_REPO}/zlux-core/" + "${zoweVersion}-${zluxbuildpr}/" + From 1af62bce7a8f661190d32f3bb6b743809923eec7 Mon Sep 17 00:00:00 2001 From: James Struga Date: Tue, 11 May 2021 12:04:59 -0400 Subject: [PATCH 16/18] added more conditions Signed-off-by: James Struga --- Jenkinsfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b07f305..6805e43 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -285,9 +285,7 @@ node(JENKINS_NODE) { def artifactoryServer = Artifactory.server ARTIFACTORY_SERVER def timestamp = (new Date()).format("yyyyMMdd.HHmmss") def target = null - echo "${params.'STARTED_JOB'}" - echo "${zluxbuildpr}" - if (zluxbuildpr.startsWith("PR-")){ + if (zluxbuildpr.startsWith("PR-") && !params.'STARTED_JOB' && !params.'BUILD_DEFAULT'){ target = "${ARTIFACTORY_REPO}/zlux-core/" + "${zoweVersion}-${zluxbuildpr}/" + "zlux-core-${zoweVersion}-${timestamp}" From db46720eaafbe9e89647d22b1befd7a02ccf68ae Mon Sep 17 00:00:00 2001 From: James Struga Date: Sun, 16 May 2021 19:29:03 -0400 Subject: [PATCH 17/18] remove rc build Signed-off-by: James Struga --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6805e43..c49d8c5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -113,7 +113,9 @@ node(JENKINS_NODE) { zluxbuildpr = env.BRANCH_NAME if (zluxbuildpr.startsWith("PR-")){ pullRequests['zlux-build'] = getPullRequest(GITHUB_TOKEN, 'zlux-build', zluxbuildpr.drop(3)) - } else if (params.'BUILD_DEFAULT'){ + }else if (env.BRANCH_NAME.toLowerCase() == 'rc') { + currentBuild.result = 'ABORTED' + } else if (params.'BUILD_DEFAULT'){ DEFAULT_BRANCH = params.'REPO_NAME' echo "building ${DEFAULT_BRANCH}" } else { From 4e328c4afc71014f03abc8fbecd1fc5b50662379 Mon Sep 17 00:00:00 2001 From: James Struga Date: Sun, 16 May 2021 19:30:00 -0400 Subject: [PATCH 18/18] remove rc build Signed-off-by: James Struga --- Jenkinsfile.release | 231 -------------------------------------------- 1 file changed, 231 deletions(-) delete mode 100644 Jenkinsfile.release diff --git a/Jenkinsfile.release b/Jenkinsfile.release deleted file mode 100644 index 23990c2..0000000 --- a/Jenkinsfile.release +++ /dev/null @@ -1,231 +0,0 @@ -#!groovy - -/** - * This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v2.0 which accompanies - * this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html - * - * SPDX-License-Identifier: EPL-2.0 - * - * Copyright Contributors to the Zowe Project. - */ - - -/* - * A monstrous pipeline to build, run unit tests, package and deploy zLUX artifacts. - * It should be split / simplified at some point. - */ - -import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException - - -JENKINS_NODE = "zlux-agent" -GITHUB_PROJECT = "zowe" -GITHUB_TOKEN = "zowe-robot-github" -GITHUB_SSH_KEY = "zlux-jenkins" - -ZLUX_CORE_PLUGINS = [ - "zlux-app-manager", - "zlux-app-server", - "zlux-build", - "zlux-platform", - "zlux-server-framework", - "zlux-shared" -] -DEFAULT_BRANCH = "rc" -ZOWE_MANIFEST_URL = \ - "https://raw.githubusercontent.com/zowe/zowe-install-packaging/rc/manifest.json.template" -ARTIFACTORY_SERVER = "zoweArtifactory" -ARTIFACTORY_REPO = "libs-snapshot-local/org/zowe/zlux" -// PAX_HOSTNAME = "172.30.0.1" -// PAX_HOSTNAME = "river.zowe.org" -PAX_HOSTNAME = "zzow01.zowe.marist.cloud" -// PAX_SSH_PORT = 2022 -PAX_SSH_PORT = 22 -// PAX_CREDENTIALS = "TestAdminzOSaaS2" -// PAX_CREDENTIALS = "ssh-zdt-test-image-guest" -PAX_CREDENTIALS = "ssh-marist-server-zzow01" -NODE_VERSION = "v12.16.1" -NODE_HOME = "/ZOWE/node/node-${NODE_VERSION}-os390-s390x" -NODE_ENV_VARS = "_TAG_REDIR_ERR=txt _TAG_REDIR_IN=txt _TAG_REDIR_OUT=txt __UNTAGGED_READ_MODE=V6" - -properties([ - parameters([ - string( - name: "RELEASE_VERSION", - defaultValue: "", - description: "Version of release (X.X.X)", - trim: true - ) - ]) -]) - - -def getZoweVersion() { - return params.RELEASE_VERSION - // def response = httpRequest url: ZOWE_MANIFEST_URL - // echo "Zowe manifest template:\n${response.content}" - // return (response.content =~ /"version"\s*:\s*"(.*)"/)[0][1] -} - -def zoweVersion = null -def paxPackageDir = "/ZOWE/tmp/~${env.BUILD_TAG}" - - -node(JENKINS_NODE) { - currentBuild.result = "SUCCESS" - try { - - stage("Prepare") { - zoweVersion = getZoweVersion() - env.BRANCH_NAME = DEFAULT_BRANCH - } - - sshagent(credentials: [GITHUB_SSH_KEY]) { - stage("Checkout") { - sh \ - """ - mkdir zlux - git config --global user.email "zowe-robot@zowe.org" - git config --global user.name "Zowe Robot" - """ - ZLUX_CORE_PLUGINS.each { - sh \ - """ - cd zlux - git clone https://github.com/zowe/${it}.git - cd ${it} - git checkout ${DEFAULT_BRANCH} - """ - } - } - - stage("Set version") { - def (majorVersion, minorVersion, microVersion) = zoweVersion.tokenize(".") - sh \ - """ - cd zlux/zlux-build - sed -i -e "s/MAJOR_VERSION=0/MAJOR_VERSION=${majorVersion}/" \\ - -e "s/MINOR_VERSION=8/MINOR_VERSION=${minorVersion}/" \\ - -e "s/REVISION=4/REVISION=${microVersion}/" \\ - version.properties - echo "Set version to:" - cat version.properties - """ - } - - stage("Build") { - sh "bash -c 'cd zlux/zlux-build && set -o pipefail && ant production 2>&1 | grep -vE \"^\\s+\\[exec\\]\\s+0\\% compiling\"'" - } - - stage("Package") { - sh \ - """ - chmod +x dist/zlux-build/*.sh - cd dist - tar cf ../zlux.tar -H ustar * - cd .. - git clone -b feature/tag-script https://github.com/1000TurquoisePogs/zowe-install-packaging.git - """ - - withCredentials([usernamePassword( - credentialsId: PAX_CREDENTIALS, - usernameVariable: "PAX_USERNAME", - passwordVariable: "PAX_PASSWORD" - )]) { - def PAX_SERVER = [ - name : PAX_HOSTNAME, - host : PAX_HOSTNAME, - port : PAX_SSH_PORT, - user : PAX_USERNAME, - password : PAX_PASSWORD, - allowAnyHosts: true - ] - sshCommand remote: PAX_SERVER, command: \ - "rm -rf ${paxPackageDir} && mkdir -p ${paxPackageDir}" - sshPut remote: PAX_SERVER, from: "zlux.tar", into: "${paxPackageDir}/" - sshPut remote: PAX_SERVER, from: "zowe-install-packaging/scripts/tag-files.sh", into: "${paxPackageDir}/" - sshCommand remote: PAX_SERVER, command: \ - """ - export _BPXK_AUTOCVT=ON && - cd ${paxPackageDir} && - chtag -tc iso8859-1 tag-files.sh && - chmod +x tag-files.sh && - mkdir -p zlux/share && cd zlux && - mkdir bin && cd share && - tar xpoUf ../../zlux.tar && - ../../tag-files.sh . && - cd zlux-server-framework && - rm -rf node_modules && - ${NODE_ENV_VARS} PATH=${NODE_HOME}/bin:$PATH npm install && - cd .. && - iconv -f iso8859-1 -t 1047 zlux-app-server/defaults/serverConfig/server.json > zlux-app-server/defaults/serverConfig/server.json.1047 && - mv zlux-app-server/defaults/serverConfig/server.json.1047 zlux-app-server/defaults/serverConfig/server.json && - chtag -tc 1047 zlux-app-server/defaults/serverConfig/server.json && - cd zlux-app-server/bin && - cp start.sh configure.sh ../../../bin && - if [ -e "validate.sh" ]; then - cp validate.sh ../../../bin - fi - cd .. - if [ -e "manifest.yaml" ]; then - cp manifest.yaml ../../ - fi - cd ../../ - pax -x os390 -pp -wf ../zlux.pax * - """ - sshGet remote: PAX_SERVER, from: "${paxPackageDir}/zlux.pax", into: "zlux.pax" - } - } - - stage("Deploy") { - def artifactoryServer = Artifactory.server ARTIFACTORY_SERVER - def timestamp = (new Date()).format("yyyyMMdd.HHmmss") - def target = "${ARTIFACTORY_REPO}/zlux-core/" + - "${zoweVersion}-${env.BRANCH_NAME.toUpperCase()}/" + - "zlux-core-${zoweVersion}-${timestamp}" - - ["tar", "pax"].each { - def uploadSpec = """{"files": [{"pattern": "zlux.${it}", "target": "${target}.${it}"}]}""" - def buildInfo = Artifactory.newBuildInfo() - artifactoryServer.upload spec: uploadSpec, buildInfo: buildInfo - artifactoryServer.publishBuildInfo buildInfo - } - } - } - } catch (FlowInterruptedException e) { - currentBuild.result = "ABORTED" - throw e - } catch (e) { - if (e.getMessage() != 'nothing to build') { - currentBuild.result = "FAILURE" - throw e - } - } finally { - stage("Report") { - def prettyParams = "n/a" - emailext \ - subject: """${env.JOB_NAME} [${env.BUILD_NUMBER}]: ${currentBuild.result}""", - attachLog: true, - mimeType: "text/html", - recipientProviders: [ - [$class: "RequesterRecipientProvider"], - [$class: "CulpritsRecipientProvider"], - [$class: "DevelopersRecipientProvider"], - [$class: "UpstreamComitterRecipientProvider"] - ], - body: \ - """ -

${currentBuild.result}

-
- -
- """ - } - } -}