Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d8bb39a
chore(ci): Update default branches
actuarysailor Aug 12, 2025
f326080
feat: Added Docker based pre-commit-hooks (#1)
actuarysailor Aug 12, 2025
d70be2c
chore(ci): Fix release workflow (#2)
actuarysailor Aug 12, 2025
3b18d08
chore(ci): Fix release workflow (#3)
actuarysailor Aug 12, 2025
1b78031
chore(release): version 1.0.0 [skip ci]
semantic-release-bot Aug 12, 2025
3e91a9c
fix: Build Docker image workflow (#4)
actuarysailor Aug 12, 2025
bb38650
Update Dockerfile
actuarysailor Aug 12, 2025
17aa365
chore(release): version 1.0.1 [skip ci]
semantic-release-bot Aug 12, 2025
aa0d873
fix: Changelog dysync due to tag issue
actuarysailor Aug 12, 2025
8c61c89
chore(release): version 1.101.0 [skip ci]
semantic-release-bot Aug 12, 2025
0f8dfaa
chore: Resolve comment from yermulnik
actuarysailor Aug 15, 2025
6025c14
chore: Resolving coderabbits comment
actuarysailor Aug 15, 2025
c40f434
chore: Address coderabbit comment
actuarysailor Aug 15, 2025
c699975
chore: Making changelog compatible with upstream
actuarysailor Aug 15, 2025
d97a860
Update README.md
actuarysailor Aug 15, 2025
2f2bca6
Update .github/workflows/build-image.yaml
actuarysailor Aug 15, 2025
f26e742
Update Dockerfile.tools
actuarysailor Aug 15, 2025
4400849
chore: Pre-commit linting
actuarysailor Aug 15, 2025
df1fb32
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 15, 2025
db8b255
chore: Coderabbit review of PRE_COMMIT_VERSION validation
actuarysailor Aug 15, 2025
0751a04
chore: Coderabbit INSTALL_ALL validation
actuarysailor Aug 15, 2025
506466c
chore: Fix coderabbit grep pattern
actuarysailor Aug 15, 2025
75a3a51
chore: Coderabbit bad recommendation
actuarysailor Aug 15, 2025
f35d066
chore: fixing a coderabbit change
actuarysailor Aug 15, 2025
12e5de2
chore: Accept coderabbit suggestion
actuarysailor Aug 15, 2025
8455c2e
chore: Fix coderabbit suggestion
actuarysailor Aug 15, 2025
1731092
chore: trigger CI with empty commit
actuarysailor Aug 15, 2025
8fb27aa
Update Dockerfile.tools
actuarysailor Aug 15, 2025
2f4a2a3
Update Dockerfile.tools
actuarysailor Aug 15, 2025
5aab062
Update Dockerfile.tools
actuarysailor Aug 15, 2025
dd977d1
fix: Disable docker hooks on pre-commit.ci (#5)
actuarysailor Aug 16, 2025
2dec291
chore(release): version 1.101.1 [skip ci]
semantic-release-bot Aug 16, 2025
70a37a8
Update Dockerfile.tools
actuarysailor Aug 16, 2025
d1629ba
chore: Improved documentation for pre-commit
actuarysailor Aug 16, 2025
4050d10
ci: Fixing pre-commit validate hook (#6)
actuarysailor Aug 16, 2025
1815705
chore: Fix Changelog
actuarysailor Aug 16, 2025
5aed527
chore: Remaining coderabbit comments
actuarysailor Aug 16, 2025
75e7837
chore: Coderabbit nitpicks
actuarysailor Aug 16, 2025
3d20103
chore: One last nitpic
actuarysailor Aug 16, 2025
9e0a309
chore: More coderabbit nitpicks
actuarysailor Aug 16, 2025
246cbe5
Trigger CodeRabbit
actuarysailor Aug 16, 2025
1108a8f
chore: More coderabbit nitpicks
actuarysailor Aug 16, 2025
d848eb1
Trigger coderabbit
actuarysailor Aug 16, 2025
6b2eb62
Fix terraform_fmt hook and drop useless stuff
MaxymVlasov Sep 2, 2025
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
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*
!.dockerignore
!Dockerfile
!hooks/*.sh
!lib_getopt
!src/
!tools/entrypoint.sh
!tools/install/*.sh
52 changes: 37 additions & 15 deletions .github/workflows/build-image-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,23 @@ jobs:

strategy:
matrix:
arch:
- amd64
- arm64
include:
- os-name: Ubuntu x64
os: ubuntu-latest
arch: amd64

dockerfile: Dockerfile
- os-name: Ubuntu ARM
os: ubuntu-24.04-arm
arch: arm64
dockerfile: Dockerfile
- os-name: Ubuntu x64 (tools)
os: ubuntu-latest
arch: amd64
dockerfile: Dockerfile.tools
- os-name: Ubuntu ARM (tools)
os: ubuntu-24.04-arm
arch: arm64
dockerfile: Dockerfile.tools

name: ${{ matrix.os-name }}
runs-on: ${{ matrix.os }}
Expand All @@ -45,27 +51,29 @@ jobs:
files: |
.dockerignore
.github/workflows/build-image-test.yaml
Dockerfile
${{ matrix.dockerfile }}
tools/entrypoint.sh
tools/install/*.sh

- name: Set IMAGE environment variable
if: steps.changed-files-specific.outputs.any_changed == 'true'
# Lowercase the org/repo name to allow for workflow to run in forks,
# which owners have uppercase letters in username
run: >-
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}:${{ env.IMAGE_TAG }}"
>> $GITHUB_ENV
run: |
if [[ "${{ matrix.dockerfile }}" == "Dockerfile" ]]; then
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}:${{ env.IMAGE_TAG }}" >> $GITHUB_ENV
else
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}:${{ env.IMAGE_TAG }}-tools" >> $GITHUB_ENV
fi

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
if: steps.changed-files-specific.outputs.any_changed == 'true'

- name: Build if Dockerfile changed
- name: Build if "${{ matrix.dockerfile }}" changed
if: steps.changed-files-specific.outputs.any_changed == 'true'
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: ${{ matrix.dockerfile }}
build-args: |
INSTALL_ALL=true
push: false
Expand Down Expand Up @@ -98,8 +106,7 @@ jobs:
IMAGE_NAME: ${{ env.IMAGE }}
run: >-
container-structure-test test
--config ${{ github.workspace
}}/.github/.container-structure-test-config.yaml
--config ${{ github.workspace }}/.github/.container-structure-test-config.yaml
--image "${IMAGE_NAME}"

- name: Dive - check image for waste files
Expand All @@ -112,8 +119,9 @@ jobs:

# Can't build both platforms and use --load at the same time
# https://github.com/docker/buildx/issues/59#issuecomment-1433097926
- name: Build Multi-arch docker-image
if: >-
# Build Multi-arch docker-image
- name: Build Multi-arch "${{ matrix.dockerfile }}"
if: >
steps.changed-files-specific.outputs.any_changed == 'true'
&& matrix.os == 'ubuntu-latest'
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
Expand All @@ -128,3 +136,17 @@ jobs:
provenance: false
secrets: |
"github_token=${{ secrets.GITHUB_TOKEN }}"

# Only run smoke tests for the tools image
- name: Smoke test tools image
if: >
steps.changed-files-specific.outputs.any_changed == 'true'
&& matrix.os == 'ubuntu-latest'
&& matrix.dockerfile == 'Dockerfile.tools'
env:
TOOLS_IMAGE: ${{ env.IMAGE }}
run: |
echo "Testing tools image: $TOOLS_IMAGE"
docker run --rm "$TOOLS_IMAGE" terraform --version
docker run --rm "$TOOLS_IMAGE" terraform-docs --version
docker run --rm "$TOOLS_IMAGE" tflint --version
163 changes: 118 additions & 45 deletions .github/workflows/build-image.yaml
Copy link
Author

Choose a reason for hiding this comment

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

largely the same, but got rid of the need for your if schedule do these jobs if not do these other jobs by using one of the other standard docker actions. was able to clean up the jobs a bit and basically do the same thing - you might want to double check though

Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,35 @@ name: Publish container image

on:
workflow_dispatch:
push:
paths:
- .github/workflows/build-image.yaml
- Dockerfile*
release:
types:
- created
schedule:
- cron: 00 00 * * *

permissions:
contents: read
env:
REGISTRY: ghcr.io

jobs:
docker:
runs-on: ubuntu-latest
permissions:
# for docker/build-push-action to publish docker image
contents: read
packages: write

runs-on: ubuntu-latest
attestations: write
id-token: write
strategy:
fail-fast: false
matrix:
include:
- dockerfile: Dockerfile
image_name: ${{ github.repository }}
- dockerfile: Dockerfile.tools
image_name: ${{ github.repository }}-tools
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -26,60 +39,120 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

- name: Login to GitHub Container Registry
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set tag for image
env:
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref_name }}
run: >-
echo IMAGE_TAG=$(
[ $REF_TYPE == 'tag' ]
&& echo $REF_NAME
|| echo 'latest'
) >> $GITHUB_ENV

- name: Set IMAGE_REPO environment variable
# Lowercase the org/repo name to allow for workflow to run in forks,
# which owners have uppercase letters in username
run: >-
echo "IMAGE_REPO=ghcr.io/${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

- name: Build and Push release
if: github.event_name != 'schedule'
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f
with:
context: .
build-args: |
INSTALL_ALL=true
platforms: linux/amd64,linux/arm64
push: true
images: ${{ env.REGISTRY }}/${{ matrix.image_name }}
tags: |
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}
${{ env.IMAGE_REPO }}:latest
# Fix multi-platform: https://github.com/docker/buildx/issues/1533
provenance: false
secrets: |
"github_token=${{ secrets.GITHUB_TOKEN }}"
type=ref,event=branch
type=ref,event=pr
type=sha
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=${{ github.ref_name }},enable=${{ github.ref_type == 'tag' }}
type=raw,value=nightly,enable=${{ github.event_name == 'schedule' }}

- name: Build and Push nightly
if: github.event_name == 'schedule'
- name: Build and Push release
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: ${{ matrix.dockerfile }}
build-args: |
INSTALL_ALL=true
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_REPO }}:nightly
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Fix multi-platform: https://github.com/docker/buildx/issues/1533
provenance: false
secrets: |
"github_token=${{ secrets.GITHUB_TOKEN }}"

- name: Test tools image
if: matrix.dockerfile == 'Dockerfile.tools' && github.event_name != 'schedule'
env:
IMAGE_TAGS: ${{ steps.meta.outputs.tags }}
run: |
set -euo pipefail
IMAGE_TAG=$(echo "$IMAGE_TAGS" | head -n1)
echo "Testing tools image: $IMAGE_TAG"

# Version checks
docker run --rm "$IMAGE_TAG" terraform --version
docker run --rm "$IMAGE_TAG" terraform-docs --version
docker run --rm "$IMAGE_TAG" tflint --version

# Optional extra versions (quick smoke)
docker run --rm "$IMAGE_TAG" checkov --version || true
docker run --rm "$IMAGE_TAG" trivy --version || true

# Create a minimal, self-contained Terraform module for functional tests
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
cat > "$TMP_DIR/main.tf" << 'EOF'
terraform {
required_version = ">= 1.3.0"
}
variable "example_var" {
description = "An example variable"
type = string
default = "test"
}
output "example_output" {
description = "An example output"
value = var.example_var
}
EOF
echo "# Test Module" > "$TMP_DIR/README.md"

echo "Testing terraform fmt..."

docker run --rm \
-v "$TMP_DIR:/workspace" \
-w /workspace \
"$IMAGE_TAG" \
terraform fmt -check -diff

echo "Testing terraform init/validate..."

docker run --rm \
-v "$TMP_DIR:/workspace" \
-w /workspace \
"$IMAGE_TAG" \
terraform init -backend=false

docker run --rm \
-v "$TMP_DIR:/workspace" \
-w /workspace \
"$IMAGE_TAG" \
terraform validate

echo "Testing terraform-docs..."

docker run --rm \
-v "$TMP_DIR:/workspace" \
-w /workspace \
"$IMAGE_TAG" \
terraform-docs markdown table . --output-file README.md

echo "Testing tflint..."

docker run --rm \
-v "$TMP_DIR:/workspace" \
-w /workspace \
"$IMAGE_TAG" \
tflint --init

docker run --rm \
-v "$TMP_DIR:/workspace" \
-w /workspace \
"$IMAGE_TAG" \
tflint

echo "All functional tests passed!"
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ name: CodeQL
on:
push:
branches:
- main
- master
merge_group:
pull_request:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Copy link
Author

Choose a reason for hiding this comment

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

added main because i normally fork to master and only allow upstream updates to come in, then use main for my main in case i want to use it before a PR is approved. Also made it both docker files and the release workflow so i could trigger it when i changed it. modified to use built-in github_token because that is the only way for "fresh/new" packages to auto attribute to parent repo, PAT orphans them until you go add them to a repo.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it. Now I'll modify them back

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ on:
workflow_dispatch:
push:
branches:
- main
- master
paths:
- .github/workflows/release.yml
- '**/*.py'
- '**/*.sh'
- Dockerfile
Expand Down Expand Up @@ -46,4 +48,4 @@ jobs:
# Custom token for triggering Docker image build GH Workflow on release
# created by cycjimmy/semantic-release-action. Events created by
# workflows with default GITHUB_TOKEN not trigger other GH Workflow.
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- cron: 20 7 * * 2
push:
branches:
- main
- master

# Declare default permissions as read only.
Expand Down
Loading