-
Notifications
You must be signed in to change notification settings - Fork 39
424 lines (361 loc) · 15.4 KB
/
releases.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
name: "Publish release"
run-name: >
${{ format('Publish Release for Workflow: {0}', inputs.workflow_id) }}
on:
workflow_dispatch:
inputs:
workflow_id:
description: |
Workflow Run ID from this repository to fetch artifacts from for this
release.
required: true
type: string
defaults:
run:
shell: bash
jobs:
get-version:
name: Get application version for this revision
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.get-sha.outputs.git-sha }}
otc-version: ${{ steps.get-version.outputs.otc-version }}
sumo-version: ${{ steps.get-version.outputs.sumo-version }}
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Outuput Workflow ID
run: echo ::notice title=Workflow ID::${{ inputs.workflow_id }}
- name: Output Workflow URL
run: |
repo_url="https://github.com/SumoLogic/sumologic-otel-collector"
url="${repo_url}/actions/runs/${{ inputs.workflow_id }}"
echo ::notice title=Workflow URL::${url}
- name: Download otelcol-sumo artifact from workflow
uses: actions/download-artifact@v4
with:
name: otelcol-sumo-linux_amd64
path: artifacts/
merge-multiple: true
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.workflow_id }}
- name: Determine version from artifact
id: get-version
run: |
artifact="artifacts/otelcol-sumo-linux_amd64"
chmod +x "${artifact}"
script="ci/get_version_from_binary.sh"
core="$("$script" core "${artifact}")"
sumo="$("$script" sumo "${artifact}")"
echo "otc-version=$core" >> $GITHUB_OUTPUT
echo "sumo-version=$sumo" >> $GITHUB_OUTPUT
echo "version=${core}-sumo-${sumo}" >> $GITHUB_OUTPUT
- name: Output Version
run: |
echo ::notice title=Version::${{ steps.get-version.outputs.version }}
- name: Determine Git SHA of workflow
id: get-sha
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
workflow="${{ inputs.workflow_id }}"
sha="$(gh run view ${workflow} --json headSha -t '{{.headSha}}')"
echo "git-sha=$sha" >> $GITHUB_OUTPUT
- name: Output Git SHA
run: |
echo ::notice title=Git SHA::${{ steps.get-sha.outputs.git-sha }}
build-container-images:
name: Build container
runs-on: ubuntu-20.04
needs:
- get-version
strategy:
matrix:
arch_os: ["linux_amd64", "linux_arm64"]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Buildx
id: buildx
uses: docker/[email protected]
- name: Show Buildx platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login to Open Source ECR
run: make login
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Login to Docker Hub
run: |
docker login \
--username ${{ secrets.DOCKERHUB_LOGIN }} \
--password ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Download platform otelcol-sumo artifacts from workflow
uses: actions/download-artifact@v4
with:
pattern: otelcol-sumo-${{ matrix.arch_os }}
path: artifacts/
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.workflow_id }}
- name: Download platform fips otelcol-sumo artifacts from workflow
uses: actions/download-artifact@v4
with:
pattern: otelcol-sumo-fips-${{ matrix.arch_os }}
path: artifacts/
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.workflow_id }}
- name: Build and push FIPS image to Open Source ECR
run: |
cp artifacts/otelcol-sumo-fips-${{matrix.arch_os}}/otelcol-sumo-fips-${{matrix.arch_os}} otelcol-sumo
make build-push-container-multiplatform \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
BUILD_TYPE_SUFFIX="-fips"
- name: Build and push FIPS image to DockerHub
run: |
cp artifacts/otelcol-sumo-fips-${{matrix.arch_os}}/otelcol-sumo-fips-${{matrix.arch_os}} otelcol-sumo
make build-push-container-multiplatform \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-fips"
- name: Build and push UBI-based FIPS image to Open Source ECR
run: |
cp artifacts/otelcol-sumo-fips-${{matrix.arch_os}}/otelcol-sumo-fips-${{matrix.arch_os}} otelcol-sumo
make build-push-container-ubi \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
BUILD_TYPE_SUFFIX="-ubi-fips"
- name: Build and push UBI-based FIPS image to DockerHub
run: |
cp artifacts/otelcol-sumo-fips-${{matrix.arch_os}}/otelcol-sumo-fips-${{matrix.arch_os}} otelcol-sumo
make build-push-container-ubi \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-ubi-fips"
- name: Build and push image to Open Source ECR
run: |
cp artifacts/otelcol-sumo-${{matrix.arch_os}}/otelcol-sumo-${{matrix.arch_os}} otelcol-sumo
make build-push-container-multiplatform \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }}
- name: Build and push image to DockerHub
run: |
cp artifacts/otelcol-sumo-${{matrix.arch_os}}/otelcol-sumo-${{matrix.arch_os}} otelcol-sumo
make build-push-container-multiplatform \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
REPO_URL=sumologic/sumologic-otel-collector
- name: Build and push UBI-based image to Open Source ECR
run: |
cp artifacts/otelcol-sumo-${{matrix.arch_os}}/otelcol-sumo-${{matrix.arch_os}} otelcol-sumo
make build-push-container-ubi \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
BUILD_TYPE_SUFFIX="-ubi"
- name: Build and push UBI-based image to DockerHub
run: |
cp artifacts/otelcol-sumo-${{matrix.arch_os}}/otelcol-sumo-${{matrix.arch_os}} otelcol-sumo
make build-push-container-ubi \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-ubi"
push-docker-manifest:
name: Push joint container manifest
runs-on: ubuntu-20.04
needs:
# Require darwin build to succeed to prevent pushing container images
# when darwin build fails.
- build-container-images
- get-version
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Buildx
id: buildx
uses: docker/[email protected]
- name: Show Buildx platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login to Open Source ECR
run: make login
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Login to Docker Hub
run: |
docker login \
--username ${{ secrets.DOCKERHUB_LOGIN }} \
--password ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push joint FIPS container manifest for all platforms to Open Source ECR
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64" \
BUILD_TYPE_SUFFIX="-fips"
- name: Push joint FIPS container manifest for all platforms to DockerHub
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64" \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-fips"
- name: Push joint UBI-based FIPS container manifest for all platforms to Open Source ECR
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64" \
BUILD_TYPE_SUFFIX="-ubi-fips"
- name: Push joint UBI-based FIPS container manifest for all platforms to DockerHub
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64" \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-ubi-fips"
- name: Push joint container manifest for all platforms to Open Source ECR
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64"
- name: Push joint container manifest for all platforms to DockerHub
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64" \
REPO_URL=sumologic/sumologic-otel-collector
- name: Push joint UBI-based container manifest for all platforms to Open Source ECR
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64" \
BUILD_TYPE_SUFFIX="-ubi"
- name: Push joint UBI-based container manifest for all platforms to DockerHub
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64" \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-ubi"
# Store the install script from the packaging repository as a release artifact.
# Originally, this script was stored in this repository, and the official download url pointed
# to the most recent release here. The script has since been moved to the packaging repository.
# It is kept here for backwards compatibility. Once the download count for this artifact
# reaches 0 for new releases, this can be removed.
#
# TODO: This pulls the latest install scripts from the main branch of the
# packaging reopsitory. There is a chance that the install scripts attached to
# a collector release will differ from the install scripts attached to a
# packaging release. We can either remove install scripts from releases here
# or we should ensure that the install scripts are always automically synced
# to this repository and use the install scripts from the HEAD SHA of the
# collector workflow run specified for a release.
install-script:
name: Store install script
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: SumoLogic/sumologic-otel-collector-packaging
- name: Store Linux install script as action artifact
uses: actions/upload-artifact@v4
with:
name: install.sh
path: ./install-script/install.sh
if-no-files-found: error
- name: Store Windows install script as action artifact
uses: actions/upload-artifact@v4
with:
name: install.ps1
path: ./install-script/install.ps1
if-no-files-found: error
config-management-assets:
name: Store Chef cookbook, Puppet module, and Ansible playbook
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Archive Chef cookbook
run: tar -cvf ./examples/chef/chef-cookbook.tar.gz -C ./examples/chef sumologic-otel-collector/
- name: Archive Puppet module
run: tar -cvf ./examples/puppet/puppet-module.tar.gz -C ./examples/puppet/modules install_otel_collector/
- name: Archive Ansible playbook
run: tar -cvf ./examples/ansible-playbook.tar.gz -C ./examples ansible/
# Users can download it via the "latest/download" redirect.
- name: Store Chef cookbook archive as action artifact
uses: actions/upload-artifact@v4
with:
name: chef-cookbook.tar.gz
path: ./examples/chef/chef-cookbook.tar.gz
if-no-files-found: error
- name: Store Puppet module archive as action artifact
uses: actions/upload-artifact@v4
with:
name: puppet-module.tar.gz
path: ./examples/puppet/puppet-module.tar.gz
if-no-files-found: error
- name: Store Ansible playbook archive as action artifact
uses: actions/upload-artifact@v4
with:
name: ansible-playbook.tar.gz
path: ./examples/ansible-playbook.tar.gz
if-no-files-found: error
create-release:
name: Create Github release
runs-on: ubuntu-20.04
needs:
- get-version
- build-container-images
- push-docker-manifest
steps:
- name: Download all artifacts from workflow
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.workflow_id }}
- name: Add version to binary names
working-directory: artifacts/
run: |
version="${{ needs.get-version.outputs.version }}"
find . -type f -name 'otelcol-sumo*' \
| sed 's/^\.\///' \
| while read -r file; do
new_name=$(echo "$file" | sed "s/otelcol-sumo/otelcol-sumo-${version}/g")
mv "$file" "$new_name"
done
find . -type f -name 'otelcol-config*' \
| sed 's/^\.\///' \
| while read -r file; do
new_name=$(echo "$file" | sed "s/otelcol-config/otelcol-config-${version}/g")
mv "$file" "$new_name"
done
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: false
commit: ${{ needs.get-sha.outputs.git-sha }}
tag: v${{ needs.get-version.outputs.version }}
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
body: |
## v${{ needs.get-version.outputs.version }}
**TODO**
### Upstream releases
** TODO: Add upstream versions in the links below**
Core: https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v
Contrib: https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v
### Changelog
**TODO**
### Container images:
```
docker pull public.ecr.aws/sumologic/sumologic-otel-collector:${{ needs.get-version.outputs.version }}
```
artifacts: "artifacts/*"
artifactErrorsFailBuild: true
replacesArtifacts: true