fix: Docker scanner workflow #15
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: Sanity Checks | |
on: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build the application image | |
run: docker build -t clouddrove/devops:0.0.${{ github.run_number }} -f .docker/Dockerfile . | |
- name: Bring container up and running | |
run: docker run --name devops -d clouddrove/devops:0.0.${{ github.run_number }} | |
- name: Wait for container to boot up | |
run: sleep 10 | |
- name: Sanity check | |
run: | | |
# Get the latest versions | |
LATEST_TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version) | |
# Get the installed versions | |
INSTALLED_TERRAFORM_VERSION=$(docker exec devops terraform version -json | jq -r .terraform_version) | |
# Compare versions | |
if [ "$LATEST_TERRAFORM_VERSION" != "$INSTALLED_TERRAFORM_VERSION" ]; then | |
echo "Terraform version mismatch: expected $LATEST_TERRAFORM_VERSION, got $INSTALLED_TERRAFORM_VERSION" | |
exit 1 | |
fi |