-
Notifications
You must be signed in to change notification settings - Fork 22
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
Use a plugin source to find the central plugin discovery #232
Use a plugin source to find the central plugin discovery #232
Conversation
6b2153e
to
69bdd95
Compare
c8159eb
to
e341e68
Compare
e341e68
to
675d0af
Compare
// this allows a user to delete the default central discovery and not | ||
// have the CLI add it again. A user can then use "plugin source init" | ||
// to add the default discovery again. | ||
if force || discoverySources == nil { |
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.
Notice that if len(discoverySources) == 0
we don't create the default central discovery.
I decided to do that so it is possible to run the CLI with no default central repo.
11182f1
to
0ee85b5
Compare
This commit removes the use of TANZU_CLI_PRE_RELEASE_REPO_IMAGE which was a temporary approach. Instead, the central discovery is automatically created in the config file as a "discoverySource" and "tanzu plugin source update" can be used to override this default value. This commit also updates the "tanzu plugin source" family of commands. With the central discovery feature enabled: 1. "tanzu plugin source add" is removed 2. "tanzu plugin source update" no longer has a "--type/-t" flag 3. "tanzu plugin source init" is added Signed-off-by: Marc Khouzam <kmarc@vmware.com>
0ee85b5
to
ede6414
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.
The changes look good to me. Thanks!
With PR vmware-tanzu#232 the trusted registries include the configured plugin source. The default central repo URI is no longer automatically trusted but only if it is configure as a plugin source (which happens by default). Therefore, the unit test is superceded by the unit tests of the same file that verifies the trusted registries for configured plugin source. Furthermore, the test that this commit removes would fail locally when the plugin source configured is not the default central repo. Signed-off-by: Marc Khouzam <kmarc@vmware.com>
With PR #232 the trusted registries include the configured plugin source. The default central repo URI is no longer automatically trusted but only if it is configured as a plugin source (which happens by default). Therefore, this removed unit test is superceded by the unit test of the same file that verifies the trusted registries for configured plugin sources. Furthermore, the test that this commit removes would fail locally when the plugin source configured is not the default central repo. Signed-off-by: Marc Khouzam <kmarc@vmware.com>
This commit removes the use of TANZU_CLI_PRE_RELEASE_REPO_IMAGE which was a temporary approach. Instead, the central discovery is automatically created in the config file as a "discoverySource" and "tanzu plugin source update" can be used to override this default value. This commit also updates the "tanzu plugin source" family of commands. With the central discovery feature enabled: 1. "tanzu plugin source add" is removed 2. "tanzu plugin source update" no longer has a "--type/-t" flag 3. "tanzu plugin source init" is added Signed-off-by: Marc Khouzam <kmarc@vmware.com>
With PR #232 the trusted registries include the configured plugin source. The default central repo URI is no longer automatically trusted but only if it is configured as a plugin source (which happens by default). Therefore, this removed unit test is superceded by the unit test of the same file that verifies the trusted registries for configured plugin sources. Furthermore, the test that this commit removes would fail locally when the plugin source configured is not the default central repo. Signed-off-by: Marc Khouzam <kmarc@vmware.com>
What this PR does / why we need it
This PR removes the use of
TANZU_CLI_PRE_RELEASE_REPO_IMAGE
which was a temporary approach.Instead, the central discovery is automatically created in the config file as a "discoverySource" and "tanzu plugin source update" can be used to override this default value.
This commit also updates the "tanzu plugin source" family of commands.
With the central discovery feature enabled:
Please see the additional notes at the end of this PR's description to see how "tanzu plugin source delete" is handled.
Which issue(s) this PR fixes
Fixes # N/A
Describe testing done for PR
I confirm that
make e2e-context-tmc-test
passes locally.Now lets test the special "plugin source delete" handling which allows to remove the default central discovery:
Release note
Additional information
Special notes for your reviewer
There is an important behaviour I'd like to get opinions on:
I decided to keep
tanzu plugin source delete
. The idea is that I've always been a bit uncomfortable with the fact there was no way to remove the default discovery. By keeping thetanzu plugin source delete
command it allows us to remove the default central repo and not have the CLI add it back automatically; instead, if a user does atanzu plugin source delete default
they can add back the central repo by doingtanzu plugin source init
.Note that on first use or removal of the config file, the CLI will notice the config file has no top-level entry for discoverySources and will create the default discovery source; but after a
tanzu plugin source delete
, the CLI will see the discoverySources section exist but is empty, in which case it will not add back the central discovery source.If this is not desirable, we can easily remove the
tanzu plugin source delete
command as was originally planned.