Skip to content

Commit a8965a7

Browse files
committed
ci: add fips check
1 parent af84080 commit a8965a7

File tree

6 files changed

+36
-53
lines changed

6 files changed

+36
-53
lines changed

.tekton/fetch-tsa-certs-pull-request.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,25 @@ spec:
4444
CGO_ENABLED=0 go build -trimpath -o bin/timestamp-cli ./cmd/timestamp-cli
4545
CGO_ENABLED=0 go build -trimpath -o bin/timestamp-server ./cmd/timestamp-server
4646
go test ./...
47+
- name: build-platforms
48+
value:
49+
- linux/x86_64
50+
- linux/arm64
51+
- linux/ppc64le
52+
- linux/s390x
53+
- name: fips-check
54+
value: "true"
4755
pipelineRef:
4856
params:
4957
- name: url
5058
value: https://github.com/securesign/pipelines.git
5159
- name: revision
5260
value: main
5361
- name: pathInRepo
54-
value: pipelines/docker-build-oci-ta.yaml
62+
value: pipelines/docker-build-multi-platform-oci-ta.yaml
5563
resolver: git
5664
taskRunSpecs:
5765
- pipelineTaskName: run-unit-test
58-
podTemplate:
59-
imagePullSecrets:
60-
- name: brew-registry-pull-secret
61-
serviceAccountName: appstudio-pipeline
6266
stepSpecs:
6367
- computeResources:
6468
limits:

.tekton/fetch-tsa-certs-push.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,25 @@ spec:
4141
CGO_ENABLED=0 go build -trimpath -o bin/timestamp-cli ./cmd/timestamp-cli
4242
CGO_ENABLED=0 go build -trimpath -o bin/timestamp-server ./cmd/timestamp-server
4343
go test ./...
44+
- name: build-platforms
45+
value:
46+
- linux/x86_64
47+
- linux/arm64
48+
- linux/ppc64le
49+
- linux/s390x
50+
- name: fips-check
51+
value: "true"
4452
pipelineRef:
4553
params:
4654
- name: url
4755
value: https://github.com/securesign/pipelines.git
4856
- name: revision
4957
value: main
5058
- name: pathInRepo
51-
value: pipelines/docker-build-oci-ta.yaml
59+
value: pipelines/docker-build-multi-platform-oci-ta.yaml
5260
resolver: git
5361
taskRunSpecs:
5462
- pipelineTaskName: run-unit-test
55-
podTemplate:
56-
imagePullSecrets:
57-
- name: brew-registry-pull-secret
58-
serviceAccountName: appstudio-pipeline
5963
stepSpecs:
6064
- computeResources:
6165
limits:

.tekton/timestamp-authority-pull-request.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ spec:
4444
CGO_ENABLED=0 go build -trimpath -o bin/timestamp-cli ./cmd/timestamp-cli
4545
CGO_ENABLED=0 go build -trimpath -o bin/timestamp-server ./cmd/timestamp-server
4646
go test ./...
47+
- name: fips-check
48+
value: "true"
4749
pipelineRef:
4850
params:
4951
- name: url
@@ -55,10 +57,6 @@ spec:
5557
resolver: git
5658
taskRunSpecs:
5759
- pipelineTaskName: run-unit-test
58-
podTemplate:
59-
imagePullSecrets:
60-
- name: brew-registry-pull-secret
61-
serviceAccountName: appstudio-pipeline
6260
stepSpecs:
6361
- computeResources:
6462
limits:

.tekton/timestamp-authority-push.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ spec:
4141
CGO_ENABLED=0 go build -trimpath -o bin/timestamp-cli ./cmd/timestamp-cli
4242
CGO_ENABLED=0 go build -trimpath -o bin/timestamp-server ./cmd/timestamp-server
4343
go test ./...
44+
- name: fips-check
45+
value: "true"
4446
pipelineRef:
4547
params:
4648
- name: url
@@ -52,10 +54,6 @@ spec:
5254
resolver: git
5355
taskRunSpecs:
5456
- pipelineTaskName: run-unit-test
55-
podTemplate:
56-
imagePullSecrets:
57-
- name: brew-registry-pull-secret
58-
serviceAccountName: appstudio-pipeline
5957
stepSpecs:
6058
- computeResources:
6159
limits:

