-
Notifications
You must be signed in to change notification settings - Fork 45
182 lines (171 loc) · 6.42 KB
/
envoy-dependency.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
name: Envoy/dependency
permissions:
contents: read
on:
workflow_dispatch:
inputs:
task:
description: Select a task
required: true
default: bazel
type: choice
options:
- bazel
- bazel-api
- build-image
dependency:
description: Dependency to update (if applicable)
version:
description: Version to set (optional)
pr:
type: boolean
default: true
pr_message:
description: Additional message for PR, eg to fix an issue (optional)
concurrency:
group: ${{ github.run_id }}-${{ github.workflow }}
cancel-in-progress: true
env:
COMMITTER_NAME: dependency-envoy[bot]
COMMITTER_EMAIL: 148525496+dependency-envoy[bot]@users.noreply.github.com
jobs:
update_bazel:
if: startsWith(inputs.task, 'bazel')
name: >-
Update dep
(${{ inputs.pr && 'PR/' || '' }}${{ inputs.task == 'bazel' && 'bazel' || 'bazel/api' }}/${{ inputs.dependency }}/${{ inputs.version }})
runs-on: ubuntu-22.04
steps:
- id: checkout
name: Checkout Envoy repository
uses: envoyproxy/toolshed/gh-actions/github/checkout@actions-v0.0.34
with:
app_id: ${{ secrets.ENVOY_CI_DEP_APP_ID }}
app_key: ${{ secrets.ENVOY_CI_DEP_APP_KEY }}
- id: version
name: Shorten (possible) SHA
uses: envoyproxy/toolshed/gh-actions/str/sub@actions-v0.0.34
with:
string: ${{ inputs.version }}
length: 7
min: 40
- run: |
echo "Updating(${TASK}): ${DEPENDENCY} -> ${VERSION}"
bazel run --config=ci //bazel:${TARGET} $DEPENDENCY $VERSION
name: Update dependency
env:
DEPENDENCY: ${{ inputs.dependency }}
VERSION: ${{ inputs.version }}
TARGET: ${{ inputs.task == 'bazel' && 'update' || 'api-update' }}
TASK: ${{ inputs.task == 'bazel' && 'bazel' || 'api/bazel' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: envoyproxy/toolshed/gh-actions/upload/diff@actions-v0.0.34
name: Upload diff
with:
name: ${{ inputs.dependency }}-${{ steps.version.outputs.string }}
- name: Create a PR
if: ${{ inputs.pr }}
uses: envoyproxy/toolshed/gh-actions/github/pr@actions-v0.0.34
with:
base: main
body: |
Created by Envoy dependency bot for @${{ github.actor }}
${{ inputs.pr_message }}
branch: >-
dependency/${{ inputs.task }}/${{ inputs.dependency }}/${{ steps.version.outputs.string }}
commit-message: |
${{ inputs.task == 'bazel' && 'deps' || 'deps/api' }}: Bump `${{ inputs.dependency }}` -> ${{ steps.version.outputs.string }}
Signed-off-by: ${{ env.COMMITTER_NAME }} <${{ env.COMMITTER_EMAIL }}>
committer-name: ${{ env.COMMITTER_NAME }}
committer-email: ${{ env.COMMITTER_EMAIL }}
title: >-
${{ inputs.task == 'bazel' && 'deps' || 'deps/api' }}: Bump `${{ inputs.dependency }}`
-> ${{ steps.version.outputs.string }}
GITHUB_TOKEN: ${{ steps.checkout.outputs.token }}
update_build_image:
if: github.event.inputs.task == 'build-image'
name: Update build image (PR)
runs-on: ubuntu-22.04
steps:
- name: Fetch token for app auth
id: appauth
uses: envoyproxy/toolshed/gh-actions/appauth@actions-v0.0.34
with:
app_id: ${{ secrets.ENVOY_CI_DEP_APP_ID }}
key: ${{ secrets.ENVOY_CI_DEP_APP_KEY }}
- uses: actions/checkout@v4
name: Checkout Envoy repository
with:
path: envoy
fetch-depth: 0
token: ${{ steps.appauth.outputs.token }}
- uses: actions/checkout@v4
name: Checkout Envoy build tools repository
with:
repository: envoyproxy/envoy-build-tools
path: build-tools
fetch-depth: 0
- run: |
shas=(
tag
sha
mobile_sha
gcr_sha)
for sha in "${shas[@]}"; do
current_sha=$(bazel run //tools/dependency:build-image-sha "$sha")
echo "${sha}=${current_sha}" >> "$GITHUB_OUTPUT"
done
id: current
name: Current SHAs
working-directory: envoy
- run: |
# get current build image version
CONTAINER_TAG=$(git log -1 --pretty=format:"%H" "./docker")
echo "tag=${CONTAINER_TAG}" >> "$GITHUB_OUTPUT"
echo "tag_short=${CONTAINER_TAG::7}" >> "$GITHUB_OUTPUT"
id: build-tools
name: Build image SHA
working-directory: build-tools
- name: Check Docker SHAs
id: build-images
uses: envoyproxy/toolshed/gh-actions/docker/shas@actions-v0.0.34
with:
images: |
sha: envoyproxy/envoy-build-ubuntu:${{ steps.build-tools.outputs.tag }}
mobile_sha: envoyproxy/envoy-build-ubuntu:mobile-${{ steps.build-tools.outputs.tag }}
gcr_sha: gcr.io/envoy-ci/envoy-build:${{ steps.build-tools.outputs.tag }}
- run: |
SHA_REPLACE=(
"$CURRENT_ENVOY_TAG:$ENVOY_TAG"
"$CURRENT_ENVOY_SHA:${OUTPUT_sha}"
"$CURRENT_ENVOY_MOBILE_SHA:${OUTPUT_mobile_sha}"
"$CURRENT_ENVOY_GCR_SHA:${OUTPUT_gcr_sha}")
echo "replace=${SHA_REPLACE[*]}" >> "$GITHUB_OUTPUT"
name: Find SHAs to replace
id: shas
env:
ENVOY_TAG: ${{ steps.build-tools.outputs.tag }}
CURRENT_ENVOY_TAG: ${{ steps.current.outputs.tag }}
CURRENT_ENVOY_SHA: ${{ steps.current.outputs.sha }}
CURRENT_ENVOY_MOBILE_SHA: ${{ steps.current.outputs.mobile_sha }}
CURRENT_ENVOY_GCR_SHA: ${{ steps.current.outputs.gcr_sha }}
- run: |
echo "${SHA_REPLACE}" | xargs bazel run @envoy_toolshed//sha:replace "${PWD}"
env:
SHA_REPLACE: ${{ steps.shas.outputs.replace }}
name: Update SHAs
working-directory: envoy
- name: Create a PR
uses: envoyproxy/toolshed/gh-actions/github/pr@actions-v0.0.34
with:
base: main
body: Created by Envoy dependency bot
branch: dependency-envoy/build-image/latest
committer-name: ${{ env.COMMITTER_NAME }}
committer-email: ${{ env.COMMITTER_EMAIL }}
commit-message: |
deps: Bump build images -> `${{ steps.build-tools.outputs.tag_short }}`
Signed-off-by: ${{ env.COMMITTER_NAME }} <${{ env.COMMITTER_EMAIL }}>
title: 'deps: Bump build images -> `${{ steps.build-tools.outputs.tag_short }}`'
GITHUB_TOKEN: ${{ steps.appauth.outputs.token }}
working-directory: envoy