Container Continuous Integration
Automatic building of container images using jenkins.
To enable deployment from jenkins to the container registry we need to store a username/password. We don't want to use a personal account. Harbor provides a robot account for this. Harbor project owners have admin privileges and can create robot accounts for their projects. Login to the registry, select your project, select robot account. The resulting account will be
. Save the hash.
In jenkins create a folder. Configure folder properties and enable project-based security. Add the group that should be allowed to manage credentials and add the suitable permissions.
Now we have permissions to add credentials to the folder. Enter folder, select credentials from the left side. Select folder, add domain. Add credentials username/password. Use the id podman (see below)
To ease usage of podman a jenkins library is available. Configure folder pipeline libraries and add library https://git.acc.gsi.de/k8s/jenkins.git
The library makes a few default assumptions
- registry credentials are available as
- the last folder is the registry project
- the job is the registry repository
- the git branch is the tag. Master will be replaced with latest.
- A Containerfile is at the top level of the git repository
If all these assumptions are correct, the following jenkinsfile at the top level of a git repository will be enough
# yes with the underscore
otherwise the individual steps for a custom pipeline are
. See git source code for details.
- 04 Jul 2022