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

CLI deployment pipeline #814

Merged
merged 45 commits into from
Apr 26, 2022
Merged

Conversation

namesty
Copy link
Collaborator

@namesty namesty commented Apr 14, 2022

Closes #670.

This PR aims to create a modular deployment pipeline for Polywrap's CLI. It introduces a new deploy CLI command and a DeployManifest.

Users declare deployment "stages" or steps, where each one performs deployment actions. Each stage takes a Uri argument outputs a Uri. Additionally, stages can be chained, so that the output of a stage can automatically be used as the input of another.

This aims to provide a modular, extensible, way of performing complex deployment/publishing/persistance actions that may depend on each other. An example use case would be:

  1. Deploy a wrapper's build directory to IPFS
  2. Pin the IPFS hash
  3. Publish the IPFS hash to an ENS domain
  4. Publish the IPFS hash to a Tezos domain

Each stage has an associated (declared) external package (wrappers in the future) that implements the Deployer interface:

interface Deployer {
  execute(uri: Uri, config?: unknown): Promise<Uri>;
}

The CLI determines the dependency chains, executes each stage in order of dependency and properly passes the outputs/inputs from one stage to another.

Sometimes, stages (and its packages) need additional arguments in order to execute the deployment actions. For example, an ENS deployment stage may need an ethereum provider URL. These additional arguments are declared as part of the config object of each stage.

Each package may provide a web3api.deploy.ext.json manifest extension file, with the necessary rules to validate the config properties it needs. The CLI extracts these extensions, links them to the appropriate stage in the "base" manifest and performs manifest validation. If the extension does not exist, the config property of that stage is not validated.

@Niraj-Kamdar Niraj-Kamdar self-requested a review April 15, 2022 11:40
"core: deserializeDeployManifest",
(manifest: string, options?: DeserializeManifestOptions): DeployManifest => {
let anyDeployManifest: AnyDeployManifest | undefined;
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we load json with yaml loader? Since YAML is superset of JSON, it should be possible.

Niraj-Kamdar
Niraj-Kamdar previously approved these changes Apr 15, 2022
Copy link
Contributor

@Niraj-Kamdar Niraj-Kamdar left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -948,7 +948,7 @@ describe("Web3ApiClient", () => {
).toBe(true);
});

it("simple-storage", async () => {
it.only("simple-storage", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it debug leftover?

fd.append(formDataEntry.key, elementData, options);
});

const resp = await axios.post(`${ipfsUrl}/api/v0/add`, fd, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will it also pin or we need separate deployer for pinning?

@namesty namesty requested a review from ramilexe as a code owner April 20, 2022 15:09
dOrgJelli
dOrgJelli previously approved these changes Apr 26, 2022
@dOrgJelli dOrgJelli merged commit 6900fd9 into prealpha-dev Apr 26, 2022
This was referenced Apr 26, 2022
@dOrgJelli dOrgJelli deleted the namesty/670-wrappers-cli-deployment branch April 10, 2023 16:51
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.

3 participants