Skip to content

Commit

Permalink
vuln test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Rchanger committed Aug 26, 2021
1 parent a3b201c commit 0356423
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 4 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/e2e-vuln.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: e2e-vuln-test
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened, ready_for_review, edited]
jobs:
validate:
runs-on: ubuntu-latest
env:
GO111MODULE: on
GOPATH: /home/runner/work/terrascan
GOBIN: /home/runner/work/terrascan/bin
GO_VERSION: 1.16
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_SECRET }}
GOOGLE_APPLICATION_CREDENTIALS_TEST_SECRET: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_TEST_KEY }}
steps:
- name: Checkout Terrascan
uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}

- name: Install golint
run: go get -u golang.org/x/lint/golint

- name: Go validations
run: make validate

- name: Run e2e tests
run: make e2e-tests

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1


3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,6 @@ atlantis-docker-push-latest:
# push release tag terrascan_atlantis docker image
atlantis-docker-push-latest-tag:
./scripts/atlantis/docker-push-latest-tag.sh

e2e-vuln-tests: build
./scripts/run-e2e-vuln.sh
9 changes: 9 additions & 0 deletions scripts/run-e2e-vuln.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

export TERRASCAN_BIN_PATH=${PWD}/bin/terrascan

go test -p 1 -v ./test/e2e/scan/...
4 changes: 0 additions & 4 deletions test/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"bytes"
"encoding/json"
"encoding/xml"
"fmt"
"io"
"io/ioutil"
"os"
Expand Down Expand Up @@ -437,9 +436,6 @@ func CheckSummaryForVulnerabilities(session *gexec.Session, isStdOut bool) {
sessionBytes = session.Wait().Err.Contents()
}

output := session.Wait().Err.Contents()
fmt.Println("<><>", string(output))

sessionBytes = bytes.TrimSpace(sessionBytes)

var sessionEngineOutput policy.EngineOutput
Expand Down

0 comments on commit 0356423

Please sign in to comment.