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

Gh action terrscan_atlantis release #733

Merged
merged 2 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ jobs:
- name: Build Terrascan docker image
run: make docker-build

- name: Build terrascan_atlantis docker image
run: make atlantis-docker-build

- name: Login to docker hub
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u accurics --password-stdin

- name: Push Terrascan latest tag docker image
run: make docker-push-latest-tag

- name: Push terrascan_atlantis latest tag docker image
run: make atlantis-docker-push-latest-tag
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ help:
@echo "docker-push\n\tpush terrascan docker image"
@echo "docker-push-latest\n\tpush terrascan docker image with latest tag"
@echo "docker-push-latest-tag\n\tpush terrascan docker image with latest release tag"
@echo "docker-atlantis-build\n\tbuild terrascan_atlantis docker image"
@echo "docker-atlantis-push\n\tpush terrascan_atlantis docker image"
@echo "docker-atlantis-push-latest\n\tpush terrascan_atlantis docker image with latest tag"
@echo "docker-atlantis-push-latest-tag\n\tpush terrascan_atlantis docker image with latest release tag"
@echo "gofmt\n\tvalidate gofmt"
@echo "golint\n\tvalidate golint"
@echo "gomodverify\n\tverify go modules"
Expand Down Expand Up @@ -104,3 +108,19 @@ docker-push-latest:
# push release tag terrascan docker image
docker-push-latest-tag:
./scripts/docker-push-latest-tag.sh

# build terrascan_atlantis docker image
atlantis-docker-build:
./scripts/atlantis/docker-build.sh

# push terrascan_atlantis docker image
atlantis-docker-push:
./scripts/atlantis/docker-push.sh

# push latest terrascan_atlantis docker image
atlantis-docker-push-latest:
./scripts/atlantis/docker-push-latest.sh

# push release tag terrascan_atlantis docker image
atlantis-docker-push-latest-tag:
./scripts/atlantis/docker-push-latest-tag.sh
2 changes: 2 additions & 0 deletions atlantis/data/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[severity]
level = "high"
11 changes: 11 additions & 0 deletions scripts/atlantis/docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe take scripts/docker-build.sh and tweak it so it takes DOCKER_REPO and DIR as parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did have a PR for something like that : #555

I'll re-open it and make these changes there later. savvy?

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

GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null)
DOCKER_REPO="accurics/terrascan_atlantis"
DIR="./atlantis"

docker build -t ${DOCKER_REPO}:${GIT_COMMIT} ${DIR}
14 changes: 14 additions & 0 deletions scripts/atlantis/docker-push-latest-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for this guy, see if scripts/docker-push* can be adjusted for several images

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

GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null)
DOCKER_REPO="accurics/terrascan_atlantis"
LATEST_TAG=$(git describe --abbrev=0 --tags)
LATEST_TAG_SHORT=$(echo "${LATEST_TAG//v}")

# PS: It is a prerequisite to execute 'docker login' before running this script
docker tag ${DOCKER_REPO}:${GIT_COMMIT} ${DOCKER_REPO}:${LATEST_TAG_SHORT}
docker push ${DOCKER_REPO}:${LATEST_TAG_SHORT}
13 changes: 13 additions & 0 deletions scripts/atlantis/docker-push-latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

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

GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null)
DOCKER_REPO="accurics/terrascan_atlantis"
LATEST_TAG="latest"

# PS: It is a prerequisite to execute 'docker login' before running this script
docker tag ${DOCKER_REPO}:${GIT_COMMIT} ${DOCKER_REPO}:${LATEST_TAG}
docker push ${DOCKER_REPO}:${LATEST_TAG}
11 changes: 11 additions & 0 deletions scripts/atlantis/docker-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

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

GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null)
DOCKER_REPO="accurics/terrascan_atlantis"

# PS: It is a prerequisite to execute 'docker login' before running this script
docker push ${DOCKER_REPO}:${GIT_COMMIT}