Preparing the GitHub Workflow
Last updated
Last updated
To trigger a workflow in GitHub CI/CD, a special yml
script to invoke the iCR container must be inserted into the project’s repository. This script MUST be placed in the .github
directory at the top level of the repository. If it is not already present, a subdirectory named workflows
must be created. Then, within the workflows
directory, a yml
script describing the bahviour of the workflow is placed. This script is triggered upon events specified in the script.
The DevOps engineer preparing the workflow can create whatever triggers are appropriate for their specific needs. This script can be incorporated into a previous workflow script or edited to make the workflow operate as needed.
We won’t cover how to add a file to a GitHub repository as that is beyond the scope of this User Guide.
As an example, we will show the baritone
project. We go to the main repository page for this project and look at the .github/workflows
directory:
We have copied the sample script below into a file named githubAction.yml
. Let’s quickly review the sample script:
In this sample script, the on:
section specifies what will trigger the execution of this script. In this example, whenever a commit is pushed to the master
branch, it will be executed. The container:image
tags identify the iCR Docker name: openrefactory/icr-github-cicd:5.0.0
. For items such as the User ID for the user for whom this workflow is to be executed, subsitute <User_ID>
with that User's login ID.
The critical items of interest are the variables referenced in the run:
step. They are needed to be able to locate the targeted iCR server and to provide the Navigator with the information required so it can authenticate itself with the proper username and identify the project and branch name.
There are seven variables in the script. Let’s look at all of them. They are broken into 2 groups: preconfigured environment variables and user supplied secret values.