-
Notifications
You must be signed in to change notification settings - Fork 200
Preserve App, Package and Directory addresses #120
Conversation
Implement a basic deploy handler to track app, packae and directory address in zos.network.json if project deploy fails
Now, only one method (fetchOrDeploy) is provided by both LibProject and AppProject. This method will fetch the App, Package and/or Provider if possible, and if not, will try to deploy them
297aab3
to
c44a0e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, left some small comments
project.directory = directory | ||
project.package = thepackage | ||
return project | ||
static async fetchOrDeploy(name = 'main', version = '0.1.0', txParams = {}, { appAddress = undefined, packageAddress = undefined }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the default values for name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say so, it simplifies usage of the Project class directly
return project | ||
} catch(deployError) { | ||
throw new DeployError(deployError.message, { thepackage, directory, app }) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about splitting this method a bit to sth like:
static async fetchOrDeploy(name = 'main', version = '0.1.0', txParams = {}, { appAddress = undefined, packageAddress = undefined }) {
try {
const app = await this.fetchOrDeployApp(...)
const thepackage = await this.fetchOrDeployPackage(...)
const directory = await this.fetchOrDeployDirectory(...)
return this.buildProject(...)
} catch(deployError) {
throw new DeployError(deployError.message, { thepackage, directory, app })
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've discussed this offline. It's not a good idea to merge deploy
and fetch
methods in Package
and App
, as it would add complexity.
On the other hand, separating the logic to new static methods inside AppProject
/LibProject
(or BasePackageProject
) just to make the code prettier is not reason enough to do so. In case we would want to provide this methods through zos-lib
, we can add them, but this exceeds this PR's scope.
return project | ||
} catch(deployError) { | ||
throw new DeployError(deployError.message, { thepackage, directory }) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may want to split this one too, it is not that large tho
this.unsetContracts() | ||
]) | ||
} | ||
|
||
async pushVersion() { | ||
_checkVersion() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@jcarpanelli feel free to merge after applying @facuspagnuolo's suggestions |
Fixes #35
push
runs.