Skip to content

Commit

Permalink
Auto generated from templates by gromit
Browse files Browse the repository at this point in the history
  • Loading branch information
Gromit authored and ermirizio committed Nov 16, 2023
1 parent d7dfaa4 commit 67527c0
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Generated by: gromit policy
# Generated on: Fri Oct 27 04:05:19 UTC 2023
# Generated on: Tue Nov 14 18:48:18 UTC 2023

version: 2
updates:
Expand Down
203 changes: 201 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated by: gromit policy
# Generated on: Fri Oct 27 04:05:19 UTC 2023
# Generated on: Tue Nov 14 18:48:18 UTC 2023

# Distribution channels covered by this workflow
# - Ubuntu and Debian
Expand Down Expand Up @@ -154,6 +154,7 @@ jobs:
done
- uses: actions/upload-artifact@v3
if: ${{ matrix.golang_cross == '1.19-bullseye' }}
with:
name: deb
retention-days: 1
Expand All @@ -162,13 +163,211 @@ jobs:
!dist/*PAYG*.deb
- uses: actions/upload-artifact@v3
if: ${{ matrix.golang_cross == '1.19-bullseye' }}
with:
name: rpm
retention-days: 1
path: |
dist/*.rpm
!dist/*PAYG*.rpm
!dist/*PAYG*.rpm
api-tests:
needs: goreleaser
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
strategy:
fail-fast: false
matrix:
conf: [ "sha256", "murmur64" ]
db: [ "mongo44", "postgres15" ]
include:
- db: postgres15
conf: "sha256"
markers: "and not sql"
msgid: "1"
- db: postgres15
conf: "murmur64"
markers: "and not sql"
msgid: "2"
- db: mongo44
conf: "sha256"
msgid: "3"
- db: mongo44
conf: "murmur64"
msgid: "4"
outputs:
api_test_result: ${{ steps.test_result.outputs.pytest_run }}

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

- name: Checkout of tyk-automated-tests
uses: actions/checkout@v3
with:
repository: TykTechnologies/tyk-automated-tests
token: ${{ secrets.ORG_GH_TOKEN }}
ref: ${{ startsWith(github.ref_name, 'release-') && github.ref_name || 'master' }}
path: tyk-automated-tests

- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::754489498669:role/ecr_rw_tyk
role-session-name: cipush
aws-region: eu-central-1

- id: ecr
uses: aws-actions/amazon-ecr-login@v1
with:
mask-password: 'true'

# Only ${{ github.actor }} has access
# See https://github.com/mxschmitt/action-tmate#use-registered-public-ssh-keys
- name: Setup tmate session only in debug mode
uses: mxschmitt/action-tmate@v3
if: ${{ runner.debug == '1' }}
with:
detached: true
limit-access-to-actor: true

- name: env up
shell: bash
working-directory: tyk-automated-tests/ci/auto
id: env_up
env:
t: ${{ needs.goreleaser.outputs.tags }}
pull_policy: 'if_not_present'
# gw and dash use the same branch names
gw_dash_image_tag: ${{ ( (github.repository == 'TykTechnologies/tyk' || github.repository == 'TykTechnologies/tyk-analytics') && startsWith(github.ref_name, 'release-') ) && github.ref_name || 'master' }}
pump_image_tag: ${{ ( github.repository == 'TykTechnologies/tyk-pump' && startsWith(github.ref_name, 'release-') ) && github.ref_name || 'master' }}
sink_image_tag: ${{ ( github.repository == 'TykTechnologies/tyk-sink' && startsWith(github.ref_name, 'release-') ) && github.ref_name || 'master' }}
GH_TOKEN: ${{ secrets.ORG_GH_TOKEN }}
TYK_DB_LICENSEKEY: ${{ secrets.DASH_LICENSE }}
TYK_MDCB_LICENSE: ${{ secrets.MDCB_LICENSE }}
run: |
echo CI tags: $t
tags=($t)
echo First tag: ${tags[0]}
# Start customising the env
echo "registry=${{ steps.ecr.outputs.registry }}
tyk_image=\${registry}/tyk:${gw_dash_image_tag}
tyk_alfa_image=\${registry}/tyk:${gw_dash_image_tag}
tyk_beta_image=\${registry}/tyk:${gw_dash_image_tag}
tyk_analytics_image=\${registry}/tyk-analytics:${gw_dash_image_tag}
tyk_sink_image=\${registry}/tyk-sink:${sink_image_tag}
tyk_pump_image=\${registry}/tyk-pump:${pump_image_tag}
# override default above with just built tag
pump_image_tag=${tags[0]}
# base dir for config files
confs_dir=./pro-ha
# pick database to use
env_file=local-${{ matrix.db }}.env
" > versions.env
# Add Tyk component config variations to $env_file
cat confs/${{ matrix.conf }}.env >> local-${{ matrix.db }}.env
# bring up env, the project name is important
docker compose -p auto -f pro-ha.yml -f deps_pro-ha.yml -f ${{ matrix.db }}.yml --env-file versions.env --profile master-datacenter up --quiet-pull -d
./dash-bootstrap.sh http://localhost:3000
docker compose -p auto -f pro-ha.yml -f deps_pro-ha.yml -f ${{ matrix.db }}.yml --env-file versions.env --profile slave-datacenter up --quiet-pull -d
- name: Run tests
working-directory: tyk-automated-tests/ci/auto
run: |
docker run --rm --network auto_default --env-file pytest.env \
${{ steps.ecr.outputs.registry }}/tyk-automated-tests:${{ startsWith(github.ref_name, 'release-') && github.ref_name || 'master' }} \
pytest -c pytest_ci.ini --ci -m "not local and not dind ${{ matrix.markers }}"
- name: Set test result
id: test_result
if: always() && steps.test_execution.outcome != 'success'
run: echo "pytest_run=${{ steps.test_execution.outcome }}" >> $GITHUB_OUTPUT

- name: Archive Integration tests report
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: api-test-report
path: ${{ github.workspace }}/reports

- name: Fetch commit author
if: ${{ steps.test_execution.outcome != 'success' && !github.event.pull_request.draft }}
run: echo "GIT_USER_EMAIL=$(git show -s --format='%ae' HEAD)" >> $GITHUB_ENV

- name: Fetch slack user
if: ${{ steps.test_execution.outcome != 'success' && !github.event.pull_request.draft }}
id: fetch_slack_user
uses: TykTechnologies/github-actions/.github/actions/github-to-slack@main
with:
github_email: ${{ env.GIT_USER_EMAIL }}

- name: Notify slack
if: ${{ steps.test_execution.outcome != 'success' && !github.event.pull_request.draft }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.API_TEST_ALERT_SLACK_WEBHOOK }}
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: "Result: ${{ steps.test_execution.outcome }}"
SLACK_USERNAME: API INTEGRATION TESTS
SLACK_MESSAGE: "*Test*: ${{ matrix.db }}-${{ matrix.conf }}, *Author*: ${{ steps.fetch_slack_user.outputs.slack-user-name }}"
SLACK_FOOTER: "<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|SEE EXECUTION DETAILS HERE>"

- name: Comment on PR
if: ${{ always() && !github.event.pull_request.draft }}
uses: mshick/add-pr-comment@v2
with:
message: |
**API tests result - ${{ matrix.db }}-${{ matrix.conf }} env: ${{ steps.test_execution.outcome }}** ${{ env.STATUS }}
Branch used: ${{ github.ref }}
Commit: ${{ github.event.after }} ${{ github.event.commits[0].message }}
Triggered by: ${{ github.event_name }} (@${{ github.actor }})
[Execution page](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
repo-token: ${{ secrets.ORG_GH_TOKEN }}
message-id: ${{ matrix.msgid }}
env:
STATUS: "${{ steps.test_execution.outcome == 'success' && ':white_check_mark:' || ':no_entry_sign:' }}"

- name: Getting gateway logs on failure
if: ${{ failure() }}
run: docker logs tyk

- name: Getting dashboard logs on failure
if: ${{ failure() }}
run: docker logs tyk-analytics

xray:
needs: api-tests
runs-on: ubuntu-latest
if: always() && github.event_name == 'push'

steps:
- name: Checkout of tyk-automated-tests
uses: actions/checkout@v3
with:
repository: TykTechnologies/tyk-automated-tests
token: ${{ secrets.ORG_GH_TOKEN }}
ref: ${{ startsWith(github.ref_name, 'release-') && github.ref_name || 'master' }}
path: tyk-automated-tests

- name: Xray update
run: |
./update_xray.sh
working-directory: tyk-automated-tests
env:




TEST: "QA-1307"
STATUS: ${{ needs.api-tests.outputs.api_test_result || 'success' }}
CLIENT_ID: ${{secrets.XRAY_CLIENT_ID}}
CLIENT_SECRET: ${{secrets.XRAY_CLIENT_SECRET}}
BRANCH: ${{ github.ref }}
# TODO: PR comment, using just one comment and updating, not a new comment each time

upgrade-deb:
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile.std
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated by: gromit policy
# Generated on: Fri Oct 27 04:05:19 UTC 2023
# Generated on: Tue Nov 14 18:48:18 UTC 2023

FROM debian:bullseye-slim
ARG TARGETARCH
Expand Down
2 changes: 1 addition & 1 deletion ci/aws/byol.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Generated by: gromit policy
# Generated on: Fri Oct 27 04:05:19 UTC 2023
# Generated on: Tue Nov 14 18:48:18 UTC 2023

packer {
required_plugins {
Expand Down
2 changes: 1 addition & 1 deletion ci/goreleaser/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated by: gromit policy
# Generated on: Fri Oct 27 04:05:19 UTC 2023
# Generated on: Tue Nov 14 18:48:18 UTC 2023

# Check the documentation at http://goreleaser.com
# This project needs CGO_ENABLED=1 and the cross-compiler toolchains for
Expand Down
2 changes: 1 addition & 1 deletion ci/install/before_install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Generated by: gromit policy
# Generated on: Fri Oct 27 04:05:19 UTC 2023
# Generated on: Tue Nov 14 18:48:18 UTC 2023

echo "Creating user and group..."
GROUPNAME="tyk"
Expand Down
2 changes: 1 addition & 1 deletion ci/install/post_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


# Generated by: gromit policy
# Generated on: Fri Oct 27 04:05:19 UTC 2023
# Generated on: Tue Nov 14 18:48:18 UTC 2023

# If "True" the install directory ownership will be changed to "tyk:tyk"
change_ownership="True"
Expand Down
2 changes: 1 addition & 1 deletion ci/install/post_remove.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Generated by: gromit policy
# Generated on: Fri Oct 27 04:05:19 UTC 2023
# Generated on: Tue Nov 14 18:48:18 UTC 2023


cleanRemove() {
Expand Down
2 changes: 1 addition & 1 deletion ci/install/post_trans.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Generated by: gromit policy
# Generated on: Fri Oct 27 04:05:19 UTC 2023
# Generated on: Tue Nov 14 18:48:18 UTC 2023

if command -V systemctl >/dev/null 2>&1; then
if [ ! -f /lib/systemd/system/tyk-pump.service ]; then
Expand Down

0 comments on commit 67527c0

Please sign in to comment.