Skip to content

Commit 3f6adad

Browse files
Razeen-Abdal-RahmanGromitbuger
authored andcommitted
Gromit sync with tyk repo TT-16131 (#7542)
## Description Carry over changes from gromit into the tyk repo ## Related Issue [TT-16131](https://tyktech.atlassian.net/browse/TT-16131) ## Motivation and Context Ensure the tyk repo is in sync as the buildenv for this repo will continue to be `1.24-bullseye` with the addition of a manual pull of the latest go version, this is done upstream when the image is built. This PR carries over other changes from gromit ensuring everything is in sync after this change. [TT-16131]: https://tyktech.atlassian.net/browse/TT-16131?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: Gromit <policy@gromit> Co-authored-by: Leonid Bugaev <leonsbox@gmail.com> (cherry picked from commit 007b66a)
1 parent dd4e595 commit 3f6adad

4 files changed

Lines changed: 81 additions & 13 deletions

File tree

.github/workflows/release.yml

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
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 \
@@ -197,6 +198,71 @@ 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-bullseye' }}
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-bullseye' }}
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-fips
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-bullseye' }}
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
202268
if: ${{ matrix.golang_cross == '1.24-bullseye' }}
@@ -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=""
@@ -479,7 +546,8 @@ jobs:
479546
COPY tyk-gateway*.${RHELARCH}.rpm /tyk-gateway.rpm
480547
RUN command -v curl || yum install -y curl
481548
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
549+
RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-gateway/script.rpm.sh | bash || echo "Repository setup failed, but continuing"
550+
RUN yum install -y tyk-gateway-3.0.8-1 || echo "Previous version not found, testing fresh install"
483551
RUN curl https://keyserver.tyk.io/tyk.io.rpm.signing.key.2020 -o tyk-gateway.key && rpm --import tyk-gateway.key
484552
RUN rpm --checksig /tyk-gateway.rpm
485553
RUN rpm -Uvh --force /tyk-gateway.rpm

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

ci/goreleaser/goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ builds:
6363
env:
6464
- NOP=nop # ignore this, it is jsut to avoid a complex conditional in the templates
6565
- CC=gcc
66-
- $env
66+
- GOEXPERIMENT=boringcrypto
6767
ldflags:
6868
- -X github.com/TykTechnologies/tyk/internal/build.Version={{.Version}}
6969
- -X github.com/TykTechnologies/tyk/internal/build.Commit={{.FullCommit}}

ci/install/post_install.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ fi
1818
cleanup() {
1919
# After installing, remove files that were not needed on this platform / system
2020
if [ "${use_systemctl}" = "True" ]; then
21-
rm -f /lib/systemd/system/tyk-gateway.service
22-
else
2321
rm -f /etc/init.d/tyk-gateway
22+
else
23+
rm -f /lib/systemd/system/tyk-gateway.service
2424
fi
2525
}
2626

@@ -39,8 +39,8 @@ restoreServices() {
3939
setupOwnership() {
4040
printf "\033[32m Post Install of the install directory ownership and permissions\033[0m\n"
4141
[ "${change_ownership}" = "True" ] && chown -R tyk:tyk /opt/tyk-gateway
42-
# Config file should never be world-readable
43-
chmod 660 /opt/tyk-gateway/tyk.conf
42+
# Config file should never be world-readable (only if it exists)
43+
[ -f /opt/tyk-gateway/tyk.conf ] && chmod 660 /opt/tyk-gateway/tyk.conf
4444
}
4545

4646
cleanInstall() {

0 commit comments

Comments
 (0)