-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (61 loc) · 1.93 KB
/
Copy pathclient-agent-image.yml
File metadata and controls
71 lines (61 loc) · 1.93 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
name: client-agent-image
on:
push:
tags:
- "v*"
workflow_dispatch:
concurrency:
group: client-agent-image-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- name: Set immutable image tags
id: tags
shell: bash
run: |
tags="yyyyyt123/netopsbench-client:sha-${GITHUB_SHA}"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
tags="${tags}"$'\n'"yyyyyt123/netopsbench-client:${GITHUB_REF_NAME}"$'\n'"yyyyyt123/netopsbench-client:latest"
fi
{
echo "value<<EOF"
echo "${tags}"
echo "EOF"
} >> "${GITHUB_OUTPUT}"
- name: Build and publish linux/amd64 image
id: build
uses: docker/build-push-action@v6
with:
context: .
file: containers/client/Dockerfile
platforms: linux/amd64
push: true
provenance: false
tags: ${{ steps.tags.outputs.value }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Publish manifest digest
run: echo "digest=${{ steps.build.outputs.digest }}" >> "${GITHUB_STEP_SUMMARY}"
- name: Verify anonymous digest pull
env:
IMAGE_DIGEST: ${{ steps.build.outputs.digest }}
run: |
docker logout
for attempt in $(seq 1 12); do
if docker manifest inspect "yyyyyt123/netopsbench-client@${IMAGE_DIGEST}" >/dev/null; then
exit 0
fi
sleep 5
done
exit 1