Skip to content

puppetlabs/pdk-docker

Repository files navigation

Puppet Development Kit (PDK) Docker Images

Code Owners ci

This repository provides official docker images for the Puppet Development Kit (PDK).

Images are published to Docker Hub at https://hub.docker.com/r/puppet/pdk.

The following image tags are available from Docker Hub:

  • latest: Meta-tag which will always point to the latest stable PDK release
  • nightly: Meta-tag which will always point to the latest PDK release which may be a pre-release build

Additionally there are version-specific tags for every PDK release that makes it on to http://nightlies.puppet.com/, for example 1.12.0.0 (stable release), 1.13.0.0.pre.2.g9c61983 (nightly pre-release).

To learn more about the PDK, visit https://puppet.com/docs/pdk/latest/pdk.html and https://github.com/puppetlabs/pdk.

How images are built

The PDK docker images are currently based on a fairly minimal Ubuntu 18.04 image. From there, a PDK .deb package is installed. Since there is a lag time between when changes are merged to the puppetlabs/pdk or puppetlabs/pdk-vanagon Github repositories and when a .deb package with the changes is actually available, we can't trigger Docker Hub builds immediately on commit/tag to either of those repositories.

Instead, we have configured a periodic Jenkins job (internal only right now, sorry) which runs the update-pdk-release-file.rb script in this repo and then checks to see if that resulted in any changes to the pdk-release.env file. This file contains environment variables which indicate what the most recent PDK release package available on the Puppet nightlies server is. pdk-release.env is then used by the Dockerfile (via install-pdk-release.sh) to build an image containing the specified release package.

If changes to pdk-release.env are detected by the Jenkins job, a new commit is made to the main branch of this repo. (If the release is identified as a final release, the stable branch is rebased on main to pick up this change as well.) Lastly a new tag is made with the version number of the new release and then Jenkins pushes all commits and tags back to this repo.

Finally, Docker Hub is configured to watch the this repo and build/tag new images automatically based on the branch or tag that received new commits.

In summary:

sequenceDiagram
box Grey On Jenkins
participant J as pdk-docker-promote<br/>jenkins job
participant p as pdk-docker<br/>(local workspace)
end
participant g as pdk-docker<br/>(github.com)
participant d as Docker Hub
participant ecr as Elastic Container Registry<br/>(AWS)  
J ->>+ p: clone pdk-docker
p ->>+ p: update-pdk-release-file.rb
p ->>+ p: Has pdk-release.env changed?
note right of p: "i.e., is there a new<br/>version of pdk?"
alt no
else yes
    p ->> g: commit update to main
    g ->> g: Trigger the "image-push"<br/>github action
    g ->> d: push to registry
    g ->> ecr: push to registry
end
p ->> J: finish
Loading

How to use the Image

Download a release from Docker Hub as detailed above. e.g.

docker pull puppet/pdk:latest

Run it

docker run -v /path/to/module:/workspace puppet/pdk <pdk command>

Run it with persistent pdk cache

docker run -v /path/to/module:/workspace -v /path/to/cache:/cache puppet/pdk <pdk command>