Skip to content

Commit 1947496

Browse files
feat(testing): add arm64 testing infra (#7998)
* add arm64 testing infra * add arm64 testing infra * bump images * ci * update e2e infra * update e2e infra * improve docker ubi 8 to support arm * improve docker ubi 8 to support arm * improve docker ubi 8 to support arm * improve docker ubi 8 to support arm * fix vulnerabilities * fix vulnerabilities * fix vulnerabilities * fix vulnerabilities * fix vulnerabilities --------- Co-authored-by: cx-miguel-silva <100352574+cx-miguel-silva@users.noreply.github.com> Co-authored-by: Artur Ribeiro <153724638+cx-artur-ribeiro@users.noreply.github.com>
1 parent 87a909a commit 1947496

8 files changed

Lines changed: 163 additions & 133 deletions

File tree

.github/workflows/go-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
strategy:
4141
matrix:
4242
go-version: [1.25.x]
43-
os: [ubuntu-latest, windows-2022, macos-latest]
43+
os: [ubuntu-latest, ubuntu-24.04-arm, windows-2022, macos-latest]
4444
runs-on: ${{ matrix.os }}
4545
steps:
4646
- name: Set up Go
@@ -88,7 +88,7 @@ jobs:
8888
if: always()
8989
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
9090
with:
91-
name: unit-test-${{ runner.os }}-${{ github.event.pull_request.head.sha }}.log
91+
name: unit-test-${{ matrix.os }}-${{ github.event.pull_request.head.sha }}.log
9292
path: unit-test.log
9393
security-scan:
9494
name: security-scan

.github/workflows/go-e2e-debian.yaml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@ on:
55
branches: [master]
66

77
jobs:
8-
e2e-debian-tests:
9-
name: e2e-debian-tests
8+
e2e-tests:
9+
name: e2e-tests-${{ matrix.config.tag_suffix }}
1010
strategy:
1111
fail-fast: false
1212
matrix:
1313
go-version: [1.25.x]
14-
os: [ubuntu-latest]
15-
runs-on: ${{ matrix.os }}
14+
config:
15+
- os: ubuntu-latest
16+
platform: linux/amd64
17+
dockerfile: docker/Dockerfile.debian
18+
tag_suffix: debian-amd64
19+
- os: ubuntu-24.04-arm
20+
platform: linux/arm64
21+
dockerfile: docker/Dockerfile.debian
22+
tag_suffix: debian-arm64
23+
runs-on: ${{ matrix.config.os }}
1624
steps:
1725
- name: Cancel Previous Runs
1826
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
@@ -47,10 +55,11 @@ jobs:
4755
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4856
with:
4957
path: /tmp/.buildx-cache
50-
key: ${{ runner.os }}-buildx-${{ github.ref }}
58+
key: ${{ runner.os }}-buildx-${{ matrix.config.tag_suffix }}-${{ github.ref }}
5159
restore-keys: |
52-
${{ runner.os }}-buildx-${{ github.ref }}
60+
${{ runner.os }}-buildx-${{ matrix.config.tag_suffix }}-${{ github.ref }}
5361
- name: Append Entrypoint in dockerfile
62+
if: matrix.config.dockerfile == 'docker/Dockerfile.debian'
5463
run: |
5564
echo "ENTRYPOINT [\"/app/bin/kics\"]" >> docker/Dockerfile.debian
5665
- name: Get short SHA
@@ -61,13 +70,15 @@ jobs:
6170
with:
6271
load: true
6372
context: ./
64-
file: ./docker/Dockerfile.debian
73+
file: ./${{ matrix.config.dockerfile }}
6574
builder: ${{ steps.buildx.outputs.name }}
6675
push: false
67-
tags: kics:e2e-debian-tests-${{ github.sha }}
76+
tags: kics:e2e-${{ matrix.config.tag_suffix }}-${{ github.sha }}
77+
platforms: ${{ matrix.config.platform }}
6878
build-args: |
6979
VERSION=development
7080
COMMIT=${{ github.sha }}
81+
BUILDPLATFORM=${{ matrix.config.platform }}
7182
cache-from: type=local,src=/tmp/.buildx-cache
7283
cache-to: type=local,dest=/tmp/.buildx-cache
7384
- name: Image digest
@@ -81,27 +92,23 @@ jobs:
8192
sudo chmod -R 777 ./e2e
8293
- name: Run E2E Tests
8394
env:
84-
E2E_KICS_DOCKER: kics:e2e-debian-tests-${{ github.sha }}
95+
E2E_KICS_DOCKER: kics:e2e-${{ matrix.config.tag_suffix }}-${{ github.sha }}
8596
E2E_KICS_QUERIES_PATH: ${{ steps.getbin.outputs.queries }}
8697
run: |
8798
go test -tags dev "github.com/Checkmarx/kics/v2/e2e" -timeout 1500s -json > results.json
8899
- name: Generate E2E Report
89100
if: always()
90101
env:
91-
E2E_KICS_DOCKERFILE: docker/Dockerfile.debian
102+
E2E_KICS_DOCKERFILE: ${{ matrix.config.dockerfile }}
92103
run: |
93104
CWD=$(pwd)
94105
cd .github/scripts/report
95106
go mod tidy
96107
go build
97108
./e2e-report -test-path ${CWD} -test-name results.json -report-path ${CWD} -report-name e2e-report.html
98-
- name: Get docker name
99-
run: |
100-
DOCKER_NAME=$(echo docker/Dockerfile.debian | sed 's/\//-/')
101109
- name: Archive test report
102110
if: always()
103111
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
104112
with:
105-
name: e2e-tests-report-dockerfile-$DOCKER_NAME
113+
name: e2e-tests-report-${{ matrix.config.tag_suffix }}
106114
path: e2e-report.html
107-
# dummy

.github/workflows/go-e2e.yaml

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,37 @@ on:
66

77
jobs:
88
e2e-tests:
9-
name: e2e-tests
9+
name: e2e-tests-${{ matrix.config.tag_suffix }}
1010
strategy:
1111
fail-fast: false
1212
matrix:
1313
go-version: [1.25.x]
14-
os: [ubuntu-latest]
15-
kics-docker: ["Dockerfile", "docker/Dockerfile.ubi8", "docker/Dockerfile.alpine"]
16-
runs-on: ${{ matrix.os }}
14+
config:
15+
- os: ubuntu-latest
16+
platform: linux/amd64
17+
dockerfile: Dockerfile
18+
tag_suffix: default-amd64
19+
- os: ubuntu-latest
20+
platform: linux/amd64
21+
dockerfile: docker/Dockerfile.ubi8
22+
tag_suffix: ubi8-amd64
23+
- os: ubuntu-latest
24+
platform: linux/amd64
25+
dockerfile: docker/Dockerfile.alpine
26+
tag_suffix: alpine-amd64
27+
- os: ubuntu-24.04-arm
28+
platform: linux/arm64
29+
dockerfile: Dockerfile
30+
tag_suffix: default-arm64
31+
- os: ubuntu-24.04-arm
32+
platform: linux/arm64
33+
dockerfile: docker/Dockerfile.ubi8
34+
tag_suffix: ubi8-arm64
35+
- os: ubuntu-24.04-arm
36+
platform: linux/arm64
37+
dockerfile: docker/Dockerfile.alpine
38+
tag_suffix: alpine-arm64
39+
runs-on: ${{ matrix.config.os }}
1740
steps:
1841
- name: Cancel Previous Runs
1942
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
@@ -48,9 +71,9 @@ jobs:
4871
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4972
with:
5073
path: /tmp/.buildx-cache
51-
key: ${{ runner.os }}-buildx-${{ github.ref }}
74+
key: ${{ runner.os }}-buildx-${{ matrix.config.tag_suffix }}-${{ github.ref }}
5275
restore-keys: |
53-
${{ runner.os }}-buildx-${{ github.ref }}
76+
${{ runner.os }}-buildx-${{ matrix.config.tag_suffix }}-${{ github.ref }}
5477
- name: Get short SHA
5578
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-8)" >> $GITHUB_ENV
5679
- name: Build
@@ -59,10 +82,11 @@ jobs:
5982
with:
6083
load: true
6184
context: ./
62-
file: ./${{ matrix.kics-docker }}
85+
file: ./${{ matrix.config.dockerfile }}
6386
builder: ${{ steps.buildx.outputs.name }}
6487
push: false
65-
tags: kics:e2e-tests-${{ github.sha }}
88+
tags: kics:e2e-${{ matrix.config.tag_suffix }}-${{ github.sha }}
89+
platforms: ${{ matrix.config.platform }}
6690
build-args: |
6791
VERSION=development
6892
COMMIT=${{ github.sha }}
@@ -79,28 +103,23 @@ jobs:
79103
sudo chmod -R 777 ./e2e
80104
- name: Run E2E Tests
81105
env:
82-
E2E_KICS_DOCKER: kics:e2e-tests-${{ github.sha }}
106+
E2E_KICS_DOCKER: kics:e2e-${{ matrix.config.tag_suffix }}-${{ github.sha }}
83107
E2E_KICS_QUERIES_PATH: ${{ steps.getbin.outputs.queries }}
84108
run: |
85109
go test -tags dev "github.com/Checkmarx/kics/v2/e2e" -timeout 1500s -json > results.json
86110
- name: Generate E2E Report
87111
if: always()
88112
env:
89-
E2E_KICS_DOCKERFILE: ${{ matrix.kics-docker }}
113+
E2E_KICS_DOCKERFILE: ${{ matrix.config.dockerfile }}
90114
run: |
91115
CWD=$(pwd)
92116
cd .github/scripts/report
93117
go mod tidy
94118
go build
95119
./e2e-report -test-path ${CWD} -test-name results.json -report-path ${CWD} -report-name e2e-report.html
96-
- name: Get docker name
97-
if: always()
98-
run: |
99-
DOCKER_NAME=$(echo ${{ matrix.kics-docker }} | sed 's/\//-/')
100-
echo "DOCKER_NAME=$DOCKER_NAME" >> $GITHUB_ENV
101120
- name: Archive test report
102121
if: always()
103122
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
104123
with:
105-
name: e2e-tests-report-${{ env.DOCKER_NAME }}
124+
name: e2e-tests-report-${{ matrix.config.tag_suffix }}
106125
path: e2e-report.html

