Skip to content

Commit

Permalink
copy chainlink-env
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed Oct 24, 2023
1 parent 6618c3e commit 3fdf6ef
Show file tree
Hide file tree
Showing 139 changed files with 66,882 additions and 0 deletions.
12 changes: 12 additions & 0 deletions env/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: gomod
directory: '/'
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: daily
open-pull-requests-limit: 10
118 changes: 118 additions & 0 deletions env/.github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Deployments tests (E2E)
on:
pull_request:

concurrency:
group: e2e-tests-chainlink-env-${{ github.ref }}
cancel-in-progress: true

env:
INTERNAL_DOCKER_REPO: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com
ENV_JOB_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-env-tests:ci.${{ github.sha }}
BASE_IMAGE_NAME: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image:ci.${{ github.sha }}
CHAINLINK_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink
CHAINLINK_VERSION: develop
SELECTED_NETWORKS: SIMULATED
CHAINLINK_COMMIT_SHA: ${{ github.sha }}
CHAINLINK_ENV_USER: ${{ github.actor }}
TEST_LOG_LEVEL: debug

jobs:
build_tests:
runs-on: ubuntu-latest
environment: integration
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- name: Build Base Image
uses: smartcontractkit/chainlink-github-actions/docker/build-push@ce87f8986ca18336cc5015df75916c2ec0a7c4b3 # v2.1.2
with:
tags: ${{ env.BASE_IMAGE_NAME }}
file: Dockerfile.base
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
- name: Base Image Built
run: |
echo "### chainlink image used for this test run :link:" >>$GITHUB_STEP_SUMMARY
echo "\`${{ env.CHAINLINK_VERSION }}\`" >>$GITHUB_STEP_SUMMARY
echo "### test-base-image image tag for this test run :ship:" >>$GITHUB_STEP_SUMMARY
echo "\`ci.${{ github.sha }}\`" >>$GITHUB_STEP_SUMMARY
- name: Build Test Runner
uses: smartcontractkit/chainlink-github-actions/docker/build-push@ce87f8986ca18336cc5015df75916c2ec0a7c4b3 # v2.1.2
with:
tags: ${{ env.ENV_JOB_IMAGE }}
file: Dockerfile
build-args: |
BASE_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image
IMAGE_VERSION=ci.${{ github.sha }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
- name: Test Image Built
run: |
echo "### chainlink-env-tests image tag for this test run :ship:" >>$GITHUB_STEP_SUMMARY
echo "\`ci.${{ github.sha }}\`" >>$GITHUB_STEP_SUMMARY
e2e_tests:
runs-on: ubuntu-latest
environment: integration
permissions:
id-token: write
contents: read
env:
TEST_SUITE: local-runner
steps:
- uses: actions/checkout@v3
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@ce87f8986ca18336cc5015df75916c2ec0a7c4b3 # v2.1.2
with:
cl_repo: ${{ env.CHAINLINK_IMAGE }}
cl_image_tag: ${{ env.CHAINLINK_VERSION }}
test_command_to_run: unset ENV_JOB_IMAGE && make test_e2e_ci
test_download_vendor_packages_command: go mod download
artifacts_location: ./e2e/logs
publish_check_name: E2E Test Results
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: go.mod
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
- name: Upload test log
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-log
path: /tmp/gotest.log

e2e_remote_runner_tests:
runs-on: ubuntu-latest
environment: integration
needs: [build_tests]
permissions:
id-token: write
contents: read
env:
TEST_SUITE: remote-runner
TEST_TRIGGERED_BY: chainlink-env-remote-runner-ci
steps:
- uses: actions/checkout@v3
- name: Run Remote Runner Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@ce87f8986ca18336cc5015df75916c2ec0a7c4b3 # v2.1.2
with:
cl_repo: ${{ env.CHAINLINK_IMAGE }}
cl_image_tag: ${{ env.CHAINLINK_VERSION }}
test_command_to_run: make test_e2e_ci_remote_runner
test_download_vendor_packages_command: go mod download
artifacts_location: ./e2e/logs
publish_check_name: E2E Remote Runner Test Results
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: go.mod
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
- name: Upload test log
uses: actions/upload-artifact@v2
if: failure()
with:
name: remote-runner-test-log
path: /tmp/remoterunnergotest.log
15 changes: 15 additions & 0 deletions env/.github/workflows/go_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Go test
on:
pull_request:
jobs:
unit_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
check-latest: true
- name: Test config
run: make test
86 changes: 86 additions & 0 deletions env/.github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Linting
on:
push:
branches:
- master
pull_request:
jobs:
tools:
name: Get Tool tool-versions
runs-on: ubuntu-latest
steps:
- name: Check out Code
uses: actions/checkout@v3
- uses: smartcontractkit/tool-versions-to-env-action@v1.0.8
id: tool-versions
outputs:
golangci-lint-version: ${{ steps.tool-versions.outputs.golangci-lint_version }}

golangci:
name: Linting
runs-on: ubuntu-latest
needs: [tools]
steps:
- name: Check out Code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
check-latest: true
- name: golangci-lint ${{ needs.tools.outputs.golangci-lint-version }}
##
# XXX: change this to the official action once multiple --out-format args are supported.
# See: https://github.com/golangci/golangci-lint-action/issues/612
##
uses: smartcontractkit/golangci-lint-action@54ab6c5f11d66a92d14c3f7cc41ea13f676644bd # feature/multiple-output-formats-backup
with:
version: v${{ needs.tools.outputs.golangci-lint-version }}
allow-extra-out-format-args: true
args: --out-format checkstyle:golangci-lint-report.xml
- name: Print lint report artifact
if: always()
run: test -f golangci-lint-report.xml || true
- name: Store lint report artifact
if: always()
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: golangci-lint-report
path: golangci-lint-report.xml

vulnerabilities-check:
name: Check for Vulnerabilities
runs-on: ubuntu-latest
needs: [tools]
steps:
- name: Check out Code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
check-latest: true
- name: Write Go List
run: go list -json -deps ./... > go.list
- name: Nancy
uses: sonatype-nexus-community/nancy-github-action@main

sonarqube:
name: SonarQube Analysis
needs: [golangci]
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0 # fetches all history for all tags and branches to provide more metadata for sonar reports
- name: Download all workflow run artifacts
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@a6ba0aafc293e03de5437af7edbc97f7d3ebc91a # v1.2.0
with:
args: >
-Dsonar.go.golangci-lint.reportPaths=golangci-lint-report/golangci-lint-report.xml
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
24 changes: 24 additions & 0 deletions env/.github/workflows/publish-test-bash-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Test Base Image
on:
push:
tags:
- 'v*'

jobs:
publish_test_base_image:
runs-on: ubuntu-latest
environment: integration
permissions:
id-token: write
contents: read
env:
BASE_IMAGE_TAG: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image:${{ github.ref_name }}
steps:
- uses: actions/checkout@v3
- name: Build Base Image
uses: smartcontractkit/chainlink-github-actions/docker/build-push@cb4a8f51d77cbf77ea6a765bd1f437ffc7a18730 # v2.0.28
with:
tags: ${{ env.BASE_IMAGE_TAG }}
file: Dockerfile.base
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
23 changes: 23 additions & 0 deletions env/.github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Static Analysis
on:
push:
branches: ["master"]
schedule:
- cron: "23 19 * * 4"
jobs:
codeQL:
name: CodeQL Checks
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: go
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
13 changes: 13 additions & 0 deletions env/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmd/chaos
bin/
# temp manifest for deployment and validation
tmp-manifest-*.yaml
# remote runner binary
remote.test
e2e.test

.vscode/
.idea/
.direnv/

k3dvolume/
15 changes: 15 additions & 0 deletions env/.golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
run:
timeout: 5m
skip-dirs:
- bin
- imports
issues:
exclude-use-default: false
linters-settings:
revive:
rules:
- name: exported
severity: warning
- name: dot-imports
disabled: true
linters:
53 changes: 53 additions & 0 deletions env/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
project_name: chainlink-env

release:
github:
owner: smartcontractkit
name: chainlink-env

builds:
- binary: chainlink-env
goos:
- darwin
- linux
goarch:
- amd64
- arm64
goarm:
- 6
- 7
gomips:
- hardfloat
env:
- CGO_ENABLED=0
main: cmd/wizard/chainlink-env.go
flags:
- -trimpath
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}

archives:
- format: tar.gz
wrap_in_directory: true
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
files:
- LICENSE
- README.md

snapshot:
name_template: SNAPSHOT-{{ .Commit }}

checksum:
name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt'

changelog:
sort: asc
filters:
exclude:
- '(?i)^docs?:'
- '(?i)^docs\([^:]+\):'
- '(?i)^docs\[[^:]+\]:'
- '^tests?:'
- '(?i)^dev:'
- '^build\(deps\): bump .* in /docs \(#\d+\)'
- Merge pull request
- Merge branch
7 changes: 7 additions & 0 deletions env/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
golang 1.21.1
helm 3.10.3
golangci-lint 1.51.1
kubectl 1.25.5
nodejs 18.13.0
yarn 1.22.19
k3d 5.5.1
7 changes: 7 additions & 0 deletions env/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG BASE_IMAGE
ARG IMAGE_VERSION=latest
FROM ${BASE_IMAGE}:${IMAGE_VERSION}
COPY . testdir/
WORKDIR /go/testdir
RUN ./scripts/buildTests
ENTRYPOINT ["./scripts/entrypoint"]
Loading

0 comments on commit 3fdf6ef

Please sign in to comment.