-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to terraform 1.5.7 and add Dockerfile validation
- Loading branch information
Showing
7 changed files
with
136 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
name: Ansible | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Tools environment | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
paths: | ||
- Dockerfile | ||
- requirements.txt | ||
- requirements.yml | ||
- .github/workflows/tools.yml | ||
pull_request: | ||
paths: | ||
- Dockerfile | ||
- requirements.txt | ||
- requirements.yml | ||
- .github/workflows/tools.yml | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: qe-sap-deployment # ${{ github.repository }} | ||
TEST_TAG: test | ||
|
||
|
||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Install the cosign tool except on PR | ||
# https://github.com/sigstore/cosign-installer | ||
#- name: Install cosign | ||
# if: github.event_name != 'pull_request' | ||
# uses: sigstore/cosign-installer@f3c664df7af409cb4873aa5068053ba9d61a57b6 #v2.6.0 | ||
# with: | ||
# cosign-release: 'v1.11.0' | ||
|
||
# Workaround: https://github.com/docker/build-push-action/issues/461 | ||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
#- name: Extract Docker metadata | ||
# id: meta | ||
# uses: docker/metadata-action@v5 | ||
# with: | ||
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
#context: . | ||
push: false | ||
load: true # Export to Docker Engine rather than pushing to a registry | ||
# push: ${{ github.event_name != 'pull_request' }} # Don't push on PR | ||
tags: ${{ github.run_id }} # ${{ env.TEST_TAG }} # ${{ steps.meta.outputs.tags }} | ||
#target: test | ||
#labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Test | ||
run: | | ||
docker run --rm ${{ github.run_id }} cat /etc/os-release | ||
- name: Podman info | ||
run: | | ||
podman info | ||
- name: Test | ||
run: | | ||
./tools/image_test.sh ${{ env.TEST_TAG }} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
img_name=$1 | ||
|
||
#podman build -f Dockerfile -t "${img_name}" | ||
|
||
podman run "${img_name}" terraform --version | grep 1.5.7 || ( echo "ERROR[$?] wrong or not usable Terraform" ; exit 1 ) | ||
podman run -v $(pwd):/src "${img_name}" terraform -chdir=/src/terraform/azure init || ( echo "ERROR[$?] terraform init does not work for azure" ; exit 1 ) | ||
podman run -v $(pwd):/src "${img_name}" terraform -chdir=/src/terraform/aws init || ( echo "ERROR[$?] terraform init does not work for aws" ; exit 1 ) | ||
podman run -v $(pwd):/src "${img_name}" terraform -chdir=/src/terraform/gcp init || ( echo "ERROR[$?] terraform init does not work for google" ; exit 1 ) | ||
|
||
podman run "${img_name}" python3.11 --version | grep 3.11 || ( echo "ERROR[$?] wrong or not usable Python" ; exit 1 ) | ||
podman run "${img_name}" pip3.11 --version || ( echo "ERROR[$?] wrong or not usable pip" ; exit 1 ) | ||
podman run "${img_name}" pip3.11 freeze | grep ansible-core || ( echo "ERROR[$?] ansible-core not installed" ; exit 1 ) | ||
podman run "${img_name}" ansible --version || ( echo "ERROR[$?] wrong or not usable Terraform" ; exit 1 ) | ||
podman run "${img_name}" ansible-galaxy --version || ( echo "ERROR[$?] wrong or not usable Terraform" ; exit 1 ) | ||
|
||
podman run "${img_name}" pip3.11 freeze | grep aws || ( echo "ERROR[$?] aws cli not installed" ; exit 1 ) | ||
podman run "${img_name}" aws --version || ( echo "ERROR[$?] wrong or not usable aws" ; exit 1 ) | ||
podman run "${img_name}" az --version || ( echo "ERROR[$?] wrong or not usable az" ; exit 1 ) | ||
podman run "${img_name}" cat /root/.bashrc | ||
#podman run "${img_name}" gcloud --version | ||
|
||
|