Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read build info from package.json #58

Merged
merged 5 commits into from
Jan 12, 2024
Merged

Conversation

mhofman
Copy link
Member

@mhofman mhofman commented Jan 12, 2024

Follow-up to #52, but instead of relying on new commands and positional parameters, the base build info is read from the package.json enclosing the proposals. This allows using a single and simple synthetic-chain build command, whether in a3p itself or in other repos integrations. It also provides a place in the future to configure the build of other a3p like images.

I have manually locally tested this change with Agoric/agoric-sdk#8743.

A new version of the synthetic-chain package still needs to be published if approved.

@mhofman mhofman requested a review from turadg January 12, 2024 07:31
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like where this is going but I think this increment is a little more confusing on the way to something better.

If we want the package.json to control the build config, then let's go all the way.

This one would be:

    "agoricSyntheticChain": {
        "mode": "fromAg0",
    },

Then appending to the default (main) would be:

    "agoricSyntheticChain": {
        "mode": "append",
    },

And a specific branch would be:

    "agoricSyntheticChain": {
        "mode": "append",
        "fromTag": "my-tag",
    },

Then the CLI command could be simply synthetic-chain build for all cases.

@@ -49,16 +52,19 @@ const buildImages = () => {

switch (cmd) {
case 'amend': // alias for backcompat
case 'append':
const fromTag = positionals[1] || baseTag;
case 'append': { // alias for backcompat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is the primary, not the alias. maybe this got moved accidentally from case: 'build':?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to deprecate the append command line as well, and keep only build

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha. Let's just drop this case and make the breaking change right now now to have just build

@@ -20,7 +21,9 @@ const { positionals, values } = parseArgs({
allowPositionals: true,
});

const allProposals = readProposals(path.resolve('.'));
const proposalsParent = path.resolve('.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't inaccurate but I think more importantly it's the root of the testing project.

Suggested change
const proposalsParent = path.resolve('.');
const root = path.resolve('.');

@mhofman
Copy link
Member Author

mhofman commented Jan 12, 2024

Then the CLI command could be simply synthetic-chain build for all cases.

It already is, but admittedly the "from ag0" case is not obviously spelled out, with fromTag being null.

Then appending to the default (main) would be:

I think the "appending" mode should also be the default. At the end of the day we only expect a single a3p image, but multiple integrations in dapps and agoric-sdk.

@mhofman mhofman force-pushed the mhofman/build-info-package-json branch from 9dfb37b to a8976ba Compare January 12, 2024 16:19
@mhofman mhofman requested a review from turadg January 12, 2024 16:26
@mhofman
Copy link
Member Author

mhofman commented Jan 12, 2024

I clarified that using null is the toggle to build from scratch, and I removed the extra commands to only keep build

Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement

@@ -49,16 +52,19 @@ const buildImages = () => {

switch (cmd) {
case 'amend': // alias for backcompat
case 'append':
const fromTag = positionals[1] || baseTag;
case 'append': { // alias for backcompat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha. Let's just drop this case and make the breaking change right now now to have just build

@@ -17,6 +17,7 @@ sed -i.bak "s/^enable-unsafe-cors =.*/enable-unsafe-cors = true/" "$HOME/.agoric
sed -i.bak "s/127.0.0.1:26657/0.0.0.0:26657/" "$HOME/.agoric/config/config.toml"
sed -i.bak "s/cors_allowed_origins = \[\]/cors_allowed_origins = \[\"*\"\]/" "$HOME/.agoric/config/config.toml"
sed -i.bak '/^\[api]/,/^\[/{s/^enable[[:space:]]*=.*/enable = true/}' "$HOME/.agoric/config/app.toml"
sed -i.bak "s/^pruning =.*/pruning = \"nothing\"/" "$HOME/.agoric/config/app.toml"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be its own commit but I'll approve to get this in faster.

@turadg
Copy link
Member

turadg commented Jan 12, 2024

Failure was Unable to find image 'ghcr.io/agoric/agoric-3-proposals:test-upgrade-13' locally, which is a deficiency of the build daemon that it dropped from build results.

Since it has to run again, I moved the prune change into its own commit and added the version release commit.

@turadg turadg force-pushed the mhofman/build-info-package-json branch from a8976ba to e7855fb Compare January 12, 2024 17:35
@mhofman
Copy link
Member Author

mhofman commented Jan 12, 2024

Since it has to run again, I moved the prune change into its own commit and added the version release commit.

Oh my bad I didn't mean to include that in this PR, it was a local experiment. But I guess it's there now

@turadg turadg enabled auto-merge January 12, 2024 17:42
@turadg
Copy link
Member

turadg commented Jan 12, 2024

Released as https://www.npmjs.com/package/@agoric/synthetic-chain/v/0.0.2

@turadg turadg merged commit 5d6ba27 into main Jan 12, 2024
3 checks passed
@turadg turadg deleted the mhofman/build-info-package-json branch January 12, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants