Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cicd deployment update #1630

Merged
merged 6 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .github/workflows/gobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,26 @@ jobs:
needs: validate

runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name == 'push' #&& github.ref == 'refs/heads/master'
mandibles232 marked this conversation as resolved.
Show resolved Hide resolved

steps:
- name: Checkout Terrascan
uses: actions/checkout@v3

- uses: docker/setup-qemu-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Artifactory
run: docker login --username svc_terrascan --password ${{ secrets.ARTIFACTORY_API_TOKEN }} https://docker-terrascan-local.artifactory.eng.tenable.com

- name: Build and push Terrascan latest docker image
- name: Build latest docker image
run: make docker-build-push-latest
env:
MULTIPLATFORM: true

- name: Pull Image
run: docker pull docker-terrascan-local.artifactory.eng.tenable.com/tenb-cb:1.0.10.DEV231011191849-J-EPRT-TENB-CB-TENB-CB-CICD-5797-10

- name: Run scan
run: |
image_tag=$(<dockerhub-image-label.txt)
docker run -e JKN_USERNAME=${{ secrets.JKN_USERNAME }} -e JKN_PASSWORD=${{ secrets.JKN_PASSWORD }} -t docker-terrascan-local.artifactory.eng.tenable.com/latest jobs execute-job --credential-mode env -n teams-deleng-terraform -p deleng-terraform/dockerhub-publish -d "{\"APPID\":\"test\", \"IMAGE\":\"docker-terrascan-local.artifactory.eng.tenable.com/terrascan:${image_tag}\", \"TARGETS\": \"tenable/terrascan:${image_tag},tenable/was-scanner:latest\", \"MULTIARCH\":\"true\"}" --cloudflare-access-secret ${{ secrets.CF_ACCESS_TOKEN }}:${{ secrets.CF_SECRET }}
4 changes: 3 additions & 1 deletion scripts/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -o errexit
set -o nounset
set -o pipefail

DOCKER_REPO="tenable/terrascan"
DOCKER_REPO="docker-terrascan-local.artifactory.eng.tenable.com/terrascan"
DOCKERFILE="./build/Dockerfile"

if [ $# -eq 0 ]; then
Expand Down Expand Up @@ -42,4 +42,6 @@ docker buildx create "${PLATFORM[@]}" --name terrascan-builder --use

docker buildx build --provenance=false "${OUTPUT_TYPE}" "${PLATFORM[@]}" -t "${DOCKER_REPO}:${LABEL}" -f "${DOCKERFILE}" .

echo "${LABEL}" > dockerhub-image-label.txt

docker buildx rm terrascan-builder
Loading