-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (76 loc) · 2.94 KB
/
build-postgres-container.yml
File metadata and controls
90 lines (76 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: build
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
# Checkout repository
contents: read
# Push container images
packages: write
# This is required for requesting the JWT
id-token: write
jobs:
build:
runs-on: ubuntu-24.04
env:
IMAGE_NAME: ghcr.io/gardenlinux/glvd-postgres
IMAGE_TAG: latest
# Change this if you fork the repo
IMAGE_NAME_ORG: gardenlinux
# Change this if you fork the repo
OIDC_AUDIENCE: glvd
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install qemu dependency for multi-arch build
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2.13
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_TAG }}
platforms: linux/amd64, linux/arm64
containerfiles: |
./Containerfile
- name: Echo Outputs
run: |
echo "Image: ${{ steps.build_image.outputs.image }}"
echo "Tags: ${{ steps.build_image.outputs.tags }}"
echo "Tagged Image: ${{ steps.build_image.outputs.image-with-tag }}"
- name: Check images created
run: buildah images | grep '${{ env.IMAGE_NAME }}'
- name: Check manifest
run: |
set -x
buildah manifest inspect ${{ steps.build_image.outputs.image }}:${{ env.IMAGE_TAG }}
- name: Push To ghcr.io
id: push-to-ghcr
if: ${{ github.event_name != 'pull_request' }}
uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2.8
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Print image url
if: ${{ github.event_name != 'pull_request' }}
run: echo "Image pushed to ${{ steps.push-to-ghcr.outputs.registry-paths }}"
- name: Authenticate to cluster
id: kube_auth
uses: gardener/cc-utils/.github/actions/kubernetes-auth@9efc8a40cef4a55b6a4bee8ee18502fe9e53f344 # ocm/0.8.0
with:
server: https://api.dev.gl-dev.shoot.canary.k8s-hana.ondemand.com
server-ca-discovery-url: https://discovery.ingress.garden.canary.k8s.ondemand.com/projects/gl-dev/shoots/6a3efe36-1d56-4e07-83f6-36720207b51b/cluster-ca
audience: ${{ env.OIDC_AUDIENCE }}
- name: Deploy the image
if: ${{ github.event_name != 'pull_request' }}
env:
KUBECONFIG: kubeconfig.yaml
run: kubectl --namespace glvd set image sts/glvd-database glvd-postgres=ghcr.io/gardenlinux/glvd-postgres@${{ steps.push-to-ghcr.outputs.digest }}