.github/workflows/release-dkr-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ jobs:
118118
file: ./docker/Dockerfile.ubi8
119119
push: true
120120
tags: checkmarx/kics:ubi8,checkmarx/kics:${{ steps.get-version.outputs.version }}-ubi8
121-
platforms: linux/amd64
121+
platforms: linux/amd64,linux/arm64
122122
build-args: |
123123
VERSION=${{ steps.get-version.outputs.version }}
124124
COMMIT=${{ github.sha }}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM checkmarx/go:1.26.1-r1@sha256:3984b97600a32d5a9ff14cc4b8029572a762082d98fb9788bbc4050d4f45d9d2 AS build_env
1+
FROM checkmarx/go:1.26.1@sha256:1d40555ccad7e4e931c5e36d9ca743e3d37d895923e061b94615ae0e69f57b8b AS build_env
22

33
# Copy the source from the current directory to the Working Directory inside the container
44
WORKDIR /app
@@ -29,7 +29,7 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
2929
# Runtime image
3030
# Ignore no User Cmd since KICS container is stopped afer scan
3131
# kics-scan ignore-line
32-
FROM checkmarx/git:2.53.0-r0@sha256:6f398e9772fc0271cbdd77b065a09c9244004fbda17c1c58ba01b412a4292bde
32+
FROM checkmarx/git:2.53.0@sha256:9b16c12c6247d4f5a50f11844bf8e89b6bf1c14ddeed18291cbc857e84d8c4e6
3333

