Skip to content

Improve logic to determine if receipts migration is necessary - #377

Merged
k8s-ci-robot merged 3 commits into
kubernetes-sigs:masterfrom
corneliusweig:w/migration-check-bug
Nov 15, 2019
Merged

k8s-ci-robot merged 3 commits into
kubernetes-sigs:masterfrom
corneliusweig:w/migration-check-bug

Conversation

@corneliusweig

Copy link
Copy Markdown
Contributor

Fixes #374

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 11, 2019
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 11, 2019
Comment thread pkg/receiptsmigration/migration.go Outdated
for _, entry := range store {
if entry.IsDir() {
for _, entry := range plugins {
if strings.HasPrefix(entry.Name(), "kubectl-") && 0 != entry.Mode()&os.ModeSymlink {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@ahmetb

ahmetb commented Nov 11, 2019

Copy link
Copy Markdown
Member

mostly lgtm
/hold
for comments

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 11, 2019
@ahmetb

ahmetb commented Nov 11, 2019

Copy link
Copy Markdown
Member

/lgtm
/approve

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

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 11, 2019
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 11, 2019
@corneliusweig

Copy link
Copy Markdown
Contributor Author

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.

Comment thread pkg/receiptsmigration/migration_test.go Outdated
{
name: "One plugin and receipts",
filesPresent: []string{"store/konfig/konfig.sh", "receipts/present"},
filesPresent: []string{"bin/konfig/konfig.sh", "receipts/present"},

@ahmetb ahmetb Nov 11, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, makes much more sense!

@ahmetb

ahmetb commented Nov 12, 2019

Copy link
Copy Markdown
Member

/lgtm
/approve
thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 12, 2019
@ahmetb

ahmetb commented Nov 12, 2019

Copy link
Copy Markdown
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 12, 2019
@ahmetb

ahmetb commented Nov 12, 2019

Copy link
Copy Markdown
Member

/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 "Looks good to me", indicates that a PR is ready to be merged. label Nov 12, 2019
if err := os.MkdirAll(binPath, 0755); err != nil {
t.Fatal(err)
}
tempDir.Write("receipts/krew.notyaml", []byte("must be present for receipts migration check"))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

@codecov-io

codecov-io commented Nov 12, 2019 •

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor Author

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

@ahmetb

ahmetb commented Nov 15, 2019

Copy link
Copy Markdown
Member

I think so.

@ahmetb

ahmetb commented Nov 15, 2019

Copy link
Copy Markdown
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 15, 2019
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[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

Details 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
@ahmetb

ahmetb commented Nov 15, 2019

Copy link
Copy Markdown
Member

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

receiptsmigration detection on windows is faulty if krew itself fails to install

4 participants