diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index 37102bf..47b563e 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -2,8 +2,6 @@ name: Build and publish a 🛢️ container on: push: - paths-ignore: - - '.github/**' branches: - 'main' tags: @@ -11,28 +9,38 @@ on: workflow_dispatch: jobs: + setup-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Source checkout + uses: actions/checkout@v4 + + - id: set-matrix + run: echo "matrix=$(jq -c . build_versions.json)" >> $GITHUB_OUTPUT + build-and-push-container: runs-on: ubuntu-latest permissions: contents: read packages: write + needs: setup-matrix + strategy: + matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} steps: - - name: Build Puppet 7 container - uses: voxpupuli/gha-build-and-publish-a-container@v2 - with: - registry_password: ${{ secrets.GITHUB_TOKEN }} - build_args: 'PUPPET_VERSION=7' - if: ${{ startsWith(github.ref_name, 'v7') }} - - - name: Build Puppet 8 container - uses: voxpupuli/gha-build-and-publish-a-container@v2 - with: - registry_password: ${{ secrets.GITHUB_TOKEN }} - build_args: 'PUPPET_VERSION=8' - if: ${{ startsWith(github.ref_name, 'v8') }} - - - name: Build development tag + - name: Build Puppet Development Container ${{ matrix.puppet_release }} uses: voxpupuli/gha-build-and-publish-a-container@v2 with: registry_password: ${{ secrets.GITHUB_TOKEN }} - if: ${{ startsWith(github.ref_name, 'main') }} + build_args: | + PUPPET_RELEASE=${{ matrix.puppet_release }} + PUPPET_VERSION=${{ matrix.puppet_version }} + TERRAFORM_VERSION=${{ matrix.terraform_version }} + PDK_VERSION=${{ matrix.pdk_version }} + BOLT_VERSION=${{ matrix.bolt_version }} + PUPPETDB_TERMINI_VERSION=${{ matrix.puppetdb_termini_version }} + tags: | + ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ matrix.puppet_release }} + ghcr.io/${{ github.repository }}:latest-${{ matrix.puppet_release }} + ghcr.io/${{ github.repository }}:latest diff --git a/Dockerfile b/Dockerfile index c998b7c..097d48e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM ubuntu:22.04 +ARG UBUNTU_CODENAME=jammy + +FROM ubuntu:${UBUNTU_CODENAME} LABEL org.label-schema.maintainer="betadots GmbH " \ org.label-schema.vendor="betadots" \ @@ -10,11 +12,30 @@ LABEL org.label-schema.maintainer="betadots GmbH " \ org.label-schema.dockerfile="/Dockerfile" ARG TARGETARCH + +# needs to be set again, otherwise it is not available in the next stage +ARG UBUNTU_CODENAME + +ARG PUPPET_RELEASE +ENV PUPPET_RELEASE=${PUPPET_RELEASE:-7} + ARG PUPPET_VERSION -ENV PUPPET_VERSION=${PUPPET_VERSION:-7} +ENV PUPPET_VERSION=${PUPPET_VERSION:-7.27.0} + +ARG TERRAFORM_VERSION +ENV TERRAFORM_VERSION=${TERRAFORM_VERSION:-1.6.2} + +ARG PDK_VERSION +ENV PDK_VERSION=${PDK_VERSION:-3.0.0.0} + +ARG BOLT_VERSION +ENV BOLT_VERSION=${BOLT_VERSION:-3.27.4} + +ARG PUPPETDB_TERMINI_VERSION +ENV PUPPETDB_TERMINI_VERSION=${PUPPETDB_TERMINI_VERSION:-7.15.0} ENV DEBIAN_FRONTEND=noninteractive -ENV PUPPET_DEB=puppet${PUPPET_VERSION}-release-jammy.deb +ENV PUPPET_DEB=puppet${PUPPET_RELEASE}-release-${UBUNTU_CODENAME}.deb ADD https://apt.puppet.com/${PUPPET_DEB} /${PUPPET_DEB} @@ -37,11 +58,11 @@ RUN apt update && apt install -y --no-install-recommends \ make \ openssh-client \ openssl \ - pdk \ + pdk=${PDK_VERSION}-1${UBUNTU_CODENAME} \ pkg-config\ - puppet-agent \ - puppet-bolt \ - puppetdb-termini \ + puppet-agent=${PUPPET_VERSION}-1${UBUNTU_CODENAME} \ + puppet-bolt=${BOLT_VERSION}-1${UBUNTU_CODENAME} \ + puppetdb-termini=${PUPPETDB_TERMINI_VERSION}-1${UBUNTU_CODENAME} \ python3-yaml \ unzip \ wget \ @@ -54,12 +75,12 @@ RUN apt update && apt install -y --no-install-recommends \ && locale-gen en_US.UTF-8 # && /opt/puppetlabs/puppet/bin/bundle install -ADD https://releases.hashicorp.com/terraform/1.6.2/terraform_1.6.2_linux_${TARGETARCH}.zip /terraform_1.6.2_linux_${TARGETARCH}.zip +ADD https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${TARGETARCH}.zip /terraform_${TERRAFORM_VERSION}_linux_${TARGETARCH}.zip RUN \ - unzip terraform_1.6.2_linux_${TARGETARCH}.zip && \ + unzip terraform_${TERRAFORM_VERSION}_linux_${TARGETARCH}.zip && \ mv terraform /usr/local/bin/terraform && \ chmod +x /usr/local/bin/terraform && \ - rm terraform_1.6.2_linux_${TARGETARCH}.zip && \ + rm terraform_${TERRAFORM_VERSION}_linux_${TARGETARCH}.zip && \ terraform --version ENV BOLT_DISABLE_ANALYTICS=true diff --git a/Gemfile b/Gemfile index dd9e08c..ca9917b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,10 @@ source 'https://rubygems.org' gem 'hiera-eyaml', '~> 3.3' +gem 'onceover', '~> 3.20' gem 'onceover-codequality', '~> 0.10' gem 'onceover-lookup', '~> 0.1', '>= 0.1.1' gem 'onceover-octocatalog-diff', '~> 0.1', '>= 0.1.8' -gem 'onceover', '~> 3.20' gem 'r10k', '~> 4.0' gem 'ra10ke', '~> 3.0' gem 'voxpupuli-acceptance', '~> 3.0' diff --git a/README.md b/README.md index a1d3f73..2e75c1a 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,3 @@ # Puppet Development Container -includes: - -- bolt 3.27.2 -- Puppet 7.26.0 -- catalog_diff -- PDK 3.0.0 -- Puppetdb-termini 7.14.0 -- yamllint -- terraform 1.6.2 +included fixed software see: [build_versions.json](build_versions.json) diff --git a/build_versions.json b/build_versions.json new file mode 100644 index 0000000..74c624e --- /dev/null +++ b/build_versions.json @@ -0,0 +1,20 @@ +{ + "include": [ + { + "puppet_release": 7, + "puppet_version": "7.27.0", + "puppetdb_termini_version": "7.15.0", + "terraform_version": "1.6.2", + "pdk_version": "3.0.0.0", + "bolt_version": "3.27.4" + }, + { + "puppet_release": 8, + "puppet_version": "8.3.1", + "puppetdb_termini_version": "8.2.0", + "terraform_version": "1.6.2", + "pdk_version": "3.0.0.0", + "bolt_version": "3.27.4" + } + ] +}