Repository navigation
ci/distribution: Switch to hermetic pgp signing tool (sq) - #47314
Conversation
|
CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to |
|
requires #47310 |
|
this one cant pass until it lands as it requires var/s set in ci |
Signed-off-by: Ryan Northey <[email protected]>
jwendell
left a comment
There was a problem hiding this comment.
Nice cleanup - the string_flag + no-remote layering plus the aquery audit step is a much more robust story than the old MOUNT_GPG_HOME approach. I couldn't find a path for key material to reach the build graph or caches.
Two things I think are release-breaking though (both are about where artifacts land in the bundle vs. what the unchanged downstream consumers look for), plus a small consistency nit. Details inline.
Review assisted by GitHub Copilot.
| cp $(location :signed_checksums) "$$tmpdir/checksums.txt.asc" | ||
| cp $(location :signed_checksums_checksums) "$$tmpdir/checksums.txt" |
There was a problem hiding this comment.
checksums.txt.asc will no longer be published as a release asset.
These put the checksums at the root of the bundle, but the old envoy.gpg.sign tool wrote checksums.txt.asc inside bin/ (BinarySigningUtil.checksum_path = self.path / "checksums.txt.asc", where self.path is the bin dir).
The publisher is unchanged by this PR and is a pinned pip package: envoy.base.utils project.publish() does
with utils.untar(assets) as tmpdir:
release.assets.push(tmpdir.joinpath("bin"))and aio.api.github's push() uploads path.glob("*") - bin/ only, non-recursive.
The v1.39.1 release asset list is exactly the old bin/ contents:
checksums.txt.asc, debs.tar.gz,
envoy-1.39.1-linux-{aarch_64,x86_64},
envoy-contrib-1.39.1-linux-{aarch_64,x86_64}
So as written the release would ship 5 assets and lose the only signature artifact consumers verify against. The same applies to the new changes/<arch>/*.changes written at the bundle root just below - they'd never be uploaded either.
Suggest placing checksums.txt/checksums.txt.asc under bin/ (matching the old layout), or changing the publish path.
There was a problem hiding this comment.
eek - we defo need this not to break
| srcs = [":distro_packages"], | ||
| tools = ["//tools/distribution:sign"], | ||
| tags = ["no-remote"], | ||
| extension = "tar.gz", |
There was a problem hiding this comment.
Signed per-distro .changes dropped from debs.tar.gz - distro verify will silently test nothing.
With packages.<arch>.tar.gz now a plain pkg_tar, debs.tar.gz contains only the original unsigned multi-distro <pkg>_<ver>_<arch>.changes. Previously //tools/distribution:sign ran at per-arch packaging time and replaced those with one debsigned file per distro (envoy_1.39.1_amd64.bookworm.changes, ...), which flowed into bin/debs.tar.gz. The new signed copies land at changes/<arch>/<pkg>.<distro>.changes with different names.
.github/workflows/_publish_verify.yml and distribution/distros.yaml aren't touched in this PR. The verify job still builds its test tree solely from bin/debs.tar.gz (untars it and copies *_${DEB_ARCH}* into distribution/deb), and envoy.distribution.verify selects installables via
packages_dir.joinpath(type).glob(f"*.{ext}")with ext = bookworm.changes / trixie.changes / focal.changes / jammy.changes / noble.changes from distros.yaml (distrotest.py:229-231, checker.py:129-136).
None of those globs can match any more, so check_distros iterates an empty package list - the job likely goes green while verifying nothing.
Either restore the signed per-distro .changes into debs.tar.gz under the historical <pkg>_<version>_<arch>.<distro>.changes names, or update _publish_verify.yml/distros.yaml to consume the new changes/<arch>/ layout.
| echo "Signing binary packages..." | ||
| setup_clang_toolchain | ||
| if [[ -z "${ENVOY_SIGNING_KEY_PATH}" || -z "${ENVOY_SIGNING_PASSPHRASE_PATH}" ]]; then | ||
| echo "ENVOY_SIGNING_KEY_PATH and ENVOY_SIGNING_PASSPHRASE_PATH must be set" >&2 |
There was a problem hiding this comment.
Nit: convention in this file is to prefix messages that precede a non-zero exit with FAIL: (see lines 60, 87, 91, 119, 124, 138, 1087, 1093, 1249):
| echo "ENVOY_SIGNING_KEY_PATH and ENVOY_SIGNING_PASSPHRASE_PATH must be set" >&2 | |
| echo "FAIL: ENVOY_SIGNING_KEY_PATH and ENVOY_SIGNING_PASSPHRASE_PATH must be set" >&2 |
Worth applying consistently anywhere an error is printed and the script then exits non-zero.
| fi | ||
| if [[ -n $$NEEDS_PATH ]]; then | ||
| echo "You must set //distribution:x64-release and //distribution:arm64-release for signing packages" >&2 | ||
| echo "You must set //distribution:x64-release and //distribution:arm64-release for building release binaries" >&2 |
There was a problem hiding this comment.
Same FAIL: nit as in ci/do_ci.sh - this message is also immediately followed by exit 1:
| echo "You must set //distribution:x64-release and //distribution:arm64-release for building release binaries" >&2 | |
| echo "FAIL: You must set //distribution:x64-release and //distribution:arm64-release for building release binaries" >&2 |
Signed-off-by: Ryan Northey <[email protected]>
- Update ci/docker-compose.yml to envoyproxy/envoy#47758, envoyproxy/envoy#47932, envoyproxy/envoy#47314 - Update docs/root/updating_envoy_dependency.md to include syncing ci/docker-compose.yml --------- Signed-off-by: Jason Ye <[email protected]>
the existing setup protected the gpg secrets but was fragile and several (ie innocent) changes could have rendered its defenses moot
this moves the signer to a hermetic sq-based tool in toolshed
secrets are protected in 2 ways - firstly the bazel rule is set no-remote to prevent any caching, and secondly the rule requires a string_flag to a hardcoded absolute path containing any secrets
this prevents the secrets from ever appearing in any build graph, caches or otherwise leaking into the bazel ecosystem