-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.87 KB
/
dac-initcontainer-import-kernel-docker.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
75
76
77
78
name: DAC - docker initcontainer-import-kernel
on:
workflow_dispatch:
inputs:
rollup_data_dir_name:
description: 'Name of compiled kernel directory to import in K8S (eg, dac-abcdef-tz1dvvhsPv12Ea8vNG6X1XWWB8xJFZCP8nQS)'
required: true
env:
ARTEFACTS_PROJECT_PATH: ./infra_tooling/build_artifacts/dac
IMG_SUFFIX: dac
PROJECT_NAME: dac
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set image tag vars
id: tag_vars
run: |
echo "date=$(date +%Y-%m-%dT%H-%M-%S)" >> "${GITHUB_OUTPUT}"
echo "sha_short=$(git rev-parse --short HEAD)" >> "${GITHUB_OUTPUT}"
- name: Set rollup_data_dir_name
id: vars_pt1
run: |
if [[ -z "${{ github.event.inputs.rollup_data_dir_name }}" ]]; then
echo "rollup_data_dir_name=$(cat ${{ env.ARTEFACTS_PROJECT_PATH }}/.latest)" >> "${GITHUB_OUTPUT}"
else
echo "rollup_data_dir_name=${{ github.event.inputs.rollup_data_dir_name }}" >> "${GITHUB_OUTPUT}"
fi
- name: Set rollup_data_dir_fullpath
id: vars_pt2
run: |
echo "rollup_data_dir_fullpath=${{ env.ARTEFACTS_PROJECT_PATH }}/${{ steps.vars_pt1.outputs.rollup_data_dir_name }}" >> "${GITHUB_OUTPUT}"
- name: Check rollup_data_dir_fullpath
id: check_rollup_data_dir_fullpath
run: |
echo "rollup_data_dir_fullpath=${{ steps.vars_pt2.outputs.rollup_data_dir_fullpath }}"
if [ ! -d "${{ steps.vars_pt2.outputs.rollup_data_dir_fullpath }}" ]; then
echo "Directory ${{ steps.vars_pt2.outputs.rollup_data_dir_fullpath }} does not exist. Exiting..."
exit 1
fi
- name: Copy Dockerfile and scripts
id: copy
run: |
cp -r ./infra_tooling/docker/initcontainer_import_kernel/* ${{ steps.vars_pt2.outputs.rollup_data_dir_fullpath }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: ${{ steps.vars_pt2.outputs.rollup_data_dir_fullpath }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/marigold-dev/dac-initcontainer-import:${{ steps.vars_pt1.outputs.rollup_data_dir_name }}
ghcr.io/marigold-dev/dac-initcontainer-import:latest
ghcr.io/marigold-dev/dac-initcontainer-import:${{ steps.tag_vars.outputs.date }}-${{ steps.tag_vars.outputs.sha_short }}