From d3437aaeb339acda9d25208e479f24c76c3eb6b7 Mon Sep 17 00:00:00 2001 From: George Matthews Date: Wed, 22 Apr 2026 14:31:47 +0100 Subject: [PATCH] Set tag for ipmi exporter image Set a version tag for ipmi exporter as any untagged images are cleared by garbage collection --- .github/workflows/build_images.yaml | 34 +++++++++++++++++++++-------- exporters/ipmi_exporter/Dockerfile | 2 ++ exporters/ipmi_exporter/version.txt | 1 + 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 exporters/ipmi_exporter/version.txt diff --git a/.github/workflows/build_images.yaml b/.github/workflows/build_images.yaml index 4f3039e..66cdd40 100644 --- a/.github/workflows/build_images.yaml +++ b/.github/workflows/build_images.yaml @@ -12,10 +12,12 @@ on: - "exporters/**" - ".github/workflows/codeql.yaml" - ".github/workflows/build_images.yaml" - schedule: [{ cron: "14 14 * * TUE" }] # Every Tuesday at 14:14 + schedule: [ { cron: "14 14 * * TUE" } ] # Every Tuesday at 14:14 jobs: setup: - if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association) + if: github.event_name != 'pull_request' || + !contains('OWNER,MEMBER,COLLABORATOR', + github.event.pull_request.author_association) runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd @@ -80,18 +82,32 @@ jobs: cache-to: type=gha,mode=max push: true context: "{{defaultContext}}:${{ matrix.image }}" - tags: "harbor.stfc.ac.uk/stfc-cloud-staging/${{ matrix.image }}:${{ needs.setup.outputs.sha }}" + tags: "harbor.stfc.ac.uk/stfc-cloud-staging/${{ matrix.image }}:${{ + needs.setup.outputs.sha }}" + - name: Inform of tagged name + if: ${{ github.ref != 'refs/heads/master' }} + run: echo "::notice title=published::harbor.stfc.ac.uk/stfc-cloud-staging/${{ + matrix.image }}:${{ needs.setup.outputs.sha }}" + - name: Get release tag for later + id: release_tag + run: echo "version=$(cat ${{ matrix.image }}/version.txt)" >> $GITHUB_OUTPUT + - name: Check if release file has updated + uses: dorny/paths-filter@9d7afb8d214ad99e78fbd4247752c4caed2b6e4c + id: release_updated + with: + filters: | + version: + - '${{ matrix.image }}/version.txt' - name: Build & push to prod if: ${{ github.ref == 'refs/heads/master' }} uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 with: push: true context: "{{defaultContext}}:${{ matrix.image }}" - tags: "harbor.stfc.ac.uk/stfc-cloud/${{ matrix.image }}:latest" - - name: Inform of tagged name - if: ${{ github.ref != 'refs/heads/master' }} - run: echo "::notice title=published::harbor.stfc.ac.uk/stfc-cloud-staging/${{ matrix.image }}:${{ needs.setup.outputs.sha }}" - finished: # convenient single job name to apply branch protection to + tags: "harbor.stfc.ac.uk/stfc-cloud/${{ matrix.image }}:v${{ + steps.release_tag.outputs.version }}" + finished: + # convenient single job name to apply branch protection to needs: build runs-on: ubuntu-latest - steps: [{ run: true }] + steps: [ { run: true } ] diff --git a/exporters/ipmi_exporter/Dockerfile b/exporters/ipmi_exporter/Dockerfile index d53d9dd..c759cfc 100644 --- a/exporters/ipmi_exporter/Dockerfile +++ b/exporters/ipmi_exporter/Dockerfile @@ -2,6 +2,8 @@ FROM golang:1.25-alpine AS build-stage WORKDIR / ENV GOBIN=/ + +# ipmi exporter version also goes in version.txt RUN go install github.com/prometheus-community/ipmi_exporter@v1.10.1 FROM alpine:latest AS build-release-stage diff --git a/exporters/ipmi_exporter/version.txt b/exporters/ipmi_exporter/version.txt new file mode 100644 index 0000000..e33692a --- /dev/null +++ b/exporters/ipmi_exporter/version.txt @@ -0,0 +1 @@ +1.10.1 \ No newline at end of file