File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ jobs:
129
129
run : |
130
130
tar -xz -f ${{steps.download.outputs.download-path}}/clair-${{ needs.config.outputs.version }}.tar.gz --strip-components=1
131
131
go build\
132
- -trimpath -ldflags="-s -w -X github.com/quay/clair/v4/cmd.Version=${{ needs.config.outputs.version }} "\
132
+ -trimpath -ldflags="-s -w"\
133
133
-o "clairctl-${{matrix.goos}}-${{matrix.goarch}}"\
134
134
./cmd/clairctl
135
135
- name : Upload
@@ -196,8 +196,6 @@ jobs:
196
196
- name : Build Container
197
197
uses : docker/build-push-action@v3
198
198
with :
199
- build-args : |
200
- CLAIR_VERSION=${{ needs.config.outputs.version }}
201
199
cache-from : type=gha
202
200
cache-to : type=gha,mode=max
203
201
context : ${{ runner.temp }}/build
Original file line number Diff line number Diff line change @@ -71,14 +71,16 @@ jobs:
71
71
registry : quay.io
72
72
username : ${{ secrets.QUAY_USER }}
73
73
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"'
74
77
- uses : docker/build-push-action@v3
75
78
with :
76
79
build-args : |
77
80
GO_VERSION=${{ env.GO_VERSION }}
78
- CLAIR_VERSION=${{ steps.mod.outputs.clair_version }}
79
81
cache-from : type=gha
80
82
cache-to : type=gha,mode=max
81
- context : .
83
+ context : clair.tar
82
84
platforms : linux/amd64,linux/arm64
83
85
push : ${{ steps.setup.outputs.push && steps.novelty.outputs.cache-hit != 'true' }}
84
86
tags : |
Original file line number Diff line number Diff line change @@ -16,10 +16,10 @@ ARG GO_VERSION=1.18
16
16
FROM quay.io/projectquay/golang:${GO_VERSION} AS build
17
17
WORKDIR /build/
18
18
ADD . /build/
19
- ARG CLAIR_VERSION=dev
19
+ ARG CLAIR_VERSION=""
20
20
RUN for cmd in clair clairctl; do\
21
21
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}") " \
23
23
./cmd/$cmd; done
24
24
25
25
FROM registry.access.redhat.com/ubi8/ubi-minimal AS init
Original file line number Diff line number Diff line change @@ -57,7 +57,11 @@ vendor/modules.txt: go.mod
57
57
58
58
.PHONY : container-build
59
59
container-build :
60
+ ifneq ($(file < .git/HEAD) ,)
61
+ $(docker) build "--build-arg=CLAIR_VERSION=$$(git describe --match 'v4.*')" -t clair-local:latest .
62
+ else
60
63
$(docker) build -t clair-local:latest .
64
+ endif
61
65
62
66
DOCS_DIR ?= ../clair-doc
63
67
.PHONY : docs-build
You can’t perform that action at this time.
0 commit comments