Build.mak

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
1+
FIPS_MODULE ?= latest
2+
13
.PHONY:
2-
cross-platform: fetch-tsa-certs-darwin-arm64 fetch-tsa-certs-darwin-amd64 fetch-tsa-certs-linux-amd64 fetch-tsa-certs-linux-arm64 fetch-tsa-certs-linux-ppc64le fetch-tsa-certs-linux-s390x fetch-tsa-certs-windows ## Build all distributable (cross-platform) binaries
4+
cross-platform: fetch-tsa-certs-darwin-arm64 fetch-tsa-certs-darwin-amd64 fetch-tsa-certs-windows ## Build all distributable (cross-platform) binaries
35

46
.PHONY: fetch-tsa-certs-darwin-arm64
57
fetch-tsa-certs-darwin-arm64: ## Build for mac M1
6-
env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -mod=readonly -o fetch_tsa_certs_darwin_arm64 -trimpath ./cmd/fetch-tsa-certs
8+
env CGO_ENABLED=0 GOFIPS140=$(FIPS_MODULE) GOOS=darwin GOARCH=arm64 go build -mod=readonly -o fetch_tsa_certs_darwin_arm64 -trimpath ./cmd/fetch-tsa-certs
79

810
.PHONY: fetch-tsa-certs-darwin-amd64
911
fetch-tsa-certs-darwin-amd64: ## Build for Darwin (macOS)
10-
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -mod=readonly -o fetch_tsa_certs_darwin_amd64 -trimpath ./cmd/fetch-tsa-certs
11-
12-
.PHONY: fetch-tsa-certs-linux-amd64
13-
fetch-tsa-certs-linux-amd64: ## Build for Linux amd64
14-
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod=readonly -o fetch_tsa_certs_linux_amd64 -trimpath ./cmd/fetch-tsa-certs
15-
16-
.PHONY: fetch-tsa-certs-linux-arm64
17-
fetch-tsa-certs-linux-arm64: ## Build for Linux arm64
18-
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -mod=readonly -o fetch_tsa_certs_linux_arm64 -trimpath ./cmd/fetch-tsa-certs
19-
20-
.PHONY: fetch-tsa-certs-linux-ppc64le
21-
fetch-tsa-certs-linux-ppc64le: ## Build for Linux ppc64le
22-
env CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -mod=readonly -o fetch_tsa_certs_linux_ppc64le -trimpath ./cmd/fetch-tsa-certs
23-
24-
.PHONY: fetch-tsa-certs-linux-s390x
25-
fetch-tsa-certs-linux-s390x: ## Build for Linux s390x
26-
env CGO_ENABLED=0 GOOS=linux GOARCH=s390x go build -mod=readonly -o fetch_tsa_certs_linux_s390x -trimpath ./cmd/fetch-tsa-certs
12+
env CGO_ENABLED=0 GOFIPS140=$(FIPS_MODULE) GOOS=darwin GOARCH=amd64 go build -mod=readonly -o fetch_tsa_certs_darwin_amd64 -trimpath ./cmd/fetch-tsa-certs
2713

2814
.PHONY: fetch-tsa-certs-windows
2915
fetch-tsa-certs-windows: ## Build for Windows
30-
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -mod=readonly -o fetch_tsa_certs_windows_amd64.exe -trimpath ./cmd/fetch-tsa-certs
16+
env CGO_ENABLED=0 GOFIPS140=$(FIPS_MODULE) GOOS=windows GOARCH=amd64 go build -mod=readonly -o fetch_tsa_certs_windows_amd64.exe -trimpath ./cmd/fetch-tsa-certs

Dockerfile.fetch_tsa_certs.rh

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.redhat.io/ubi9/go-toolset:9.6@sha256:84286c7555df503df0bd3acb86fe2ad50af82a07f35707918bb0fad312fdc193 as build-env
1+
FROM registry.redhat.io/ubi9/go-toolset:9.6 as build-env
22
ENV GOEXPERIMENT=strictfipsruntime
33
ENV CGO_ENABLED=1
44
ENV APP_ROOT=/opt/app-root
@@ -12,13 +12,11 @@ ADD ./cmd/ $APP_ROOT/src/cmd/
1212
ADD ./pkg/ $APP_ROOT/src/pkg/
1313
ADD ./Build.mak $APP_ROOT/src/Build.mak
1414

