ci: Add API protobuf breaking-change-detector CI script (#17793)

This PR is a continuation to #17515 - it adds a script that uses buf to check for breaking changes on proto files in the api folder. It does so by comparing the current api folder against the api folder at the git commit computed by tools/git/last_github_commit.sh - that should hopefully represent the most recent commit on main (if there is a better method to obtain the base branch commit, let me know!).

Adding the script also required re-organizing some of the breaking change detector logic from the previous pr: some levels of abstraction were added, and the detector now expects a git repository and ref as the input for initial state (rather than a proto file).

The script is invoked in do_ci.sh if bazel.api_compat is specified as the CI_TARGET.

This PR also bumps the buf bazel dependency to 0.53.0. If this is preferred to be in a separate PR, let me know and I would be happy to do so

Risk Level: low (hopefully) - the CI script will be invoked in a separate CI pipeline job that can be set to be optional on github. The azure pipeline has been added but needs to be set to optional by a CI maintainer

Testing: New scripts and logic were tested manually; also ran tests from the previous PR and they still pass. hoping to observe more output of this tool through reading CI logs of other PRs once this is merged (this PR should not affect the existing PR workflow - refer to Risk Level)

Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: CI script uses a linux binary for buf so it cannot be run outside of docker on non-linux systems

Fixes #3368

Signed-off-by: Yaseen Alkhafaji <yaseena@google.com>

Mirrored from https://github.com/envoyproxy/envoy @ f30c289e456df11d549d7236c56f22da00500e9e
pull/624/head
data-plane-api(Azure Pipelines) 3 years ago
parent 77872e2bb4
commit af40d8639f
  1. 8
      BUILD
  2. 6
      bazel/repository_locations.bzl
  3. 52
      buf.lock
  4. 19
      buf.yaml

@ -256,3 +256,11 @@ proto_library(
":v3_protos",
],
)
filegroup(
name = "proto_breaking_change_detector_buf_config",
srcs = [
"buf.yaml",
],
visibility = ["//visibility:public"],
)

@ -122,11 +122,11 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "buf",
project_desc = "A new way of working with Protocol Buffers.", # Used for breaking change detection in API protobufs
project_url = "https://buf.build",
version = "0.48.2",
sha256 = "ee0ea6c4a7bbb016d79b056905c0a1f018e7c5e47b37038c993a77b1bc732c0d",
version = "0.53.0",
sha256 = "888bb52d358e34a8d6a57ecff426bed896bdf478ad13c78a70a9e1a9a2d75715",
strip_prefix = "buf",
urls = ["https://github.com/bufbuild/buf/releases/download/v{version}/buf-Linux-x86_64.tar.gz"],
release_date = "2021-07-30",
release_date = "2021-08-25",
use_category = ["api"],
tags = ["manual"],
),

@ -0,0 +1,52 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: beta
repository: opencensus
branch: main
commit: 5f5f8259293649d68707d2e5b6285748
digest: b1-myYwcdM0Xu05qIwhiy4eWEcARYUuZZ1vTbYvrrHu1mU=
create_time: 2021-03-03T20:50:42.079743Z
- remote: buf.build
owner: beta
repository: opentelemetry
branch: main
commit: 549da630ffe24b53be3983fcee3bb346
digest: b1-HVAvWKH61BF6TdZSbHRhrD2SUuC0V7uAlZgCRimGPLI=
create_time: 2021-08-09T14:24:57.923964Z
- remote: buf.build
owner: beta
repository: prometheus
branch: main
commit: a91b42d18a994cd4b07b37f365f87cf9
digest: b1-uKmv58fyoNwJI855qg7UEagfdyUl6XNPsFAdDoi57f4=
create_time: 2021-06-23T20:16:58.410272Z
- remote: buf.build
owner: beta
repository: protoc-gen-validate
branch: main
commit: 82388a0a0cb04e98a203f95dfed5e84b
digest: b1-lYgUMN58PxyCwvfQoopp40AJ-oHHjWXAzksF7v9U-U4=
create_time: 2021-06-21T22:00:30.152545Z
- remote: buf.build
owner: beta
repository: xds
branch: main
commit: 45f850b92541434cbde4aece01bc7d53
digest: b1-QZUL5DC6-nVgMMlajH_hlImwghg5HjRsqlEAOl0dZgI=
create_time: 2021-08-09T14:37:06.872899Z
- remote: buf.build
owner: gogo
repository: protobuf
branch: main
commit: 4df00b267f944190a229ce3695781e99
digest: b1-sjLgsg7CzrkOrIjBDh3s-l0aMjE6oqTj85-OsoopKAw=
create_time: 2021-08-10T00:14:28.345069Z
- remote: buf.build
owner: googleapis
repository: googleapis
branch: main
commit: d1a849b8f8304950832335723096e954
digest: b1-zJkwX0YeOp1Wa0Jaj_RqMLa2-oEzePH6PJEK8aaMeI4=
create_time: 2021-08-26T15:07:19.652533Z

@ -0,0 +1,19 @@
version: v1beta1
deps:
- buf.build/googleapis/googleapis
- buf.build/beta/opencensus
- buf.build/beta/prometheus
- buf.build/beta/opentelemetry
- buf.build/gogo/protobuf
- buf.build/beta/xds
breaking:
ignore_unstable_packages: true
use:
- FIELD_SAME_ONEOF
- FIELD_SAME_JSON_NAME
- FIELD_SAME_NAME
- FIELD_SAME_TYPE
- FIELD_SAME_LABEL
- FILE_SAME_PACKAGE
- FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED
- FIELD_NO_DELETE_UNLESS_NAME_RESERVED
Loading…
Cancel
Save