3434
ENV TERM xterm-256color
3535

docker/Dockerfile.ubi8

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
FROM --platform=${BUILDPLATFORM:-linux/amd64} registry.access.redhat.com/ubi8:latest AS build_env
1+
FROM registry.access.redhat.com/ubi8:latest AS build_env
2+
3+
ARG TARGETOS
4+
ARG TARGETARCH
25

36
WORKDIR /build
47

58
ENV PATH=$PATH:/usr/local/go/bin
69

7-
ADD https://golang.org/dl/go1.25.7.linux-amd64.tar.gz .
8-
RUN yum install git gcc -y \
9-
&& rm -rf /usr/local/go && tar -C /usr/local -xzf go1.25.7.linux-amd64.tar.gz \
10-
&& rm -f go1.25.7.linux-amd64.tar.gz
10+
RUN echo "Installing Go 1.25.7 for ${TARGETARCH:-amd64} architecture"
11+
12+
RUN yum install git gcc wget -y \
13+
&& rm -rf /usr/local/go \
14+
&& wget -q https://golang.org/dl/go1.25.7.linux-${TARGETARCH:-amd64}.tar.gz \
15+
&& tar -C /usr/local -xzf go1.25.7.linux-${TARGETARCH:-amd64}.tar.gz \
16+
&& rm -f go1.25.7.linux-${TARGETARCH:-amd64}.tar.gz
1117

