From 62328e4208d69208a5a88229eb21445cd4964c46 Mon Sep 17 00:00:00 2001 From: Ben Rockwood Date: Fri, 6 Oct 2023 12:57:33 -0700 Subject: [PATCH] Tolerate v prefix Signed-off-by: Ben Rockwood --- .github/workflows/build_container.yml | 28 ++++++++++++++++----------- .github/workflows/edge.yml | 23 ++++++++++++++-------- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index e2af0b25..1c1ec736 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -22,10 +22,16 @@ jobs: uses: WyriHaximus/github-action-get-previous-tag@v1 - name: Parse semver string - id: semver + id: semver uses: booxmedialtd/ws-action-parse-semver@v1 with: input_string: ${{ steps.vars.outputs.tag }} + - name: Clean Version Tag + id: version + run: | + VERSION=$(echo "${{ steps.vars.outputs.tag }}" | sed -e 's/^v//'') + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -41,20 +47,20 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Build and push root images uses: docker/build-push-action@v5 with: context: . platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 push: true - build-args: VERSION=${{ steps.vars.outputs.tag }} + build-args: VERSION=${{ steps.version.outputs.version }} target: root tags: | - mondoolabs/mondoo:${{ steps.vars.outputs.tag }} + mondoolabs/mondoo:${{ steps.version.outputs.version }} mondoolabs/mondoo:${{ steps.semver.outputs.major }} mondoolabs/mondoo:latest - mondoo/client:${{ steps.vars.outputs.tag }} + mondoo/client:${{ steps.version.outputs.version }} mondoo/client:${{ steps.semver.outputs.major }} mondoo/client:latest @@ -64,10 +70,10 @@ jobs: context: . platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 push: true - build-args: VERSION=${{ steps.vars.outputs.tag }} + build-args: VERSION=${{ steps.version.outputs.version }} target: rootless tags: | - mondoo/client:${{ steps.vars.outputs.tag }}-rootless + mondoo/client:${{ steps.version.outputs.version }}-rootless mondoo/client:${{ steps.semver.outputs.major }}-rootless mondoo/client:latest-rootless @@ -78,10 +84,10 @@ jobs: file: Dockerfile-ubi platforms: linux/amd64,linux/arm64 push: true - build-args: VERSION=${{ steps.vars.outputs.tag }} + build-args: VERSION=${{ steps.version.outputs.version }} target: root tags: | - mondoo/client:${{ steps.vars.outputs.tag }}-ubi + mondoo/client:${{ steps.version.outputs.version }}-ubi mondoo/client:${{ steps.semver.outputs.major }}-ubi mondoo/client:latest-ubi @@ -92,10 +98,10 @@ jobs: file: Dockerfile-ubi platforms: linux/amd64,linux/arm64 push: true - build-args: VERSION=${{ steps.vars.outputs.tag }} + build-args: VERSION=${{ steps.version.outputs.version }} target: rootless tags: | - mondoo/client:${{ steps.vars.outputs.tag }}-ubi-rootless + mondoo/client:${{ steps.version.outputs.version }}-ubi-rootless mondoo/client:${{ steps.semver.outputs.major }}-ubi-rootless mondoo/client:latest-ubi-rootless diff --git a/.github/workflows/edge.yml b/.github/workflows/edge.yml index c57fea82..303400a1 100644 --- a/.github/workflows/edge.yml +++ b/.github/workflows/edge.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: version: - description: 'Mondoo client version' + description: 'Mondoo client version' required: true jobs: @@ -13,6 +13,13 @@ jobs: timeout-minutes: 10 name: Build Docker steps: + - name: Clean Version + id: version + run: | + VERSON=${{ steps.version.outputs.version | replace('v', '') }} + echo "VERSION=${VERSION}" >> $GITHUB_ENV + echo "version=${VERSION}" >> $GITHUB_OUTPUT + - name: Clone repository uses: actions/checkout@v4 with: @@ -32,7 +39,7 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Build and push root images (alpine) uses: docker/build-push-action@v5 with: @@ -40,11 +47,11 @@ jobs: platforms: linux/386,linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 push: true build-args: | - BASEURL=https://releases.mondoo.com/edge/mondoo/${{ github.event.inputs.version }} - VERSION=${{ github.event.inputs.version }} + BASEURL=https://releases.mondoo.com/edge/mondoo/${{ steps.version.outputs.version }} + VERSION=${{ steps.version.outputs.version }} target: root tags: | - mondoo/client:edge-${{ github.event.inputs.version }} + mondoo/client:edge-${{ steps.version.outputs.version }} mondoo/client:edge-latest - name: Build and push rootless images (alpine) @@ -54,9 +61,9 @@ jobs: platforms: linux/386,linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 push: true build-args: | - BASEURL=https://releases.mondoo.com/edge/mondoo/${{ github.event.inputs.version }} - VERSION=${{ github.event.inputs.version }} + BASEURL=https://releases.mondoo.com/edge/mondoo/${{ steps.version.outputs.version }} + VERSION=${{ steps.version.outputs.version }} target: rootless tags: | - mondoo/client:edge-${{ github.event.inputs.version }}-rootless + mondoo/client:edge-${{ steps.version.outputs.version }}-rootless mondoo/client:edge-latest-rootless