-
Notifications
You must be signed in to change notification settings - Fork 1
164 lines (138 loc) · 5.75 KB
/
debug-image.yaml
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: 'Test/push the `probe` image'
on:
# Run the workflow every day at 5 am UTC (1 am EST, 7am CET)
# This is useful for keeping the image up-to-date with security
# patches provided in the UBI.
# Disclaimer: There is no guarantee that scheduled workflows will
# run at the predefined time, if at all. The delay is usually
# around 10-30 minutes.
schedule:
- cron: '0 5 * * *'
release:
types: [published]
workflow_dispatch:
defaults:
run:
shell: bash
env:
REGISTRY: quay.io
IMAGE_NAME_LEGACY: testnetworkfunction/k8s-best-practices-debug
IMAGE_TAG_LEGACY: latest
IMAGE_NAME: redhat-best-practices-for-k8s/certsuite-probe
IMAGE_TAG: latest
IMAGE_CONTAINER_FILE_PATH: ./Dockerfile
jobs:
test-debug-image-legacy:
name: 'Build and test the `debug` image'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 'Build the `debug` image'
run: docker build --no-cache -f Dockerfile -t $IMAGE_NAME_LEGACY:$IMAGE_TAG_LEGACY .
- name: 'Test: Check if lscpu is installed'
run: docker run $IMAGE_NAME_LEGACY:$IMAGE_TAG_LEGACY which lscpu
- name: 'Test: Check if lsblk is installed'
run: docker run $IMAGE_NAME_LEGACY:$IMAGE_TAG_LEGACY which lsblk
- name: 'Test: Check if lspci is installed'
run: docker run $IMAGE_NAME_LEGACY:$IMAGE_TAG_LEGACY which lspci
- name: 'Test: Check if ping is installed'
run: docker run $IMAGE_NAME_LEGACY:$IMAGE_TAG_LEGACY which ping
- name: 'Test: Check if ip is installed'
run: docker run $IMAGE_NAME_LEGACY:$IMAGE_TAG_LEGACY which ip
- name: Authenticate against Quay.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
# Use a Robot Account to authenticate against Quay.io
# https://docs.quay.io/glossary/robot-accounts.html
username: ${{ secrets.QUAY_ROBOT_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Add metadata
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LEGACY }}
labels: |
maintainer=Red Hat, Inc.
org.opencontainers.image.title=Best Practices Debug Image
org.opencontainers.image.description=CNF Certification Test certsuite debug image
org.opencontainers.image.vendor=Red Hat, Inc.
tags: |
type=raw,value=latest
type=schedule,pattern=nightly
type=semver,pattern={{raw}}
- name: 'Build and push the new `debug` image'
uses: docker/build-push-action@v6
with:
push: true
file: ${{ env.IMAGE_CONTAINER_FILE_PATH }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
- name: If failed to create the image, send alert msg to dev team.
if: ${{ failure() }}
uses: ./.github/actions/slack-webhook-sender
with:
message: 'Failed to create debug parter image version ${{ env.IMAGE_TAG_LEGACY }}'
slack_webhook: '${{ secrets.SLACK_ALERT_WEBHOOK_URL }}'
test-debug-image:
name: 'Build and test the `probe` image'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 'Build the `debug` image'
run: docker build --no-cache -f Dockerfile -t $IMAGE_NAME:$IMAGE_TAG .
- name: 'Test: Check if lscpu is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which lscpu
- name: 'Test: Check if lsblk is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which lsblk
- name: 'Test: Check if lspci is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which lspci
- name: 'Test: Check if ping is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ping
- name: 'Test: Check if ip is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ip
- name: Authenticate against Quay.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
# Use a Robot Account to authenticate against Quay.io
# https://docs.quay.io/glossary/robot-accounts.html
username: ${{ secrets.QUAY_ROBOT_USERNAME_K8S }}
password: ${{ secrets.QUAY_ROBOT_TOKEN_K8S }}
- name: Add metadata
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
maintainer=Red Hat, Inc.
org.opencontainers.image.title=Best Practices Probe Image
org.opencontainers.image.description=Certsuite Probe
org.opencontainers.image.vendor=Red Hat, Inc.
tags: |
type=raw,value=latest
type=schedule,pattern=nightly
type=semver,pattern={{raw}}
- name: 'Build and push the new `probe` image'
uses: docker/build-push-action@v6
with:
push: true
file: ${{ env.IMAGE_CONTAINER_FILE_PATH }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
- name: If failed to create the image, send alert msg to dev team.
if: ${{ failure() }}
uses: ./.github/actions/slack-webhook-sender
with:
message: 'Failed to create debug parter image version ${{ env.IMAGE_TAG }}'
slack_webhook: '${{ secrets.SLACK_ALERT_WEBHOOK_URL }}'