generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 23
73 lines (63 loc) · 2.27 KB
/
build-telemetry-self-monitor-image.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
name: Telemetry Self Monitor Image Builder
on:
pull_request_target:
paths:
- "dependencies/telemetry-self-monitor/**"
types: [ opened, edited, synchronize, reopened, ready_for_review ]
push:
branches:
- main
paths:
- "dependencies/telemetry-self-monitor/**"
workflow_dispatch:
jobs:
envs:
runs-on: ubuntu-latest
outputs:
build-args: ${{ steps.prepare-envs.outputs.build-args }}
build-tag: ${{ steps.build-tag.outputs.build-tag || '' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch new env file
run: |
git fetch origin ${{ github.event.pull_request.head.sha }}
git checkout ${{ github.event.pull_request.head.sha }} --no-overlay -- dependencies/telemetry-self-monitor/envs
if: github.event_name == 'pull_request_target'
- name: Prepare Envs
id: prepare-envs
run: |
{
# this creates a multiline string with the envs.
# Everything between `build-args<<BUILD_ARGS` and BUILD_ARGS will be content of the build-args variable.
echo 'build-args<<BUILD_ARGS'
cat dependencies/telemetry-self-monitor/envs
echo BUILD_ARGS
} >> "$GITHUB_OUTPUT"
- name: load envs into output
id: load-envs
run: |
cat dependencies/telemetry-self-monitor/envs >> "$GITHUB_OUTPUT"
- name: get commit short sha
id: get-short-sha
run: echo "short-sha=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_OUTPUT
- name: build image tag
id: build-tag
run: echo "build-tag=${{ steps.load-envs.outputs.PROMETHEUS_VERSION }}-${{ steps.get-short-sha.outputs.short-sha }}" >> $GITHUB_OUTPUT
if: github.event_name == 'push'
build-image:
needs: envs
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main
with:
name: tpi/telemetry-self-monitor
dockerfile: Dockerfile
context: dependencies/telemetry-self-monitor
build-args: ${{ needs.envs.outputs.build-args }}
tags: ${{ needs.envs.outputs.build-tag }}
list-images:
needs: build-image
runs-on: ubuntu-latest
steps:
- name: List images
run: |
echo "${{ needs.build-image.outputs.images }}"