Preparing and Registering the Docker Image
To control a CI/CD workflow, GitHub supports adding custom functionality to a workflow via containers. Each container needs to be registered in the GitHub container registry. Repositories wanting to use iCR CI/CD are then associated with the container. iCR implements its GitHub Actions CI/CD via the supplied Docker container image. To learn more about GitHub’s support for Docker in their container registry you can visit their Website.
Included in the iCR CI/CD directory is a script named prep-container
. This script is used to prepare and register the provided iCR Docker container for use with GitHub CI/CD. To register this component within a specific User’s container registry, execute the command below from within the directory where the container image resides:
./prep-container github <username> <authentication-token> [<project-name> <enterprise-URL>]
Where <username>
is the name of the user who owns the project to be analyzed and <authentication-token>
is a Personal Access Token (PAT) that the User must create within GitHub to authorize the login to the GitHub container registry. This method insures that authenticated access to the registry will succeed even if two-factor authentication is enabled for that User.
If the user is planning on pulling the source code from a GitHub Enterprise server, then a specific project name must be specified as part of the package registration so <project-name>
is used to identify the specific project. This is followed by the URL of the Enterprise server itself specified using <enterprise-URL>
.
Staying with the examples used in the User Guide for Private Platform, and assuming a cloud-based VCS, the command would look like:
./prep-container github or-testuser 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
This command causes the icr-github.tar
image that is included in the CI/CD directory to be inserted into the local Docker registry where it can then be pushed to the User’s container registry in the GitHub cloud VCS. The output looks like:
Once registered, the container will appear in the GitHub packages listing.
To verify this, from the User home page in GitHub select Packages from the top menu.
This will bring you to the package registry page for this User displaying all of the currently registered container packages. On our example, we just have the one new container that we just pushed to the registry: icr-github.
Last updated