Skip to content

Commit a2aed2b

Browse files
browcodex
andcommitted
fix: align push gateway release contracts
Signed-off-by: Tom Brow <[email protected]> Co-authored-by: Codex <[email protected]> Ai-assisted: true
1 parent ef1fa97 commit a2aed2b

5 files changed

Lines changed: 27 additions & 18 deletions

File tree

‎deploy/charts/buzz-push-gateway/Chart.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: v2
44
name: buzz-push-gateway
55
description: Public capability-gated APNs last-hop gateway for Buzz
66
version: 0.2.0
7-
appVersion: "0.2.0"
7+
appVersion: "0.1.0"
88
type: application

‎deploy/charts/buzz-push-gateway/tests/release-contract.sh‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ env -u GEM_HOME -u GEM_PATH -u RUBYLIB -u RUBYOPT ruby -ryaml <<'RUBY'
44
auto_text = File.read('.github/workflows/auto-tag-on-release-pr-merge.yml')
55
publish_text = File.read('.github/workflows/push-gateway-helm-chart.yml')
66
chart = YAML.load_file('deploy/charts/buzz-push-gateway/Chart.yaml')
7-
production = YAML.load_file('deploy/charts/buzz-push-gateway/values-production.yaml')
87
# Parse first, then pin the tag producer and consumer strings whose agreement
98
# makes this a reachable lane rather than an orphan publisher.
109
YAML.load(auto_text)
1110
YAML.load(publish_text)
1211
version = chart.fetch('version').to_s
1312
raise "gateway chart version is not semver: #{version}" unless version.match?(/\A\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?\z/)
14-
raise "gateway chart version/appVersion drift" unless chart.fetch('appVersion').to_s == version
15-
digest = production.dig('image', 'digest').to_s
16-
raise "production image digest is not immutable: #{digest}" unless digest.match?(/\Asha256:[0-9a-f]{64}\z/)
13+
workspace_package = File.read('Cargo.toml').match(/\[workspace\.package\](.*?)(?=\n\[|\z)/m)
14+
raise "workspace package metadata is missing" unless workspace_package
15+
binary_version = workspace_package[1].match(/^version\s*=\s*"([^"]+)"/)&.[](1)
16+
raise "workspace package version is missing" unless binary_version
17+
unless chart.fetch('appVersion').to_s == binary_version
18+
raise "gateway chart appVersion does not match packaged binary #{binary_version}"
19+
end
1720
[
1821
'push-chart-release/*)',
1922
'VERSION="${BRANCH#push-chart-release/}"',

‎deploy/charts/buzz-push-gateway/tests/render.sh‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ helm template push deploy/charts/buzz-push-gateway >"$out"
1010
# HTTPRoute. The environment-owned inputs remain mandatory.
1111
production_args=(
1212
-f deploy/charts/buzz-push-gateway/values-production.yaml
13+
--set 'image.digest=sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
1314
--set 'profiles.dogfood.appAttestAppId=REALTEAM.xyz.block.buzz.dogfood.mobile'
1415
--set 'networkPolicy.postgresEgressCidrs[0]=10.42.0.0/16'
1516
)
@@ -94,12 +95,9 @@ ingress_ports = np.dig("spec", "ingress")
9495
assert!(ingress_ports == Set[8080], ingress_ports.inspect)
9596
production = YAML.load_stream(File.read(ARGV[1])).compact
9697
assert!(!production.any? { |x| x["kind"] == "HTTPRoute" })
97-
production_values = YAML.load_file("deploy/charts/buzz-push-gateway/values-production.yaml")
98-
reviewed_digest = production_values.dig("image", "digest")
99-
assert!(reviewed_digest.match?(/\Asha256:[0-9a-f]{64}\z/), reviewed_digest.inspect)
10098
production_deployment = production.find { |x| x["kind"] == "Deployment" }
10199
production_image = production_deployment.dig("spec", "template", "spec", "containers", 0, "image")
102-
assert!(production_image == "ghcr.io/block/buzz-push-gateway@#{reviewed_digest}", production_image.inspect)
100+
assert!(production_image == "ghcr.io/block/buzz-push-gateway@sha256:#{"a" * 64}", production_image.inspect)
103101
route = YAML.load_stream(File.read(ARGV[2])).compact.find { |x| x["kind"] == "HTTPRoute" }
104102
assert!(!route.dig("spec", "parentRefs").empty?)
105103
assert!(route.dig("spec", "hostnames").include?("push.buzz.xyz"))

‎deploy/charts/buzz-push-gateway/values-production.yaml‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# The immutable gateway image was reviewed from the successful multi-arch main
2-
# build at source 4a9de1a3a121285ef475d630b2b5764044c02cde. Its SLSA
3-
# provenance was verified against block/buzz/.github/workflows/docker.yml.
1+
# Required environment-owned values are deliberately invalid/empty here. A
2+
# production renderer must inject all of them; CI proves omission fails.
43
image:
54
tag: ""
6-
digest: sha256:3936cad2d5cb0f6711c749024b96e56969d7e4506eb35d3519e3ef126fa6636d
7-
# Environment-owned values remain deliberately invalid/empty. A production
8-
# renderer must inject all of them; CI proves omission fails.
5+
digest: ""
96
profiles:
107
dogfood:
118
appAttestAppId: ""

‎docs/push-gateway-deployment.md‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,17 @@ gh attestation verify \
224224
--source-digest <40-lowercase-hex-source-commit>
225225
```
226226

227-
Only after that command succeeds, record the exact digest as `image.digest`; the chart then renders `ghcr.io/block/buzz-push-gateway@sha256:...` and ignores the mutable tag. The `0.2.0` production values pin `sha256:3936cad2d5cb0f6711c749024b96e56969d7e4506eb35d3519e3ef126fa6636d`, the amd64/arm64 index built from `4a9de1a3a121285ef475d630b2b5764044c02cde` by the successful [main image workflow](https://github.com/block/buzz/actions/runs/33457946099). Its SLSA provenance was verified against `block/buzz/.github/workflows/docker.yml` and that source digest. `values-production.yaml` remains an intentionally invalid production-input contract: deployment CI must inject the provisioned dogfood Apple application identifier and the actual PostgreSQL network. In an environment with an existing ingress or service mesh route, keep `httpRoute.enabled=false`. If this chart owns a Gateway API route, enable it and inject an environment-owned `parentRef`; schema validation rejects an enabled route with no parent. The render guard proves both rejection of missing required inputs and fully injected renders.
227+
Only after that command succeeds, inject the exact digest as `image.digest` in
228+
the environment's GitOps values; the chart then renders
229+
`ghcr.io/block/buzz-push-gateway@sha256:...` and ignores the mutable tag.
230+
`values-production.yaml` remains an intentionally invalid production-input
231+
contract: deployment CI must inject the verified image digest, the provisioned
232+
dogfood Apple application identifier, and the actual PostgreSQL network. In an
233+
environment with an existing ingress or service mesh route, keep
234+
`httpRoute.enabled=false`. If this chart owns a Gateway API route, enable it and
235+
inject an environment-owned `parentRef`; schema validation rejects an enabled
236+
route with no parent. The render guard proves both rejection of missing required
237+
inputs and fully injected renders.
228238

229239
Network policy keeps APNs HTTPS and PostgreSQL egress in separate CIDR lists. APNs currently requires broad TCP/443 reachability; `networkPolicy.postgresEgressCidrs` must be narrowed to the production database network, and the DNS namespace/pod selectors must match the cluster DNS deployment. The sample private CIDR is not a claim about the production topology.
230240

@@ -233,8 +243,9 @@ Kubernetes does not restart pods when referenced Secret bytes change. AEAD or AP
233243
## Gateway chart release
234244

235245
The gateway chart has a collision-free release lane separate from the main
236-
`buzz` chart. To publish version `X.Y.Z`, update both `version` and `appVersion`
237-
in `deploy/charts/buzz-push-gateway/Chart.yaml`, validate the chart, and open a
246+
`buzz` chart. To publish chart version `X.Y.Z`, update `version` in
247+
`deploy/charts/buzz-push-gateway/Chart.yaml` and keep `appVersion` equal to the
248+
gateway binary's workspace package version. Validate the chart, then open a
238249
same-repository PR whose branch is exactly `push-chart-release/X.Y.Z`:
239250

240251
```bash

0 commit comments

Comments
 (0)