Skip to content

Commit

Permalink
[TT-9223] Fix GitHub actions on 4.0.14 (#5266)
Browse files Browse the repository at this point in the history
Synchronizes github actions and goreleaser configs from 4-lts into
4.0.14

---------

Co-authored-by: Tit Petric <tit@tyk.io>
  • Loading branch information
titpetric and Tit Petric authored Jul 4, 2023
1 parent 17134c3 commit 7122d61
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 55 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
git config --global url."https://${TOKEN}@github.com".insteadOf "https://github.com"
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: tyk
token: ${{ secrets.ORG_GH_TOKEN }}
Expand All @@ -45,19 +45,19 @@ jobs:
env:
TOKEN: '${{ secrets.ORG_GH_TOKEN }}'
run: |
echo "::set-output name=branch::master"
echo "branch=master" >> $GITHUB_OUTPUT
if [ ! -z "${{ github.head_ref }}" ] && git ls-remote --exit-code --heads https://${TOKEN}@github.com/TykTechnologies/tyk-automated-tests ${{ github.head_ref }}; then
echo "::set-output name=branch::${{ github.head_ref }}"
echo "branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT
fi
if [ ! -z "${{ github.base_ref }}" ] && git ls-remote --exit-code --heads https://${TOKEN}@github.com/TykTechnologies/tyk-automated-tests ${{ github.base_ref }}; then
echo "::set-output name=branch::${{ github.base_ref }}"
echo "branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT
fi
if [ ! -z "${{ github.ref }}" ] && git ls-remote --exit-code --heads https://${TOKEN}@github.com/TykTechnologies/tyk-automated-tests ${{ github.ref }}; then
echo "::set-output name=branch::${{ github.ref }}"
echo "branch=${{ github.ref }}" >> $GITHUB_OUTPUT
fi
- name: Checkout test repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: TykTechnologies/tyk-automated-tests
token: ${{ secrets.ORG_GH_TOKEN }}
Expand All @@ -69,19 +69,19 @@ jobs:
env:
TOKEN: '${{ secrets.ORG_GH_TOKEN }}'
run: |
echo "::set-output name=branch::master"
if [ ! -z "${{ github.head_ref }}" ] && git ls-remote --exit-code --heads https://${TOKEN}@github.com/TykTechnologies/tyk-analytics ${{ github.head_ref }}; then
echo "::set-output name=branch::${{ github.head_ref }}"
echo "branch=master" >> $GITHUB_OUTPUT
if [ ! -z "${{ github.head_ref }}" ] && git ls-remote --exit-code --heads https://${TOKEN}@github.com/TykTechnologies/tyk-analytics ${{ github.head_ref }}; then
echo "branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT
fi
if [ ! -z "${{ github.base_ref }}" ] && git ls-remote --exit-code --heads https://${TOKEN}@github.com/TykTechnologies/tyk-analytics ${{ github.base_ref }}; then
echo "::set-output name=branch::${{ github.base_ref }}"
if [ ! -z "${{ github.base_ref }}" ] && git ls-remote --exit-code --heads https://${TOKEN}@github.com/TykTechnologies/tyk-analytics ${{ github.base_ref }}; then
echo "branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT
fi
if [ ! -z "${{ github.ref }}" ] && git ls-remote --exit-code --heads https://${TOKEN}@github.com/TykTechnologies/tyk-analytics ${{ github.ref }}; then
echo "::set-output name=branch::${{ github.ref }}"
if [ ! -z "${{ github.ref }}" ] && git ls-remote --exit-code --heads https://${TOKEN}@github.com/TykTechnologies/tyk-analytics ${{ github.ref }}; then
echo "branch=${{ github.ref }}" >> $GITHUB_OUTPUT
fi
- name: Checkout dashboard
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: TykTechnologies/tyk-analytics
token: ${{ secrets.ORG_GH_TOKEN }}
Expand Down Expand Up @@ -133,10 +133,11 @@ jobs:
run: |
pytest
working-directory: tyk-automated-tests
timeout-minutes: 30

- name: Archive Integration tests report
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: api-test-report
path: ./tyk-automated-tests/reports/
Expand Down Expand Up @@ -177,3 +178,7 @@ jobs:
CLIENT_ID: ${{secrets.XRAY_CLIENT_ID}}
CLIENT_SECRET: ${{secrets.XRAY_CLIENT_SECRET}}
BRANCH: ${{ github.ref }}

- name: Getting docker logs on failure
if: ${{ failure() }}
run: docker-compose -f ci/ci_testing_env.yml logs
2 changes: 1 addition & 1 deletion .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout Tyk
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout Tyk
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Golang
uses: actions/setup-go@v2
Expand Down
79 changes: 45 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
strategy:
fail-fast: false
matrix:
golang_cross: [ 1.15 , 1.15-el7 ]
golang_cross: [ 1.15, 1.15-el7 ]
include:
- golang_cross: 1.15-el7
goreleaser: 'ci/goreleaser/goreleaser-el7.yml'
Expand All @@ -64,27 +64,27 @@ jobs:
git config --global url."https://${TOKEN}@github.com".insteadOf "https://github.com"
- name: Checkout of tyk
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: "Add Git safe.directory"
run: git config --global --add safe.directory $GITHUB_WORKSPACE

- uses: docker/setup-qemu-action@v1
- uses: docker/setup-qemu-action@v2

- uses: docker/setup-buildx-action@v1
- uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
if: startsWith(github.ref, 'refs/tags')
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Cloudsmith
if: startsWith(github.ref, 'refs/tags')
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: docker.tyk.io
username: ${{ secrets.CLOUDSMITH_USERNAME }}
Expand All @@ -100,7 +100,7 @@ jobs:
run: |
ci/bin/unlock-agent.sh
current_tag=${GITHUB_REF##*/}
echo "::set-output name=tag::${current_tag}"
echo "tag=${current_tag}" >> $GITHUB_OUTPUT
- name: Delete old release assets
if: startsWith(github.ref, 'refs/tags')
Expand Down Expand Up @@ -132,10 +132,10 @@ jobs:
cp -r ./* /go/src/github.com/TykTechnologies/tyk
- uses: goreleaser/goreleaser-action@v2
- uses: goreleaser/goreleaser-action@v4
with:
version: 1.18.2
args: release --rm-dist -f ${{ matrix.goreleaser }}
args: release --clean -f ${{ matrix.goreleaser }} ${{ !startsWith(github.ref, 'refs/tags/') && ' --snapshot' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CGO_ENABLED: 1
Expand All @@ -149,15 +149,15 @@ jobs:
RPMVERS: ${{ matrix.rpmvers }}
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: deb
retention-days: 1
path: |
dist/*.deb
!dist/*PAYG*.deb
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: rpm
retention-days: 1
Expand All @@ -173,12 +173,12 @@ jobs:

steps:
- name: Shallow checkout of tyk
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
terraform_wrapper: false
Expand All @@ -192,12 +192,12 @@ jobs:
eval $(terraform output -json tyk | jq -r 'to_entries[] | [.key,.value] | join("=")')
region=$(terraform output region | xargs)
[ -z "$key" -o -z "$secret" -o -z "$region" ] && exit 1
echo "::set-output name=secret::$secret"
echo "::set-output name=key::$key"
echo "::set-output name=region::$region"
echo "secret=$secret" >> $GITHUB_OUTPUT
echo "key=$key" >> $GITHUB_OUTPUT
echo "region=$region" >> $GITHUB_OUTPUT
- name: Configure AWS credentials for use
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ steps.aws-creds.outputs.key }}
aws-secret-access-key: ${{ steps.aws-creds.outputs.secret }}
Expand All @@ -207,16 +207,16 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: deb

- uses: docker/setup-qemu-action@v1
- uses: docker/setup-qemu-action@v2

- uses: docker/setup-buildx-action@v1
- uses: docker/setup-buildx-action@v2

- name: CI build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
push: true
context: "."
Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
--author 'Bender' \
--author-icon 'https://hcoop.net/~alephnull/bender/bender-arms.jpg' \
--author-link 'https://github.com/TykTechnologies/tyk-ci' \
--channel '#integration' \
--channel '#service-integration' \
--color $colour \
--fields '{"title": "Repo", "value": "${{ github.repository }}", "short": false}' \
--footer 'github-actions' \
Expand All @@ -255,7 +255,17 @@ jobs:
--title 'Failed to add new build for CD' \
--title-link 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
sbom:
needs: ci
uses: TykTechnologies/github-actions/.github/workflows/sbom.yaml@main
secrets:
TF_API_TOKEN: ${{ secrets.TF_API_TOKEN }}
DEPDASH_URL: ${{ secrets.DEPDASH_URL }}
DEPDASH_KEY: ${{ secrets.DEPDASH_KEY }}
ORG_GH_TOKEN: ${{ secrets.ORG_GH_TOKEN }}

upgrade-deb:
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: goreleaser
strategy:
Expand All @@ -271,17 +281,17 @@ jobs:
- debian:bullseye

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: deb

- uses: docker/setup-qemu-action@v1
- uses: docker/setup-qemu-action@v2

- uses: docker/setup-buildx-action@v1
- uses: docker/setup-buildx-action@v2

- name: generate dockerfile
run: |
Expand All @@ -301,7 +311,7 @@ jobs:
' > Dockerfile
- name: install on ${{ matrix.distro }}
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: "."
platforms: linux/${{ matrix.arch }}
Expand All @@ -315,6 +325,7 @@ jobs:
docker run --rm test-${{ matrix.distro }}-${{ matrix.arch }}
upgrade-rpm:
if: startsWith(github.ref, 'refs/tags')
needs: goreleaser
runs-on: ubuntu-latest
strategy:
Expand All @@ -325,15 +336,15 @@ jobs:
- ubi8/ubi

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: rpm

- uses: docker/setup-buildx-action@v1
- uses: docker/setup-buildx-action@v2

- name: generate dockerfile
run: |
Expand All @@ -354,7 +365,7 @@ jobs:
' > Dockerfile
- name: install on ${{ matrix.distro }}
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: "."
file: Dockerfile
Expand All @@ -373,7 +384,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1

Expand Down Expand Up @@ -422,11 +433,11 @@ jobs:

steps:
- name: Checkout tyk
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: rpm
path: aws
Expand Down
6 changes: 2 additions & 4 deletions ci/goreleaser/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ dockers:
goos: linux
dockerfile: ci/Dockerfile.std
extra_files:
- "ci/install/"
- "ci/"
- "README.md"

- "LICENSE.md"
- "apps/app_sample.json"
- "templates"
Expand All @@ -126,9 +125,8 @@ dockers:
goos: linux
dockerfile: ci/Dockerfile.slim
extra_files:
- "ci/install/"
- "ci/"
- "README.md"

- "LICENSE.md"
- "apps/app_sample.json"
- "templates"
Expand Down

0 comments on commit 7122d61

Please sign in to comment.