File tree 6 files changed +129
-172
lines changed
6 files changed +129
-172
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ on :
2
+ push :
3
+ branches :
4
+ - master
5
+ pull_request :
6
+
7
+ permissions :
8
+ contents : read
9
+ security-events : write # upload Sarif results
10
+
11
+ name : Build
12
+ jobs :
13
+ build-amd64 :
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - name : Checkout code
17
+ uses : actions/checkout@v4
18
+
19
+ - name : Set the TAG value
20
+ id : get-TAG
21
+ run : |
22
+ echo "$(make -s log | grep TAG)" >> "$GITHUB_ENV"
23
+ - name : Build container image
24
+ uses : docker/build-push-action@v5
25
+ with :
26
+ context : .
27
+ push : false
28
+ tags : rancher/hardened-crictl:${{ env.TAG }}-amd64
29
+ file : Dockerfile
30
+
31
+ - name : Run Trivy vulnerability scanner
32
+ uses : aquasecurity/trivy-action@0.18.0
33
+ with :
34
+ image-ref : rancher/hardened-crictl:${{ env.TAG }}-amd64
35
+ ignore-unfixed : true
36
+ vuln-type : ' os,library'
37
+ severity : ' CRITICAL,HIGH'
38
+ format : ' sarif'
39
+ output : ' trivy-results.sarif'
40
+ - name : Upload Trivy scan results to GitHub Security tab
41
+ uses : github/codeql-action/upload-sarif@v3
42
+ if : always()
43
+ with :
44
+ sarif_file : ' trivy-results.sarif'
45
+
46
+ build-arm64 :
47
+ runs-on : ubuntu-latest
48
+ steps :
49
+ - name : Check out code
50
+ uses : actions/checkout@v4
51
+
52
+ - name : Set up QEMU
53
+ uses : docker/setup-qemu-action@v3
54
+
55
+ - name : Set up Docker Buildx
56
+ uses : docker/setup-buildx-action@v3
57
+
58
+ - name : Set the TAG value
59
+ id : get-TAG
60
+ run : |
61
+ echo "$(make -s log | grep TAG)" >> "$GITHUB_ENV"
62
+ - name : Build container image
63
+ uses : docker/build-push-action@v5
64
+ with :
65
+ context : .
66
+ push : false
67
+ tags : rancher/hardened-crictl:${{ env.TAG }}-arm64
68
+ file : Dockerfile
69
+ outputs : type=docker
70
+ platforms : linux/arm64
Original file line number Diff line number Diff line change
1
+ on :
2
+ release :
3
+ types : [published]
4
+
5
+ permissions :
6
+ contents : read
7
+
8
+ jobs :
9
+ push-multiarch :
10
+ permissions :
11
+ contents : read
12
+ id-token : write
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+ - name : Check out code
16
+ uses : actions/checkout@v4
17
+
18
+ - name : Set up QEMU
19
+ uses : docker/setup-qemu-action@v3
20
+
21
+ - name : " Read secrets"
22
+ uses : rancher-eio/read-vault-secrets@main
23
+ with :
24
+ secrets : |
25
+ secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials username | DOCKER_USERNAME ;
26
+ secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials password | DOCKER_PASSWORD
27
+
28
+ - name : Set up Docker Buildx
29
+ uses : docker/setup-buildx-action@v3
30
+
31
+ - name : Login to Container Registry
32
+ uses : docker/login-action@v3
33
+ with :
34
+ username : ${{ env.DOCKER_USERNAME }}
35
+ password : ${{ env.DOCKER_PASSWORD }}
36
+
37
+ - name : Build container image
38
+ uses : docker/build-push-action@v5
39
+ with :
40
+ context : .
41
+ push : true
42
+ tags : rancher/hardened-crictl:${{ github.event.release.tag_name }}
43
+ file : Dockerfile
44
+ platforms : linux/amd64, linux/arm64
Original file line number Diff line number Diff line change 1
1
ARG BCI_IMAGE=registry.suse.com/bci/bci-base
2
- ARG GO_IMAGE=rancher/hardened-build-base:1 .20.4b11
2
+ ARG GO_IMAGE=rancher/hardened-build-base:v1 .20.4b11
3
3
FROM ${BCI_IMAGE} as bci
4
4
FROM ${GO_IMAGE} as builder
5
5
# setup required packages
Original file line number Diff line number Diff line change @@ -16,41 +16,40 @@ PKG ?= github.com/kubernetes-sigs/cri-tools
16
16
SRC ?= github.com/kubernetes-sigs/cri-tools
17
17
TAG ?= v1.26.1$(BUILD_META )
18
18
19
- ifneq ($(DRONE_TAG ) ,)
20
- TAG := $(DRONE_TAG)
21
- endif
22
-
23
19
ifeq (,$(filter % $(BUILD_META ) ,$(TAG ) ) )
24
- $(error TAG needs to end with build metadata: $(BUILD_META))
20
+ $(error TAG needs to end with build metadata : $(BUILD_META ) )
25
21
endif
26
22
27
23
GOLANG_VERSION := $(shell ./scripts/golang-version.sh $(TAG ) )
28
24
29
25
.PHONY : image-build
30
26
image-build :
31
- docker build \
27
+ docker buildx build \
28
+ --platform=$(ARCH ) \
32
29
--pull \
33
30
--build-arg PKG=$(PKG ) \
34
31
--build-arg SRC=$(SRC ) \
35
32
--build-arg TAG=$(TAG:$(BUILD_META ) = ) \
36
33
--build-arg ARCH=$(ARCH) \
37
- --build-arg GO_IMAGE=rancher/hardened-build-base :$(GOLANG_VERSION ) \
38
34
--tag $(ORG)/hardened-crictl:$(TAG) \
39
35
--tag $(ORG)/hardened-crictl:$(TAG)-$(ARCH) \
36
+ --load \
40
37
.
41
38
42
39
.PHONY : image-push
43
40
image-push :
44
41
docker push $(ORG ) /hardened-crictl:$(TAG ) -$(ARCH )
45
42
46
- .PHONY : image-manifest
47
- image-manifest :
48
- DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create --amend \
49
- $(ORG ) /hardened-crictl:$(TAG ) \
50
- $(ORG ) /hardened-crictl:$(TAG ) -$(ARCH )
51
- DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push \
52
- $(ORG ) /hardened-crictl:$(TAG )
53
-
54
43
.PHONY : image-scan
55
44
image-scan :
56
45
trivy --severity $(SEVERITIES ) --no-progress --ignore-unfixed $(ORG ) /hardened-crictl:$(TAG )
46
+
47
+ PHONY : log
48
+ log :
49
+ @echo " ARCH=$( ARCH) "
50
+ @echo " TAG=$( TAG) "
51
+ @echo " ORG=$( ORG) "
52
+ @echo " PKG=$( PKG) "
53
+ @echo " SRC=$( SRC) "
54
+ @echo " BUILD_META=$( BUILD_META) "
55
+ @echo " UNAME_M=$( UNAME_M) "
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments