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] hydrogen deploy: Add token flag, add environment selection #1381

Merged
merged 3 commits into from
Oct 5, 2023

Conversation

vincentezw
Copy link
Contributor

@vincentezw vincentezw commented Sep 28, 2023

WHY are these changes introduced?

  • Adds a token flag to allow manual token entry
  • Adds selection dialog to select the environment to deploy to, when ran from outside CI environments
  • Bump to oxygen-cli 2.0.0 which renames the health check to "deployment verification".

WHAT is this pull request doing?

This will enable merchants to use the deploy command in CI environments, where the automatic token retrieval through the API will not be available. Instead, they can use the token flag to supply an Oxygen deployment token.

In addition; outside of CI environments we can display a user-friendly list of store environments to deploy to, with the current default based on the currently checked-out branch.

HOW to test your changes?

Post-merge steps

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@vincentezw vincentezw marked this pull request as ready for review September 28, 2023 16:11
@github-actions

This comment has been minimized.

Copy link
Contributor

@frandiox frandiox left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -36,6 +39,11 @@ export const deploymentLogger: Logger = (

export default class Deploy extends Command {
static flags: any = {
environmentTag: Flags.string({
Copy link
Contributor

@frandiox frandiox Oct 2, 2023

Choose a reason for hiding this comment

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

Just a suggestion, we are using "env" instead of "environment" in other flags, so maybe this one could be "envTag" instead or even "envBranch" like in h2 env pull?

Also, just noticed these flags are using camel case but we use kebab case for flags everywhere else. I don't think Oclif transform them internally so we should write them as kebab case here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have converted all to kebab case now. Are existing flags like envBranch or other commonFlags changing too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ty! The commonFlags object can use camel case because it's internal, but the flags are later exposed as kebab-case already afaik -- if we missed some flag we should change it, yeah

packages/cli/src/commands/hydrogen/deploy.ts Outdated Show resolved Hide resolved
packages/cli/src/commands/hydrogen/deploy.ts Outdated Show resolved Hide resolved
.changeset/eighty-wombats-return.md Outdated Show resolved Hide resolved
packages/cli/src/commands/hydrogen/deploy.ts Outdated Show resolved Hide resolved
Comment on lines 88 to 95
environmentTag: flags['env-branch'],
path: actualPath,
shop: flags.shop,
publicDeployment: flags.publicDeployment,
publicDeployment: flags['public-deployment'],
token: flags.token,
metadataUrl: flags.metadataUrl,
metadataUser: flags.metadataUser,
metadataVersion: flags.metadataVersion,
metadataUrl: flags['metadata-url'],
metadataUser: flags['metadata-user'],
metadataVersion: flags['metadata-version'],
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI you can use the flagsToCamelObject utility, it's also typed. You can see an example in commands/dev.ts and other commands

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Neat, thanks for sharing.

@vincentezw vincentezw force-pushed the vez/deploy-token-env-selection branch from f55873d to 9325faf Compare October 4, 2023 12:33
@frandiox frandiox merged commit 6c93d88 into main Oct 5, 2023
@frandiox frandiox deleted the vez/deploy-token-env-selection branch October 5, 2023 09:34
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