Skip to content

Commit

Permalink
ci(docker): patch @agoric/synthetic-chain to enable other repos
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Sep 9, 2024
1 parent 67275c2 commit 9b86be6
Show file tree
Hide file tree
Showing 4 changed files with 289 additions and 152 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
diff --git a/dist/cli/cli.js b/dist/cli/cli.js
index c59a54224c101648c5507f451bfe0b2cb7f420a5..24ef27a882805df4a969a96ab28dad15b8ee5479 100755
--- a/dist/cli/cli.js
+++ b/dist/cli/cli.js
@@ -14,7 +14,9 @@ import path from "node:path";
var defaultConfig = {
// Tag of the agoric-3 image containing all passed proposals
// Must match the Bake file and CI config
- fromTag: "latest"
+ fromTag: "latest",
+ repositoryColon: "ghcr.io/agoric/agoric-3-proposals:",
+ sdkRepositoryColon: "ghcr.io/agoric/agoric-sdk:",
};
function readBuildConfig(root2) {
const packageJsonPath = path.join(root2, "package.json");
@@ -25,7 +27,8 @@ function readBuildConfig(root2) {
}
var buildProposalSubmissions = (proposals2) => {
for (const proposal of proposals2) {
- if (!("source" in proposal && proposal.source === "build")) continue;
+ if (!("source" in proposal && proposal.source === "build"))
+ continue;
console.log(
"Refreshing submission for",
proposal.proposalIdentifier,
@@ -63,7 +66,6 @@ import fs3 from "node:fs";
import assert from "node:assert";
import fs2 from "node:fs";
import * as path2 from "node:path";
-var repository = "ghcr.io/agoric/agoric-3-proposals";
function readInfo(proposalPath) {
assert(
proposalPath === proposalPath.toLowerCase(),
@@ -105,7 +107,7 @@ function readProposals(proposalsParent) {
function imageNameForProposal(proposal, stage2) {
const target = `${stage2}-${proposal.proposalName}`;
return {
- name: `${repository}:${target}`,
+ name: `${buildConfig.repositoryColon}${target}`,
target
};
}
@@ -143,7 +145,7 @@ RUN /usr/src/upgrade-test-scripts/run_prepare_zero.sh
RESUME(fromTag) {
return `
## RESUME
-FROM ghcr.io/agoric/agoric-3-proposals:${fromTag} as use-${fromTag}
+FROM \${REPOSITORY_COLON:-${buildConfig.repositoryColon}\}\${FROM_TAG:-${fromTag}\} as use-${fromTag}
`;
},
/**
@@ -186,7 +188,7 @@ RUN ./run_prepare.sh ${path5}
}) {
return `
# EXECUTE ${proposalName}
-FROM ghcr.io/agoric/agoric-sdk:${sdkImageTag} as execute-${proposalName}
+FROM \${SDK_REPOSITORY_COLON:-${buildConfig.sdkRepositoryColon}\}\${SDK_TAG:-${sdkImageTag}\} as execute-${proposalName}

WORKDIR /usr/src/upgrade-test-scripts

@@ -281,13 +283,22 @@ function writeBakefileProposals(allProposals2, platforms) {
},
PROPOSALS: {
default: allProposals2.map((p) => p.proposalName)
+ },
+ REPOSITORY_COLON: {
+ default: buildConfig.repositoryColon
+ },
+ SDK_REPOSITORY_COLON: {
+ default: buildConfig.sdkRepositoryColon
+ },
+ FROM_TAG: {
+ default: buildConfig.fromTag
}
}
};
fs3.writeFileSync("docker-bake.json", JSON.stringify(json, null, 2));
}
function writeDockerfile(allProposals2, fromTag) {
- const blocks = ["# syntax=docker/dockerfile:1.4"];
+ const blocks = ["# syntax=docker/dockerfile:1.4\nARG FROM_TAG\nARG REPOSITORY_COLON\nARG SDK_TAG\nARG SDK_REPOSITORY_COLON"];
let previousProposal = null;
if (fromTag) {
blocks.push(stage.RESUME(fromTag));
@@ -493,8 +517,8 @@ var prepareDockerBuild = () => {
const cliPath = new URL(import.meta.url).pathname;
const publicDir = path4.resolve(cliPath, "..", "..");
execSync4(`cp -r ${path4.resolve(publicDir, "docker-bake.hcl")} .`);
- writeDockerfile(allProposals, buildConfig.fromTag);
- writeBakefileProposals(allProposals, buildConfig.platforms);
+ writeDockerfile(allProposals, buildConfig.fromTag, buildConfig.repositoryColon, buildConfig.sdkRepositoryColon);
+ writeBakefileProposals(allProposals, buildConfig.platforms, buildConfig.repositoryColon);
execSync4(`cp -r ${path4.resolve(publicDir, "upgrade-test-scripts")} .`);
buildProposalSubmissions(proposals);
execSync4(
diff --git a/dist/docker-bake.hcl b/dist/docker-bake.hcl
index c59a54224c101648c5507f451bfe0b2cb7f420a5..24ef27a882805df4a969a96ab28dad15b8ee5479 100755
--- a/dist/docker-bake.hcl
+++ b/dist/docker-bake.hcl
@@ -23,7 +23,7 @@
proposal = PROPOSALS
}
// TODO proposal *number* would be immutable
- tags = ["ghcr.io/agoric/agoric-3-proposals:use-${proposal}"]
+ tags = ["${REPOSITORY_COLON}use-${proposal}"]
labels = {
"org.opencontainers.image.title": "Use ${proposal}",
"org.opencontainers.image.description": "Use agoric-3 synthetic chain after ${proposal} proposal",
@@ -37,7 +37,7 @@
matrix = {
proposal = PROPOSALS
}
- tags = ["ghcr.io/agoric/agoric-3-proposals:test-${proposal}"]
+ tags = ["${REPOSITORY_COLON}test-${proposal}"]
labels = {
"org.opencontainers.image.title": "Test ${proposal}",
}
@@ -49,7 +49,7 @@
target "latest" {
inherits = ["docker-metadata-action"]
platforms = PLATFORMS
- tags = ["ghcr.io/agoric/agoric-3-proposals:latest"]
+ tags = ["${REPOSITORY_COLON}latest"]
labels = {
"org.opencontainers.image.title": "All passed proposals",
"org.opencontainers.image.description": "Use agoric-3 synthetic chain including all passed proposals",
2 changes: 1 addition & 1 deletion a3p-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"doctor": "yarn synthetic-chain doctor"
},
"dependencies": {
"@agoric/synthetic-chain": "patch:@agoric/synthetic-chain@npm%3A0.1.0#~/.yarn/patches/@agoric-synthetic-chain-npm-0.1.0-148de716a6.patch",
"@agoric/synthetic-chain": "patch:@agoric/synthetic-chain@npm%3A0.1.1#~/.yarn/patches/@agoric-synthetic-chain-npm-0.1.1-d26a740f05.patch",
"@types/better-sqlite3": "^7.6.9"
},
"packageManager": "[email protected]",
Expand Down
Loading

0 comments on commit 9b86be6

Please sign in to comment.