1218
ENV GOPRIVATE=github.com/Checkmarx/*
1319
ARG VERSION="development"
1420
ARG COMMIT="NOCOMMIT"
1521
ARG SENTRY_DSN=""
1622
ARG DESCRIPTIONS_URL=""
1723

18-
ARG TARGETOS
19-
ARG TARGETARCH
20-
2124
# Copy go mod and sum files
2225
COPY go.mod .
2326
COPY go.sum .
@@ -36,6 +39,9 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
3639

3740
FROM registry.access.redhat.com/ubi8:latest
3841

42+
ARG RELEASE
43+
ARG VERSION
44+
3945
ENV RELEASE=$RELEASE \
4046
VERSION=$VERSION
4147

@@ -55,7 +61,7 @@ ARG UID=1000
5561
ARG GID=1000
5662

5763
RUN yum install git wget unzip -y \
58-
&& groupadd -g ${UID} ${KGROUP} \
64+
&& groupadd -g ${GID} ${KGROUP} \
5965
&& adduser \
6066
--home-dir /app/bin \
6167
--no-create-home \

go.mod

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ require (
3030
github.com/relex/aini v1.6.0
3131
github.com/rs/zerolog v1.34.0
3232
github.com/sosedoff/ansible-vault-go v0.2.0
33-
github.com/spf13/cobra v1.10.1
33+
github.com/spf13/cobra v1.10.2
3434
github.com/spf13/pflag v1.0.10
3535
github.com/spf13/viper v1.21.0
3636
github.com/stretchr/testify v1.11.1
@@ -57,7 +57,7 @@ require (
5757
cloud.google.com/go/compute/metadata v0.9.0 // indirect
5858
cloud.google.com/go/iam v1.2.2 // indirect
5959
cloud.google.com/go/monitoring v1.21.2 // indirect
60-
cloud.google.com/go/storage v1.49.0 // indirect
60+
cloud.google.com/go/storage v1.50.0 // indirect
6161
dario.cat/mergo v1.0.1 // indirect
6262
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 // indirect
6363
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.1 // indirect
@@ -88,13 +88,14 @@ require (
8888
github.com/containerd/platforms v1.0.0-rc.2 // indirect
8989
github.com/containerd/typeurl/v2 v2.2.3 // indirect
9090
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
91+
github.com/distribution/distribution/v3 v3.1.0 // indirect
9192
github.com/envoyproxy/go-control-plane/envoy v1.36.0 // indirect
9293
github.com/envoyproxy/protoc-gen-validate v1.3.0 // indirect
9394
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
9495
github.com/felixge/httpsnoop v1.0.4 // indirect
9596
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
9697
github.com/go-ini/ini v1.67.0 // indirect
97-
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
98+
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
9899
github.com/go-logr/stdr v1.2.2 // indirect
99100
github.com/go-openapi/swag/cmdutils v0.25.4 // indirect
100101
github.com/go-openapi/swag/conv v0.25.4 // indirect
@@ -143,20 +144,21 @@ require (
143144
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
144145
go.opentelemetry.io/contrib/detectors/gcp v1.39.0 // indirect
145146
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
146-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
147-
go.opentelemetry.io/otel v1.40.0 // indirect
148-
go.opentelemetry.io/otel/metric v1.40.0 // indirect
149-
go.opentelemetry.io/otel/sdk v1.40.0 // indirect
150-
go.opentelemetry.io/otel/sdk/metric v1.40.0 // indirect
151-
go.opentelemetry.io/otel/trace v1.40.0 // indirect
147+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect
148+
go.opentelemetry.io/otel v1.42.0 // indirect
149+
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.42.0 // indirect
150+
go.opentelemetry.io/otel/metric v1.42.0 // indirect
151+
go.opentelemetry.io/otel/sdk v1.42.0 // indirect
152+
go.opentelemetry.io/otel/sdk/metric v1.42.0 // indirect
153+
go.opentelemetry.io/otel/trace v1.42.0 // indirect
152154
go.yaml.in/yaml/v2 v2.4.3 // indirect
153155
go.yaml.in/yaml/v3 v3.0.4 // indirect
154156
golang.org/x/mod v0.33.0 // indirect
155157
golang.org/x/tools v0.41.0 // indirect
156158
google.golang.org/api v0.215.0 // indirect
157159
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect
158-
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
159-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect
160+
google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 // indirect
161+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect
160162
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
161163
oras.land/oras-go/v2 v2.6.0 // indirect
162164
sigs.k8s.io/randfill v1.0.0 // indirect
@@ -232,8 +234,8 @@ require (
232234
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
233235
github.com/prometheus/client_golang v1.23.2 // indirect
234236
github.com/prometheus/client_model v0.6.2 // indirect
235-
github.com/prometheus/common v0.66.1 // indirect
236-
github.com/prometheus/procfs v0.17.0 // indirect
237+
github.com/prometheus/common v0.67.5 // indirect
238+
github.com/prometheus/procfs v0.20.1 // indirect
237239
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
238240
github.com/rivo/uniseg v0.4.7 // indirect
239241
github.com/rubenv/sql-migrate v1.8.0 // indirect
@@ -254,7 +256,7 @@ require (
254256
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
255257
github.com/yashtewari/glob-intersection v0.2.0 // indirect
256258
golang.org/x/crypto v0.48.0 // indirect
257-
golang.org/x/oauth2 v0.34.0 // indirect
259+
golang.org/x/oauth2 v0.35.0 // indirect
258260
golang.org/x/sync v0.19.0 // indirect
259261
golang.org/x/sys v0.41.0 // indirect
260262
golang.org/x/term v0.40.0 // indirect

0 commit comments

Comments
 (0)