Skip to content

Commit

Permalink
add support to publish to new us multiregion docker artifact registry…
Browse files Browse the repository at this point in the history
… to release-images.mjs (aptos-labs#8148)
  • Loading branch information
geekflyer authored May 11, 2023
1 parent 175ce90 commit 26d0e98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/copy-images-to-dockerhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 10 additions & 9 deletions docker/release-images.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const Features = {
Default: "default",
Indexer: "indexer",
};
const TESTING_IMAGES = ["validator-testing"];

const IMAGES_TO_RELEASE_ONLY_INTERNAL = ["validator-testing"];
const IMAGES_TO_RELEASE = {
validator: {
performance: [
Expand Down Expand Up @@ -89,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 = {};
Expand Down Expand Up @@ -134,19 +135,19 @@ 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 TARGET_REGISTRIES = [
GCP_ARTIFACT_REPO,
DOCKERHUB,
AWS_ECR,
];

const INTERNAL_TARGET_REGISTRIES = [
GCP_ARTIFACT_REPO,
GCP_ARTIFACT_REPO_US,
AWS_ECR,
];

const ALL_TARGET_REGISTRIES = [
...INTERNAL_TARGET_REGISTRIES,
DOCKERHUB,
];

// default 10 seconds
parsedArgs.WAIT_FOR_IMAGE_SECONDS = parseInt(parsedArgs.WAIT_FOR_IMAGE_SECONDS ?? 10, 10);
Expand All @@ -157,7 +158,7 @@ for (const [image, imageConfig] of Object.entries(IMAGES_TO_RELEASE)) {
const profilePrefix = profile === "release" ? "" : profile;
for (const feature of features) {
const featureSuffix = feature === Features.Default ? "" : feature;
const targetRegistries = TESTING_IMAGES.includes(image) ? INTERNAL_TARGET_REGISTRIES : TARGET_REGISTRIES;
const targetRegistries = IMAGES_TO_RELEASE_ONLY_INTERNAL.includes(image) ? INTERNAL_TARGET_REGISTRIES : ALL_TARGET_REGISTRIES;

for (const targetRegistry of targetRegistries) {
const imageSource = `${parsedArgs.GCP_DOCKER_ARTIFACT_REPO}/${image}:${joinTagSegments(
Expand Down

0 comments on commit 26d0e98

Please sign in to comment.