From 2b1427c3e9e02590bb4244c01c7b69b78f76acca Mon Sep 17 00:00:00 2001 From: Balaji Arun Date: Wed, 9 Aug 2023 08:12:27 -0700 Subject: [PATCH] Revert "remove usage of us-west1-registry from aptos-core (#9509)" This reverts commit fd22b8aa5e6ea79372801beedef1997d158889a9. --- .github/actions/docker-setup/action.yaml | 7 +++++++ .github/workflows/copy-images-to-dockerhub.yaml | 1 + .github/workflows/docker-build-test.yaml | 1 + .github/workflows/workflow-run-docker-rust-build.yaml | 1 + docker/builder/docker-bake-rust-all.hcl | 6 ++++++ docker/release-images.mjs | 5 +++-- testsuite/forge.py | 2 +- 7 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/actions/docker-setup/action.yaml b/.github/actions/docker-setup/action.yaml index 2755c30241429..7550a43e3df3c 100644 --- a/.github/actions/docker-setup/action.yaml +++ b/.github/actions/docker-setup/action.yaml @@ -83,6 +83,13 @@ runs: service_account: ${{ inputs.GCP_SERVICE_ACCOUNT_EMAIL }} export_environment_variables: ${{ inputs.EXPORT_GCP_PROJECT_VARIABLES }} + - name: Login to us-west1 Google Artifact Registry + uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # pin@v2 + with: + registry: us-west1-docker.pkg.dev + username: oauth2accesstoken + password: ${{ steps.auth.outputs.access_token }} + - name: Login to US multi-region Google Artifact Registry uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # pin@v2 with: diff --git a/.github/workflows/copy-images-to-dockerhub.yaml b/.github/workflows/copy-images-to-dockerhub.yaml index fdd86d46fb18d..9f26522fcddad 100644 --- a/.github/workflows/copy-images-to-dockerhub.yaml +++ b/.github/workflows/copy-images-to-dockerhub.yaml @@ -59,6 +59,7 @@ jobs: FORCE_COLOR: 3 # Force color output as per https://github.com/google/zx#using-github-actions GIT_SHA: ${{ inputs.GIT_SHA || github.sha }} # If GIT_SHA is not provided, use the sha of the triggering branch GCP_DOCKER_ARTIFACT_REPO: ${{ secrets.GCP_DOCKER_ARTIFACT_REPO }} + GCP_DOCKER_ARTIFACT_REPO_US: ${{ secrets.GCP_DOCKER_ARTIFACT_REPO_US }} AWS_ACCOUNT_ID: ${{ secrets.AWS_ECR_ACCOUNT_NUM }} IMAGE_TAG_PREFIX: ${{ inputs.image_tag_prefix }} run: ./docker/release-images.mjs --wait-for-image-seconds=3600 diff --git a/.github/workflows/docker-build-test.yaml b/.github/workflows/docker-build-test.yaml index 7ce098976e2f0..28a752a883f63 100644 --- a/.github/workflows/docker-build-test.yaml +++ b/.github/workflows/docker-build-test.yaml @@ -48,6 +48,7 @@ concurrency: env: GCP_DOCKER_ARTIFACT_REPO: ${{ secrets.GCP_DOCKER_ARTIFACT_REPO }} + GCP_DOCKER_ARTIFACT_REPO_US: ${{ secrets.GCP_DOCKER_ARTIFACT_REPO_US }} AWS_ECR_ACCOUNT_NUM: ${{ secrets.ENV_ECR_AWS_ACCOUNT_NUM }} # In case of pull_request events by default github actions merges main into the PR branch and then runs the tests etc # on the prospective merge result instead of only on the tip of the PR. diff --git a/.github/workflows/workflow-run-docker-rust-build.yaml b/.github/workflows/workflow-run-docker-rust-build.yaml index 62fa2b0b4b885..922d62b3b4898 100644 --- a/.github/workflows/workflow-run-docker-rust-build.yaml +++ b/.github/workflows/workflow-run-docker-rust-build.yaml @@ -64,6 +64,7 @@ env: FEATURES: ${{ inputs.FEATURES }} BUILD_ADDL_TESTING_IMAGES: ${{ inputs.BUILD_ADDL_TESTING_IMAGES }} GCP_DOCKER_ARTIFACT_REPO: ${{ secrets.GCP_DOCKER_ARTIFACT_REPO }} + GCP_DOCKER_ARTIFACT_REPO_US: ${{ secrets.GCP_DOCKER_ARTIFACT_REPO_US }} AWS_ECR_ACCOUNT_NUM: ${{ secrets.ENV_ECR_AWS_ACCOUNT_NUM }} TARGET_REGISTRY: ${{ inputs.TARGET_REGISTRY }} diff --git a/docker/builder/docker-bake-rust-all.hcl b/docker/builder/docker-bake-rust-all.hcl index 5f289bd848083..1b6194266c074 100644 --- a/docker/builder/docker-bake-rust-all.hcl +++ b/docker/builder/docker-bake-rust-all.hcl @@ -22,6 +22,8 @@ variable "BUILT_VIA_BUILDKIT" {} variable "GCP_DOCKER_ARTIFACT_REPO" {} +variable "GCP_DOCKER_ARTIFACT_REPO_US" {} + variable "AWS_ECR_ACCOUNT_NUM" {} variable "TARGET_REGISTRY" { @@ -233,12 +235,16 @@ function "generate_tags" { result = TARGET_REGISTRY == "remote-all" ? [ "${GCP_DOCKER_ARTIFACT_REPO}/${target}:${IMAGE_TAG_PREFIX}${GIT_SHA}", "${GCP_DOCKER_ARTIFACT_REPO}/${target}:${IMAGE_TAG_PREFIX}${NORMALIZED_GIT_BRANCH_OR_PR}", + "${GCP_DOCKER_ARTIFACT_REPO_US}/${target}:${IMAGE_TAG_PREFIX}${GIT_SHA}", + "${GCP_DOCKER_ARTIFACT_REPO_US}/${target}:${IMAGE_TAG_PREFIX}${NORMALIZED_GIT_BRANCH_OR_PR}", "${ecr_base}/${target}:${IMAGE_TAG_PREFIX}${GIT_SHA}", "${ecr_base}/${target}:${IMAGE_TAG_PREFIX}${NORMALIZED_GIT_BRANCH_OR_PR}", ] : ( TARGET_REGISTRY == "gcp" || TARGET_REGISTRY == "remote" ? [ "${GCP_DOCKER_ARTIFACT_REPO}/${target}:${IMAGE_TAG_PREFIX}${GIT_SHA}", "${GCP_DOCKER_ARTIFACT_REPO}/${target}:${IMAGE_TAG_PREFIX}${NORMALIZED_GIT_BRANCH_OR_PR}", + "${GCP_DOCKER_ARTIFACT_REPO_US}/${target}:${IMAGE_TAG_PREFIX}${GIT_SHA}", + "${GCP_DOCKER_ARTIFACT_REPO_US}/${target}:${IMAGE_TAG_PREFIX}${NORMALIZED_GIT_BRANCH_OR_PR}", ] : [ // "local" or any other value "aptos-core/${target}:${IMAGE_TAG_PREFIX}${GIT_SHA}-from-local", "aptos-core/${target}:${IMAGE_TAG_PREFIX}from-local", diff --git a/docker/release-images.mjs b/docker/release-images.mjs index 09608e875635f..795a3aaecfe48 100755 --- a/docker/release-images.mjs +++ b/docker/release-images.mjs @@ -20,7 +20,7 @@ // - crane - https://github.com/google/go-containerregistry/tree/main/cmd/crane#installation // - pnpm - https://pnpm.io/installation // 2. docker login - with authorization to push to the `aptoslabs` org -// 3. gcloud auth configure-docker us-docker.pkg.dev +// 3. gcloud auth configure-docker us-west1-docker.pkg.dev // 4. gcloud auth login --update-adc // 5. AWS CLI credentials configured // @@ -90,7 +90,7 @@ chdir(dirname(process.argv[1]) + "/.."); // change workdir to the root of the re execSync("pnpm install --frozen-lockfile", { stdio: "inherit" }); await import("zx/globals"); -const REQUIRED_ARGS = ["GIT_SHA", "GCP_DOCKER_ARTIFACT_REPO", "AWS_ACCOUNT_ID", "IMAGE_TAG_PREFIX"]; +const REQUIRED_ARGS = ["GIT_SHA", "GCP_DOCKER_ARTIFACT_REPO", "GCP_DOCKER_ARTIFACT_REPO_US", "AWS_ACCOUNT_ID", "IMAGE_TAG_PREFIX"]; const OPTIONAL_ARGS = ["WAIT_FOR_IMAGE_SECONDS"]; const parsedArgs = {}; @@ -135,6 +135,7 @@ if (process.env.CI === "true") { const AWS_ECR = `${parsedArgs.AWS_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/aptos`; const GCP_ARTIFACT_REPO = parsedArgs.GCP_DOCKER_ARTIFACT_REPO; +const GCP_ARTIFACT_REPO_US = parsedArgs.GCP_DOCKER_ARTIFACT_REPO_US; const DOCKERHUB = "docker.io/aptoslabs"; const INTERNAL_TARGET_REGISTRIES = [ diff --git a/testsuite/forge.py b/testsuite/forge.py index 16c17380506fa..8bbcfe2b284aa 100644 --- a/testsuite/forge.py +++ b/testsuite/forge.py @@ -59,7 +59,7 @@ MULTIREGION_KUBECONFIG_DIR = "/etc/multiregion-kubeconfig" MULTIREGION_KUBECONFIG_PATH = f"{MULTIREGION_KUBECONFIG_DIR}/kubeconfig" -GAR_REPO_NAME = "us-docker.pkg.dev/aptos-registry/docker" +GAR_REPO_NAME = "us-west1-docker.pkg.dev/aptos-global/aptos-internal" @dataclass