From 0541cbe9b5d05650da00b27464ad45519b933727 Mon Sep 17 00:00:00 2001 From: Radek Scheibinger Date: Wed, 11 Dec 2024 13:20:31 +0100 Subject: [PATCH 1/7] Integration test workflow to test ccip-v2 in CRIB --- .../crib-ccip-v2-integration-test.yml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .github/workflows/crib-ccip-v2-integration-test.yml diff --git a/.github/workflows/crib-ccip-v2-integration-test.yml b/.github/workflows/crib-ccip-v2-integration-test.yml new file mode 100644 index 00000000000..4e1b68bba2b --- /dev/null +++ b/.github/workflows/crib-ccip-v2-integration-test.yml @@ -0,0 +1,87 @@ +name: CRIB CCIP-v2 Integration Tests +on: + pull_request: + paths: + - ".github/workflows/crib-ccip-v2-integration-test.yml" + workflow_call: + workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + test: + runs-on: ubuntu-latest + environment: integration + permissions: + id-token: write + contents: read + actions: read + steps: + - name: Prevent running on draft PRs + id: check-prereqs-for-running + run: | + should_run=true + if [ "${{ github.event_name }}" == "pull_request" ] && [ "${{ github.event.pull_request.draft }}" == "true" ]; then + should_run=false + fi + echo "should_run=$should_run" >> "$GITHUB_OUTPUT" + - name: Checkout repository + uses: actions/checkout@v4.2.1 + + - uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + + - name: Setup GitHub token using GATI + id: token + uses: smartcontractkit/.github/actions/setup-github-token@c0b38e6c40d72d01b8d2f24f92623a2538b3dedb # main + with: + aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }} + aws-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }} + aws-region: ${{ secrets.AWS_REGION }} + aws-role-duration-seconds: "1800" + - name: Debug workspace dir + shell: bash + run: | + echo ${{ github.workspace }} + echo $GITHUB_WORKSPACE + + - name: Deploy and validate CRIB Environment for CCIP v2 + if: steps.check-prereqs-for-running.outputs.should_run == 'true' + uses: smartcontractkit/.github/actions/crib-deploy-environment@f051504b88d1c6b01f244f27d1af9bdc871df210 # crib-deploy-environment@7.1.1 + id: deploy-crib + with: + github-token: ${{ steps.token.outputs.access-token }} + aws-region: ${{ secrets.AWS_REGION }} + aws-role-arn: ${{ secrets.AWS_OIDC_CRIB_ROLE_ARN_STAGE }} + aws-ecr-private-registry: ${{ secrets.AWS_ACCOUNT_ID_PROD }} + ingress-base-domain: ${{ secrets.INGRESS_BASE_DOMAIN_STAGE }} + k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_STAGE }} + command: "ccip-v2" + crib-alert-slack-webhook: ${{ secrets.CRIB_ALERT_SLACK_WEBHOOK }} + product-image: ${{ secrets.AWS_SDLC_ECR_HOSTNAME }}/ccip + product-image-tag: develop + chainlink-team: ccip + chainlink-product: ccip-v2 + k8s-api-endpoint: ${{ secrets.K8S_API_ENDPOINT_STAGE }} + crib-repo-ref: 'main' + - uses: actions/checkout@v4.2.1 + - name: Set up Go + uses: ./.github/actions/setup-go + with: + go-version-file: 'go.mod' + - name: Run CRIB integration test + working-directory: integration-tests/crib + env: + K8S_STAGING_INGRESS_SUFFIX: ${{ secrets.K8S_STAGING_INGRESS_SUFFIX }} + CRIB_NAMESPACE: ${{ steps.deploy-crib.outputs.devspace-namespace }} + GAP_URL: ${{ secrets.GAP_URL }} + run: |- + # go test -v -run TestSomething + echo "running tests here" + - name: Destroy CRIB Environment + id: destroy + if: always() && steps.deploy-crib.outputs.devspace-namespace != '' + uses: smartcontractkit/.github/actions/crib-purge-environment@c0b38e6c40d72d01b8d2f24f92623a2538b3dedb # crib-purge-environment@0.1.0 + with: + namespace: ${{ steps.deploy-crib.outputs.devspace-namespace }} From d27a0aa59af67f632918da553ccb31d7ae1c581a Mon Sep 17 00:00:00 2001 From: Radek Scheibinger Date: Wed, 11 Dec 2024 14:57:26 +0100 Subject: [PATCH 2/7] specify product dir --- .github/workflows/crib-ccip-v2-integration-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/crib-ccip-v2-integration-test.yml b/.github/workflows/crib-ccip-v2-integration-test.yml index 4e1b68bba2b..722092ecb89 100644 --- a/.github/workflows/crib-ccip-v2-integration-test.yml +++ b/.github/workflows/crib-ccip-v2-integration-test.yml @@ -48,7 +48,7 @@ jobs: - name: Deploy and validate CRIB Environment for CCIP v2 if: steps.check-prereqs-for-running.outputs.should_run == 'true' - uses: smartcontractkit/.github/actions/crib-deploy-environment@f051504b88d1c6b01f244f27d1af9bdc871df210 # crib-deploy-environment@7.1.1 + uses: smartcontractkit/.github/actions/crib-deploy-environment@88437540e1ccbf72e0163c39f804198372dc6556 # crib-deploy-environment@7.1.1 id: deploy-crib with: github-token: ${{ steps.token.outputs.access-token }} @@ -61,8 +61,9 @@ jobs: crib-alert-slack-webhook: ${{ secrets.CRIB_ALERT_SLACK_WEBHOOK }} product-image: ${{ secrets.AWS_SDLC_ECR_HOSTNAME }}/ccip product-image-tag: develop + product-dir: 'ccip-v2' chainlink-team: ccip - chainlink-product: ccip-v2 + chainlink-product: ccip k8s-api-endpoint: ${{ secrets.K8S_API_ENDPOINT_STAGE }} crib-repo-ref: 'main' - uses: actions/checkout@v4.2.1 From 0b73bb32d9259e0c72f34002936461be73a28736 Mon Sep 17 00:00:00 2001 From: Radek Scheibinger Date: Mon, 16 Dec 2024 20:16:39 +0100 Subject: [PATCH 3/7] test connection to jd --- .github/workflows/crib-ccip-v2-integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/crib-ccip-v2-integration-test.yml b/.github/workflows/crib-ccip-v2-integration-test.yml index 722092ecb89..f2cd96c6c16 100644 --- a/.github/workflows/crib-ccip-v2-integration-test.yml +++ b/.github/workflows/crib-ccip-v2-integration-test.yml @@ -48,7 +48,7 @@ jobs: - name: Deploy and validate CRIB Environment for CCIP v2 if: steps.check-prereqs-for-running.outputs.should_run == 'true' - uses: smartcontractkit/.github/actions/crib-deploy-environment@88437540e1ccbf72e0163c39f804198372dc6556 # crib-deploy-environment@7.1.1 + uses: smartcontractkit/.github/actions/crib-deploy-environment@0d57046d1a3951141ec61a732cd87f07f72e7799 # crib-deploy-environment@7.1.1 id: deploy-crib with: github-token: ${{ steps.token.outputs.access-token }} @@ -65,7 +65,7 @@ jobs: chainlink-team: ccip chainlink-product: ccip k8s-api-endpoint: ${{ secrets.K8S_API_ENDPOINT_STAGE }} - crib-repo-ref: 'main' + crib-repo-ref: 'crib-352/rpc-type' - uses: actions/checkout@v4.2.1 - name: Set up Go uses: ./.github/actions/setup-go From 01fad6c957f1722133d605e887de12c45bb57b5f Mon Sep 17 00:00:00 2001 From: Radek Scheibinger Date: Tue, 17 Dec 2024 11:28:03 +0100 Subject: [PATCH 4/7] bump action --- .github/workflows/crib-ccip-v2-integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/crib-ccip-v2-integration-test.yml b/.github/workflows/crib-ccip-v2-integration-test.yml index f2cd96c6c16..47af3e07793 100644 --- a/.github/workflows/crib-ccip-v2-integration-test.yml +++ b/.github/workflows/crib-ccip-v2-integration-test.yml @@ -48,7 +48,7 @@ jobs: - name: Deploy and validate CRIB Environment for CCIP v2 if: steps.check-prereqs-for-running.outputs.should_run == 'true' - uses: smartcontractkit/.github/actions/crib-deploy-environment@0d57046d1a3951141ec61a732cd87f07f72e7799 # crib-deploy-environment@7.1.1 + uses: smartcontractkit/.github/actions/crib-deploy-environment@57f99fbea73056c490c766d50ef582a13ec4f3bb # crib-deploy-environment@7.2.0 id: deploy-crib with: github-token: ${{ steps.token.outputs.access-token }} From f818c050ef08f9ade556121e8a5e4a3d5602ef8e Mon Sep 17 00:00:00 2001 From: Radek Scheibinger Date: Tue, 17 Dec 2024 11:33:12 +0100 Subject: [PATCH 5/7] Should always run --- .github/workflows/crib-ccip-v2-integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/crib-ccip-v2-integration-test.yml b/.github/workflows/crib-ccip-v2-integration-test.yml index 47af3e07793..c18c8e8d161 100644 --- a/.github/workflows/crib-ccip-v2-integration-test.yml +++ b/.github/workflows/crib-ccip-v2-integration-test.yml @@ -47,7 +47,7 @@ jobs: echo $GITHUB_WORKSPACE - name: Deploy and validate CRIB Environment for CCIP v2 - if: steps.check-prereqs-for-running.outputs.should_run == 'true' + # if: steps.check-prereqs-for-running.outputs.should_run == 'true' uses: smartcontractkit/.github/actions/crib-deploy-environment@57f99fbea73056c490c766d50ef582a13ec4f3bb # crib-deploy-environment@7.2.0 id: deploy-crib with: From 3cc317e6ded0eb453b806ac108c0fc854cc4e7e0 Mon Sep 17 00:00:00 2001 From: Radek Scheibinger Date: Wed, 18 Dec 2024 11:27:35 +0100 Subject: [PATCH 6/7] test ws connection with geth --- .../crib-ccip-v2-integration-test.yml | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/.github/workflows/crib-ccip-v2-integration-test.yml b/.github/workflows/crib-ccip-v2-integration-test.yml index c18c8e8d161..0bca8f31120 100644 --- a/.github/workflows/crib-ccip-v2-integration-test.yml +++ b/.github/workflows/crib-ccip-v2-integration-test.yml @@ -57,7 +57,7 @@ jobs: aws-ecr-private-registry: ${{ secrets.AWS_ACCOUNT_ID_PROD }} ingress-base-domain: ${{ secrets.INGRESS_BASE_DOMAIN_STAGE }} k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_STAGE }} - command: "ccip-v2" + command: "deploy-geth" crib-alert-slack-webhook: ${{ secrets.CRIB_ALERT_SLACK_WEBHOOK }} product-image: ${{ secrets.AWS_SDLC_ECR_HOSTNAME }}/ccip product-image-tag: develop @@ -66,20 +66,39 @@ jobs: chainlink-product: ccip k8s-api-endpoint: ${{ secrets.K8S_API_ENDPOINT_STAGE }} crib-repo-ref: 'crib-352/rpc-type' - - uses: actions/checkout@v4.2.1 - - name: Set up Go - uses: ./.github/actions/setup-go + - name: Get GH JWT Token + id: get-jwt-token + uses: actions/github-script@v7 with: - go-version-file: 'go.mod' - - name: Run CRIB integration test - working-directory: integration-tests/crib + script: | + const audience = 'gap'; + const id_token = await core.getIDToken(audience); + if (!id_token) { + throw new Error("Failed to retrieve the JWT token"); + } + return id_token + - name: Test ws connection env: - K8S_STAGING_INGRESS_SUFFIX: ${{ secrets.K8S_STAGING_INGRESS_SUFFIX }} - CRIB_NAMESPACE: ${{ steps.deploy-crib.outputs.devspace-namespace }} - GAP_URL: ${{ secrets.GAP_URL }} - run: |- - # go test -v -run TestSomething - echo "running tests here" + GETH_WS_ENDPOINT: wss://gap-${{ steps.deploy-crib.outputs.devspace-namespace }}-geth-1337-ws.public.main.stage.cldev.sh + run: | + npm install -g wscat + wscat --no-check -c "${GETH_WS_ENDPOINT}" \ + --header "x-authorization-github-jwt: Bearer ${{ steps.get-jwt-token.outputs.result }}" \ + -x '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' +# - uses: actions/checkout@v4.2.1 +# - name: Set up Go +# uses: ./.github/actions/setup-go +# with: +# go-version-file: 'go.mod' +# - name: Run CRIB integration test +# working-directory: integration-tests/crib +# env: +# K8S_STAGING_INGRESS_SUFFIX: ${{ secrets.K8S_STAGING_INGRESS_SUFFIX }} +# CRIB_NAMESPACE: ${{ steps.deploy-crib.outputs.devspace-namespace }} +# GAP_URL: ${{ secrets.GAP_URL }} +# run: |- +# # go test -v -run TestSomething +# echo "running tests here" - name: Destroy CRIB Environment id: destroy if: always() && steps.deploy-crib.outputs.devspace-namespace != '' From 89bb6a2340f5814c04763d5bdb7c7d5aed9d36a9 Mon Sep 17 00:00:00 2001 From: Radek Scheibinger Date: Wed, 18 Dec 2024 11:35:01 +0100 Subject: [PATCH 7/7] more debug --- .../crib-ccip-v2-integration-test.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/crib-ccip-v2-integration-test.yml b/.github/workflows/crib-ccip-v2-integration-test.yml index 0bca8f31120..4129b3ab9d5 100644 --- a/.github/workflows/crib-ccip-v2-integration-test.yml +++ b/.github/workflows/crib-ccip-v2-integration-test.yml @@ -80,11 +80,18 @@ jobs: - name: Test ws connection env: GETH_WS_ENDPOINT: wss://gap-${{ steps.deploy-crib.outputs.devspace-namespace }}-geth-1337-ws.public.main.stage.cldev.sh + shell: bash run: | + set -xeuo pipefail + npm install -g wscat + + echo "checking ws conection via gap" wscat --no-check -c "${GETH_WS_ENDPOINT}" \ --header "x-authorization-github-jwt: Bearer ${{ steps.get-jwt-token.outputs.result }}" \ -x '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' + + echo "finished checking ws conection via gap" # - uses: actions/checkout@v4.2.1 # - name: Set up Go # uses: ./.github/actions/setup-go @@ -99,9 +106,9 @@ jobs: # run: |- # # go test -v -run TestSomething # echo "running tests here" - - name: Destroy CRIB Environment - id: destroy - if: always() && steps.deploy-crib.outputs.devspace-namespace != '' - uses: smartcontractkit/.github/actions/crib-purge-environment@c0b38e6c40d72d01b8d2f24f92623a2538b3dedb # crib-purge-environment@0.1.0 - with: - namespace: ${{ steps.deploy-crib.outputs.devspace-namespace }} +# - name: Destroy CRIB Environment +# id: destroy +# if: always() && steps.deploy-crib.outputs.devspace-namespace != '' +# uses: smartcontractkit/.github/actions/crib-purge-environment@c0b38e6c40d72d01b8d2f24f92623a2538b3dedb # crib-purge-environment@0.1.0 +# with: +# namespace: ${{ steps.deploy-crib.outputs.devspace-namespace }}