Skip to content

Commit e923360

Browse files
committed
cicd: omit Dockerfile build args
Signed-off-by: Hank Donnay <[email protected]>
1 parent 8b89980 commit e923360

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

.github/workflows/cut-release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
run: |
130130
tar -xz -f ${{steps.download.outputs.download-path}}/clair-${{ needs.config.outputs.version }}.tar.gz --strip-components=1
131131
go build\
132-
-trimpath -ldflags="-s -w -X github.com/quay/clair/v4/cmd.Version=${{ needs.config.outputs.version }}"\
132+
-trimpath -ldflags="-s -w"\
133133
-o "clairctl-${{matrix.goos}}-${{matrix.goarch}}"\
134134
./cmd/clairctl
135135
- name: Upload
@@ -196,8 +196,6 @@ jobs:
196196
- name: Build Container
197197
uses: docker/build-push-action@v3
198198
with:
199-
build-args: |
200-
CLAIR_VERSION=${{ needs.config.outputs.version }}
201199
cache-from: type=gha
202200
cache-to: type=gha,mode=max
203201
context: ${{ runner.temp }}/build

.github/workflows/nightly.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,16 @@ jobs:
7171
registry: quay.io
7272
username: ${{ secrets.QUAY_USER }}
7373
password: ${{ secrets.QUAY_TOKEN }}
74+
- name: Export
75+
# This exports the current state of the main branch, and appends our modified go module files.
76+
run: 'git archive -o clair.tar --add-file=go.mod --add-file=go.sum "main"'
7477
- uses: docker/build-push-action@v3
7578
with:
7679
build-args: |
7780
GO_VERSION=${{ env.GO_VERSION }}
78-
CLAIR_VERSION=${{ steps.mod.outputs.clair_version }}
7981
cache-from: type=gha
8082
cache-to: type=gha,mode=max
81-
context: .
83+
context: clair.tar
8284
platforms: linux/amd64,linux/arm64
8385
push: ${{ steps.setup.outputs.push && steps.novelty.outputs.cache-hit != 'true' }}
8486
tags: |

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ ARG GO_VERSION=1.18
1616
FROM quay.io/projectquay/golang:${GO_VERSION} AS build
1717
WORKDIR /build/
1818
ADD . /build/
19-
ARG CLAIR_VERSION=dev
19+
ARG CLAIR_VERSION=""
2020
RUN for cmd in clair clairctl; do\
2121
go build \
22-
-trimpath -ldflags="-s -w -X github.com/quay/clair/v4/cmd.Version=${CLAIR_VERSION}" \
22+
-trimpath -ldflags="-s -w$(test -n "$CLAIR_VERSION" && printf " -X 'github.com/quay/clair/v4/cmd.Version=%s (user)'" "${CLAIR_VERSION}")" \
2323
./cmd/$cmd; done
2424

2525
FROM registry.access.redhat.com/ubi8/ubi-minimal AS init

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ vendor/modules.txt: go.mod
5757

5858
.PHONY: container-build
5959
container-build:
60+
ifneq ($(file < .git/HEAD),)
61+
$(docker) build "--build-arg=CLAIR_VERSION=$$(git describe --match 'v4.*')" -t clair-local:latest .
62+
else
6063
$(docker) build -t clair-local:latest .
64+
endif
6165

6266
DOCS_DIR ?= ../clair-doc
6367
.PHONY: docs-build

0 commit comments

Comments
 (0)