15-
RUN make -f Build.mak cross-platform && \
15+
RUN go build -mod=readonly -o fetch_tsa_certs_linux -trimpath ./cmd/fetch-tsa-certs && \
16+
gzip -k fetch_tsa_certs_linux && \
17+
make -f Build.mak cross-platform && \
1618
gzip fetch_tsa_certs_darwin_arm64 && \
1719
gzip fetch_tsa_certs_darwin_amd64 && \
18-
gzip fetch_tsa_certs_linux_amd64 && \
19-
gzip fetch_tsa_certs_linux_arm64 && \
20-
gzip fetch_tsa_certs_linux_ppc64le && \
21-
gzip fetch_tsa_certs_linux_s390x && \
2220
gzip fetch_tsa_certs_windows_amd64.exe
2321

2422
FROM registry.access.redhat.com/ubi9-minimal@sha256:7c5495d5fad59aaee12abc3cbbd2b283818ee1e814b00dbc7f25bf2d14fa4f0c
@@ -35,19 +33,14 @@ LABEL name="rhtas/fetch-tsa-certs-rhel9"
3533

3634
COPY LICENSE /licenses/license.txt
3735

36+
COPY --from=build-env $APP_ROOT/src/fetch_tsa_certs_linux /usr/local/bin/fetch_tsa_certs_linux
37+
COPY --from=build-env $APP_ROOT/src/fetch_tsa_certs_linux.gz /usr/local/bin/fetch_tsa_certs_linux.gz
3838
COPY --from=build-env $APP_ROOT/src/fetch_tsa_certs_darwin_arm64.gz /usr/local/bin/fetch_tsa_certs_darwin_arm64.gz
3939
COPY --from=build-env $APP_ROOT/src/fetch_tsa_certs_darwin_amd64.gz /usr/local/bin/fetch_tsa_certs_darwin_amd64.gz
40-
COPY --from=build-env $APP_ROOT/src/fetch_tsa_certs_linux_amd64.gz /usr/local/bin/fetch_tsa_certs_linux_amd64.gz
41-
COPY --from=build-env $APP_ROOT/src/fetch_tsa_certs_linux_arm64.gz /usr/local/bin/fetch_tsa_certs_linux_arm64.gz
42-
COPY --from=build-env $APP_ROOT/src/fetch_tsa_certs_linux_ppc64le.gz /usr/local/bin/fetch_tsa_certs_linux_ppc64le.gz
43-
COPY --from=build-env $APP_ROOT/src/fetch_tsa_certs_linux_s390x.gz /usr/local/bin/fetch_tsa_certs_linux_s390x.gz
4440
COPY --from=build-env $APP_ROOT/src/fetch_tsa_certs_windows_amd64.exe.gz /usr/local/bin/fetch_tsa_certs_windows_amd64.exe.gz
4541

46-
RUN chown root:0 /usr/local/bin/fetch_tsa_certs_darwin_arm64.gz && chmod g+wx /usr/local/bin/fetch_tsa_certs_darwin_arm64.gz && \
42+
RUN chown root:0 /usr/local/bin/fetch_tsa_certs_linux.gz && chmod g+wx /usr/local/bin/fetch_tsa_certs_linux.gz && \
43+
chown root:0 /usr/local/bin/fetch_tsa_certs_darwin_arm64.gz && chmod g+wx /usr/local/bin/fetch_tsa_certs_darwin_arm64.gz && \
4744
chown root:0 /usr/local/bin/fetch_tsa_certs_darwin_amd64.gz && chmod g+wx /usr/local/bin/fetch_tsa_certs_darwin_amd64.gz && \
48-
chown root:0 /usr/local/bin/fetch_tsa_certs_linux_arm64.gz && chmod g+wx /usr/local/bin/fetch_tsa_certs_linux_arm64.gz && \
49-
chown root:0 /usr/local/bin/fetch_tsa_certs_linux_amd64.gz && chmod g+wx /usr/local/bin/fetch_tsa_certs_linux_amd64.gz && \
50-
chown root:0 /usr/local/bin/fetch_tsa_certs_linux_ppc64le.gz && chmod g+wx /usr/local/bin/fetch_tsa_certs_linux_ppc64le.gz && \
51-
chown root:0 /usr/local/bin/fetch_tsa_certs_linux_s390x.gz && chmod g+wx /usr/local/bin/fetch_tsa_certs_linux_s390x.gz && \
5245
chown root:0 /usr/local/bin/fetch_tsa_certs_windows_amd64.exe.gz && chmod g+wx /usr/local/bin/fetch_tsa_certs_windows_amd64.exe.gz && \
5346
chgrp -R 0 /${HOME} && chmod -R g=u /${HOME}

0 commit comments

Comments
 (0)