Update gobuild.yml #4763
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: 0 23 * * * | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
env: | |
GO111MODULE: on | |
GOPATH: /home/runner/work/terrascan | |
GOBIN: /home/runner/work/terrascan/bin | |
GO_VERSION: 1.19 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_TEST }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_TEST }} | |
AWS_REGION: ${{ secrets.AWS_REGION_TEST }} | |
AZURE_AUTH_TEST_SECRET: ${{ secrets.AZURE_AUTH_TEST_KEY }} | |
GOOGLE_APPLICATION_CREDENTIALS_TEST_SECRET: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_TEST_KEY }} | |
steps: | |
- name: Checkout Terrascan | |
uses: actions/checkout@v2 | |
- name: Login to Artifactory | |
run: curl -u ${{ secrets.ARTIFACTORY_API_TOKEN }} -X POST https://artifactory.eng.tenable.com/artifactory/api/docker/auth | |
- name: Pull Docker Image | |
run: docker pull terrascan-test.artifactory.eng.tenable.com/tenb-cb:1.0.8.DEV230807225718-J-EPRT-TENB-CB-TENB-CB-CICD-5797-8/ | |
- name: Setup Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install golint | |
run: go install golang.org/x/lint/golint@latest | |
- name: Build Terrascan docker image | |
run: make docker-build | |
- name: Go validations | |
run: make validate | |
- name: Build Terrascan | |
run: make build | |
- name: Run unit tests | |
run: make unit-tests | |
- name: install kind | |
run: make install-kind | |
- name: Run e2e tests | |
run: make e2e-tests | |
- name: Run e2e vulnerability tests | |
if: ${{ (github.event_name == 'push'|| github.event_name == 'schedule') && github.actor != 'dependabot[bot]' }} | |
run: make e2e-vulnerability-tests | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
# push image to Docker Hub | |
push: | |
# Ensure "validate" job passes before pushing image. | |
needs: validate | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- name: Login to Artifactory | |
run: curl -u ${{ secrets.ARTIFACTORY_API_TOKEN }} -X POST https://artifactory.eng.tenable.com/artifactory/api/docker/auth | |
- name: Pull Docker Image | |
run: docker pull docker-terracan-local.artifactory.eng.tenable.com/terrascan-test/tenb-cb:1.0.8.DEV230807225718-J-EPRT-TENB-CB-TENB-CB-CICD-5797-8/ | |
- name: Logout from Artifactory | |
run: echo "Logout not necessary for API token-based authentication" | |
- name: Remove Docker Login Config | |
run: rm ~/.docker/config.json |