-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (66 loc) · 2.3 KB
/
01-data-ingestion-container.yml
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
name: 01 - Build and Push Data Ingestion Container
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:
push-data-ingestion-container:
name: data_ingestion
runs-on: ubuntu-24.04
env:
IMAGE_NAME: gardenlinux/glvd-data-ingestion
IMAGE_TAG: latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- 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@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_TAG }}
platforms: linux/amd64, linux/arm64
containerfiles: |
./Containerfile
- name: Push To ghcr.io
id: push-to-ghcr
if: ${{ github.event_name != 'pull_request' }}
uses: redhat-actions/push-to-registry@v2
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 details
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "Image pushed to ${{ steps.push-to-ghcr.outputs.registry-paths }}"
echo "Digest ${{ steps.push-to-ghcr.outputs.digest }}"
- name: Get OIDC token
if: ${{ github.event_name != 'pull_request' }}
id: get-token
run: |
IDTOKEN=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=glvd" | jq -r '.value')
echo "idToken=${IDTOKEN}" >> $GITHUB_OUTPUT
- uses: azure/k8s-set-context@v4
if: ${{ github.event_name != 'pull_request' }}
with:
method: kubeconfig
kubeconfig: "${{ secrets.KUBECONFIG }}"
- name: Deploy the image
if: ${{ github.event_name != 'pull_request' }}
run: kubectl --namespace default --token "${{ steps.get-token.outputs.idToken }}" set image cj/glvd-ingestion data-ingestion=ghcr.io/gardenlinux/glvd-data-ingestion@${{ steps.push-to-ghcr.outputs.digest }}