Skip to content

Fix High and Moderate Vulnerability #992

Fix High and Moderate Vulnerability

Fix High and Moderate Vulnerability #992

Workflow file for this run

name: Build Compiler image
on:
push:
branches:
- 'main'
pull_request:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout github repository
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: '>=1.17.0'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'
- name: Build Compiler image
env:
GOOGLE_SERVICE_ACCOUNT_KEY: ${{ secrets.GCPServiceAccountKey }}
GCR_REPOSITORY: gcr.io/nsx-sm
run: |
set -x
echo $GOOGLE_SERVICE_ACCOUNT_KEY | docker login -u _json_key --password-stdin $GCR_REPOSITORY
git config --global url."https://github.com/".insteadOf "git@github.com:"
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
GITHUB_SHA=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.head.sha)
fi
if [[ $GITHUB_REF_TYPE == "tag" ]]; then
IMAGE_TAG=$GITHUB_REF_NAME
else
IMAGE_TAG=$GITHUB_SHA
fi
echo "Building compiler image with tag: $IMAGE_TAG"
pushd compiler
make docker.builder
make build_in_container
make docker TAG=$IMAGE_TAG
make publish TAG=$IMAGE_TAG
popd
test:
if: contains(fromJson('["pull_request"]'), github.event_name)
name: Run Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout github repository
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: '>=1.17.0'
- name: Test Generate Code and Render templates
run: |
git config --global url."https://github.com/".insteadOf "git@github.com:"
pushd compiler
make docker.builder
make test_in_container
make test_render_templates
make test_generate_code_in_container
popd