Skip to content

Commit ec21214

Browse files
bugerclaude
andcommitted
fix: plugin compiler FIPS support + goplugin tag
- Add FIPS plugin compiler image (tykio/tyk-plugin-compiler-fips) with GOFIPS140=v1.0.0 and -tags=goplugin,ee,fips - Fix build.sh to always include goplugin in build tags - Fix embedded test binary to include BUILD_TAG - Add GOFIPS140 ARG/ENV pass-through in Dockerfile - Update Taskfile golang-cross references from 1.22 to 1.24 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8ae6918 commit ec21214

4 files changed

Lines changed: 44 additions & 12 deletions

File tree

.github/workflows/plugin-compiler-build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,36 @@ jobs:
112112
GITHUB_SHA=${{ github.sha }}
113113
GITHUB_TAG=${{ github.ref_name }}
114114
BUILD_TAG=ee
115+
116+
- name: Set docker metadata FIPS
117+
id: set-metadata-fips
118+
uses: docker/metadata-action@v4
119+
with:
120+
images: |
121+
tykio/tyk-plugin-compiler-fips,enable=${{ startsWith(github.ref, 'refs/tags') }}
122+
${{ steps.login-ecr.outputs.registry }}/tyk-plugin-compiler-fips
123+
labels: |
124+
org.opencontainers.image.title=tyk-plugin-compiler-fips
125+
org.opencontainers.image.description=Plugin compiler for the Tyk API Gateway FIPS Edition
126+
tags: |
127+
type=ref,event=pr
128+
type=semver,pattern=v{{version}}
129+
type=semver,pattern=v{{major}}.{{minor}}
130+
type=semver,pattern={{raw}}
131+
type=sha,format=long
132+
133+
- name: Build and push to dockerhub/ECR FIPS
134+
uses: docker/build-push-action@v4
135+
with:
136+
context: .
137+
file: ci/images/plugin-compiler/Dockerfile
138+
platforms: linux/amd64
139+
push: true
140+
labels: ${{ steps.set-metadata-fips.outputs.labels }}
141+
tags: ${{ steps.set-metadata-fips.outputs.tags }}
142+
build-args: |
143+
BASE_IMAGE=tykio/golang-cross:${{ env.GOLANG_CROSS }}
144+
GITHUB_SHA=${{ github.sha }}
145+
GITHUB_TAG=${{ github.ref_name }}
146+
BUILD_TAG=ee,fips
147+
GOFIPS140=v1.0.0

Taskfile.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ tasks:
7676
test:plugin-compiler:
7777
desc: "Plugin compiler local build/test"
7878
cmds:
79-
- docker build --build-arg GO_VERSION=1.22 --build-arg BASE_IMAGE=tykio/golang-cross:1.22-bullseye --build-arg GITHUB_TAG=v5.1.0-alpha18 --build-arg GITHUB_SHA=$(git rev-parse HEAD) --platform=linux/amd64 --rm -t internal/plugin-compiler -f ci/images/plugin-compiler/Dockerfile .
79+
- docker build --build-arg GO_VERSION=1.24 --build-arg BASE_IMAGE=tykio/golang-cross:1.24-bullseye --build-arg GITHUB_TAG=v5.1.0-alpha18 --build-arg GITHUB_SHA=$(git rev-parse HEAD) --platform=linux/amd64 --rm -t internal/plugin-compiler -f ci/images/plugin-compiler/Dockerfile .
8080
- docker run -it -e GOARCH=arm64 -e GOOS=linux --rm -v $(readlink -f .)/ci/images/plugin-compiler/data/basic-plugin:/plugin-source internal/plugin-compiler basic-plugin.so
81-
- docker run -it --rm -v $PWD:/go/src/github.com/TykTechnologies/tyk -w /go/src/github.com/TykTechnologies/tyk tykio/golang-cross:1.22-bullseye go build -trimpath -tags=goplugin .
81+
- docker run -it --rm -v $PWD:/go/src/github.com/TykTechnologies/tyk -w /go/src/github.com/TykTechnologies/tyk tykio/golang-cross:1.24-bullseye go build -trimpath -tags=goplugin .
8282
- ./tyk plugin load -f ./ci/images/plugin-compiler/data/basic-plugin/basic-plugin*.so -s MyPluginPre
8383
- docker rmi internal/plugin-compiler
8484

ci/images/plugin-compiler/Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ RUN --mount=type=cache,mode=0755,target=/go/pkg/mod \
2626

2727
ADD . $TYK_GW_PATH
2828

29-
# Provide a gateway test binary for testing plugin loading.
30-
RUN --mount=type=cache,mode=0755,target=/go/pkg/mod \
31-
--mount=type=cache,mode=0755,target=/root/.cache/go-build \
32-
GOBIN=/usr/local/bin go install -tags=goplugin -trimpath .
33-
3429
ARG GITHUB_SHA
3530
ARG GITHUB_TAG
3631
ENV GITHUB_SHA=${GITHUB_SHA}
@@ -39,6 +34,14 @@ ENV GITHUB_TAG=${GITHUB_TAG}
3934
ARG BUILD_TAG
4035
ENV BUILD_TAG=${BUILD_TAG}
4136

37+
ARG GOFIPS140
38+
ENV GOFIPS140=${GOFIPS140}
39+
40+
# Provide a gateway test binary for testing plugin loading.
41+
RUN --mount=type=cache,mode=0755,target=/go/pkg/mod \
42+
--mount=type=cache,mode=0755,target=/root/.cache/go-build \
43+
GOBIN=/usr/local/bin go install -tags=goplugin${BUILD_TAG:+,$BUILD_TAG} -trimpath .
44+
4245
COPY ci/images/plugin-compiler/data/build.sh /build.sh
4346
RUN chmod +x /build.sh
4447

ci/images/plugin-compiler/data/build.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,7 @@ if [[ "$DEBUG" == "1" ]] ; then
145145
git diff --cached
146146
fi
147147

148-
if [ -n "$BUILD_TAG" ]; then
149-
CC=$CC CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -trimpath -tags=$BUILD_TAG -o $plugin_name
150-
else
151-
CC=$CC CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -trimpath -o $plugin_name
152-
fi
148+
CC=$CC CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -trimpath -tags=goplugin${BUILD_TAG:+,$BUILD_TAG} -o $plugin_name
153149

154150
set +x
155151

0 commit comments

Comments
 (0)