Skip to content

Commit 1ea3ea2

Browse files
authored
feat(ci): Build copy of Bitnami images for vendorized charts (#2392)
Signed-off-by: Javier Rodriguez <[email protected]>
1 parent 2d0b88d commit 1ea3ea2

File tree

1 file changed

+137
-0
lines changed

1 file changed

+137
-0
lines changed
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Build Bitnami Container Images
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
packages: write
9+
10+
jobs:
11+
build_and_push_images:
12+
name: Build and Push ${{ matrix.image.name }} Image
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
image:
17+
# On Ref we use the specific commit SHA to ensure reproducible builds
18+
# It can be: branch, tag or SHA
19+
# PostgreSQL version: 16.4.0
20+
- name: PostgreSQL
21+
image_name: chainloop-dev/chainloop/postgresql
22+
path: bitnami/postgresql/16/debian-12
23+
sparse_checkout: bitnami/postgresql/16/debian-12
24+
ref: 5d351cc8a742d6a6f417f879ba2df9882b617676
25+
# PostgreSQL Exporter version: 0.15.0
26+
- name: PostgreSQL Exporter
27+
image_name: chainloop-dev/chainloop/postgres-exporter
28+
path: bitnami/postgres-exporter/0/debian-12
29+
sparse_checkout: bitnami/postgres-exporter/0/debian-12
30+
ref: 1d0408ccfbdc43b90bc6449227ce731079e42f6b
31+
# OS Shell version: 12
32+
- name: OS Shell
33+
image_name: chainloop-dev/chainloop/os-shell
34+
path: bitnami/os-shell/12/debian-12
35+
sparse_checkout: bitnami/os-shell/12/debian-12
36+
ref: dde1f3b2d7b271de64c6ce948a04716cb96199a1
37+
# Dex version: 2.40.0
38+
- name: Dex
39+
image_name: chainloop-dev/chainloop/dex
40+
path: bitnami/dex/2/debian-12
41+
sparse_checkout: bitnami/dex/2/debian-12
42+
ref: 19c7a5ade4364ff1b52c65004291203ff2096eb0
43+
# Vault version: 1.17.3
44+
- name: Vault
45+
image_name: chainloop-dev/chainloop/vault
46+
path: bitnami/vault/1/debian-12
47+
sparse_checkout: bitnami/vault/1/debian-12
48+
ref: 28d8f22ad6b7c3871c2f429c72e5ccf3344ae5bc
49+
# Vault CSI Provider version: 1.4.3
50+
- name: Vault CSI Provider
51+
image_name: chainloop-dev/chainloop/vault-csi-provider
52+
path: bitnami/vault-csi-provider/1/debian-12
53+
sparse_checkout: bitnami/vault-csi-provider/1/debian-12
54+
ref: 673c94210db93a8df808765b6b213661686aeb33
55+
# Vault K8s version: 1.4.2
56+
- name: Vault K8s
57+
image_name: chainloop-dev/chainloop/vault-k8s
58+
path: bitnami/vault-k8s/1/debian-12
59+
sparse_checkout: bitnami/vault-k8s/1/debian-12
60+
ref: 62cb6e1498e873dd9ab92880073a43896b470c4b
61+
env:
62+
REGISTRY: ghcr.io
63+
IMAGE_NAME: ${{ matrix.image.image_name }}
64+
BITNAMI_PATH: bitnami-containers
65+
66+
steps:
67+
- name: Checkout repository
68+
uses: actions/checkout@v4
69+
70+
- name: Checkout Bitnami containers repository
71+
uses: actions/checkout@v4
72+
with:
73+
repository: bitnami/containers
74+
path: ${{ env.BITNAMI_PATH }}
75+
ref: ${{ matrix.image.ref }}
76+
sparse-checkout: ${{ matrix.image.sparse_checkout }}
77+
sparse-checkout-cone-mode: false
78+
79+
- name: Extract version from Bitnami Dockerfile
80+
id: extract_version
81+
run: |
82+
VERSION=$(grep -E 'APP_VERSION=' ${{ env.BITNAMI_PATH }}/${{ matrix.image.path }}/Dockerfile | cut -d'"' -f2)
83+
if [ -z "$VERSION" ]; then
84+
echo "Failed to extract version from Dockerfile"
85+
exit 1
86+
fi
87+
echo "version=$VERSION" >> $GITHUB_OUTPUT
88+
echo "Extracted ${{ matrix.image.name }} version: $VERSION"
89+
90+
- name: Set up Docker Buildx
91+
uses: docker/setup-buildx-action@v3
92+
93+
- name: Log in to the Container registry
94+
uses: docker/login-action@v3
95+
with:
96+
registry: ${{ env.REGISTRY }}
97+
username: ${{ github.actor }}
98+
password: ${{ secrets.GITHUB_TOKEN }}
99+
100+
- name: Extract metadata
101+
id: meta
102+
uses: docker/metadata-action@v5
103+
with:
104+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
105+
tags: |
106+
type=raw,value=${{ steps.extract_version.outputs.version }}
107+
type=raw,value=latest
108+
type=sha,format=long
109+
110+
- name: Build and push Docker image
111+
id: build
112+
uses: docker/build-push-action@v5
113+
with:
114+
context: ${{ env.BITNAMI_PATH }}/${{ matrix.image.path }}
115+
platforms: linux/amd64,linux/arm64
116+
push: true
117+
tags: ${{ steps.meta.outputs.tags }}
118+
labels: ${{ steps.meta.outputs.labels }}
119+
120+
- name: Install Cosign
121+
uses: sigstore/cosign-installer@v3
122+
with:
123+
cosign-release: "v2.4.1"
124+
125+
- name: Sign container image
126+
env:
127+
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_KEY }}
128+
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
129+
run: |
130+
cosign sign --tlog-upload=false --key env://COSIGN_PRIVATE_KEY ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
131+
132+
- name: Output build information
133+
run: |
134+
echo "Successfully built and pushed ${{ matrix.image.name }} image"
135+
echo "Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
136+
echo "Version: ${{ steps.extract_version.outputs.version }}"
137+
echo "Digest: ${{ steps.build.outputs.digest }}"

0 commit comments

Comments
 (0)