-
Notifications
You must be signed in to change notification settings - Fork 28
193 lines (166 loc) · 7.03 KB
/
release.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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
on:
release:
types: [published]
env:
GITHUB_ACTION_TAG: ${{ github.ref_name }}
jobs:
build-amd64-digest:
permissions:
contents: read
id-token: write
runs-on: runs-on,runner=4cpu-linux-x64,run-id=${{ github.run_id }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set the ENV values
id: get-Envs
run: |
echo "$(make -s log | grep BUILDDIR)" >> "$GITHUB_ENV"
echo "$(make -s log | grep TAG)" >> "$GITHUB_ENV"
echo "$(make -s log | grep ARCH)" >> "$GITHUB_ENV"
echo "$(make -s log | grep REGISTRY_IMAGE)" >> "$GITHUB_ENV"
- name: Docker meta
id: meta-amd64
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: "Read secrets"
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials password | DOCKER_PASSWORD ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials registry | PRIME_REGISTRY ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials username | PRIME_REGISTRY_USERNAME ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials password | PRIME_REGISTRY_PASSWORD
- name: Build and push container image
id: build-amd64
uses: rancher/ecm-distro-tools/actions/publish-image@master
env:
META_LABELS: ${{ steps.meta-amd64.outputs.labels }}
with:
image: hardened-calico
tag: ${{ github.event.release.tag_name }}
platforms: linux/amd64
public-repo: rancher
public-username: ${{ env.DOCKER_USERNAME }}
public-password: ${{ env.DOCKER_PASSWORD }}
prime-repo: rancher
prime-registry: ${{ env.PRIME_REGISTRY }}
prime-username: ${{ env.PRIME_REGISTRY_USERNAME }}
prime-password: ${{ env.PRIME_REGISTRY_PASSWORD }}
- name: Upload metadata files
uses: actions/upload-artifact@v4
with:
name: metadata-amd64
path: ${{ env.BUILDDIR}}
if-no-files-found: error
retention-days: 1
build-arm64-digest:
permissions:
contents: read
id-token: write
runs-on: runs-on,runner=4cpu-linux-arm64,run-id=${{ github.run_id }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set the ENV values
id: get-Envs
run: |
echo "$(make -s log | grep BUILDDIR)" >> "$GITHUB_ENV"
echo "$(make -s log | grep TAG)" >> "$GITHUB_ENV"
echo "$(make -s log | grep ARCH)" >> "$GITHUB_ENV"
echo "$(make -s log | grep REGISTRY_IMAGE)" >> "$GITHUB_ENV"
- name: Docker meta
id: meta-arm64
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: "Read secrets"
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials password | DOCKER_PASSWORD ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials registry | PRIME_REGISTRY ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials username | PRIME_REGISTRY_USERNAME ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials password | PRIME_REGISTRY_PASSWORD
- name: Build and push container image
id: build-arm64
uses: rancher/ecm-distro-tools/actions/publish-image@master
env:
META_LABELS: ${{ steps.meta-arm64.outputs.labels }}
with:
image: hardened-calico
tag: ${{ github.event.release.tag_name }}
platforms: linux/arm64
public-repo: rancher
public-username: ${{ env.DOCKER_USERNAME }}
public-password: ${{ env.DOCKER_PASSWORD }}
prime-repo: rancher
prime-registry: ${{ env.PRIME_REGISTRY }}
prime-username: ${{ env.PRIME_REGISTRY_USERNAME }}
prime-password: ${{ env.PRIME_REGISTRY_PASSWORD }}
- name: Upload metadata files
uses: actions/upload-artifact@v4
with:
name: metadata-arm64
path: ${{ env.BUILDDIR}}
if-no-files-found: error
retention-days: 1
merge:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
needs:
- build-amd64-digest
- build-arm64-digest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set the ENV values
id: get-Envs
run: |
echo "$(make -s log | grep BUILDDIR)" >> "$GITHUB_ENV"
echo "$(make -s log | grep REGISTRY_IMAGE)" >> "$GITHUB_ENV"
- name: Download metadata dir
uses: actions/download-artifact@v4
with:
path: ${{ env.BUILDDIR }}
merge-multiple: true
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: "Read secrets"
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials password | DOCKER_PASSWORD ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials registry | PRIME_REGISTRY ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials username | PRIME_REGISTRY_USERNAME ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials password | PRIME_REGISTRY_PASSWORD
- name: Create manifest list and push
id: push-manifest
uses: rancher/ecm-distro-tools/actions/publish-image@master
env:
MULTI_ARCH: "amd64 arm64"
DOCKER_METADATA_OUTPUT_JSON: ${{ steps.meta.outputs.json }}
REGISTRY_IMAGE: ${{ env.REGISTRY_IMAGE }}
with:
make-target: manifest-push
image: hardened-calico
tag: ${{ github.event.release.tag_name }}
public-repo: rancher
public-username: ${{ env.DOCKER_USERNAME }}
public-password: ${{ env.DOCKER_PASSWORD }}
prime-repo: rancher
prime-registry: ${{ env.PRIME_REGISTRY }}
prime-username: ${{ env.PRIME_REGISTRY_USERNAME }}
prime-password: ${{ env.PRIME_REGISTRY_PASSWORD }}
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}