Update JenkinsfileWithWaziDeploy with various changes#394
Conversation
7f75acf to
f6f75ab
Compare
|
Hello DBB maintainers, I discovered that there is a similar PR made by Kenny for the IDD Jenkinsfile. I will synchronize my PR with the improvements made in #377 and address the comments Dennis made. I will also break apart the PR into multiple commits to make it easier to review. |
f6f75ab to
436cc55
Compare
Signed-off-by: ETHAN FRITZ <erfritz@us.ibm.com>
Signed-off-by: ETHAN FRITZ <erfritz@us.ibm.com>
Signed-off-by: ETHAN FRITZ <erfritz@us.ibm.com>
Signed-off-by: ETHAN FRITZ <erfritz@us.ibm.com>
Signed-off-by: ETHAN FRITZ <erfritz@us.ibm.com>
Signed-off-by: ETHAN FRITZ <erfritz@us.ibm.com>
Signed-off-by: ETHAN FRITZ <erfritz@us.ibm.com>
Signed-off-by: ETHAN FRITZ <erfritz@us.ibm.com>
Signed-off-by: ETHAN FRITZ <erfritz@us.ibm.com>
436cc55 to
2fdc6cd
Compare
|
I am done making changes and this can be reviewed. |
dennis-behm
left a comment
There was a problem hiding this comment.
@fritze2 Thanks for the effort to uplift the Jenkins template! Great work. I have identified a couple of areas, which I would like you to another look at. Feel free to reach out to me directly as well, if you want to discuss those
| // DbbPipelineScripts - Path to the DBB Common-Backend-Scripts directory. | ||
| def zBuilderVerbose = "" | ||
| def DbbDoBuild = true | ||
| def DbbCommunityRepo = "/u/user/dbb" |
There was a problem hiding this comment.
Rather a comment/idea - would it be beneficial to inherit this as environment variables defined via the Jenkins agent?
When building the project on a different build machine (via a different agent), where the tools are installed at a different location, the user would need to update the Jenkinsfile
There was a problem hiding this comment.
I agree, it makes sense for DbbCommunityRepo to be an environment variable, and perhaps it could have a default to something set in the Jenkinsfile. I'll update that.
| BuildCmd = "${DbbPipelineScripts}/zBuilder.sh -w ${WORKSPACE} -a ${AppName} -b ${AppBranch} -p ${PipelineType} -q ${AppHLQ} ${zBuilderVerbose}" | ||
| println("${PipelineName}[INFO]: Build Command = ${BuildCmd}") | ||
|
|
||
| dir("${WORKSPACE}/${AppName}") { |
There was a problem hiding this comment.
I don't see the need to change into the app directory. I think this can be removed.
| if (verbose) { | ||
| sh "echo ${PipelineName}[DEBUG]: Build Return Code = ${Buildrc}" | ||
| } | ||
| BuildOutputDir = "${WORKSPACE}/${AppName}/logs" |
There was a problem hiding this comment.
The zBuilder.sh script copies at the end of the process the log files from the logs directory in the application repository folder into ${WORKSPACE}/logs. Let's use this location to pick up the log files.
There was a problem hiding this comment.
There was a problem hiding this comment.
I would suggest to define the BuildOutputDir in the variables section of the pipeline. I noticed, that it is referenced at multiple places.
It should be ${WORKSPACE}/logs
| // AppName - Name of the Application folder within the application repository. | ||
| // AppHLQ - Build destination High-Level Qualifier for any pipeline. | ||
| def AppBranch = "" | ||
| def BuildDir = "" |
There was a problem hiding this comment.
I think this is obsolete, while you are referencing ${WORKSPACE} instead.
| autoCancelled = false | ||
|
|
||
| // Find the package tar file to use as input for Wazi Deploy stages. | ||
| dir("${WORKSPACE}/logs") { |
There was a problem hiding this comment.
Picking on this, but it should be across the entire template -
instead of ${WORKSPACE}/logs use the ${BuildOutputDir}
|
|
||
| // Find the package tar file to use as input for Wazi Deploy stages. | ||
| dir("${WORKSPACE}/logs") { | ||
| def tarFiles = findFiles(glob: "build-*.tar") |
There was a problem hiding this comment.
I don't see a need to validate if a tar file exists. Did you encounter an issue in this area? packageBuildOutputs.sh is supposed to end with a proper return code for successful completion or failure.
There was a problem hiding this comment.
It wasn't so much a need to validate the tar file exists as it is that we need the name of the tar file, and it contains a dynamic timestamp value, in order to pass it as input -i into wazideploy-generate.sh later here.
I may have misunderstood how to pass the tar file into the wazideploy-generate.sh.
| if (autoCancelled == false) { | ||
| WdGenDeployPlanCmd = "${DbbPipelineScripts}/wazideploy-generate.sh -w ${WORKSPACE} -a ${AppName} -P ${PipelineType} -R ${ReleaseVersion} -I ${BuildNumber} -i ${PackageTarPath}" | ||
|
|
||
| dir("${WORKSPACE}") { |
There was a problem hiding this comment.
dir seems not to be needed here to run the command
| WdDeployCmd = "" | ||
| MsgHdr = "Deploy Integration Step:" | ||
|
|
||
| WdDeployCmd = "${DbbPipelineScripts}/wazideploy-deploy.sh -w ${WORKSPACE} -e ${WdEnvFileIntegration} -i ${PackageTarPath} -l deploy/evidences/evidence.yaml" |
There was a problem hiding this comment.
-i ${PackageTarPath}is not needed here, while the CBS work out of the assumptions and conventions where to store the package from the generate step. Let's catch up if you see this as a requirement.
| echo "[ERROR]: Command execution failed: ${e.message}" | ||
| // More robust error code extraction | ||
| def errorMsg = e.toString() | ||
| if (errorMsg.contains('script returned exit code')) { |
There was a problem hiding this comment.
I don't see where the scripts print a message like script returned exit code. Can you elaborate why you added this, please?
Co-authored-by: Dennis Behm <dennis.behm@de.ibm.com>
|
I am implementing the changes and re-running a test pipeline on our lab environment. I'll request another review once I have all the changes working and committed. Thanks, Dennis. |
The changes in this pipeline have been tested in the SMPO lab environment.
zBuilder.sh.-i ${PackageTarPath}to the common backend scriptswazideploy-generate.shandwazideploy-deploy.sh.JenkinsAgentto a more generic agent namedZosAgent.pipeverbosetoverbose.zAppBuildVerbosetozBuilderVerbose.AppBranch,BuildDir, andBranch. This is in case the user creates a generic pipeline using a single-branch instead of a multi-branch pipeline, so the variables will not be null.DbbCommunityRepoto be configured by the user to point to the installed DBB community repository andDbbPipelineScripts.WdEnvFileIntegrationto point to environment located in the DBB community repository.branchConfigmap to replace the series of if conditions that configure branch behavior.addSummaryDSL from deprecatedcreateSummaryDSL.addWarningBadgeandaddErrorBadgeDSLs on a build issue.dslMethodExistsso they don't fail the build.