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

Improve logic to determine if receipts migration is necessary #377

Merged

Conversation

@corneliusweig
Copy link
Contributor

corneliusweig commented Nov 11, 2019

Fixes #374

for _, entry := range store {
if entry.IsDir() {
for _, entry := range plugins {
if strings.HasPrefix(entry.Name(), "kubectl-") && 0 != entry.Mode()&os.ModeSymlink {

This comment has been minimized.

Copy link
@ahmetb

ahmetb Nov 11, 2019

Member

what if we didn't look for kubectl- prefix?
similarly, what if we didn't look for them to be symlinks?
we can just ReadDir?

This comment has been minimized.

Copy link
@corneliusweig

corneliusweig Nov 11, 2019

Author Contributor

That should be fine, unless somebody puts something into the bin directory. Doing these checks makes that much more unlikely. But this should matter in very exceptional cases only.

This comment has been minimized.

Copy link
@ahmetb

ahmetb Nov 11, 2019

Member

Yeah I guess it's especially fine because we'll remove this code ≥0.5 or maybe earlier.

@ahmetb

This comment has been minimized.

Copy link
Member

ahmetb commented Nov 11, 2019

mostly lgtm
/hold
for comments

@ahmetb

This comment has been minimized.

Copy link
Member

ahmetb commented Nov 11, 2019

/lgtm
/approve

We can have this + #375 go into a new release, as both of them address Windows installation issues.

@corneliusweig corneliusweig force-pushed the corneliusweig:w/migration-check-bug branch from 7c4fa77 to 7a3d03c Nov 11, 2019
@k8s-ci-robot k8s-ci-robot added size/S and removed lgtm size/M labels Nov 11, 2019
@corneliusweig

This comment has been minimized.

Copy link
Contributor Author

corneliusweig commented Nov 11, 2019

I simplified the logic as suggested. That way, the tests don't need to be modified as much, which is better.


We can have this + #375 go into a new release, as both of them address Windows installation issues.

Yes, makes sense. Let's wait for confirmation that the copy/move issue is indeed resolved.

@@ -39,7 +39,7 @@ func TestIsMigrated(t *testing.T) {
}{
{
name: "One plugin and receipts",
filesPresent: []string{"store/konfig/konfig.sh", "receipts/present"},
filesPresent: []string{"bin/konfig/konfig.sh", "receipts/present"},

This comment has been minimized.

Copy link
@ahmetb

ahmetb Nov 11, 2019

Member

this is not very realistic since it created dirs under bin/
let's just add bin/konfig.sh directly.

also if "konfig" the word isn't relevant, let's say "foo", (ditto below)

but it seems like this has simplified the tests a good deal.

This comment has been minimized.

Copy link
@corneliusweig

corneliusweig Nov 12, 2019

Author Contributor

Yes, makes much more sense!

@ahmetb

This comment has been minimized.

Copy link
Member

ahmetb commented Nov 12, 2019

/lgtm
/approve
thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm label Nov 12, 2019
@ahmetb

This comment has been minimized.

Copy link
Member

ahmetb commented Nov 12, 2019

/hold cancel

@ahmetb

This comment has been minimized.

Copy link
Member

ahmetb commented Nov 12, 2019

/retitle Improve logic to determine if receipts migration is necessary

@k8s-ci-robot k8s-ci-robot changed the title Improve logic to determine if repo migration is necessary Improve logic to determine if receipts migration is necessary Nov 12, 2019
@k8s-ci-robot k8s-ci-robot removed the lgtm label Nov 12, 2019
@@ -84,6 +84,7 @@ func setupKrewBin(t *testing.T, tempDir *testutil.TempDir) string {
if err := os.MkdirAll(binPath, 0755); err != nil {
t.Fatal(err)
}
tempDir.Write("receipts/krew.notyaml", []byte("must be present for receipts migration check"))

This comment has been minimized.

Copy link
@corneliusweig

corneliusweig Nov 12, 2019

Author Contributor

This is a bit hacky. But the new logic requires that something is present under receipts/.

@corneliusweig corneliusweig force-pushed the corneliusweig:w/migration-check-bug branch from 3b65a0f to b169f84 Nov 12, 2019
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Nov 12, 2019

Codecov Report

Merging #377 into master will decrease coverage by 0.18%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #377      +/-   ##
==========================================
- Coverage   57.11%   56.92%   -0.19%     
==========================================
  Files          19       19              
  Lines         914      910       -4     
==========================================
- Hits          522      518       -4     
  Misses        339      339              
  Partials       53       53
Impacted Files Coverage Δ
pkg/receiptsmigration/migration.go 46.15% <100%> (-2%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 560be99...b169f84. Read the comment docs.

@corneliusweig

This comment has been minimized.

Copy link
Contributor Author

corneliusweig commented Nov 14, 2019

@ahmetb If we merge this, we can craft a bugfix release for windows, right?

@ahmetb

This comment has been minimized.

Copy link
Member

ahmetb commented Nov 15, 2019

I think so.

@ahmetb

This comment has been minimized.

Copy link
Member

ahmetb commented Nov 15, 2019

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm label Nov 15, 2019
@k8s-ci-robot

This comment has been minimized.

Copy link

k8s-ci-robot commented Nov 15, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmetb, corneliusweig

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [ahmetb,corneliusweig]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 46eaf89 into kubernetes-sigs:master Nov 15, 2019
2 of 3 checks passed
2 of 3 checks passed
tide Not mergeable. Needs lgtm label.
Details
cla/linuxfoundation corneliusweig authorized
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ahmetb

This comment has been minimized.

Copy link
Member

ahmetb commented Nov 15, 2019

If we merge this, we can craft a bugfix release for windows, right?

Let's try to get other low-hanging small PRs in for a release too! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.