ci: make executor registry configurable (#61200)

* make executor registry configurable

* Update dev/ci/internal/ci/images_operations.go
This commit is contained in:
William Bezuidenhout 2024-03-18 15:16:23 +02:00 committed by GitHub
parent c529631483
commit f97a0bac73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 18 additions and 16 deletions

View File

@ -65,6 +65,8 @@ services:
- GID=${EXECUTOR_GID}
# Use the dind container to run docker commands within the executor
- DOCKER_HOST=${DOCKER_HOST}
# We need to be able to change the registry
- REGISTRY=${REGISTRY}
volumes:
# Mount docker socket
- '/var/run/docker.sock:/var/run/docker.sock'

View File

@ -33,10 +33,10 @@ cleanup() {
}
trap cleanup EXIT
registry="us.gcr.io/sourcegraph-dev"
export POSTGRES_IMAGE="${registry}/postgres-12-alpine:${CANDIDATE_VERSION}"
export SERVER_IMAGE="${registry}/server:${CANDIDATE_VERSION}"
export EXECUTOR_IMAGE="${registry}/executor:${CANDIDATE_VERSION}"
export REGISTRY=${REGISTRY:-"us.gcr.io/sourcegraph-dev"}
export POSTGRES_IMAGE="${REGISTRY}/postgres-12-alpine:${CANDIDATE_VERSION}"
export SERVER_IMAGE="${REGISTRY}/server:${CANDIDATE_VERSION}"
export EXECUTOR_IMAGE="${REGISTRY}/executor:${CANDIDATE_VERSION}"
export EXECUTOR_FRONTEND_PASSWORD="hunter2hunter2hunter2"
export SOURCEGRAPH_LICENSE_GENERATION_KEY="${SOURCEGRAPH_LICENSE_GENERATION_KEY:-""}"
export TMP_DIR
@ -56,7 +56,7 @@ fi
# Need to pull this image pre-execution as the docker executor doesn't have a
# credential to pull this image.
BATCHESHELPER_IMAGE="${registry}/batcheshelper:${CANDIDATE_VERSION}"
BATCHESHELPER_IMAGE="${REGISTRY}/batcheshelper:${CANDIDATE_VERSION}"
docker pull "${BATCHESHELPER_IMAGE}"
echo "--- :terminal: Start server with executor"

View File

@ -1,6 +1,6 @@
{
"executors.accessToken": "$EXECUTOR_FRONTEND_PASSWORD",
"executors.batcheshelperImage": "us.gcr.io/sourcegraph-dev/batcheshelper",
"executors.batcheshelperImage": "$REGISTRY/batcheshelper",
"executors.batcheshelperImageTag": "$CANDIDATE_VERSION",
"auth.providers": [
{

View File

@ -5,6 +5,8 @@ import (
"strconv"
"github.com/Masterminds/semver"
"github.com/sourcegraph/sourcegraph/dev/ci/images"
bk "github.com/sourcegraph/sourcegraph/dev/ci/internal/buildkite"
"github.com/sourcegraph/sourcegraph/dev/ci/internal/ci/operations"
"github.com/sourcegraph/sourcegraph/dev/ci/runtype"
@ -148,19 +150,18 @@ func executorImageFamilyForConfig(c Config) string {
return imageFamily
}
func executorsE2E(candidateTag string) operations.Operation {
func executorsE2E(c Config) operations.Operation {
return func(p *bk.Pipeline) {
p.AddStep(":bazel::docker::packer: Executors E2E",
// Run tests against the candidate server image
bk.DependsOn("bazel-push-images-candidate"),
bk.Agent("queue", AspectWorkflows.QueueDefault),
bk.Env("CANDIDATE_VERSION", candidateTag),
bk.Env("REGISTRY", images.SourcegraphDockerDevRegistry),
bk.Env("CANDIDATE_VERSION", c.candidateImageTag()),
bk.Env("SOURCEGRAPH_BASE_URL", "http://127.0.0.1:7080"),
bk.Env("SOURCEGRAPH_SUDO_USER", "admin"),
bk.Env("TEST_USER_EMAIL", "test@sourcegraph.com"),
bk.Env("TEST_USER_PASSWORD", "supersecurepassword"),
bk.Cmd("dev/ci/integration/executors/run.sh"),
bk.ArtifactPaths("./*.log"),
)
bk.ArtifactPaths("./*.log")) // Run tests against the candidate server image
}
}

View File

@ -87,15 +87,14 @@ func bazelPushImagesCmd(c Config, isCandidate bool, opts ...bk.StepOpt) func(*bk
stepKey := "bazel-push-images"
candidate := ""
// Default registries.
devRegistry := images.SourcegraphDockerDevRegistry
prodRegistry := images.SourcegraphDockerPublishRegistry
if isCandidate {
stepName = ":bazel::docker: Push candidate Images"
stepKey = stepKey + "-candidate"
candidate = "true"
}
// Default registries.
devRegistry := images.SourcegraphDockerDevRegistry
prodRegistry := images.SourcegraphDockerPublishRegistry
// If we're building an internal release, we push the final images to that specific registry instead.
// See also: release_operations.go

View File

@ -299,7 +299,7 @@ func GeneratePipeline(c Config) (*bk.Pipeline, error) {
// End-to-end tests
ops.Merge(operations.NewNamedSet("End-to-end tests",
executorsE2E(c.candidateImageTag()),
executorsE2E(c),
// testUpgrade(c.candidateImageTag(), minimumUpgradeableVersion),
))