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

Allow installation of an app without specifying version #309

Merged
merged 2 commits into from
Jun 5, 2017

Conversation

igorframos
Copy link
Contributor

@igorframos igorframos commented May 24, 2017

What is the purpose of this pull request?

Do not reject an app ID for installation if it does not have a version.

What problem is this solving?

Sometimes we just do not care about the version of an app we are installing, we just want the last one. Usually this is done by allowing users to not specify a version when installing the app.

How should this be manually tested?

Install an app using version and see it work as always.
Try to install an app without specifying version and see either:

  • With apps not deployed: API error saying the app ID is invalid;
  • With apps deployed: Installation works and latest version of the app is installed.

Screenshots or example usage

~$ vtex install vtex.visa-checkout
warn:    The following apps were not installed: vtex.visa-checkout
error:   API: 400 Bad Request
error:   Message: Invalid format for app ID
~$ vtex install vtex.visa-checkout@0.10.13
info:    Installed app vtex.visa-checkout@0.10.13 successfully
info:    Service Created: vtex.admins-app-0.0.3-7385b50dfce71d9a1937 kube-router
info:    Creating Service: vtex.store-data-grap-0.0.16-1bc2a08d1911d8a761f9 kube-router
info:    Creating Service: vtex.admins-app-0.0.3-7385b50dfce71d9a1937 kube-router
info:    Service Created: vtex.store-data-grap-0.0.16-1bc2a08d1911d8a761f9 kube-router
info:    Service Healthy: vtex.admins-app-0.0.3-7385b50dfce71d9a1937 kube-router
info:    Service Healthy: vtex.store-data-grap-0.0.16-1bc2a08d1911d8a761f9 kube-router
info:    Updating dependency tree vtex.render-builder
info:    Fetching dependencies files vtex.render-builder
info:    Installing dependencies vtex.render-builder
info:    Compiling source vtex.render-builder
info:    Preparing compiler vtex.render-builder
info:    Writing bundle vtex.render-builder
info:    Writing placeholders vtex.render-builder
info:    Build complete in 30180ms - available entry points:
http://igor--basedevmkp.myvtex.com/admin/:slug
http://igor--basedevmkp.myvtex.com/extensions
http://igor--basedevmkp.myvtex.com/extensions/manage
http://igor--basedevmkp.myvtex.com/extensions/:slug
http://igor--basedevmkp.myvtex.com/extensions/:slug/settings
http://igor--basedevmkp.myvtex.com/legacy-extensions/checkout
http://igor--basedevmkp.myvtex.com/legacy-extensions/orderplaced
http://igor--basedevmkp.myvtex.com/setup/vtex.visa-checkout vtex.render-builder

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires change to documentation, which has been updated accordingly.

@igorframos igorframos requested a review from drawveloper May 24, 2017 15:06
@tamorim
Copy link
Contributor

tamorim commented May 24, 2017

Does the Apps service already supports this?

@igorframos
Copy link
Contributor Author

No. I have a PR pending.

@tamorim
Copy link
Contributor

tamorim commented May 24, 2017

It's good practice to put a "Depends on" with a link to the PR when that's the case.

@igorframos
Copy link
Contributor Author

This is available in apps@0.11.0-beta

@@ -12,7 +13,16 @@ const installApps = async (apps: string[], reg: string): Promise<void> => {
if (apps.length === 0) {
return
}
const app = validateApp(head(apps))
var app;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use let when you need to rebind the variable, or const (preferably) when you don't need to rebind the variable.
We don't use var anymore.

}
app = validateApp(head(apps), false)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't get why you validate the app twice.

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 attacked the wrong problem. Instead of fixing the validation, I used it twice with different arguments so it would give me the expected result. Now I fixed it.

@igorframos igorframos force-pushed the feature/allow-installation-without-version branch from daabf02 to 2f4be3e Compare June 2, 2017 18:42
@igorframos
Copy link
Contributor Author

@tamorim, PTAL

@tamorim
Copy link
Contributor

tamorim commented Jun 5, 2017

@igorframos LGTM 👍

@tamorim tamorim merged commit 9b11910 into master Jun 5, 2017
@tamorim tamorim deleted the feature/allow-installation-without-version branch June 5, 2017 16:23
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