Skip to content

Commit 83df7e9

Browse files
bugerclaude
andcommitted
feat(ci): FIPS base image for FIPS Docker builds + Go 1.25
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b30deed commit 83df7e9

File tree

4 files changed

+86
-49
lines changed

4 files changed

+86
-49
lines changed

.github/workflows/release.yml

Lines changed: 59 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ on:
2222
- release-**
2323
tags:
2424
- 'v*'
25-
26-
permissions:
27-
contents: read
28-
2925
env:
3026
GOPRIVATE: github.com/TykTechnologies
3127
VARIATION: prod-variation
@@ -34,10 +30,17 @@ env:
3430
# startsWith covers pull_request_target too
3531
BASE_REF: ${{startsWith(github.event_name, 'pull_request') && github.base_ref || github.ref_name}}
3632
jobs:
33+
dep-guard:
34+
if: github.event_name == 'pull_request'
35+
uses: TykTechnologies/github-actions/.github/workflows/dependency-guard.yml@d3fa20888fa2878e877e22bb7702141217290e7c # main
36+
permissions:
37+
contents: read
3738
goreleaser:
39+
needs:
40+
- dep-guard
3841
if: github.event.pull_request.draft == false
3942
name: '${{ matrix.golang_cross }}'
40-
runs-on: warp-ubuntu-latest-x64-4x
43+
runs-on: ${{ vars.DEFAULT_RUNNER }}
4144
permissions:
4245
id-token: write # AWS OIDC JWT
4346
contents: read # actions/checkout
@@ -71,6 +74,7 @@ jobs:
7174
echo "branch=${HEAD_REF##*/}" >> $GITHUB_OUTPUT
7275
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
7376
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
77+
- uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3
7478
- name: Login to DockerHub
7579
if: startsWith(github.ref, 'refs/tags')
7680
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
@@ -84,6 +88,18 @@ jobs:
8488
registry: docker.tyk.io
8589
username: ${{ secrets.CLOUDSMITH_USERNAME }}
8690
password: ${{ secrets.CLOUDSMITH_API_KEY }}
91+
- uses: aws-actions/configure-aws-credentials@ff717079ee2060e4bcee96c4779b553acc87447c # v4
92+
with:
93+
role-to-assume: arn:aws:iam::754489498669:role/ecr_rw_tyk
94+
role-session-name: cipush
95+
aws-region: eu-central-1
96+
# Don't mask to pass it across job boundaries
97+
mask-aws-account-id: false
98+
- uses: aws-actions/amazon-ecr-login@f2e9fc6c2b355c1890b65e6f6f0e2ac3e6e22f78 # v2
99+
id: ecr
100+
if: ${{ matrix.golang_cross == '1.25-bookworm' }}
101+
with:
102+
mask-password: 'true'
87103
- uses: WarpBuilds/cache@f643a1ba29942d56621d07fc2d4284c7219868ad # v1
88104
with:
89105
path: |
@@ -104,7 +120,6 @@ jobs:
104120
git config --global --add safe.directory /go/src/github.com/TykTechnologies/tyk-pump
105121
goreleaser release --clean -f ${{ matrix.goreleaser }} ${{ !startsWith(github.ref, 'refs/tags/') && ' --snapshot --skip=sign,docker' || '--skip=docker' }}' | tee /tmp/build.sh
106122
chmod +x /tmp/build.sh
107-
mkdir -p ~/.docker && echo "{}" > ~/.docker/config.json
108123
docker run --rm --privileged -e GITHUB_TOKEN=${{ github.token }} \
109124
-e GOPRIVATE=github.com/TykTechnologies \
110125
-e DEBVERS='${{ matrix.debvers }}' \
@@ -124,18 +139,6 @@ jobs:
124139
-v /tmp/build.sh:/tmp/build.sh \
125140
-w /go/src/github.com/TykTechnologies/tyk-pump \
126141
tykio/golang-cross:${{ matrix.golang_cross }} /tmp/build.sh
127-
- uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4
128-
with:
129-
role-to-assume: arn:aws:iam::754489498669:role/ecr_rw_tyk
130-
role-session-name: cipush
131-
aws-region: eu-central-1
132-
# Don't mask to pass it across job boundaries
133-
mask-aws-account-id: false
134-
- uses: aws-actions/amazon-ecr-login@183a1442edf41672e66566b7fc560e297a290896 # v2
135-
id: ecr
136-
if: ${{ matrix.golang_cross == '1.25-bookworm' }}
137-
with:
138-
mask-password: 'true'
139142
- name: Docker metadata for fips CI
140143
id: ci_metadata_fips
141144
if: ${{ matrix.golang_cross == '1.25-bookworm' }}
@@ -168,6 +171,7 @@ jobs:
168171
labels: ${{ steps.ci_metadata_fips.outputs.labels }}
169172
build-args: |
170173
BUILD_PACKAGE_NAME=tyk-pump-fips
174+
BASE_IMAGE=tykio/dhi-busybox:1.37-fips
171175
- name: Docker metadata for fips tag push
172176
id: tag_metadata_fips
173177
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
@@ -182,7 +186,7 @@ jobs:
182186
type=semver,pattern={{version}}
183187
labels: |
184188
org.opencontainers.image.title=Tyk Analytics Pump FIPS
185-
org.opencontainers.image.description=Tyk Analytics Pump to move analytics data from Redis to any supported back end (multiple back ends can be written to at once). This version is compiled with boringssl.
189+
org.opencontainers.image.description=Tyk Analytics Pump to move analytics data from Redis to any supported back end (multiple back ends can be written to at once). Built with FIPS 140-3 compliant cryptography.
186190
org.opencontainers.image.vendor=tyk.io
187191
org.opencontainers.image.version=${{ github.ref_name }}
188192
- name: push fips image to prod
@@ -201,6 +205,19 @@ jobs:
201205
labels: ${{ steps.tag_metadata_fips.outputs.labels }}
202206
build-args: |
203207
BUILD_PACKAGE_NAME=tyk-pump-fips
208+
BASE_IMAGE=tykio/dhi-busybox:1.37-fips
209+
- name: Attach base image VEX to fips
210+
if: ${{ matrix.golang_cross == '1.25-bookworm' && startsWith(github.ref, 'refs/tags') }}
211+
run: |
212+
# Install Docker Scout CLI
213+
curl -fsSL https://raw.githubusercontent.com/docker/scout-cli/v1.20.4/install.sh -o /tmp/scout-install.sh && sh /tmp/scout-install.sh 2>/dev/null
214+
# Extract VEX from the DHI base image
215+
docker scout vex get --org tykio -o /tmp/fips-vex.json tykio/dhi-busybox:1.37-fips || true
216+
if [ -f /tmp/fips-vex.json ]; then
217+
cosign attest --yes --type openvex \
218+
--predicate /tmp/fips-vex.json \
219+
tykio/tyk-pump-fips:${{ github.ref_name }} || true
220+
fi
204221
- name: Docker metadata for std CI
205222
id: ci_metadata_std
206223
if: ${{ matrix.golang_cross == '1.25-bookworm' }}
@@ -222,7 +239,7 @@ jobs:
222239
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
223240
with:
224241
context: "dist"
225-
platforms: linux/amd64,linux/arm64,linux/s390x
242+
platforms: linux/amd64,linux/arm64
226243
file: ci/Dockerfile.distroless
227244
provenance: mode=max
228245
sbom: true
@@ -256,7 +273,7 @@ jobs:
256273
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
257274
with:
258275
context: "dist"
259-
platforms: linux/amd64,linux/arm64,linux/s390x
276+
platforms: linux/amd64,linux/arm64
260277
file: ci/Dockerfile.distroless
261278
provenance: mode=max
262279
sbom: true
@@ -291,14 +308,14 @@ jobs:
291308
if: github.event.pull_request.draft == false
292309
needs:
293310
- goreleaser
294-
runs-on: warp-ubuntu-latest-x64-2x
311+
runs-on: ${{ vars.DEFAULT_RUNNER }}
295312
outputs:
296313
envfiles: ${{ steps.params.outputs.envfiles }}
297314
pump: ${{ steps.params.outputs.pump }}
298315
sink: ${{ steps.params.outputs.sink }}
299316
steps:
300317
- name: Set test parameters
301-
uses: TykTechnologies/github-actions/.github/actions/tests/test-controller@d3fa20888fa2878e877e22bb7702141217290e7c # main
318+
uses: TykTechnologies/github-actions/.github/actions/tests/test-controller@42304edda365365e0a887cf018d8edc34b960b82 # main
302319
id: params
303320
with:
304321
variation: ${{ env.VARIATION }}
@@ -308,7 +325,7 @@ jobs:
308325
needs:
309326
- test-controller-api
310327
- goreleaser
311-
runs-on: warp-ubuntu-latest-x64-4x
328+
runs-on: ${{ vars.DEFAULT_RUNNER }}
312329
env:
313330
XUNIT_REPORT_PATH: ${{ github.workspace}}/test-results.xml
314331
permissions:
@@ -320,13 +337,13 @@ jobs:
320337
envfiles: ${{ fromJson(needs.test-controller-api.outputs.envfiles) }}
321338
sink: ${{ fromJson(needs.test-controller-api.outputs.sink) }}
322339
steps:
323-
- uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4
340+
- uses: aws-actions/configure-aws-credentials@ff717079ee2060e4bcee96c4779b553acc87447c # v4
324341
with:
325342
role-to-assume: arn:aws:iam::754489498669:role/ecr_rw_tyk
326343
role-session-name: cipush
327344
aws-region: eu-central-1
328345
- id: ecr
329-
uses: aws-actions/amazon-ecr-login@183a1442edf41672e66566b7fc560e297a290896 # v2
346+
uses: aws-actions/amazon-ecr-login@f2e9fc6c2b355c1890b65e6f6f0e2ac3e6e22f78 # v2
330347
with:
331348
mask-password: 'true'
332349
- name: Setup tmate session only in debug mode
@@ -338,11 +355,11 @@ jobs:
338355
# Only ${{ github.actor }} has access
339356
# See https://github.com/mxschmitt/action-tmate#use-registered-public-ssh-keys
340357
- name: Fetch environment from tyk-pro
341-
uses: TykTechnologies/github-actions/.github/actions/tests/checkout-tyk-pro@d3fa20888fa2878e877e22bb7702141217290e7c # main
358+
uses: TykTechnologies/github-actions/.github/actions/tests/checkout-tyk-pro@42304edda365365e0a887cf018d8edc34b960b82 # main
342359
with:
343360
org_gh_token: ${{ github.token }}
344361
- name: Set up test environment
345-
uses: TykTechnologies/github-actions/.github/actions/tests/env-up@d3fa20888fa2878e877e22bb7702141217290e7c # main
362+
uses: TykTechnologies/github-actions/.github/actions/tests/env-up@42304edda365365e0a887cf018d8edc34b960b82 # main
346363
timeout-minutes: 5
347364
id: env_up
348365
with:
@@ -352,25 +369,25 @@ jobs:
352369
TYK_DB_LICENSEKEY: ${{ secrets.DASH_LICENSE }}
353370
TYK_MDCB_LICENSE: ${{ secrets.MDCB_LICENSE }}
354371
- name: Choose test code branch
355-
uses: TykTechnologies/github-actions/.github/actions/tests/choose-test-branch@d3fa20888fa2878e877e22bb7702141217290e7c # main
372+
uses: TykTechnologies/github-actions/.github/actions/tests/choose-test-branch@42304edda365365e0a887cf018d8edc34b960b82 # main
356373
with:
357374
test_folder: api
358375
org_gh_token: ${{ secrets.ORG_GH_TOKEN }}
359376
- name: Run API tests
360-
uses: TykTechnologies/github-actions/.github/actions/tests/api-tests@d3fa20888fa2878e877e22bb7702141217290e7c # main
377+
uses: TykTechnologies/github-actions/.github/actions/tests/api-tests@42304edda365365e0a887cf018d8edc34b960b82 # main
361378
timeout-minutes: 30
362379
id: test_execution
363380
with:
364381
user_api_secret: ${{ steps.env_up.outputs.USER_API_SECRET }}
365382
- name: Generate test reports and collect logs
366-
uses: TykTechnologies/github-actions/.github/actions/tests/reporting@d3fa20888fa2878e877e22bb7702141217290e7c # main
383+
uses: TykTechnologies/github-actions/.github/actions/tests/reporting@42304edda365365e0a887cf018d8edc34b960b82 # main
367384
if: always() && (steps.test_execution.conclusion != 'skipped')
368385
with:
369386
report_xml: 'true'
370387
execution_status: ${{ steps.test_execution.outcome }}
371388
aggregator-ci-test:
372389
name: Aggregated CI Status
373-
runs-on: warp-ubuntu-latest-x64-2x
390+
runs-on: ${{ vars.DEFAULT_RUNNER }}
374391
# Dynamically determine which jobs to depend on based on repository configuration
375392
needs: [goreleaser, api-tests]
376393
if: ${{ always() && github.event_name == 'pull_request' }}
@@ -393,16 +410,16 @@ jobs:
393410
if (( ${#failed[@]} )); then
394411
# Join the failed job names with commas
395412
failed_jobs=$(IFS=", "; echo "${failed[*]}")
396-
echo "Failed jobs ----- : $failed_jobs"
413+
echo "Failed jobs ----- : $failed_jobs"
397414
exit 1
398415
fi
399416
400-
echo "All required jobs succeeded"
417+
echo "All required jobs succeeded"
401418
test-controller-distros:
402419
if: github.event.pull_request.draft == false
403420
needs:
404421
- goreleaser
405-
runs-on: warp-ubuntu-latest-x64-2x
422+
runs-on: ${{ vars.DEFAULT_RUNNER }}
406423
outputs:
407424
deb: ${{ steps.params.outputs.deb }}
408425
rpm: ${{ steps.params.outputs.rpm }}
@@ -415,7 +432,6 @@ jobs:
415432
BASE_REF: ${{startsWith(github.event_name, 'pull_request') && github.base_ref || github.ref_name}}
416433
run: |
417434
set -eo pipefail
418-
# WARNING: curl piped to shell - consider downloading and verifying before executing
419435
curl -s --retry 5 --retry-delay 10 --fail-with-body "http://tui.internal.dev.tyk.technology/v2/$VARIATION/tyk-pump/$BASE_REF/${{ github.event_name}}/api/Distros.gho" | tee -a "$GITHUB_OUTPUT"
420436
if ! [[ $VARIATION =~ prod ]];then
421437
echo "::warning file=.github/workflows/release.yml,line=24,col=1,endColumn=8::Using test variation"
@@ -424,7 +440,7 @@ jobs:
424440
services:
425441
httpbin.org:
426442
image: kennethreitz/httpbin
427-
runs-on: warp-ubuntu-latest-x64-2x
443+
runs-on: ${{ vars.DEFAULT_RUNNER }}
428444
needs:
429445
- test-controller-distros
430446
strategy:
@@ -450,7 +466,8 @@ jobs:
450466
ARG TARGETARCH
451467
COPY tyk-pump*_${TARGETARCH}.deb /tyk-pump.deb
452468
RUN apt-get update && apt-get install -y curl
453-
RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-pump/script.deb.sh | bash || echo "Repository setup failed, but continuing" # WARNING: curl piped to shell - pinning not possible for packagecloud install script
469+
# TODO(security): curl|bash - consider fetching script and verifying checksum before execution
470+
RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-pump/script.deb.sh | bash || echo "Repository setup failed, but continuing" # SECURITY: accepted risk, see TODO above
454471
RUN apt-get install -y tyk-pump=1.6.0 || echo "Previous version not found, testing fresh install"
455472
RUN dpkg -i /tyk-pump.deb
456473
@@ -470,7 +487,7 @@ jobs:
470487
services:
471488
httpbin.org:
472489
image: kennethreitz/httpbin
473-
runs-on: warp-ubuntu-latest-x64-2x
490+
runs-on: ${{ vars.DEFAULT_RUNNER }}
474491
needs:
475492
- test-controller-distros
476493
strategy:
@@ -497,7 +514,8 @@ jobs:
497514
COPY tyk-pump*.${RHELARCH}.rpm /tyk-pump.rpm
498515
RUN command -v curl || yum install -y curl
499516
RUN command -v useradd || yum install -y shadow-utils
500-
RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-pump/script.rpm.sh | bash || echo "Repository setup failed, but continuing" # WARNING: curl piped to shell - pinning not possible for packagecloud install script
517+
# TODO(security): curl|bash - consider fetching script and verifying checksum before execution
518+
RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-pump/script.rpm.sh | bash || echo "Repository setup failed, but continuing" # SECURITY: accepted risk, see TODO above
501519
RUN yum install -y tyk-pump-1.6.0-1 || echo "Previous version not found, testing fresh install"
502520
RUN curl https://keyserver.tyk.io/tyk.io.rpm.signing.key.2020 -o tyk-pump.key && rpm --import tyk-pump.key
503521
RUN rpm --checksig /tyk-pump.rpm
@@ -517,7 +535,7 @@ jobs:
517535
push: false
518536
sbom:
519537
needs: goreleaser
520-
uses: TykTechnologies/github-actions/.github/workflows/sbom.yaml@d3fa20888fa2878e877e22bb7702141217290e7c # main
538+
uses: TykTechnologies/github-actions/.github/workflows/sbom.yaml@42304edda365365e0a887cf018d8edc34b960b82 # main
521539
secrets:
522540
DEPDASH_URL: ${{ secrets.DEPDASH_URL }}
523541
DEPDASH_KEY: ${{ secrets.DEPDASH_KEY }}

ci/Dockerfile.distroless

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Generated by: gromit policy
22

3-
FROM debian:trixie-slim@sha256:edc9450a9fe37d30b508808052f8d0564e3ed9eaf565e043c6f5632957f7381e AS deb
3+
ARG BASE_IMAGE=gcr.io/distroless/static-debian13:nonroot
4+
5+
FROM debian:trixie-slim AS deb
46
ARG TARGETARCH
57
ARG BUILD_PACKAGE_NAME
68

@@ -10,7 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive
1012
COPY ${BUILD_PACKAGE_NAME}_*${TARGETARCH}.deb /
1113
RUN dpkg -i /${BUILD_PACKAGE_NAME}_*${TARGETARCH}.deb && rm /*.deb
1214

13-
FROM gcr.io/distroless/static-debian12:nonroot@sha256:5074667eecabac8ac5c5d395100a153a7b4e8426181cca36181cd019530f00c8
15+
FROM ${BASE_IMAGE}
1416

1517
COPY --from=deb /opt/tyk-pump /opt/tyk-pump
1618

ci/Dockerfile.std

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generated by: gromit policy
22

3-
FROM debian:trixie-slim@sha256:edc9450a9fe37d30b508808052f8d0564e3ed9eaf565e043c6f5632957f7381e
3+
FROM debian:trixie-slim
44
ARG TARGETARCH
55
ARG BUILD_PACKAGE_NAME
66

ci/goreleaser/goreleaser.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ version: 2
88
builds:
99
- id: fips-amd64
1010
flags:
11-
- -tags=fips,boringcrypto
11+
- -tags=fips
1212
env:
1313
- NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates
14-
- GOEXPERIMENT=boringcrypto
14+
- GOFIPS140=v1.0.0
1515
ldflags:
1616
- -X github.com/TykTechnologies/tyk-pump/pumps.Version={{.Version}}
1717
- -X github.com/TykTechnologies/tyk-pump/pumps.Commit={{.FullCommit}}
@@ -24,10 +24,10 @@ builds:
2424
binary: tyk-pump
2525
- id: fips-arm64
2626
flags:
27-
- -tags=fips,boringcrypto
27+
- -tags=fips
2828
env:
2929
- NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates
30-
- GOEXPERIMENT=boringcrypto
30+
- GOFIPS140=v1.0.0
3131
ldflags:
3232
- -X github.com/TykTechnologies/tyk-pump/pumps.Version={{.Version}}
3333
- -X github.com/TykTechnologies/tyk-pump/pumps.Commit={{.FullCommit}}
@@ -38,6 +38,22 @@ builds:
3838
goarch:
3939
- arm64
4040
binary: tyk-pump
41+
- id: fips-s390x
42+
flags:
43+
- -tags=fips
44+
env:
45+
- NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates
46+
- GOFIPS140=v1.0.0
47+
ldflags:
48+
- -X github.com/TykTechnologies/tyk-pump/pumps.Version={{.Version}}
49+
- -X github.com/TykTechnologies/tyk-pump/pumps.Commit={{.FullCommit}}
50+
- -X github.com/TykTechnologies/tyk-pump/pumps.BuildDate={{.Date}}
51+
- -X github.com/TykTechnologies/tyk-pump/pumps.BuiltBy=goreleaser
52+
goos:
53+
- linux
54+
goarch:
55+
- s390x
56+
binary: tyk-pump
4157
- id: std-amd64
4258
env:
4359
- NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates
@@ -82,12 +98,13 @@ nfpms:
8298
vendor: "Tyk Technologies Ltd"
8399
homepage: "https://tyk.io"
84100
maintainer: "Tyk <info@tyk.io>"
85-
description: Tyk Analytics Pump to move analytics data from Redis to any supported back end (multiple back ends can be written to at once). This version is compiled with boringssl.
101+
description: Tyk Analytics Pump to move analytics data from Redis to any supported back end (multiple back ends can be written to at once). Built with FIPS 140-3 compliant cryptography.
86102
package_name: tyk-pump-fips
87103
file_name_template: "{{ .ConventionalFileName }}"
88104
ids:
89105
- fips-amd64
90106
- fips-arm64
107+
- fips-s390x
91108
formats:
92109
- deb
93110
- rpm

0 commit comments

Comments
 (0)