forked from envoyproxy/java-control-plane
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script to update protos to specific envoy version (envoyproxy#186)
Signed-off-by: Erik Lindblad <erili@spotify.com> Co-authored-by: Erik Lindblad <erili@spotify.com> Co-authored-by: rulex123 <29862113+rulex123@users.noreply.github.com>
- Loading branch information
1 parent
1898ce3
commit 7065151
Showing
4 changed files
with
89 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: update-protobuf | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
envoy_version: | ||
description: 'Envoy version to update to' | ||
required: true | ||
|
||
jobs: | ||
update-protobuf: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run scripts | ||
working-directory: ./tools/ | ||
run: | | ||
./update-sha.sh ${{ github.event.inputs.envoy_version }} | tee /dev/tty > API_SHAS | ||
./update-api.sh | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
branch: update-protobuf-to-${{ github.event.inputs.envoy_version }} | ||
signoff: true | ||
title: '[protobuf] Update protobuf definitions to ${{ github.event.inputs.envoy_version }}' | ||
body: | | ||
This is an automatic PR created by github action workflow: | ||
- Updated protobuf files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env bash | ||
|
||
function find_sha() { | ||
local CONTENT=$1 | ||
local DEPENDENCY=$2 | ||
echo "$CONTENT" | grep "$DEPENDENCY" -A 11 | grep -m 1 version | awk '{ print $3 }' | tr -d '"' | tr -d "," | ||
} | ||
|
||
function find_date() { | ||
local CONTENT=$1 | ||
local DEPENDENCY=$2 | ||
echo "$CONTENT" | grep "$DEPENDENCY" -A 11 | grep -m 1 release_date | awk '{ print $3 }' | tr -d '"' | tr -d "," | ||
} | ||
|
||
function find_envoy_sha_from_tag() { | ||
local TAG=$1 | ||
curl -s https://api.github.com/repos/envoyproxy/envoy/tags | grep "$TAG" -A 4 | grep sha | awk '{print $2}' | tr -d '"' | tr -d "," | ||
} | ||
|
||
ENVOY_VERSION=$(find_envoy_sha_from_tag "$1") | ||
|
||
CURL_OUTPUT=$(curl -s "https://raw.githubusercontent.com/envoyproxy/envoy/$ENVOY_VERSION/api/bazel/repository_locations.bzl") | ||
|
||
GOOGLEAPIS_SHA=$(find_sha "$CURL_OUTPUT" com_google_googleapis) | ||
GOOGLEAPIS_DATE=$(find_date "$CURL_OUTPUT" com_google_googleapis) | ||
|
||
PGV_GIT_SHA=$(find_sha "$CURL_OUTPUT" com_envoyproxy_protoc_gen_validate) | ||
PGV_GIT_DATE=$(find_date "$CURL_OUTPUT" com_envoyproxy_protoc_gen_validate) | ||
|
||
PROMETHEUS_SHA=$(find_sha "$CURL_OUTPUT" prometheus_metrics_model) | ||
PROMETHEUS_DATE=$(find_date "$CURL_OUTPUT" prometheus_metrics_model) | ||
|
||
OPENCENSUS_SHA=$(find_sha "$CURL_OUTPUT" opencensus_proto) | ||
OPENCENSUS_DATE=$(find_date "$CURL_OUTPUT" opencensus_proto) | ||
|
||
UDPA_SHA=$(find_sha "$CURL_OUTPUT" com_github_cncf_udpa) | ||
UDPA_DATE=$(find_date "$CURL_OUTPUT" com_github_cncf_udpa) | ||
|
||
OPENTELEMETRY_SHA=$(find_sha "$CURL_OUTPUT" opentelemetry_proto) | ||
OPENTELEMETRY_DATE=$(find_date "$CURL_OUTPUT" opentelemetry_proto) | ||
|
||
echo -n "# Update the versions here and run update-api.sh | ||
# envoy (source: SHA from https://github.com/envoyproxy/envoy) | ||
ENVOY_SHA=\"$ENVOY_VERSION\" | ||
# dependencies (source: https://github.com/envoyproxy/envoy/blob/$ENVOY_VERSION/api/bazel/repository_locations.bzl) | ||
GOOGLEAPIS_SHA=\"$GOOGLEAPIS_SHA\" # $GOOGLEAPIS_DATE | ||
PGV_VERSION=\"$PGV_GIT_SHA\" # $PGV_GIT_DATE | ||
PROMETHEUS_SHA=\"$PROMETHEUS_SHA\" # $PROMETHEUS_DATE | ||
OPENCENSUS_VERSION=\"$OPENCENSUS_SHA\" # $OPENCENSUS_DATE | ||
OPENTELEMETRY_VERSION=\"$OPENTELEMETRY_SHA\" # $OPENTELEMETRY_DATE | ||
UDPA_SHA=\"$UDPA_SHA\" # $UDPA_DATE | ||
" | ||
|
||
# replace version in EnvoyContainer.java | ||
sed -i 's/\(envoy-alpine-dev:\).*\(\");\)/\1'"$ENVOY_VERSION"'\2/g' ../server/src/test/java/io/envoyproxy/controlplane/server/EnvoyContainer.java |