Skip to content

Commit

Permalink
Merge pull request #99 from Agoric/ta/more-misc
Browse files Browse the repository at this point in the history
publish "latest" image with passed proposals
  • Loading branch information
turadg authored Feb 9, 2024
2 parents 26667fa + 366d774 commit 796d2e7
Show file tree
Hide file tree
Showing 49 changed files with 2,826 additions and 2,815 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ jobs:
./docker-bake.json
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: use
# Include "latest" which is latest "use" image
targets: use, latest
push: true

- name: notify on failure
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
]
},
"license": "Apache-2.0",
"packageManager": "yarn@4.0.2",
"packageManager": "yarn@4.1.0",
"devDependencies": {
"prettier": "^3.2.0"
"prettier": "^3.2.5"
}
}
12 changes: 12 additions & 0 deletions packages/synthetic-chain/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,15 @@ target "test" {
}
target = "test-${proposal}"
}

// Single image for using the chain with the state after all the passed proposals
// Must match the CI config and synthetic-chain default fromTag
target "latest" {
inherits = ["docker-metadata-action"]
platforms = PLATFORMS
tags = ["ghcr.io/agoric/agoric-3-proposals:latest"]
labels = {
"org.opencontainers.image.title": "All passed proposals",
"org.opencontainers.image.description": "Use agoric-3 synthetic chain including all passed proposals",
}
}
12 changes: 6 additions & 6 deletions packages/synthetic-chain/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agoric/synthetic-chain",
"version": "0.0.4-3",
"version": "0.0.5-3",
"description": "Utilities to build a chain and test proposals atop it",
"bin": "./cli.ts",
"main": "cli.ts",
Expand All @@ -18,17 +18,17 @@
"test:xs": "exit 0"
},
"dependencies": {
"@endo/zip": "^1.0.0",
"better-sqlite3": "^9.2.2",
"@endo/zip": "^1.0.1",
"better-sqlite3": "^9.4.0",
"chalk": "^5.3.0",
"execa": "^8.0.1",
"tsx": "^3.12.8",
"tsx": "^3.14.0",
"typescript": "^5.3.3"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.9",
"@types/node": "^18.11.9",
"ava": "^5.3.0"
"@types/node": "^18.19.14",
"ava": "^5.3.1"
},
"ava": {
"extensions": {
Expand Down
5 changes: 3 additions & 2 deletions packages/synthetic-chain/src/cli/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ export type AgoricSyntheticChainConfig = {
/**
* The agoric-3-proposals tag to build the agoric synthetic chain from.
* If `null`, the chain is built from an ag0 genesis.
* Defaults to `main`, which containing all passed proposals
* Defaults to `latest`, which containing all passed proposals
*/
fromTag: string | null;
platforms?: Platform[];
};

const defaultConfig: AgoricSyntheticChainConfig = {
// Tag of the agoric-3 image containing all passed proposals
fromTag: 'main',
// Must match the Bake file and CI config
fromTag: 'latest',
};

export function readBuildConfig(root: string): AgoricSyntheticChainConfig {
Expand Down
18 changes: 7 additions & 11 deletions packages/synthetic-chain/src/cli/dockerfileGen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ FROM ${previousStage}-${proposalName} as use-${proposalName}
WORKDIR /usr/src/upgrade-test-scripts
COPY --link --chmod=755 ./upgrade-test-scripts/run_use.sh /usr/src/upgrade-test-scripts/
COPY --link --chmod=755 ./upgrade-test-scripts/run_use.sh ./upgrade-test-scripts/start_agd.sh /usr/src/upgrade-test-scripts/
SHELL ["/bin/bash", "-c"]
RUN ./run_use.sh ${proposalIdentifier}:${proposalName}
ENTRYPOINT ./start_agd.sh
`;
},
/**
Expand All @@ -157,28 +158,23 @@ FROM use-${proposalName} as test-${proposalName}
WORKDIR /usr/src/upgrade-test-scripts
# copy run_test for this entrypoint and start_agd for optional debugging
COPY --link --chmod=755 ./upgrade-test-scripts/run_test.sh ./upgrade-test-scripts/start_agd.sh /usr/src/upgrade-test-scripts/
COPY --link --chmod=755 ./upgrade-test-scripts/run_test.sh /usr/src/upgrade-test-scripts/
SHELL ["/bin/bash", "-c"]
ENTRYPOINT ./run_test.sh ${proposalIdentifier}:${proposalName}
`;
},
/**
* The last target in the file, for untargeted `docker build`
*/
DEFAULT(lastProposal: ProposalInfo) {
LAST(lastProposal: ProposalInfo) {
// Assumes the 'use' image is built and tagged.
// This isn't necessary for a multi-stage build, but without it CI
// rebuilds the last "use" image during the "default" image step
// Some background: https://github.com/moby/moby/issues/34715
const useImage = imageNameForProposal(lastProposal, 'use').name;
return `
# DEFAULT
FROM ${useImage}
WORKDIR /usr/src/upgrade-test-scripts
SHELL ["/bin/bash", "-c"]
ENTRYPOINT ./start_agd.sh
# LAST
FROM ${useImage} as latest
`;
},
};
Expand Down Expand Up @@ -259,7 +255,7 @@ export function writeDockerfile(
// If one of the proposals is a passed proposal, make the latest one the default entrypoint
const lastPassed = allProposals.findLast(isPassed);
if (lastPassed) {
blocks.push(stage.DEFAULT(lastPassed));
blocks.push(stage.LAST(lastPassed));
}

const contents = blocks.join('\n');
Expand Down
2 changes: 1 addition & 1 deletion packages/synthetic-chain/src/cli/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const fixupProposal = (proposal: ProposalInfo) => {
const packageJson = JSON.parse(
fs.readFileSync(path.join(proposalPath, 'package.json'), 'utf-8'),
);
if (packageJson.dependencies) {
if (packageJson.dependencies || packageJson.devDependencies) {
assert(
packageJson.packageManager,
'missing packageManager in package.json',
Expand Down
Empty file modified proposals/16:upgrade-8/test.sh
100644 → 100755
Empty file.
Empty file modified proposals/16:upgrade-8/use.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions proposals/29:upgrade-9/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion proposals/29:upgrade-9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"scripts": {
"agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops"
},
"packageManager": "yarn@4.0.2"
"packageManager": "yarn@4.1.0"
}
Empty file modified proposals/29:upgrade-9/test.sh
100644 → 100755
Empty file.
Empty file modified proposals/29:upgrade-9/use.sh
100644 → 100755
Empty file.
Loading

0 comments on commit 796d2e7

Please sign in to comment.