Skip to content

Commit

Permalink
TT-257 Use checks for existing images for shas before building (#8976)
Browse files Browse the repository at this point in the history
* TT-257 Use checks for existing images for shas before building

* Fix some patterns

* fix action to use inputs instead of input

* Point tags to correct location

* Fix solana image build test

* bump solana action versions

* helm repo update for solana

* Switch to having solana test image build in a different step.

* Review comments
  • Loading branch information
tateexon authored Apr 17, 2023
1 parent b8279a5 commit 762a01a
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 187 deletions.
62 changes: 62 additions & 0 deletions .github/actions/build-test-image/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build Test Image
description: A composite action that allows building and publishing the test remote runner image

inputs:
repository:
description: The docker repository for the image
default: chainlink-tests
required: false
tag:
description: The tag to use by default and to use for checking image existance
default: ${{ github.sha }}
required: false
other_tags:
description: Other tags to push if needed
required: false
suites:
description: The test suites to build into the image
default: chaos migration performance reorg smoke soak benchmark
required: false
QA_AWS_ROLE_TO_ASSUME:
description: The AWS role to assume as the CD user, if any. Used in configuring the docker/login-action
required: true
QA_AWS_REGION:
description: The AWS region the ECR repository is located in, should only be needed for public ECR repositories, used in configuring docker/login-action
required: true
QA_AWS_ACCOUNT_NUMBER:
description: The AWS region the ECR repository is located in, should only be needed for public ECR repositories, used in configuring docker/login-action
required: true

runs:
using: composite
steps:
- name: Check if image exists
id: check-image
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ab595504ae9cf10c60eb8d2c5ce025284e58b210 #v2.1.5
with:
repository: ${{ inputs.repository }}
tag: ${{ inputs.tag }}
AWS_REGION: ${{ inputs.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ inputs.QA_AWS_ROLE_TO_ASSUME }}
- name: Build and Publish Test Runner
if: steps.check-image.outputs.exists == 'false'
uses: smartcontractkit/chainlink-github-actions/docker/build-push@ab595504ae9cf10c60eb8d2c5ce025284e58b210 #v2.1.5
with:
tags: |
${{ inputs.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ inputs.QA_AWS_REGION }}.amazonaws.com/${{ inputs.repository }}:${{ inputs.tag }}
${{ inputs.other_tags }}
file: ./integration-tests/test.Dockerfile
build-args: |
BASE_IMAGE=${{ inputs.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ inputs.QA_AWS_REGION }}.amazonaws.com/test-base-image
IMAGE_VERSION=v0.3.29
SUITES="${{ inputs.suites }}"
AWS_REGION: ${{ inputs.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ inputs.QA_AWS_ROLE_TO_ASSUME }}
- name: Print Image Built
shell: sh
env:
INPUTS_REPOSITORY: ${{ inputs.repository }}
INPUTS_TAG: ${{ inputs.tag }}
run: |
echo "### ${INPUTS_REPOSITORY} image tag for this test run :ship:" >>$GITHUB_STEP_SUMMARY
echo "\`${INPUTS_TAG}\`" >>$GITHUB_STEP_SUMMARY
31 changes: 8 additions & 23 deletions .github/workflows/automation-benchmark-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,15 @@ jobs:
TEST_INPUTS: ${{ inputs.TestInputs }}
CHAINLINK_ENV_USER: ${{ github.actor }}
REF_NAME: ${{ github.head_ref || github.ref_name }}
ENV_JOB_IMAGE_BASE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-tests
steps:
- name: Setup Push Tag
id: push
shell: bash
run: |
echo "### chainlink image used for this test run :link:" >>$GITHUB_STEP_SUMMARY
echo "\`${{ inputs.chainlinkVersion }}\`" >>$GITHUB_STEP_SUMMARY
echo "### chainlink-tests image tag for this test run :ship:" >>$GITHUB_STEP_SUMMARY
if [ "${{ env.REF_NAME }}" != "develop" ]; then
# use sha if not on develop
echo "tag=${{ env.ENV_JOB_IMAGE_BASE }}:benchmark.${{ github.sha }}" >>$GITHUB_OUTPUT
echo "\`benchmark.${{ github.sha }}\`" >>$GITHUB_STEP_SUMMARY
else
# default to develop
echo "tag=${{ env.ENV_JOB_IMAGE_BASE }}:develop" >>$GITHUB_OUTPUT
echo "\`develop\`" >>$GITHUB_STEP_SUMMARY
fi
echo "\`${GITHUB_SHA}\`" >>$GITHUB_STEP_SUMMARY
- name: Add mask
run: |
EVM_URLS=$(jq -r '.inputs.wsURL' $GITHUB_EVENT_PATH)
Expand Down Expand Up @@ -109,25 +100,19 @@ jobs:
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
ref: ${{ env.REF_NAME }}
- name: build test runner
if: ${{ env.REF_NAME != 'develop' }}
uses: smartcontractkit/chainlink-github-actions/docker/build-push@ab595504ae9cf10c60eb8d2c5ce025284e58b210 # v2.1.5
- name: Build Test Image
uses: ./.github/actions/build-test-image
with:
tags: ${{ steps.push.outputs.tag }}
file: ./integration-tests/test.Dockerfile
build-args: |
BASE_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image
IMAGE_VERSION=v0.3.24
SUITES="benchmark"
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@ab595504ae9cf10c60eb8d2c5ce025284e58b210 # v2.1.5
env:
DETACH_RUNNER: true
TEST_SUITE: benchmark
TEST_ARGS: -test.timeout 720h
ENV_JOB_IMAGE: ${{ steps.push.outputs.tag }}
ENV_JOB_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-tests:${{ github.sha }}
with:
test_command_to_run: cd integration-tests && go test -timeout 30m -v -run ^TestAutomationBenchmark$ ./benchmark -count=1
test_download_vendor_packages_command: make gomod
Expand Down
71 changes: 22 additions & 49 deletions .github/workflows/integration-chaos-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ on:
- "*"

env:
REF_NAME: ${{ github.head_ref || github.ref_name }}
DEVELOP_REF: develop
BUILD_SHA_REF: chaos.${{ github.sha }}
CHAINLINK_ECR_BASE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink
ENV_JOB_IMAGE_BASE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-tests
CHAINLINK_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink
ENV_JOB_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-tests:${{ github.sha }}
TEST_SUITE: chaos
TEST_ARGS: -test.timeout 1h
SELECTED_NETWORKS: SIMULATED
Expand All @@ -27,33 +24,31 @@ jobs:
contents: read
name: Build Chainlink Image
runs-on: ubuntu-latest
outputs:
push: ${{ steps.push.outputs.tag }}
steps:
- name: Checkout the repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Check if image exists
id: check-image
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ab595504ae9cf10c60eb8d2c5ce025284e58b210 #v2.1.5
with:
repository: chainlink
tag: ${{ github.sha }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
- name: Build Image
if: ${{ env.REF_NAME != env.DEVELOP_REF }}
if: steps.check-image.outputs.exists == 'false'
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/build-image@ab595504ae9cf10c60eb8d2c5ce025284e58b210 # v2.1.5
with:
cl_repo: smartcontractkit/chainlink
cl_ref: ${{ github.sha }}
push_tag: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink:${{ env.BUILD_SHA_REF }}
push_tag: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink:${{ github.sha }}
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
- name: Print Chainlink Image Built
id: push
run: |
echo "### chainlink image tag used for this test run :link:" >>$GITHUB_STEP_SUMMARY
if [ "${{ env.REF_NAME }}" != "${{ env.DEVELOP_REF }}" ]; then
# use sha if not on ${{ env.DEVELOP_REF }}
echo "tag=${{ env.BUILD_SHA_REF }}" >>$GITHUB_OUTPUT
echo "\`${{ env.BUILD_SHA_REF }}\`" >>$GITHUB_STEP_SUMMARY
else
# default to ${{ env.DEVELOP_REF }}
echo "tag=${{ env.DEVELOP_REF }}" >>$GITHUB_OUTPUT
echo "\`${{ env.DEVELOP_REF }}\`" >>$GITHUB_STEP_SUMMARY
fi
echo "### chainlink node image tag used for this test run :link:" >>$GITHUB_STEP_SUMMARY
echo "\`${GITHUB_SHA}\`" >>$GITHUB_STEP_SUMMARY
- name: Collect Metrics
if: always()
id: collect-gha-metrics
Expand All @@ -71,36 +66,15 @@ jobs:
contents: read
name: Build Test Runner Image
runs-on: ubuntu-latest
outputs:
testtag: ${{ steps.testtag.outputs.tag }}
steps:
- name: Checkout the repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: build test runner
if: ${{ env.REF_NAME != env.DEVELOP_REF }}
uses: smartcontractkit/chainlink-github-actions/docker/build-push@ab595504ae9cf10c60eb8d2c5ce025284e58b210 # v2.1.5
- name: Build Test Image
uses: ./.github/actions/build-test-image
with:
tags: ${{ env.ENV_JOB_IMAGE_BASE }}:${{ env.BUILD_SHA_REF }}
file: ./integration-tests/test.Dockerfile
build-args: |
BASE_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image
IMAGE_VERSION=v0.3.24
SUITES="${{ env.TEST_SUITE }}"
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
- id: testtag
name: Print Chainlink Image Built
run: |
echo "### chainlink-tests image tag used for this test run :link:" >>$GITHUB_STEP_SUMMARY
if [ "${{ env.REF_NAME }}" != "${{ env.DEVELOP_REF }}" ]; then
# use sha if not on ${{ env.DEVELOP_REF }}
echo "tag=${{ env.BUILD_SHA_REF }}" >>$GITHUB_OUTPUT
echo "\`${{ env.BUILD_SHA_REF }}\`" >>$GITHUB_STEP_SUMMARY
else
# default to ${{ env.DEVELOP_REF }}
echo "tag=${{ env.DEVELOP_REF }}" >>$GITHUB_OUTPUT
echo "\`${{ env.DEVELOP_REF }}\`" >>$GITHUB_STEP_SUMMARY
fi
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
- name: Collect Metrics
if: always()
id: collect-gha-metrics
Expand Down Expand Up @@ -130,16 +104,15 @@ jobs:
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: EVM Pods Chaos Tests
continue-on-error: true
- run: echo "${{ needs.build-test-runner.outputs.testtag }}"
- name: Checkout the repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@ab595504ae9cf10c60eb8d2c5ce025284e58b210 # v2.1.5
with:
test_command_to_run: export ENV_JOB_IMAGE=${{ env.ENV_JOB_IMAGE_BASE }}:${{ needs.build-test-runner.outputs.testtag }} && make test_need_operator_assets && cd integration-tests && go test -timeout 1h -count=1 -json -test.parallel 11 ./chaos 2>&1 | tee /tmp/gotest.log | gotestfmt
test_command_to_run: make test_need_operator_assets && cd integration-tests && go test -timeout 1h -count=1 -json -test.parallel 11 ./chaos 2>&1 | tee /tmp/gotest.log | gotestfmt
test_download_vendor_packages_command: cd ./integration-tests && go mod download
cl_repo: ${{ env.CHAINLINK_ECR_BASE }}
cl_image_tag: ${{ needs.build-chainlink.outputs.push }}
cl_repo: ${{ env.CHAINLINK_IMAGE }}
cl_image_tag: ${{ github.sha }}
artifacts_location: ./integration-tests/chaos/logs
publish_check_name: EVM Pods Chaos Test Results
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/integration-tests-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ jobs:
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: build test runner
uses: smartcontractkit/chainlink-github-actions/docker/build-push@ab595504ae9cf10c60eb8d2c5ce025284e58b210 # v2.1.5
- name: Build Image
uses: ./.github/actions/build-test-image
with:
tags: ${{ env.ECR_TAG }}
file: ./integration-tests/test.Dockerfile
build-args: |
BASE_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image
IMAGE_VERSION=v0.3.24
SUITES="chaos migration performance reorg smoke soak benchmark"
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
other_tags: ${{ env.ECR_TAG }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
Loading

0 comments on commit 762a01a

Please sign in to comment.