-
Notifications
You must be signed in to change notification settings - Fork 138
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?
Changes from all commits
c8ca5db
82a3809
e9eab81
8de7794
f584cfc
9e98a02
7b49b4e
ca23c00
98e9de0
b87255e
9a1f583
e923fd2
8499816
4a32af5
27587cf
7e1ac6d
88f2df3
2881037
d4bd7dd
4aba150
43797c7
4b25d17
2d9da76
333c0f7
2eea9b1
068cc8b
fd398d2
d09cdac
86a5b61
31a2439
14caa4f
cb713bb
725c4f2
cbf88b1
5a8296e
172f7a2
50e9934
aabd600
601dc33
f8e4b6b
1da2b20
e78bf47
9547523
0a17ed0
1bf2035
da200ea
2740ac7
d439114
1c37255
52e2ea9
d73c755
9c602a2
15cfcbd
79f6ca0
b8f5edf
4431915
53af650
ac1c4bc
62f4091
9f6aab6
ef71fc4
4b55eb8
27d008e
226e7f5
839fd3a
eedd6b6
676226d
8d62c0d
2d9990a
89b8f8c
d55517f
6b56de8
4936889
70c7551
d5d0c15
716c8f3
0e261b1
1bf7cd9
9552aa1
0b5921e
07ff7da
f2e4b89
8e5e23b
139a28c
85ee445
718a6ea
7549a5a
ad13508
5e52119
c0cdf1b
132e69e
5bdbd62
b899fc1
e0dc379
5c52251
09a7574
6f9adce
c4aedd3
70ce2f3
654ae89
72e48e9
c80fb56
cf6c490
945e234
2df7fcf
c230415
5c45d09
6e83355
90ded94
b05ebd8
6d73045
d8d6eda
5fd8ddf
daec39d
ae02e69
75311e8
1f5f65f
6de3d4c
b3cfe74
942d4a2
824e652
ac0a7cc
dea582a
b1bf88e
858591b
15504fe
1391d58
deeb9bb
e4e41f2
61d1d9a
275a526
51a0da2
9de0df9
eaca963
5da0453
f03c412
3739497
6134ce3
be55b7a
5d73f63
28b88c4
837e847
9cf238f
6ba67ce
1f98451
288170b
c12192d
71a10e6
f53be77
6c553a4
1848448
8e3ee4a
29e817a
459c0b0
4c04c2b
98381e1
346886e
e077634
76c8b1e
c22a823
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 application's [baselineReference.config](samples/baselineReference.config) file. | [script details](#computeReleaseVersionsh) | ||
[packageBuildOutputs.sh](packageBuildOutputs.sh) | Pipeline Shell Script to create a Package using the [PackageBuildOutputs groovy script](https://github.com/IBM/dbb/tree/main/Pipeline/PackageBuildOutputs) | [script details](#packagebuildoutputssh) | ||
[ucdPackage.sh](ucdPackaging.sh) | Pipeline Shell Script to publish to UCD Code Station binary repository using the [CreateUCDComponentVersion groovy script](https://github.com/IBM/dbb/tree/main/Pipeline/CreateUCDComponentVersion) | [script details](#ucdpackagingsh) | ||
[wazideploy-generate.sh](wazideploy-generate.sh) | Pipeline Shell Script to generate a Deployment Plan to be used with Wazi Deploy | [script details](#wazideploy-generatesh) | ||
|
@@ -492,6 +493,84 @@ The [dbbzBuilderUtils](utilities/dbbzBuilderUtils.sh) script is a core utility s | |
|
||
Depending on the Deployment Manager tool you are using, you can choose from either creating a package with the [PackageBuildOutputs](#packagebuildoutputssh) script that can be used with IBM Wazi Deploy, or the [UCD packaging](#ucdpackagingsh) script that creates the UCD shiplist and UCD component version. | ||
|
||
### computeReleaseVersion.sh | ||
|
||
This script is to compute the version for the next release based on the information of baseline version stored in the [baseineReference.config](samples/baselineReference.config) file. The computation of the release version follows the versioning described in [IBM recommended Git branching model for mainframe developer](https://ibm.github.io/z-devops-acceleration-program/docs/branching/git-branching-model-for-mainframe-dev). It follows the Systematic Versioning as MAJOR.MINOR.PATCH number. The number of the coresponding part is increased based on the type of release. | ||
|
||
The computed release version is used as part of the archive name to be uploaded or downloaded from the artifact repository. The release version is an input for [packageBuildOutputs.sh](#packagebuildoutputssh) and [wazideploy-generate.sh](#wazideploy-generatesh). | ||
|
||
#### Invocation | ||
|
||
The `computeReleaseVersion.sh` script can be invoked as follows: | ||
|
||
``` | ||
computeReleaseVersion.sh -w MortApp/main/build-1 -a MortgageApplication -b main -r minor | ||
``` | ||
|
||
CLI parameter | Description | ||
---------- | ---------------------------------------------------------------------------------------- | ||
-w `<workspace>` | **Workspace directory**, an absolute or relative path that represents unique directory for this pipeline definition, that needs to be consistent through multiple steps. | ||
-a `<application>` | **Application name** to be built. | ||
-b `<branch>` | **Git branch** that is built. | ||
-r `<major/minor/patch>` | **Release Type** to indicate the type of changes to be relased. | ||
|
||
#### Output | ||
|
||
The section below contains the output that is produced by the `computeReleaseVersion.sh` script. | ||
|
||
<details> | ||
<summary>Script Output</summary> | ||
|
||
``` | ||
+ computeReleaseVersion.sh -w /var/jenkins/workspace/tgageApplication-Pipelines2_main -a MortgageApplication -b main -r major | ||
[Pipeline] echo | ||
computeReleaseVersion.sh: [INFO] Release Version Wrapper. Version=1.10 | ||
computeReleaseVersion.sh: [INFO] Reading pipeline configuration file: /var/jenkins/dbb/Templates/Common-Backend-Scripts/pipelineBackend.config | ||
computeReleaseVersion.sh: [INFO] Validating Options | ||
computeReleaseVersion.sh: [INFO] Application Directory: /var/jenkins/workspace/tgageApplication-Pipelines2_main/MortgageApplication | ||
computeReleaseVersion.sh: [INFO] Detected the application respository (MortgageApplication) within the git repository layout structure. | ||
computeReleaseVersion.sh: [INFO] Assuming this as the new application location. | ||
computeReleaseVersion.sh: [INFO] ************************************************************** | ||
computeReleaseVersion.sh: [INFO] ** Started Next Release Computation on HOST/USER: z/OS ZT01 05.00 02 8561/ | ||
computeReleaseVersion.sh: [INFO] ** Workspace: /var/jenkins/workspace/tgageApplication-Pipelines2_main/MortgageApplication | ||
computeReleaseVersion.sh: [INFO] ** Application: MortgageApplication | ||
computeReleaseVersion.sh: [INFO] ** Branch: main | ||
computeReleaseVersion.sh: [INFO] ** Release Type: major | ||
computeReleaseVersion.sh: [INFO] ** Baselinereference file: /var/jenkins/workspace/tgageApplication-Pipelines2_main/MortgageApplication/application-conf/baselineReference.config | ||
computeReleaseVersion.sh: [INFO] ************************************************************** | ||
|
||
computeReleaseVersion.sh: [INFO] Baseline reference: refs/tags/rel-1.6.0 | ||
computeReleaseVersion.sh: [INFO] Compute the next release version complete. The next release version: rel-2.0.0. rc=0 | ||
|
||
``` | ||
|
||
</details> | ||
|
||
#### Extract the next release version | ||
|
||
To obtain the release version from the `computeReleaseVersion.sh` script's output log, utilize string manipulation commands within your pipeline orchestrator to search for the pattern `version: .*rc=0` pattern and extract the version number form the search result. | ||
|
||
<details> | ||
<summary>Example snippet to extract the version number</summary> | ||
|
||
``` | ||
regexPattern = "version: .*rc=0" | ||
pattern = java.util.regex.Pattern.compile(regexPattern) | ||
//logContent is the output from invoking the computeReleaseVersion.sh script | ||
def pMatcher = pattern.matcher(logContent) | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Hard-coding the length seems to be error-prone. What about a There was a problem hiding this comment. Choose a reason for hiding this commentThe 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'. |
||
} | ||
} else { | ||
println("[INFO]: Failed to search for ${regexPattern}") | ||
} | ||
|
||
``` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @monvora this is missing the closing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
</details> | ||
|
||
### packageBuildOutputs.sh | ||
|
||
This script is to execute the `PackageBuildOutputs.groovy` that packages up the build outputs and optionally uploads it to an artifact repository to publish the artifacts created by a DBB build in the pipeline. | ||
|
@@ -512,7 +591,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 commentThe reason will be displayed to describe this comment to others. Learn more. Can we extend the packageBuildOutputs.sh to accept a new flag like 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 commentThe 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. |
||
|
||
The archive's file name is computed using the application's name, the release name (`-r` argument) and a unique build identifier (`-i` argument). This parameter is typically the pipeline build number that is passed by the pipeline orchestrator. If a build identifier is not provided, the current timestamp is used. | ||
|
||
|
||
|
@@ -629,8 +709,6 @@ rc=0 | |
|
||
</details> | ||
|
||
|
||
|
||
### ucdPackaging.sh | ||
|
||
This script is to execute the `dbb-ucd-packaging.groovy` that invokes the Urban Code Deploy (UCD) buztool utility, to publish the artifacts created by the DBB Build from a pipeline. | ||
|
@@ -727,7 +805,7 @@ CLI parameter | Description | |
-- | - when retrieving the tar file from Artifact repo the below options are mandatory - | ||
-b `<branch>`| Name of the **git branch** turning into a segment of the directory path for the location within the artifact repository. | ||
-p `<build/release>` | **Pipeline Type** to indicate a `build` pipeline (build only with test/debug options) or a `release` pipeline (build for optimized load modules for release candidates). | ||
-R `<releaseIdentifier>` | **Release identifier** to indicate the next planned release name. This is a computed value based on the pipeline templates. | ||
-R `<releaseIdentifier>` | **Release identifier** to indicate the next planned release name. This is a computed value based on the pipeline templates. It can be automatically computed using the [computeReleaseVersion.sh](#computereleaseversionsh) script. | ||
-I `<buildIdentifier>` | **Build identifier** a unique value to identify the tar file. This is a computed value provided by the pipeline templates. Typically the build number of the pipeline run. | ||
-c `<configurationFile>` | Absolute path to the Wazi Deploy **Configuration File** that contains information to connect to the artifact repository. See [IBM Wazi Deploy documentation](https://www.ibm.com/docs/en/developer-for-zos/17.0?topic=files-configuration-file) | ||
|
||
|
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?