Skip to content
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

First version of Gitlab pipeline template. #221

Merged
merged 8 commits into from
Mar 4, 2024

Conversation

monvora
Copy link
Member

@monvora monvora commented Feb 20, 2024

This is the first version of Gitlab pipeline template along with the documentation.

Copy link
Member

@dennis-behm dennis-behm left a 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 check out the comments?

GIT_STRATEGY: none
GIT_CHECKOUT: "false"
application: "CBSA"
wdEnvironmentFileIntegration: ${WAZI_DEPLOY_SAMPLES}/plum-samples/external-repos/environment-conf/python/EOLEB7-CBSA-Integration.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't find an explanation for the variable WAZI_DEPLOY_SAMPLES . Is this an environment variable configured for the service account running the pipeline steps?

Copy link
Member Author

@monvora monvora Feb 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding, this is just installation path of Wazi Deploy. It's point to /var/WaziDeploy/wazi-deploy-samples-0.10.0/wazi-deploy-sample. right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WAZI_DEPLOY_SAMPLES is a CI/CD variable defined at the group level. It points to the Wazi Deploy samples location on z/OS. This is where the samples are installed and customized (actually in our setup, it is where the Wazi Deploy repository that contains our customization is cloned).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@M-DLB that is what I thought at first this is only a sample file. I only document that it should be customized the path to the deployment configuration file but did not mention about the WAZI_DEPLOY_SAMPLES variable. How should we handle this in this document?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are passing an absolute path, while the Azure Devops pipeline is passing a relative path. So either, we switch to a relative path and specify the absolute folder path in the wdEnvironmentConfigurations variable of the pipelineBackend.config file, or we just leave it like this.
Also, please consider changing the path in the template since there is no existence of plum-samples anymore (replaced by wazideploy-samples, like in https://github.com/jbyibm/cics-genapp/tree/main/wazideploy-samples).

# Working directory on Linux machine
buildOutputDirectory: ${CI_PROJECT_DIR}/BUILD-OUTPUT
deployOutputDirectory: ${CI_PROJECT_DIR}/DEPLOY-OUTPUT
baselineReferenceFile: $CI_PROJECT_DIR/CBSA/application-conf/baselineReference.config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we replace the concrete application nameCBSA with an environment variable for the application?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dennis-behm this is actually the $CI_PROJECT_DIR already contains the name of application. CBSA is a sub-directory for source code under "CICS-Bank-Sample-Application" repository. Do you think we still need to change the this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dennis-behm Can you please help confirm this. Than you.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use the $CI_PROJECT_NAME variable, but in our case it's CICS-Bank-Sample-Application, not CBSA. But I agree it shouldn't hardcoded like this.

tar -xvf "${destinationLogsFile}" -C "${buildOutputDirectory}/" --strip-components 1
echo [INFO] Extracted log.tar file to ${buildOutputDirectory}
else
echo [WARNING] Tar file containing the logs was not found
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above condition checks if the variable is defined, not if the log file exists. Could be renamed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, I meant to check if the file exist. I updated to the following.
if [ -f "${sourceLogsFile}" ]; then

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh!! I cannot check this from the definition file since the files are on USS. I would to assume it is created if the script successfully execute. With the updated ZOWE CI, we should be able to trust the RC returned.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to not checking any condition since the "sourceLogsFile" will always be defined and assigned the path.

Templates/GitlabCIPipeline/.gitlab-ci.yml Outdated Show resolved Hide resolved

# Creates the git tag using the CLI REST interface and the automation token
curl --request POST --header "PRIVATE-TOKEN: ${AutomationToken}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/tags?tag_name=${newVersionTag}&ref=${CI_COMMIT_REF_NAME}"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check the return code of the curl request? If is successful?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Templates/GitlabCIPipeline/.gitlab-ci.yml Outdated Show resolved Hide resolved
Templates/GitlabCIPipeline/.gitlab-ci.yml Outdated Show resolved Hide resolved
if [ "${releaseType}" == "major" ]; then
export newVersionTag=`echo ${baselineRef} | sed 's/^["refs\/tags\/rel-]*//g' | sed 's/-[a-zA-Z0-9]*//g' | awk -F. -v OFS=. '{$1 += 1 ; $2 = 0; $3 = 0; print}'`
fi
echo [INFO} New verion == ${newVersionTag}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment like above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

tags: [shell]
script: |

echo [INFO] Retrieve baseline reference information from ${baselineReferenceFile}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of calculating the git tag again, can we access the variable from the previous step?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dennis-behm I tested we need to re-calculating the git tag again. The value is not passing to the downstream job. T T

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this!

### Variables configuration
The following variables need to be defined and configured as the environment variables in the GitLab group or project setting:

Veriables | Description
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variables instead of Veriables

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done...

wdEnvironmentFileIntegration | Path to a Wazi Deploy configuration file for integration environment.
wdEnvironmentFileAcceptance | Path to a Wazi Deploy configuration file for acceptance environment.
wdEnvironmentFileProduction | Path to a Wazi Deploy configuration file for production environment.
baselineReferenceFile | Path to baselineRefer0ence.config file of your application.
Copy link
Member

@dennis-behm dennis-behm Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A typo in baselineReference.config.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done...

Copy link
Member

@dennis-behm dennis-behm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@monvora

I made a couple of comments about the messages the script writes.
I think we can be clear that Deployment failed ..., instead of saying Unsuccessfully ... .
Also there is some messages with all in upper case, that can be adjusted.

I might not have added comments to all occurrences .

if [ ${RC} -eq 0 ]; then
echo [INFO] Completed build application job.
else
echo [ERROR] Incompleted build application job with exit code ${RC}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of

Incompleted build application job with exit code

Maybe something like

Build step failed. Exit code: ${RC}

if [ ${RC} -eq 0 ]; then
echo [INFO] Successfully prepare log files.

echo START TRANSFER LOGS FILE = ${sourceLogsFile} to ${destinationLogsFile}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also have the [INFO] prefix for this echo?

@@ -196,16 +230,22 @@ Clone:
if [ -z "${releaseCandidate}" ]; then
# initial version tag
export newVersionTag="${newVersionTag}_rc00"
echo [INFO] 1 Update New release condidate tag == ${newVersionTag}
echo [INFO] Updated release condidate tag == ${newVersionTag}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo - condidate > candidate

if [ ${RC} -eq 0 ]; then
echo [INFO] Release candidate tag is successfully created as ${newVersionTag}.
else
echo [ERROR] Release candidate tag is unsuccessfully created.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to create release candidate tag

# Create integration report directory
mkdir ${integrationReportDir}
echo [INFO] Create integration report directory = ${integrationReportDir}
# Transfer deployment report and evidence report
echo [INFO] TRANSFER OUTPUT FILES = ${sourceOutputFile} to ${integrationReportDir}/deployment-report.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all message all in upper case output stands out. Maybe we can be updated to something like this:
echo [INFO] Loading deployment report ${sourceOutputFile} to ${integrationReportDir}/deployment-report.html

if [ ${RC} -eq 0 ]; then
echo [INFO] Successfully transfer deployment report file.
else
echo [ERROR] Unsuccessfully transfer deployment report file with exit code ${RC}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above comment

@monvora
Copy link
Member Author

monvora commented Mar 1, 2024

@monvora

I made a couple of comments about the messages the script writes. I think we can be clear that Deployment failed ..., instead of saying Unsuccessfully ... . Also there is some messages with all in upper case, that can be adjusted.

I might not have added comments to all occurrences .

@dennis-behm Ok, I'll clean up the output message.

Copy link
Collaborator

@M-DLB M-DLB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment!

RSEAPI_USER | Username for Zowe RSEAPI server authentication. This username is used when issue shell script command through Zowe.
RSEAPI_PASSWORD | Password for Zowe RSEAPI server authentication. This password is used when issue shell script command through Zowe.
PIPELINE_WORKSPACE | Root directory on z/OS Unix System services to perform builds. E.g. /u/gitlab/workspace
WAZI_DEPLOY_CONFIGDIR | Path to a directory of Wazi Deploy configuration files.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should say this WAZI_DEPLOY_CONFIGDIR directory is on USS and can be populated with the samples available in https://github.com/jbyibm/cics-genapp/tree/main/wazideploy-samples

Copy link
Member

@dennis-behm dennis-behm left a 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 update the table located at https://github.com/IBM/dbb/tree/main/Templates ?

monvora and others added 3 commits March 4, 2024 10:57
…eline/README.md about WAZI_DEPLOY_CONFIGDIR.
Signed-off-by: Monvorath Phongpaibul <145766235+monvora@users.noreply.github.com>
Signed-off-by: Monvorath Phongpaibul <145766235+monvora@users.noreply.github.com>
Copy link
Member

@dennis-behm dennis-behm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@monvora Thank you. Great work!

@dennis-behm dennis-behm merged commit 97b1cd1 into IBM:main Mar 4, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants