From 15e832d839dc2302bc3d4cd67c4a1c0e81a56cc6 Mon Sep 17 00:00:00 2001 From: Radek Scheibinger Date: Tue, 21 Jan 2025 15:23:49 +0100 Subject: [PATCH] crib ccip integration-tests workflow --- .github/actions/crib/action.yml | 16 ++- .github/workflows/build-publish.yml | 2 +- .../crib-ccip-v2-integration-test.yml | 108 ++++-------------- .github/workflows/crib-integration-test.yml | 1 + 4 files changed, 36 insertions(+), 91 deletions(-) diff --git a/.github/actions/crib/action.yml b/.github/actions/crib/action.yml index a877d0ff4b3..f65688949ef 100644 --- a/.github/actions/crib/action.yml +++ b/.github/actions/crib/action.yml @@ -39,6 +39,14 @@ inputs: gap-url-integration-tests: description: "GAP URL for integration tests" required: true + crib-product-dir: + default: "chainlink" + description: "Product directory under crib deployments folder" + required: false + crib-command: + default: "core" + description: "The devspace command to run." + required: false crib-alert-slack-webhook: description: "CRIB alert Slack webhook" required: true @@ -111,8 +119,8 @@ runs: aws-region: ${{ inputs.aws-region }} aws-role-duration-seconds: "1800" - - name: Deploy and validate CRIB Environment for Core - uses: smartcontractkit/.github/actions/crib-deploy-environment@265e28cc322771651688493303785323e3482b15 # crib-deploy-environment@8.2.1 + - name: Deploy and validate CRIB Environment for ${{ inputs.crib-product-dir }} + uses: smartcontractkit/.github/actions/crib-deploy-environment@d7521ea9bcaa8a022a3244221d6294bca79649ac # crib-deploy-environment@8.3.0 id: deploy-crib with: github-token: ${{ steps.token.outputs.access-token }} @@ -123,7 +131,8 @@ runs: k8s-cluster-name: ${{ inputs.k8s-cluster-name }} chainlink-team: releng chainlink-product: crib - command: "core-dev-simulated-core-ocr1" + product-dir: ${{ inputs.crib-product-dir }} + command: ${{ inputs.crib-command }} crib-alert-slack-webhook: ${{ inputs.crib-alert-slack-webhook }} product-image: ${{ inputs.crib-chainlink-docker-image-name }} product-image-tag: ${{ inputs.crib-chainlink-docker-image-tag }} @@ -131,6 +140,7 @@ runs: main-dns-zone: ${{ inputs.main-dns-zone }} - name: Set up Go + if: inputs.integration-tests-run == 'true' uses: ./.github/actions/setup-go with: go-version-file: "go.mod" diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index 80efa0f3b71..28285f6be89 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -165,13 +165,13 @@ jobs: aws-account-id: ${{ secrets.AWS_ACCOUNT_ID_PROD }} api-gw-host-crib: ${{ secrets.AWS_API_GW_HOST_CRIB_STAGE }} api-gw-host-k8s: ${{ secrets.AWS_API_GW_HOST_K8S_STAGE }} - k8s-api-endpoint: ${{ secrets.GAP_HOST_K8S_STAGE }} k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_STAGE }} aws-token-issuer-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }} aws-token-issuer-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }} ingress-base-domain: ${{ secrets.INGRESS_BASE_DOMAIN_STAGE }} k8s-staging-ingress-suffix: ${{ secrets.K8S_STAGING_INGRESS_SUFFIX }} gap-url-integration-tests: ${{ secrets.GAP_URL }} + crib-command: 'core-dev-simulated-core-ocr1' crib-alert-slack-webhook: ${{ secrets.CRIB_ALERT_SLACK_WEBHOOK }} crib-chainlink-docker-image-name: ${{ format('{0}/{1}', env.ECR_HOSTNAME, needs.checks.outputs.ecr-image-name) }} crib-chainlink-docker-image-tag: ${{ needs.build-sign-publish-chainlink.outputs.docker-image-tag}} diff --git a/.github/workflows/crib-ccip-v2-integration-test.yml b/.github/workflows/crib-ccip-v2-integration-test.yml index 4129b3ab9d5..7b63bd4f6bc 100644 --- a/.github/workflows/crib-ccip-v2-integration-test.yml +++ b/.github/workflows/crib-ccip-v2-integration-test.yml @@ -3,11 +3,15 @@ on: pull_request: paths: - ".github/workflows/crib-ccip-v2-integration-test.yml" + schedule: + - cron: "0 1 * * *" workflow_call: workflow_dispatch: + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + jobs: test: runs-on: ubuntu-latest @@ -17,98 +21,28 @@ jobs: 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 + persist-credentials: false - - name: Setup GitHub token using GATI - id: token - uses: smartcontractkit/.github/actions/setup-github-token@c0b38e6c40d72d01b8d2f24f92623a2538b3dedb # main + - name: Run CRIB Integration Tests for CCIP + uses: ./.github/actions/crib 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@57f99fbea73056c490c766d50ef582a13ec4f3bb # crib-deploy-environment@7.2.0 - 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 }} + aws-region: ${{ secrets.AWS_REGION }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID_PROD }} + api-gw-host-crib: ${{ secrets.AWS_API_GW_HOST_CRIB_STAGE }} + api-gw-host-k8s: ${{ secrets.AWS_API_GW_HOST_K8S_STAGE }} k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_STAGE }} - command: "deploy-geth" + aws-token-issuer-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }} + aws-token-issuer-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }} + ingress-base-domain: ${{ secrets.INGRESS_BASE_DOMAIN_STAGE }} + k8s-staging-ingress-suffix: ${{ secrets.K8S_STAGING_INGRESS_SUFFIX }} + gap-url-integration-tests: ${{ secrets.GAP_URL }} + crib-product-dir: 'ccip-v2' + crib-command: 'ccip-v2-infra' 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 - k8s-api-endpoint: ${{ secrets.K8S_API_ENDPOINT_STAGE }} - crib-repo-ref: 'crib-352/rpc-type' - - name: Get GH JWT Token - id: get-jwt-token - uses: actions/github-script@v7 - with: - 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: - 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 -# 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 }} + crib-chainlink-docker-image-name: ${{ secrets.AWS_SDLC_ECR_HOSTNAME }}/ccip + crib-chainlink-docker-image-tag: develop + main-dns-zone: ${{ secrets.MAIN_DNS_ZONE_PUBLIC_STAGE }} diff --git a/.github/workflows/crib-integration-test.yml b/.github/workflows/crib-integration-test.yml index 97f87c7d7fc..fa3bbb09e76 100644 --- a/.github/workflows/crib-integration-test.yml +++ b/.github/workflows/crib-integration-test.yml @@ -39,6 +39,7 @@ jobs: ingress-base-domain: ${{ secrets.INGRESS_BASE_DOMAIN_STAGE }} k8s-staging-ingress-suffix: ${{ secrets.K8S_STAGING_INGRESS_SUFFIX }} gap-url-integration-tests: ${{ secrets.GAP_URL }} + crib-command: 'core-dev-simulated-core-ocr1' crib-alert-slack-webhook: ${{ secrets.CRIB_ALERT_SLACK_WEBHOOK }} crib-chainlink-docker-image-name: ${{ secrets.AWS_SDLC_ECR_HOSTNAME }}/chainlink crib-chainlink-docker-image-tag: develop