-
Notifications
You must be signed in to change notification settings - Fork 182
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
PDE-2981: feature(cli) - Update "promote" and "migrate" to use new endpoint #480
Conversation
percent, | ||
name: 'migrate', | ||
from_version: fromVersion, | ||
to_version: toVersion, |
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.
Is this the right place to review map from?
https://github.com/zapier/zapier/blob/16c0ad7ce5dbb39f9802bd8b45c2305c35b77699/web/backend/zapier/app_platform/developer_cli/api/migration_resources.py
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.
yep!
@eliangcs - not sure what testing this looks like but I can supply a screenshot of this working locally when pointing to zapier-staging.com |
if (changelog) { | ||
body.changelog = changelog; | ||
body.job.changelog = changelog; |
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 know you were just following existing code, but you can move this above for the same effect:
const body = {
job: {
name: 'promote',
to_version: version,
changelog,
},
};
Since it'll be undefined if it's missing, it just works
@@ -15,6 +15,7 @@ class MigrateCommand extends BaseCommand { | |||
const user = this.flags.user; | |||
const fromVersion = this.args.fromVersion; | |||
const toVersion = this.args.toVersion; | |||
const email = this.args.email; |
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.
This won't quite work. If you look below at MigrateCommand.flags
, we only define the user
flag. I think if you provide --email
, the CLI will error at you.
Because the name email
vs user
doesn't matter, I'd keep the existing flag name and just save it as email
in the request body. That way the flags don't change for our users, but we send the right data to the API. Does that make sense?
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.
Yep, makes sense, good catch!
Because the name email vs user doesn't matter
Can you help me locate this for my own learning? I'm tracing where the endpoint builds the payload and find it set here but not sure where it will end up being used.
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.
https://cdn.zappy.app/eb7c153daa90542ec50c964bdc903dcb.png
nvm! I see now that user is email in this system!
@@ -120,7 +126,7 @@ PromoteCommand.args = [ | |||
{ | |||
name: 'version', | |||
required: true, | |||
description: 'The version you want promote.', | |||
description: 'The version you want to promote.', |
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.
Nice catch! 🙌
percent, | ||
name: 'migrate', | ||
from_version: fromVersion, | ||
to_version: toVersion, |
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.
yep!
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.
This is a great start! There are some things we'll want to fix before we ship, but we're most of the way there.
re: testing- we don't have great unit test coverage on CLI now, so as long as you've done thorough testing against staging/local, we're probably fine. Make sure to test all the args/flags! 😁
0e0b72f
to
3160a48
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.
Looks great! had one minor suggestion, but you can also go ahead and merge.
Also- the title of this PR is chore(cli)
, but that's usually reserved for bumping deps, fixing typos, etc. This is a feature! New and better migrations!
@@ -58,8 +62,12 @@ class MigrateCommand extends BaseCommand { | |||
`Starting migration from ${fromVersion} to ${toVersion} for ${percent}%` | |||
); | |||
} | |||
if (percent) { | |||
body.job.percent_human = percent; |
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 believe this can also be included rigtht in the job
above, since it's always defined (either from the default or from the user passing it explicitly)
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 tested all the code branches locally, and they all work wonderfully! Nice work!
Internally points the CLI
promote
andmigrate
command to use the new migration endpoint.These commands currently point to an endpoint that calls out to the new migration endpoint so this is work to remove that indirection.