Skip to content

Commit

Permalink
Merge branch 'master' into feat/FTI-5861-AI-Metrics-Prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineJac authored Jun 17, 2024
2 parents ce19b11 + 3c0aa60 commit 7a1e261
Show file tree
Hide file tree
Showing 70 changed files with 2,595 additions and 337 deletions.
2 changes: 1 addition & 1 deletion .github/matrix-commitly.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# please see matrix-full.yml for meaning of each field
build-packages:
- label: ubuntu-22.04
os: ubuntu-22.04
image: ubuntu:22.04
package: deb
check-manifest-suite: ubuntu-22.04-amd64

Expand Down
2 changes: 2 additions & 0 deletions .github/matrix-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ build-packages:
package: deb
check-manifest-suite: ubuntu-20.04-amd64
- label: ubuntu-22.04
image: ubuntu:22.04
package: deb
check-manifest-suite: ubuntu-22.04-amd64
- label: ubuntu-22.04-arm64
image: ubuntu:22.04
package: deb
bazel-args: --platforms=//:generic-crossbuild-aarch64
check-manifest-suite: ubuntu-22.04-arm64
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ jobs:
run: |
echo FAILED_TEST_FILES_FILE=failed-tests.json >> $GITHUB_ENV
echo TEST_FILE_RUNTIME_FILE=test-runtime.json >> $GITHUB_ENV
echo SPEC_ERRLOG_CACHE_DIR=/tmp/${{ github.run_id }}/build_test/${{ matrix.runner }} >> $GITHUB_ENV
- name: Build & install dependencies
run: |
Expand Down Expand Up @@ -290,13 +291,22 @@ jobs:
DD_CIVISIBILITY_AGENTLESS_ENABLED: true
DD_TRACE_GIT_METADATA_ENABLED: true
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
SPEC_ERRLOG_CACHE_DIR: ${{ env.SPEC_ERRLOG_CACHE_DIR }}
uses: Kong/gateway-test-scheduler/runner@69f0c2a562ac44fc3650b8bfa62106b34094b5ce # v3
with:
tests-to-run-file: test-chunk.${{ matrix.runner }}.json
failed-test-files-file: ${{ env.FAILED_TEST_FILES_FILE }}
test-file-runtime-file: ${{ env.TEST_FILE_RUNTIME_FILE }}
setup-venv-path: ${{ env.BUILD_ROOT }}

- name: Upload error logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: busted-test-errlogs-${{ matrix.runner }}
path: ${{ env.SPEC_ERRLOG_CACHE_DIR }}
retention-days: 1

- name: Upload test rerun information
if: always()
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -361,6 +371,10 @@ jobs:
$CPAN_DOWNLOAD/cpanm --notest --local-lib=$HOME/perl5 local::lib && eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib)
$CPAN_DOWNLOAD/cpanm --notest Test::Nginx
- name: Generate environment variables
run: |
echo SPEC_ERRLOG_CACHE_DIR=/tmp/${{ github.run_id }}/PDK_test >> $GITHUB_ENV
- name: Tests
env:
TEST_SUITE: pdk
Expand All @@ -372,6 +386,14 @@ jobs:
eval $(perl -I $HOME/perl5/lib/perl5/ -Mlocal::lib)
prove -I. -r t
- name: Upload error logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: PDK-test-errlogs
path: ${{ env.SPEC_ERRLOG_CACHE_DIR }}
retention-days: 1

- name: Archive coverage stats file
uses: actions/upload-artifact@v3
if: ${{ always() && (inputs.coverage == true || github.event_name == 'schedule') }}
Expand Down
114 changes: 114 additions & 0 deletions .github/workflows/deck-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Gateway decK Integration Tests

on:
pull_request:
paths:
- 'kong/db/schema/**/*.lua'
- 'kong/**/schema.lua'
- 'kong/plugins/**/daos.lua'
- 'kong/db/dao/*.lua'
- 'kong/api/**/*.lua'

permissions:
pull-requests: write

env:
LIBRARY_PREFIX: /usr/local/kong
TEST_RESULTS_XML_OUTPUT: test-results
BUILD_ROOT: ${{ github.workspace }}/bazel-bin/build

# cancel previous runs if new commits are pushed to the PR
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
uses: ./.github/workflows/build.yml
with:
relative-build-root: bazel-bin/build

deck-integration:
name: Gateway decK integration tests
runs-on: ubuntu-22.04
needs: build
timeout-minutes: 5

services:
postgres:
image: postgres:13
env:
POSTGRES_USER: kong
POSTGRES_DB: kong
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 8

steps:
- name: Install packages
run: sudo apt update && sudo apt install -y libyaml-dev valgrind libprotobuf-dev libpam-dev postgresql-client jq

- name: Checkout Kong source code
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.GHA_KONG_BOT_READ_TOKEN }}

- name: Lookup build cache
id: cache-deps
uses: actions/cache@v4
with:
path: ${{ env.BUILD_ROOT }}
key: ${{ needs.build.outputs.cache-key }}

- name: Install Kong dev
run: make dev

- name: Tests
id: deck_tests
continue-on-error: true
env:
KONG_TEST_PG_DATABASE: kong
KONG_TEST_PG_USER: kong
KONG_TEST_DATABASE: postgres
run: |
mkdir $TEST_RESULTS_XML_OUTPUT
source ${{ env.BUILD_ROOT }}/kong-dev-venv.sh
bin/busted spec/06-third-party/01-deck -o hjtest -Xoutput $(realpath $TEST_RESULTS_XML_OUTPUT)/report.xml -v
- name: Find review if exists
id: find-review
uses: actions/github-script@v7
with:
result-encoding: json
retries: 3
script: |
const reviews = await github.paginate(github.rest.pulls.listReviews, {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
const botReview = reviews.reverse().find(review => {
return review.user.login === "github-actions[bot]" && review.body.includes("decK integration tests");
});
if (botReview && botReview.state === "CHANGES_REQUESTED") {
return { "review_id": botReview.id };
} else {
return { "review_id": "" };
}
- name: Request changes if failures are detected
if: ${{ fromJson(steps.find-review.outputs.result).review_id == '' && steps.deck_tests.outcome != 'success' }}
uses: actions/github-script@v7
with:
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
event: 'REQUEST_CHANGES',
body: `## decK integration tests\n\n:warning: failure detected. Please check [the workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.`
})
Loading

0 comments on commit 7a1e261

Please sign in to comment.