-
Notifications
You must be signed in to change notification settings - Fork 2.5k
187 lines (161 loc) · 6.41 KB
/
ci-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
name: Publish release
on:
# Disable auto-run, once we sunset 1.x components we might go back to auto-release.
#
# release:
# types:
# - published
workflow_dispatch:
inputs:
# Disable version inputs for now, the build always uses the latest tags.
#
# version_v1:
# required: true
# type: string
# description: Version number for 1.x components. Don't include a leading `v`.
# version_v2:
# required: true
# type: string
# description: Version number for 2.x components. Don't include a leading `v`.
dry_run:
required: true
type: boolean
description: Do a test run. It will only build one platform (for speed) and will not push artifacts.
overwrite:
required: true
type: boolean
description: Allow overwriting artifacts.
jobs:
publish-release:
permissions:
contents: write
deployments: write
if: github.repository == 'jaegertracing/jaeger'
runs-on: ubuntu-latest
steps:
- name: Clean up some disk space
# We had an issue where the workflow was running out of disk space,
# because it downloads so many Docker images for different platforms.
# Here we delete some stuff from the VM that we do not use.
# Inspired by https://github.com/jlumbroso/free-disk-space.
run: |
sudo rm -rf /usr/local/lib/android || true
df -h /
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
submodules: true
- name: Fetch git tags
run: |
git fetch --prune --unshallow --tags
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: 1.23.x
- uses: ./.github/actions/setup-node.js
- name: Determine parameters
id: params
run: |
docker_flags=()
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
docker_flags=("${docker_flags[@]}" -l -p linux/amd64)
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
echo "gpg_key_override=-k skip" >> $GITHUB_OUTPUT
else
echo "platforms=$(make echo-platforms)" >> $GITHUB_OUTPUT
fi
if [[ "${{ inputs.overwrite }}" == "true" ]]; then
docker_flags=("${docker_flags[@]}" -o)
fi
echo "docker_flags=${docker_flags[@]}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Export BRANCH variable and validate it is a semver
# Many scripts depend on BRANCH variable. We do not want to
# use ./.github/actions/setup-branch here because it may set
# BRANCH=main when the workflow is triggered manually.
#
# TODO this currently utilizes 1.x version tag, which is ok for v1
# binaries, but for tools/utils we may need to change in the future.
run: |
BRANCH=$(make echo-v1)
echo Validate that the latest tag ${BRANCH} is in semver format
echo ${BRANCH} | grep -E '^v[0-9]+.[0-9]+.[0-9]+$'
echo "BRANCH=${BRANCH}" >> ${GITHUB_ENV}
- name: Configure GPG Key
if: ${{ inputs.dry_run != true }}
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Build all binaries
run: make build-all-platforms PLATFORMS=${{ steps.params.outputs.platforms }}
- name: Package binaries
run: |
bash scripts/build/package-deploy.sh \
-p ${{ steps.params.outputs.platforms }} \
${{ steps.params.outputs.gpg_key_override }}
- name: Upload binaries
if: ${{ inputs.dry_run != true }}
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # 2.9.0
with:
file: '{deploy/*.tar.gz,deploy/*.zip,deploy/*.sha256sum.txt,deploy/*.asc}'
file_glob: true
overwrite: ${{ inputs.overwrite }}
tag: ${{ env.BRANCH }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: Delete the release artifacts after uploading them.
run: |
rm -rf deploy || true
df -h /
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Build and upload all container images
# -B skips building the binaries since we already did that above
run: |
bash scripts/build/build-upload-docker-images.sh -B \
${{ steps.params.outputs.docker_flags }}
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
- name: Build, test, and publish all-in-one v1 image
run: |
BRANCH=$(make echo-v1) \
bash scripts/build/build-all-in-one-image.sh \
${{ steps.params.outputs.docker_flags }} \
v1
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
- name: Build, test, and publish v2 image
run: |
BRANCH=$(make echo-v2) \
bash scripts/build/build-all-in-one-image.sh \
${{ steps.params.outputs.docker_flags }} \
v2
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
- name: Build, test, and publish hotrod image
run: |
bash scripts/build/build-hotrod-image.sh \
${{ steps.params.outputs.docker_flags }}
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
- name: Generate SBOM
uses: anchore/sbom-action@d94f46e13c6c62f59525ac9a1e147a99dc0b9bf5 # v0.17.0
with:
output-file: jaeger-SBOM.spdx.json
upload-release-assets: false
upload-artifact: false
- name: Upload SBOM
# Upload SBOM manually, because anchore/sbom-action does not do that
# when the workflow is triggered manually, only from a release.
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # 2.9.0
if: ${{ inputs.dry_run != true }}
with:
file: jaeger-SBOM.spdx.json
overwrite: ${{ inputs.overwrite }}
# TODO this will only work for 1.x artifacts
tag: ${{ env.BRANCH }}
repo_token: ${{ secrets.GITHUB_TOKEN }}