diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml index 79e9842eb..fc536776d 100644 --- a/.buildkite/pipeline.yaml +++ b/.buildkite/pipeline.yaml @@ -4,6 +4,20 @@ steps: - "scripts/ci/helm-unittest.sh" agents: { queue: standard } + # Internal releases point values.yaml at the internal registry and pin new + # image tags and chart versions (see release.yaml). Rerun the unit tests with + # placeholder values rewritten the same way, so a test that asserts the + # defaults fails on its PR instead of on the release branch. + - label: ":test_tube: Unit Tests with internal release values" + command: | + find charts -name values.yaml -exec sed -i -E \ + -e 's#^([[:space:]]*repository:) index\.docker\.io/sourcegraph$#\1 us-docker.pkg.dev/sourcegraph-images/internal#' \ + -e 's#^([[:space:]]*defaultTag:) [0-9.]+@sha256:[0-9a-f]{64}$#\1 99.0.0@sha256:0000000000000000000000000000000000000000000000000000000000000000#' {} + + find charts -name Chart.yaml -exec sed -i -E 's#^([[:space:]]*(version|appVersion):) "[0-9]+\.[0-9]+\.[0-9]+"$#\1 "99.0.0"#' {} + + git diff --stat + scripts/ci/helm-unittest.sh + agents: { queue: standard } + - label: ":database: Schema Validation" commands: - "scripts/ci/validate-schema.sh" diff --git a/charts/sourcegraph/tests/dataDirPermissionsInitContainer_test.yaml b/charts/sourcegraph/tests/dataDirPermissionsInitContainer_test.yaml index df28d96c5..28b515eaa 100644 --- a/charts/sourcegraph/tests/dataDirPermissionsInitContainer_test.yaml +++ b/charts/sourcegraph/tests/dataDirPermissionsInitContainer_test.yaml @@ -3,9 +3,14 @@ release: name: sourcegraph namespace: sourcegraph tests: +# Releases rewrite sourcegraph.image.repository in values.yaml, so pin it here +# instead of asserting the chart default. - it: should run the pgsql init container on the pgsql image template: pgsql/pgsql.StatefulSet.yaml set: + sourcegraph: + image: + repository: my.registry.example/sg pgsql: image: name: custom-postgres @@ -13,10 +18,13 @@ tests: asserts: - equal: path: spec.template.spec.initContainers[?(@.name == "correct-data-dir-permissions")].image - value: index.docker.io/sourcegraph/custom-postgres:test + value: my.registry.example/sg/custom-postgres:test - it: should run the codeintel-db init container on the codeintel-db image template: codeintel-db/codeintel-db.StatefulSet.yaml set: + sourcegraph: + image: + repository: my.registry.example/sg codeIntelDB: image: name: custom-postgres @@ -24,10 +32,13 @@ tests: asserts: - equal: path: spec.template.spec.initContainers[?(@.name == "correct-data-dir-permissions")].image - value: index.docker.io/sourcegraph/custom-postgres:test + value: my.registry.example/sg/custom-postgres:test - it: should run the codeinsights-db init container on the codeinsights-db image template: codeinsights-db/codeinsights-db.StatefulSet.yaml set: + sourcegraph: + image: + repository: my.registry.example/sg codeInsightsDB: image: name: custom-postgres @@ -35,4 +46,4 @@ tests: asserts: - equal: path: spec.template.spec.initContainers[?(@.name == "correct-data-dir-permissions")].image - value: index.docker.io/sourcegraph/custom-postgres:test + value: my.registry.example/sg/custom-postgres:test