@@ -119,6 +119,40 @@ jobs:
119119 key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
120120 restore-keys : |
121121 ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
122+ - name : Validate Go version
123+ run : |
124+ GO_VERSION_STR=$(docker run --rm tykio/golang-cross:${{ matrix.golang_cross }} go version 2>&1 || true)
125+ if [[ ! "$GO_VERSION_STR" =~ go[0-9]+ ]]; then
126+ echo "::warning::Could not determine Go version from container: $GO_VERSION_STR"
127+ exit 1
128+ fi
129+ GO_VERSION=$(echo "$GO_VERSION_STR" | awk '{print $3}' | sed 's/^go//')
130+ echo "Go version in container: $GO_VERSION"
131+ MINOR_VERSION=$(echo "$GO_VERSION" | cut -d. -f1,2)
132+ echo "Minor version: $MINOR_VERSION"
133+
134+ # Fetch latest patches
135+ LATEST_PATCH_STR=$(curl -s 'https://go.dev/dl/?mode=json&include=all' || true)
136+ if [ -z "$LATEST_PATCH_STR" ]; then
137+ echo "::warning::Could not fetch Go releases from API. Skipping validation."
138+ exit 0
139+ fi
140+ LATEST_PATCH=$(echo "$LATEST_PATCH_STR" | jq -r --arg minor "go${MINOR_VERSION}" '.[] | select(.stable == true and (.version | startswith($minor + ".") or . == $minor)) | .version' | head -n 1 | sed 's/^go//')
141+
142+ if [ -n "$LATEST_PATCH" ]; then
143+ echo "Latest patch version for Go $MINOR_VERSION is $LATEST_PATCH"
144+ if [ "$GO_VERSION" != "$LATEST_PATCH" ]; then
145+ echo "::error::Go version validation failed!"
146+ echo "Used version: $GO_VERSION (in tykio/golang-cross:${{ matrix.golang_cross }})"
147+ echo "Latest patch: $LATEST_PATCH"
148+ echo "Please update the buildenv Go version to the latest patch version."
149+ exit 1
150+ else
151+ echo "Go version is up to date: $GO_VERSION"
152+ fi
153+ else
154+ echo "::warning::Could not determine latest patch version for Go $MINOR_VERSION from API. Skipping validation."
155+ fi
122156 - name : Build
123157 env :
124158 NFPM_PASSPHRASE : ${{ secrets.SIGNING_KEY_PASSPHRASE }}
@@ -129,7 +163,7 @@ jobs:
129163 ci/bin/unlock-agent.sh
130164 git config --global url."https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/".insteadOf "https://github.com/"
131165 git config --global --add safe.directory /go/src/github.com/TykTechnologies/tyk
132- goreleaser release --clean -f ${{ matrix.goreleaser }} ${{ !startsWith(github.ref, 'refs/tags/') && ' --snapshot --skip=sign,docker' || '--skip=docker' }}' | tee /tmp/build.sh
166+ goreleaser release --timeout 120m -- clean -f ${{ matrix.goreleaser }} ${{ !startsWith(github.ref, 'refs/tags/') && ' --snapshot --skip=sign,docker' || '--skip=docker' }}' | tee /tmp/build.sh
133167 chmod +x /tmp/build.sh
134168 docker run --rm --privileged -e GITHUB_TOKEN=${{ github.token }} \
135169 -e GOPRIVATE=github.com/TykTechnologies \
@@ -150,6 +184,15 @@ jobs:
150184 -v /tmp/build.sh:/tmp/build.sh \
151185 -w /go/src/github.com/TykTechnologies/tyk \
152186 tykio/golang-cross:${{ matrix.golang_cross }} /tmp/build.sh
187+ - name : Install Docker Scout CLI
188+ if : ${{ matrix.golang_cross == '1.25-bullseye' && startsWith(github.ref, 'refs/tags') }}
189+ run : |
190+ mkdir -p ~/.docker/cli-plugins
191+ curl --proto '=https' --tlsv1.2 -fsSL https://github.com/docker/scout-cli/releases/download/v1.22.0/docker-scout_1.22.0_linux_amd64.tar.gz -o /tmp/scout.tar.gz
192+ curl --proto '=https' --tlsv1.2 -fsSL https://github.com/docker/scout-cli/releases/download/v1.22.0/docker-scout_1.22.0_checksums.txt -o /tmp/scout_checksums.txt
193+ grep "docker-scout_1.22.0_linux_amd64.tar.gz" /tmp/scout_checksums.txt | awk '{print $1 " /tmp/scout.tar.gz"}' | sha256sum -c -
194+ tar -xzf /tmp/scout.tar.gz -C ~/.docker/cli-plugins/ docker-scout
195+ chmod +x ~/.docker/cli-plugins/docker-scout
153196 - name : Docker metadata for ee CI
154197 id : ci_metadata_ee
155198 if : ${{ matrix.golang_cross == '1.25-bullseye' }}
@@ -307,9 +350,6 @@ jobs:
307350 - name : Attach base image VEX to ee
308351 if : ${{ matrix.golang_cross == '1.25-bullseye' && startsWith(github.ref, 'refs/tags') }}
309352 run : |
310- # Install Docker Scout CLI
311- 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
312- # Extract VEX from the DHI base image
313353 docker scout vex get --org tykio -o /tmp/ee-vex.json tykio/dhi-busybox:1.37-fips || true
314354 if [ -f /tmp/ee-vex.json ]; then
315355 cosign attest --yes --type openvex \
@@ -475,9 +515,6 @@ jobs:
475515 - name : Attach base image VEX to fips
476516 if : ${{ matrix.golang_cross == '1.25-bullseye' && startsWith(github.ref, 'refs/tags') }}
477517 run : |
478- # Install Docker Scout CLI
479- 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
480- # Extract VEX from the DHI base image
481518 docker scout vex get --org tykio -o /tmp/fips-vex.json tykio/dhi-busybox:1.37-fips || true
482519 if [ -f /tmp/fips-vex.json ]; then
483520 cosign attest --yes --type openvex \
@@ -986,7 +1023,7 @@ jobs:
9861023 git config --global --add safe.directory /go/src/github.com/TykTechnologies/tyk-analytics
9871024
9881025 # Build packages for current platform (GOOS and GOARCH are set via docker -e)
989- goreleaser release --clean -f ci/goreleaser/goreleaser.yml --snapshot --skip=sign,docker
1026+ goreleaser release --timeout 120m -- clean -f ci/goreleaser/goreleaser.yml --snapshot --skip=sign,docker
9901027 EOF
9911028
9921029 chmod +x /tmp/build-dashboard.sh
@@ -1201,135 +1238,23 @@ jobs:
12011238 outputs :
12021239 deb : ${{ steps.params.outputs.deb }}
12031240 rpm : ${{ steps.params.outputs.rpm }}
1241+ rpm_amd64 : ${{ steps.params.outputs.rpm_amd64 }}
12041242 steps :
1205- - name : set params
1243+ - name : Set distro matrix
1244+ uses : TykTechnologies/github-actions/.github/actions/tests/distro-matrix@production
12061245 id : params
1207- shell : bash
1208- env :
1209- # startsWith covers pull_request_target too
1210- BASE_REF : ${{startsWith(github.event_name, 'pull_request') && github.base_ref || github.ref_name}}
1211- run : |
1212- set -eo pipefail
1213- curl -s --retry 5 --retry-delay 10 --fail-with-body "http://tui.internal.dev.tyk.technology/v2/$VARIATION/tyk/$BASE_REF/${{ github.event_name}}/api/Distros.gho" | tee -a "$GITHUB_OUTPUT"
1214- if ! [[ $VARIATION =~ prod ]];then
1215- echo "::warning file=.github/workflows/release.yml,line=24,col=1,endColumn=8::Using test variation"
1216- fi
1217- upgrade-deb :
1218- services :
1219- httpbin.org :
1220- image : kennethreitz/httpbin
1221- runs-on : ${{ vars.DEFAULT_RUNNER }}
1246+ upgrade-tests :
12221247 needs :
12231248 - test-controller-distros
1224- strategy :
1225- fail-fast : true
1226- matrix :
1227- arch :
1228- - amd64
1229- - arm64
1230- distro : ${{ fromJson(needs.test-controller-distros.outputs.deb) }}
1231- steps :
1232- - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1233- with :
1234- fetch-depth : 1
1235- sparse-checkout : ci
1236- - uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
1237- with :
1238- name : deb
1239- - uses : docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
1240- - uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
1241- - name : generate dockerfile
1242- run : |
1243- echo 'FROM ${{ matrix.distro }}
1244- ARG TARGETARCH
1245- COPY tyk-gateway*_${TARGETARCH}.deb /tyk-gateway.deb
1246- RUN apt-get update && apt-get install -y curl
1247- # TODO(security): curl|bash - consider fetching script and verifying checksum before execution
1248- RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-gateway/script.deb.sh | bash || echo "Repository setup failed, but continuing" # SECURITY: accepted risk, see TODO above
1249- RUN apt-get install -y tyk-gateway=3.0.8 || echo "Previous version not found, testing fresh install"
1250- RUN dpkg -i /tyk-gateway.deb
1251-
1252- RUN /opt/tyk-gateway/install/setup.sh --listenport=8080 --redishost=localhost --redisport=6379 --domain=""
1253- COPY ci/tests/api-functionality/data/api.json /opt/tyk-gateway/apps/
1254- CMD ["/opt/tyk-gateway/tyk", "--conf", "/opt/tyk-gateway/tyk.conf"]
1255- ' | tee Dockerfile
1256- - name : install on ${{ matrix.distro }}
1257- uses : docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
1258- with :
1259- context : " ."
1260- platforms : linux/${{ matrix.arch }}
1261- build-args : |
1262- RHELARCH=${{ startsWith(matrix.arch, 'arm64') && 'aarch64' || 'x86_64' }}
1263- cache-from : type=gha
1264- cache-to : type=gha,mode=max
1265- file : Dockerfile
1266- push : false
1267- tags : test-${{ matrix.distro }}-${{ matrix.arch }}
1268- load : true
1269- - name : Test the built container image with api functionality test.
1270- run : |
1271- docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.services['httpbin.org'].network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }}
1272- sleep 2
1273- ./ci/tests/api-functionality/api_test.sh
1274- sleep 2
1275- docker stop test || true
1276- upgrade-rpm :
1277- services :
1278- httpbin.org :
1279- image : kennethreitz/httpbin
1280- runs-on : ${{ vars.DEFAULT_RUNNER }}
1281- needs :
1282- - test-controller-distros
1283- strategy :
1284- fail-fast : true
1285- matrix :
1286- arch :
1287- - amd64
1288- - arm64
1289- distro : ${{ fromJson(needs.test-controller-distros.outputs.rpm) }}
1290- steps :
1291- - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1292- with :
1293- fetch-depth : 1
1294- sparse-checkout : ci
1295- - uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
1296- with :
1297- name : rpm
1298- - uses : docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
1299- - uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
1300- - name : generate dockerfile
1301- run : |
1302- echo 'FROM ${{ matrix.distro }}
1303- ARG RHELARCH
1304- COPY tyk-gateway*.${RHELARCH}.rpm /tyk-gateway.rpm
1305- RUN command -v curl || yum install -y curl
1306- RUN command -v useradd || yum install -y shadow-utils
1307- # TODO(security): curl|bash - consider fetching script and verifying checksum before execution
1308- RUN curl -fsSL https://packagecloud.io/install/repositories/tyk/tyk-gateway/script.rpm.sh | bash || echo "Repository setup failed, but continuing" # SECURITY: accepted risk, see TODO above
1309- RUN yum install -y tyk-gateway-3.0.8-1 || echo "Previous version not found, testing fresh install"
1310- RUN curl https://keyserver.tyk.io/tyk.io.rpm.signing.key.2020 -o tyk-gateway.key && rpm --import tyk-gateway.key
1311- RUN rpm --checksig /tyk-gateway.rpm
1312- RUN rpm -Uvh --force /tyk-gateway.rpm
1313-
1314- RUN /opt/tyk-gateway/install/setup.sh --listenport=8080 --redishost=localhost --redisport=6379 --domain=""
1315- COPY ci/tests/api-functionality/data/api.json /opt/tyk-gateway/apps/
1316- CMD ["/opt/tyk-gateway/tyk", "--conf", "/opt/tyk-gateway/tyk.conf"]
1317- ' | tee Dockerfile
1318- - name : install on ${{ matrix.distro }}
1319- uses : docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
1320- with :
1321- context : " ."
1322- platforms : linux/${{ matrix.arch }}
1323- build-args : |
1324- RHELARCH=${{ startsWith(matrix.arch, 'arm64') && 'aarch64' || 'x86_64' }}
1325- cache-from : type=gha
1326- cache-to : type=gha,mode=max
1327- file : Dockerfile
1328- push : false
1329- tags : test-${{ matrix.distro }}-${{ matrix.arch }}
1330- load : true
1331- - name : Test the built container image with api functionality test.
1332- run : " docker run -d -p8080:8080 --name=test --platform linux/${{ matrix.arch }} --network ${{ job.services['httpbin.org'].network }} --rm test-${{ matrix.distro }}-${{ matrix.arch }}\n sleep 2\n ./ci/tests/api-functionality/api_test.sh\n sleep 2\n docker stop test || true \n "
1249+ uses : TykTechnologies/github-actions/.github/workflows/upgrade-tests.yml@production
1250+ with :
1251+ deb : ${{ needs.test-controller-distros.outputs.deb }}
1252+ rpm : ${{ needs.test-controller-distros.outputs.rpm }}
1253+ rpm_amd64 : ${{ needs.test-controller-distros.outputs.rpm_amd64 }}
1254+ package_name : tyk-gateway
1255+ upgrade_repo : tyk-gateway
1256+ runs_on : ${{ vars.DEFAULT_RUNNER }}
1257+ run_gateway_tests : true
13331258 release-tests :
13341259 needs :
13351260 - goreleaser
0 commit comments