Skip to content

Commit ce3d2fe

Browse files
author
Gromit
committed
Auto generated from templates by gromit
1 parent b554cf0 commit ce3d2fe

4 files changed

Lines changed: 355 additions & 26 deletions

File tree

.github/workflows/release.yml

Lines changed: 98 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ jobs:
4141
fail-fast: false
4242
matrix:
4343
golang_cross:
44-
- 1.24-bullseye
44+
- 1.24-bookworm
4545
include:
46-
- golang_cross: 1.24-bullseye
46+
- golang_cross: 1.24-bookworm
4747
goreleaser: 'ci/goreleaser/goreleaser.yml'
4848
cgo: 1
4949
rpmvers: 'el/7 el/8 el/9 amazon/2 amazon/2023'
5050
debvers: 'ubuntu/xenial ubuntu/bionic ubuntu/focal ubuntu/jammy ubuntu/noble debian/jessie debian/buster debian/bullseye debian/bookworm debian/trixie'
5151
outputs:
5252
ee_tags: ${{ steps.ci_metadata_ee.outputs.tags }}
53+
fips_tags: ${{ steps.ci_metadata_fips.outputs.tags }}
5354
std_tags: ${{ steps.ci_metadata_std.outputs.tags }}
5455
commit_author: ${{ steps.set_outputs.outputs.commit_author}}
5556
steps:
@@ -98,7 +99,7 @@ jobs:
9899
ci/bin/unlock-agent.sh
99100
git config --global url."https://${{ secrets.ORG_GH_TOKEN }}@github.com".insteadOf "https://github.com"
100101
git config --global --add safe.directory /go/src/github.com/TykTechnologies/tyk
101-
goreleaser release --clean -f ${{ matrix.goreleaser }} ${{ !startsWith(github.ref, 'refs/tags/') && ' --snapshot --skip=sign' || '' }}' | tee /tmp/build.sh
102+
goreleaser release --clean -f ${{ matrix.goreleaser }} ${{ !startsWith(github.ref, 'refs/tags/') && ' --snapshot --skip=sign,docker' || '--skip=docker' }}' | tee /tmp/build.sh
102103
chmod +x /tmp/build.sh
103104
docker run --rm --privileged -e GITHUB_TOKEN=${{ github.token }} \
104105
-e GOPRIVATE=github.com/TykTechnologies \
@@ -128,12 +129,12 @@ jobs:
128129
mask-aws-account-id: false
129130
- uses: aws-actions/amazon-ecr-login@v2
130131
id: ecr
131-
if: ${{ matrix.golang_cross == '1.24-bullseye' }}
132+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
132133
with:
133134
mask-password: 'true'
134135
- name: Docker metadata for ee CI
135136
id: ci_metadata_ee
136-
if: ${{ matrix.golang_cross == '1.24-bullseye' }}
137+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
137138
uses: docker/metadata-action@v5
138139
with:
139140
images: |
@@ -148,7 +149,7 @@ jobs:
148149
type=semver,pattern={{major}}.{{minor}},prefix=v
149150
type=semver,pattern={{version}},prefix=v
150151
- name: push ee image to CI
151-
if: ${{ matrix.golang_cross == '1.24-bullseye' }}
152+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
152153
uses: docker/build-push-action@v6
153154
with:
154155
context: "dist"
@@ -182,7 +183,7 @@ jobs:
182183
org.opencontainers.image.vendor=tyk.io
183184
org.opencontainers.image.version=${{ github.ref_name }}
184185
- name: push ee image to prod
185-
if: ${{ matrix.golang_cross == '1.24-bullseye' }}
186+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
186187
uses: docker/build-push-action@v6
187188
with:
188189
context: "dist"
@@ -197,9 +198,74 @@ jobs:
197198
labels: ${{ steps.tag_metadata_ee.outputs.labels }}
198199
build-args: |
199200
BUILD_PACKAGE_NAME=tyk-gateway-ee
201+
- name: Docker metadata for fips CI
202+
id: ci_metadata_fips
203+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
204+
uses: docker/metadata-action@v5
205+
with:
206+
images: |
207+
${{ steps.ecr.outputs.registry }}/tyk
208+
flavor: |
209+
latest=false
210+
tags: |
211+
type=ref,event=branch
212+
type=ref,event=pr
213+
type=sha,format=long
214+
type=semver,pattern={{major}},prefix=v
215+
type=semver,pattern={{major}}.{{minor}},prefix=v
216+
type=semver,pattern={{version}},prefix=v
217+
- name: push fips image to CI
218+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
219+
uses: docker/build-push-action@v6
220+
with:
221+
context: "dist"
222+
platforms: linux/amd64
223+
file: ci/Dockerfile.distroless
224+
provenance: mode=max
225+
sbom: true
226+
push: true
227+
cache-from: type=gha
228+
cache-to: type=gha,mode=max
229+
tags: ${{ steps.ci_metadata_fips.outputs.tags }}
230+
labels: ${{ steps.ci_metadata_fips.outputs.labels }}
231+
build-args: |
232+
BUILD_PACKAGE_NAME=tyk-gateway-fips
233+
- name: Docker metadata for fips tag push
234+
id: tag_metadata_fips
235+
uses: docker/metadata-action@v5
236+
with:
237+
images: |
238+
tykio/tyk-gateway
239+
flavor: |
240+
latest=false
241+
prefix=v
242+
tags: |
243+
type=semver,pattern={{major}}.{{minor}}
244+
type=semver,pattern={{version}}
245+
labels: |
246+
org.opencontainers.image.title=Tyk Gateway FIPS
247+
org.opencontainers.image.description=Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols Built with boringssl
248+
org.opencontainers.image.vendor=tyk.io
249+
org.opencontainers.image.version=${{ github.ref_name }}
250+
- name: push fips image to prod
251+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
252+
uses: docker/build-push-action@v6
253+
with:
254+
context: "dist"
255+
platforms: linux/amd64
256+
file: ci/Dockerfile.distroless
257+
provenance: mode=max
258+
sbom: true
259+
cache-from: type=gha
260+
cache-to: type=gha,mode=max
261+
push: ${{ startsWith(github.ref, 'refs/tags') }}
262+
tags: ${{ steps.tag_metadata_fips.outputs.tags }}
263+
labels: ${{ steps.tag_metadata_fips.outputs.labels }}
264+
build-args: |
265+
BUILD_PACKAGE_NAME=tyk-gateway-fips
200266
- name: Docker metadata for std CI
201267
id: ci_metadata_std
202-
if: ${{ matrix.golang_cross == '1.24-bullseye' }}
268+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
203269
uses: docker/metadata-action@v5
204270
with:
205271
images: |
@@ -214,7 +280,7 @@ jobs:
214280
type=semver,pattern={{major}}.{{minor}},prefix=v
215281
type=semver,pattern={{version}},prefix=v
216282
- name: push std image to CI
217-
if: ${{ matrix.golang_cross == '1.24-bullseye' }}
283+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
218284
uses: docker/build-push-action@v6
219285
with:
220286
context: "dist"
@@ -248,7 +314,7 @@ jobs:
248314
org.opencontainers.image.vendor=tyk.io
249315
org.opencontainers.image.version=${{ github.ref_name }}
250316
- name: push std image to prod
251-
if: ${{ matrix.golang_cross == '1.24-bullseye' }}
317+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
252318
uses: docker/build-push-action@v6
253319
with:
254320
context: "dist"
@@ -265,7 +331,7 @@ jobs:
265331
BUILD_PACKAGE_NAME=tyk-gateway
266332
- name: save deb
267333
uses: actions/upload-artifact@v4
268-
if: ${{ matrix.golang_cross == '1.24-bullseye' }}
334+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
269335
with:
270336
name: deb
271337
retention-days: 1
@@ -275,7 +341,7 @@ jobs:
275341
!dist/*fips*.deb
276342
- name: save rpm
277343
uses: actions/upload-artifact@v4
278-
if: ${{ matrix.golang_cross == '1.24-bullseye' }}
344+
if: ${{ matrix.golang_cross == '1.24-bookworm' }}
279345
with:
280346
name: rpm
281347
retention-days: 1
@@ -421,7 +487,8 @@ jobs:
421487
ARG TARGETARCH
422488
COPY tyk-gateway*_${TARGETARCH}.deb /tyk-gateway.deb
423489
RUN apt-get update && apt-get install -y curl
424-
RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-gateway/script.deb.sh | bash && apt-get install -y tyk-gateway=3.0.8
490+
RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-gateway/script.deb.sh | bash || echo "Repository setup failed, but continuing"
491+
RUN apt-get install -y tyk-gateway=3.0.8 || echo "Previous version not found, testing fresh install"
425492
RUN dpkg -i /tyk-gateway.deb
426493
427494
RUN /opt/tyk-gateway/install/setup.sh --listenport=8080 --redishost=localhost --redisport=6379 --domain=""
@@ -444,7 +511,21 @@ jobs:
444511
- name: Test the built container image with api functionality test.
445512
run: |
446513
docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.container.network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }}
447-
sleep 2
514+
echo "waiting for Tyk Gateway to initalize..."
515+
sleep 30
516+
for i in {1..10}; do
517+
if curl -s https://localhost:8080/hello > /dev/null; then
518+
echo "Gateway is ready!"
519+
break
520+
fi
521+
echo "Waiting for gateway to become available... ($i/10)"
522+
sleep 5
523+
if [ $i -eq 10 ]; then
524+
echo "Gateway failed to start within timeout"
525+
docker logs test
526+
exit 1
527+
fi
528+
done
448529
./ci/tests/api-functionality/api_test.sh
449530
sleep 2
450531
docker stop test || true
@@ -479,7 +560,8 @@ jobs:
479560
COPY tyk-gateway*.${RHELARCH}.rpm /tyk-gateway.rpm
480561
RUN command -v curl || yum install -y curl
481562
RUN command -v useradd || yum install -y shadow-utils
482-
RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-gateway/script.rpm.sh | bash && yum install -y tyk-gateway-3.0.8-1
563+
RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-gateway/script.rpm.sh | bash || echo "Repository setup failed, but continuing"
564+
RUN yum install -y tyk-gateway-3.0.8-1 || echo "Previous version not found, testing fresh install"
483565
RUN curl https://keyserver.tyk.io/tyk.io.rpm.signing.key.2020 -o tyk-gateway.key && rpm --import tyk-gateway.key
484566
RUN rpm --checksig /tyk-gateway.rpm
485567
RUN rpm -Uvh --force /tyk-gateway.rpm
@@ -502,7 +584,7 @@ jobs:
502584
tags: test-${{ matrix.distro }}-${{ matrix.arch }}
503585
load: true
504586
- name: Test the built container image with api functionality test.
505-
run: "docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.container.network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }}\nsleep 2\n./ci/tests/api-functionality/api_test.sh\nsleep 2\ndocker stop test || true \n"
587+
run: "docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.container.network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }}\necho \"waiting for Tyk Gateway to initalize...\"\nsleep 30\nfor i in {1..10}; do\n if curl -s https://localhost:8080/hello > /dev/null; then\n echo \"Gateway is ready!\"\n break\n fi\n echo \"Waiting for gateway to become available... ($i/10)\"\n sleep 5\n if [ $i -eq 10 ]; then\n echo \"Gateway failed to start within timeout\"\n docker logs test\n exit 1\n fi\ndone\n./ci/tests/api-functionality/api_test.sh\nsleep 2\ndocker stop test || true \n"
506588
release-tests:
507589
needs:
508590
- goreleaser

ci/Dockerfile.std

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ RUN apt-get update \
1313
RUN dpkg --purge --force-remove-essential curl ncurses-base || true
1414
RUN rm -fv /usr/bin/passwd /usr/sbin/adduser || true
1515

16+
# Comment this to test in dev
17+
COPY dist/${BUILD_PACKAGE_NAME}_*_${TARGETARCH}.deb /
18+
RUN dpkg -i /${BUILD_PACKAGE_NAME}_*_${TARGETARCH}.deb && find / -maxdepth 1 -name "*.deb" -delete
19+
1620
# Clean up caches, unwanted .a and .o files
1721
RUN rm -rf /root/.cache \
1822
&& apt-get -y autoremove \
1923
&& apt-get clean \
20-
&& rm -rf /usr/include/* /var/cache/apt/archives /var/lib/{apt,dpkg,cache,log} \
24+
&& rm -rf /usr/include/* /var/cache/apt/archives /var/lib/apt /var/lib/cache /var/log/* \
2125
&& find /usr/lib -type f -name '*.a' -o -name '*.o' -delete
2226

23-
# Comment this to test in dev
24-
COPY ${BUILD_PACKAGE_NAME}_*${TARGETARCH}.deb /
25-
RUN dpkg -i /${BUILD_PACKAGE_NAME}*${TARGETARCH}.deb && rm /*.deb
26-
2727
ARG PORTS
2828

2929
EXPOSE $PORTS

0 commit comments

Comments
 (0)