-
Notifications
You must be signed in to change notification settings - Fork 137
Feature/301 create utility scripts to compute the next release build for cbs #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature/301 create utility scripts to compute the next release build for cbs #310
Conversation
monvora
commented
Apr 11, 2025
- Add shell script to compute the next release version: computeReleaseVersion.sh
- Add Jenkins pipeline definition template that perform deployment through Wazi Deploy
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Co-authored-by: Mathieu Dalbin <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
Signed-off-by: Dennis Behm <[email protected]>
…utility-scripts-to-compute-the-next-release-build-for-CBS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export mainBranchSegment=`echo ${Branch} | awk -F "/" '{ print $1 }'` | ||
export secondBranchSegment=`echo ${Branch} | awk -F "/" '{ print $2 }'` | ||
export thirdBranchSegment=`echo ${Branch} | awk -F "/" '{ print $3 }'` | ||
echo $PGM": [INFO] Branch segments: ${mainBranchSegment}, ${secondBranchSegment}, ${thirdBranchSegment}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this print. It is a big confusing.
Maybe put it into a comment and add a comment that this is for debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @dennis-behm for a review. I made all the changes we discussed. Now the PR contains:
- computeReleaseVersion.sh script to compute the next release version.
- Updated readme.md which documented about computeReleaseVersion.sh
Please have another reveiw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monvora - can you please add a section to the README about this new script, please?
…nor update to the computeReleaseVersion.sh script based on Dennis's feedback
Done... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monvora Thanks for the documentation updates. I tested your script and this caused a set of new ideas. Can you please check my comments below?
echo $PGM": [INFO] Baseline reference: ${baselineRef}" | ||
|
||
computeNextReleaseVersion | ||
export releaseVersion="rel-"${newVersion} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if newVersion
was computed - basically if it is "set" like the other environment variables. If the variable is empty, set RC=8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done...
@@ -133,7 +133,8 @@ Artifact Name | Description | Script details | |||
---------- | -----| ----------------------------------------------------- | |||
[gitClone.sh](gitClone.sh) | Pipeline Shell Script to perform Git Clone to z/OS UNIX System Services | [script details](README.md#41---gitclonesh) | |||
[dbbBuild.sh](dbbBuild.sh) | Pipeline Shell Script to invoke the Dependency Based Build framework [zAppBuild](https://github.com/IBM/dbb-zappbuild) | [script details](#dbbbuildsh-for-zappbuild-frameworkh) | |||
[zBuilder.sh](zBuilder.sh) | Pipeline Shell script to invoke the zBuilder framework [zBuilder](https://www.ibm.com/docs/en/dbb/3.0?topic=building-zos-applications-zbuilder) | [script details](#zbuildersh-for-dbb-zbuilder) | |||
[zBuilder.sh](zBuilder.sh) | Pipeline Shell Script to invoke the zBuilder framework [zBuilder](https://www.ibm.com/docs/en/dbb/3.0?topic=building-zos-applications-zbuilder) | [script details](#zbuildersh-for-dbb-zbuilder) | |||
[computeReleaseVersion.sh](computeReleaseVersion.sh) | Pipeline Shell Script to compute the next release version based on the baseline version information stored in the [baselineReference.config](samples/baselineReference.config) file. | [script details](#computeReleaseVersionsh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[computeReleaseVersion.sh](computeReleaseVersion.sh) | Pipeline Shell Script to compute the next release version based on the baseline version information stored in the [baselineReference.config](samples/baselineReference.config) file. | [script details](#computeReleaseVersionsh) | |
[computeReleaseVersion.sh](computeReleaseVersion.sh) | Pipeline Shell Script to compute the next release version based on the baseline version information stored in the application's [baselineReference.config](samples/baselineReference.config) file. | [script details](#computeReleaseVersionsh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -512,7 +564,8 @@ For release builds (that use the `pipelineType=release`), the archive is uploade | |||
`release/<reference>/<application>-<buildIdentifier>`: | |||
|
|||
* **release** is defined for release builds. | |||
* **reference** is the release name: for instance, `rel-1.2.3` (provided through the mandatory `-r` argument). | |||
* **reference** is the release name: for instance, `rel-1.2.3` (provided through the mandatory `-r` argument). The release name can be automatically computed using the [computeReleaseVersion.sh](#computereleaseversionsh) script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we extend the packageBuildOutputs.sh to accept a new flag like -R
(requires some analysis), which then calls computeReleaseVersion.sh
as a utility program.
This will reduce the necessary communication between the pipeline orchestrator and the mainframe (keeps the pipeline implementation simpler).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dennis-behm I like this idea. The pipeline implementation will definitely simpler. I will made all the changes you suggested above to close this PR. Then, I'll look into extending the packageBUildOutputs.sh script.
getBaselineReference | ||
if [ $rc -eq 0 ]; then | ||
ERRMSG=$PGM": [INFO] Baseline reference: ${baselineRef}" | ||
eecho $ERRMSG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eecho $ERRMSG | |
echo $ERRMSG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and tested
;; | ||
*) | ||
rc=8 | ||
ERRMSG=$PGM": [ERROR] Release type can only be Major, Minor or Patch. rc="$rc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERRMSG=$PGM": [ERROR] Release type can only be Major, Minor or Patch. rc="$rc | |
ERRMSG=$PGM": [ERROR] No valid release type found. Valid release types are 'major', 'minor' or 'patch'. rc="$rc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monvora I have a few more comments. Please see below. Thank you.
echo $ERRMSG | ||
fi | ||
|
||
tmp2=$(echo $ReleaseType | tr '[:upper:]' '[:lower:]') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this section could lead to a wrong behaviour. We should not set a default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ERRMSG=$PGM": [INFO] Compute the next release version complete. The next release version: ${releaseVersion}. rc="$rc | ||
echo $ERRMSG | ||
else | ||
ERRMSG=$PGM": [ERROR] Compute the next release version failed. Check Console for details. rc="$rc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERRMSG=$PGM": [ERROR] Compute the next release version failed. Check Console for details. rc="$rc | |
ERRMSG=$PGM": [ERROR] Compute the next release version failed. Check console for details. rc="$rc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
computeNextReleaseVersion | ||
|
||
if [ $rc -eq 0 ]; then | ||
export releaseVersion="rel-"${newVersion} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will we pick up (grep
) the next release version from the pipeline orchestrators (for example to set the git tag)
Do we want to print something like
releaseVersion=rel-1.4.0
so the pipelines could grep it like we do grep the url for the package:
https://github.com/IBM/dbb/blob/main/Templates/Common-Backend-Scripts/utilities/packagingUtilities.sh#L131
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dennis-behm, earlier when we planned to have this as the core CBS script, the way I implemented is for pipeline to extract the info from the output line after ([INFO] Compute the next release version complete. The next release version: ${releaseVersion}. rc="$rc). As discussed in one of our call, 'grep' isn't working to pass the version value from script running on USS to the orchestrator.
I was thinking of modify this later when I update this script to be utility script and extend the packageBuildOutput.sh to invoke the script.
Is it ok to wait for the next PR or shall I start working on changing it to utility script in this PR (along with extending packageBuildOutput.sh and probably wazideploy-generate.sh)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it about the pipeline orchestrators ✅ I am good with this.
A primary script could be included into the packageBuildOutput.sh
and wazideploy-generate.sh
.
Can we run an analysis and deliver the updates for packageBuildOutput.sh
and wazideploy-generate.sh
with this PR?
We have a similar approach in the scripts for the build stage to invoke a utility to fetch the dependencies.
https://github.com/IBM/dbb/blob/main/Templates/Common-Backend-Scripts/dbbBuild.sh#L442
the method leverages existing variable names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dennis-behm Thank you for the feedback and sure, let me do the analysis and propose how we can update this PR for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monvora thank your for playing back your analysis. Our conclusion is to keep the computeReleaseVersion.sh script as a standalone script.
There are no plans to directly integrate them into packageBuildOutput.sh
and wazideploy-generate.sh
. The reasons are specifically about the second script wazideploy-generate.sh
:
- We want this script to be able to run on different LPARs. Therefore we cannot assume that the application repository is available to compute the name from the baselineReference.
Recommendation is to control and pass this information via the pipeline implementation technology.
``` | ||
computeReleaseVersion.sh -w MortApp/main/build-1 -a MortgageApplication -b main -r minor | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a sample how to retrieve the result from the command from a pipeline script?
} | ||
|
||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monvora this is missing the closing </details>
tag. It looks like the rest of the page is truncated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
if (pMatcher.find()) { | ||
def version = "${pMatcher.group()}" | ||
if (version){ | ||
releaseVersion = version.substring(9,version.length()-6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard-coding the length seems to be error-prone.
What about a rel-10.123.876
. I did not test it, but I assume this would cut off some information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dennis-behm, in this case if the log message isn't changed, the information will not be lost since the end part is always at the position (string length - 6) because the last part of the log message is always '. RC=0'.