Skip to content

Commit

Permalink
cicd: omit Dockerfile build args
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Dec 7, 2022
1 parent 8b89980 commit e923360
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/cut-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
run: |
tar -xz -f ${{steps.download.outputs.download-path}}/clair-${{ needs.config.outputs.version }}.tar.gz --strip-components=1
go build\
-trimpath -ldflags="-s -w -X github.com/quay/clair/v4/cmd.Version=${{ needs.config.outputs.version }}"\
-trimpath -ldflags="-s -w"\
-o "clairctl-${{matrix.goos}}-${{matrix.goarch}}"\
./cmd/clairctl
- name: Upload
Expand Down Expand Up @@ -196,8 +196,6 @@ jobs:
- name: Build Container
uses: docker/build-push-action@v3
with:
build-args: |
CLAIR_VERSION=${{ needs.config.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: ${{ runner.temp }}/build
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,16 @@ jobs:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Export
# This exports the current state of the main branch, and appends our modified go module files.
run: 'git archive -o clair.tar --add-file=go.mod --add-file=go.sum "main"'
- uses: docker/build-push-action@v3
with:
build-args: |
GO_VERSION=${{ env.GO_VERSION }}
CLAIR_VERSION=${{ steps.mod.outputs.clair_version }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
context: clair.tar
platforms: linux/amd64,linux/arm64
push: ${{ steps.setup.outputs.push && steps.novelty.outputs.cache-hit != 'true' }}
tags: |
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ ARG GO_VERSION=1.18
FROM quay.io/projectquay/golang:${GO_VERSION} AS build
WORKDIR /build/
ADD . /build/
ARG CLAIR_VERSION=dev
ARG CLAIR_VERSION=""
RUN for cmd in clair clairctl; do\
go build \
-trimpath -ldflags="-s -w -X github.com/quay/clair/v4/cmd.Version=${CLAIR_VERSION}" \
-trimpath -ldflags="-s -w$(test -n "$CLAIR_VERSION" && printf " -X 'github.com/quay/clair/v4/cmd.Version=%s (user)'" "${CLAIR_VERSION}")" \
./cmd/$cmd; done

FROM registry.access.redhat.com/ubi8/ubi-minimal AS init
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ vendor/modules.txt: go.mod

.PHONY: container-build
container-build:
ifneq ($(file < .git/HEAD),)
$(docker) build "--build-arg=CLAIR_VERSION=$$(git describe --match 'v4.*')" -t clair-local:latest .
else
$(docker) build -t clair-local:latest .
endif

DOCS_DIR ?= ../clair-doc
.PHONY: docs-build
Expand Down

0 comments on commit e923360

Please sign in to comment.