From 5126cfda98a7f06eac2d86054571221512df1de8 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 28 Nov 2023 15:15:33 +0100 Subject: [PATCH 1/9] Update build_container.yml and Dockerfile Add build_versions.json Update Gemfile --- .github/workflows/build_container.yml | 43 ++++++++++++++++----------- Dockerfile | 37 +++++++++++++++++------ Gemfile | 2 +- build_versions.json | 20 +++++++++++++ 4 files changed, 74 insertions(+), 28 deletions(-) create mode 100644 build_versions.json diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index 37102bf..1202c2c 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,37 @@ 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=$(cat build_versions.json | jq -c)" >> $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_VERSION=${{ matrix.puppetdb_version }} + tags: | + ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ matrix.puppet_release }} + ghcr.io/${{ github.repository }}:latest-${{ matrix.puppet_release }} diff --git a/Dockerfile b/Dockerfile index c998b7c..7268e70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +ARG UBUNTU_CODENAME=jammy + FROM ubuntu:22.04 LABEL org.label-schema.maintainer="betadots GmbH " \ @@ -10,11 +12,28 @@ LABEL org.label-schema.maintainer="betadots GmbH " \ org.label-schema.dockerfile="/Dockerfile" ARG TARGETARCH +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} + +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 +56,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 +73,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/build_versions.json b/build_versions.json new file mode 100644 index 0000000..05c2817 --- /dev/null +++ b/build_versions.json @@ -0,0 +1,20 @@ +{ + "include": [ + { + "puppet_release": 7, + "puppet_version": "7.27.0", + "terraform_version": "1.6.2", + "pdk_version": "3.0.0", + "bolt_version": "3.27.4", + "puppetdb_termini_version": "7.15.0" + }, + { + "puppet_release": 8, + "puppet_version": "8.3.1", + "terraform_version": "1.6.2", + "pdk_version": "3.0.0", + "bolt_version": "3.27.4", + "puppetdb_termini_version": "7.15.0" + } + ] +} From d43c344567953322748854dd913c102796389dc2 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 28 Nov 2023 15:17:16 +0100 Subject: [PATCH 2/9] Update PUPPETDB_VERSION to PUPPETDB_TERMINI_VERSION --- .github/workflows/build_container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index 1202c2c..81b39fb 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -39,7 +39,7 @@ jobs: TERRAFORM_VERSION=${{ matrix.terraform_version }} PDK_VERSION=${{ matrix.pdk_version }} BOLT_VERSION=${{ matrix.bolt_version }} - PUPPETDB_VERSION=${{ matrix.puppetdb_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 }} From fa9353e6980092a032665e9549901f9ab09d8962 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 28 Nov 2023 15:17:53 +0100 Subject: [PATCH 3/9] Add latest tag to container image --- .github/workflows/build_container.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index 81b39fb..624a183 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -43,3 +43,4 @@ jobs: tags: | ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ matrix.puppet_release }} ghcr.io/${{ github.repository }}:latest-${{ matrix.puppet_release }} + ghcr.io/${{ github.repository }}:latest From e167c37f5a2222bcdabbef2db89ebb6417e4dcf9 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 28 Nov 2023 15:24:13 +0100 Subject: [PATCH 4/9] Update .github/workflows/build_container.yml Co-authored-by: Tim Meusel --- .github/workflows/build_container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index 624a183..47b563e 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -18,7 +18,7 @@ jobs: uses: actions/checkout@v4 - id: set-matrix - run: echo "matrix=$(cat build_versions.json | jq -c)" >> $GITHUB_OUTPUT + run: echo "matrix=$(jq -c . build_versions.json)" >> $GITHUB_OUTPUT build-and-push-container: runs-on: ubuntu-latest From 381ac619d0f8293a041258cd947a9a4548b95fd3 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 28 Nov 2023 15:26:17 +0100 Subject: [PATCH 5/9] Update PDK version to 3.0.0.0 --- Dockerfile | 2 +- build_versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7268e70..b5f516d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ ARG TERRAFORM_VERSION ENV TERRAFORM_VERSION=${TERRAFORM_VERSION:-1.6.2} ARG PDK_VERSION -ENV PDK_VERSION=${PDK_VERSION:-3.0.0} +ENV PDK_VERSION=${PDK_VERSION:-3.0.0.0} ARG BOLT_VERSION ENV BOLT_VERSION=${BOLT_VERSION:-3.27.4} diff --git a/build_versions.json b/build_versions.json index 05c2817..84bcf94 100644 --- a/build_versions.json +++ b/build_versions.json @@ -4,7 +4,7 @@ "puppet_release": 7, "puppet_version": "7.27.0", "terraform_version": "1.6.2", - "pdk_version": "3.0.0", + "pdk_version": "3.0.0.0", "bolt_version": "3.27.4", "puppetdb_termini_version": "7.15.0" }, @@ -12,7 +12,7 @@ "puppet_release": 8, "puppet_version": "8.3.1", "terraform_version": "1.6.2", - "pdk_version": "3.0.0", + "pdk_version": "3.0.0.0", "bolt_version": "3.27.4", "puppetdb_termini_version": "7.15.0" } From e20dc653653259cde3cd28d617f77e8876839c79 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 28 Nov 2023 15:30:11 +0100 Subject: [PATCH 6/9] Update README.md with fixed software versions --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) 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) From d497385c33ceb92d3c85c487044a5dd5cc61b794 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 28 Nov 2023 15:32:23 +0100 Subject: [PATCH 7/9] Update puppetdb_termini_version in build_versions.json --- build_versions.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build_versions.json b/build_versions.json index 84bcf94..74c624e 100644 --- a/build_versions.json +++ b/build_versions.json @@ -3,18 +3,18 @@ { "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", - "puppetdb_termini_version": "7.15.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", - "puppetdb_termini_version": "7.15.0" + "bolt_version": "3.27.4" } ] } From 75c463ba27c8a136ec70ec2f8a548e8b584930c2 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 28 Nov 2023 15:39:55 +0100 Subject: [PATCH 8/9] Update Dockerfile to use dynamic Ubuntu version --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b5f516d..1806202 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG UBUNTU_CODENAME=jammy -FROM ubuntu:22.04 +FROM ubuntu:${UBUNTU_CODENAME} LABEL org.label-schema.maintainer="betadots GmbH " \ org.label-schema.vendor="betadots" \ @@ -12,7 +12,6 @@ LABEL org.label-schema.maintainer="betadots GmbH " \ org.label-schema.dockerfile="/Dockerfile" ARG TARGETARCH -ARG UBUNTU_CODENAME ARG PUPPET_RELEASE ENV PUPPET_RELEASE=${PUPPET_RELEASE:-7} From f12965c27a87b08202c49ca9d7c743cb93427e1f Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 28 Nov 2023 15:41:28 +0100 Subject: [PATCH 9/9] Set UBUNTU_CODENAME in Dockerfile --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 1806202..097d48e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,9 @@ LABEL org.label-schema.maintainer="betadots GmbH " \ 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}