Skip to content

Commit a2cb2c2

Browse files
author
André Anundsson
authored
Merge pull request #69 from XenitAB/feature/multi_arch_build
New Dockerfile incl. multi-arch support __ • Switched base-image to debian:slim-latest. • Migrated .sh install-scripts to environment variables for versioning binary installation. • Enabled multi-architecture support. • Updated pipelines to support multi-arch build • Updated tflint hcl config to work with new tflint version • Moved unused files to obsolete • Upgraded all binaries • Refactored rego policies to support rego v1
2 parents 969fe8c + 8ac63e5 commit a2cb2c2

54 files changed

Lines changed: 638 additions & 1178 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Docker Build Template
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
push:
7+
type: boolean
8+
required: true
9+
tag:
10+
type: string
11+
required: false
12+
platforms:
13+
type: string
14+
required: false
15+
default: linux/amd64,linux/arm64
16+
17+
jobs:
18+
build:
19+
name: Build and Push Container Image
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Login to GitHub Container Registry
29+
if: ${{ inputs.push }}
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Build and push container image
37+
id: build-push
38+
uses: docker/build-push-action@v6
39+
with:
40+
cache-from: "ghcr.io/${{ github.repository }}/tools:latest"
41+
file: docker/Dockerfile
42+
context: docker
43+
tags: "ghcr.io/${{ github.repository_owner }}/${{ github.repository }}/tools:${{ inputs.tag }}"
44+
platforms: ${{ inputs.platforms }}
45+
push: ${{ inputs.push }}
46+
47+
- name: Generate Artifact Attestation
48+
if: ${{ inputs.push }}
49+
uses: actions/attest-build-provenance@v2
50+
with:
51+
subject-name: ghcr.io/${{ github.repository }}
52+
subject-digest: ${{ steps.build-push.outputs.digest }}
53+
push-to-registry: true

.github/workflows/shared-steps.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

.github/workflows/tools-container-latest.yaml

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Tools Container - Publish Latest
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docker/**'
9+
- '.github/**'
10+
11+
jobs:
12+
publish_latest:
13+
uses: ./.github/workflows/container-build-template.yml
14+
with:
15+
push: true
16+
tag: "latest"

.github/workflows/tools-container-pr.yaml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,7 @@ on:
77

88
jobs:
99
pr_validation:
10-
name: PR Validation
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v2
15-
16-
- name: Set up Docker Buildx
17-
uses: docker/setup-buildx-action@v1
18-
19-
- name: Build container image
20-
uses: docker/build-push-action@v2
21-
with:
22-
cache-from: ghcr.io/xenitab/github-actions/tools:latest
23-
file: docker/Dockerfile
24-
context: docker
25-
push: false
10+
uses: ./.github/workflows/container-build-template.yml
11+
with:
12+
push: false
13+
tag: "pr"

.github/workflows/tools-container-tag.yaml

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,22 @@ on:
44
release:
55
types:
66
- published
7-
paths:
8-
- "docker/**"
9-
- ".github/**"
107

118
jobs:
12-
publish_latest:
13-
name: Push tagged container image to GitHub Packages
9+
generate_tag:
1410
runs-on: ubuntu-latest
11+
outputs:
12+
date_tag: ${{ steps.get_date.outputs.date_tag }}
1513
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v2
18-
19-
- name: Set up Docker Buildx
20-
uses: docker/setup-buildx-action@v1
21-
22-
- name: Login to GitHub Container Registry
23-
uses: docker/login-action@v2
24-
with:
25-
registry: ghcr.io
26-
username: ${{ github.actor }}
27-
password: ${{ secrets.GITHUB_TOKEN }}
28-
29-
- name: Get GitHub Tag
30-
id: get_tag
14+
- name: Generate Tag
15+
id: get_date
3116
run: |
32-
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
17+
date=$(date -u +"%Y.%-m.%-d")
18+
echo "date_tag=${date}" >> $GITHUB_OUTPUT
3319
34-
- name: Build and push container image
35-
uses: docker/build-push-action@v2
36-
with:
37-
cache-from: ghcr.io/xenitab/github-actions/tools:latest
38-
file: docker/Dockerfile
39-
context: docker
40-
tags: ghcr.io/xenitab/github-actions/tools:${{ steps.get_tag.outputs.tag }}
41-
push: true
20+
publish_tag:
21+
needs: generate_tag
22+
uses: ./.github/workflows/container-build-template.yml
23+
with:
24+
push: true
25+
tag: ${{ needs.generate_tag.outputs.date_tag }}

.github/workflows/tools-lite-container-latest.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/tools-lite-container-pr.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/tools-lite-container-tag.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/tools-opa-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
uses: actions/checkout@v3
99

1010
- name: Setup OPA
11-
uses: open-policy-agent/setup-opa@v1
11+
uses: open-policy-agent/setup-opa@v2
1212
with:
13-
version: 0.40.0
13+
version: 1.3.0
1414

1515
- name: Run OPA Tests
1616
run: opa test docker/opa-policies/ -v

0 commit comments

Comments
 (0)