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 robot$PROJECT+NAME. Save the hash.

Screenshot from 2022-07-04 10-30-30.png

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.

Screenshot from 2022-07-04 10-37-38.png

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)

Jenkins Pipeline

To ease usage of podman a jenkins library is available. Configure folder pipeline libraries and add library as podman.

Screenshot from 2022-07-04 10-38-46.png
Screenshot from 2022-07-04 10-38-58.png

The library makes a few default assumptions

  • registry credentials are available as podman
  • 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

@Library('podman') _
# yes with the underscore


otherwise the individual steps for a custom pipeline are podmanBuild and podmanDeploy. See git source code for details.

-- ChristophHandel - 04 Jul 2022
Topic revision: r1 - 04 Jul 2022, ChristophHandel
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback