cli icon indicating copy to clipboard operation
cli copied to clipboard

Add utility functions for config and home dirs

Open 06kellyjac opened this issue 4 years ago • 27 comments

Changes

Add utils functions for getting Config and Cache dirs

Might want to also standardize the dirs on tkn rather than config using tkn and cache using tekton

Resolves #1363

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

  • [ ] Includes tests (if functionality changed/added)
  • [X] Run the code checkers with make check
  • [X] Regenerate the manpages, docs and go formatting with make generated
  • [X] Commit messages follow commit message best practices

See the contribution guide for more details.

Release Notes

Move bundle cache to XDG_CACHE_DIR

06kellyjac avatar May 03 '21 12:05 06kellyjac

Hi @06kellyjac. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tekton-robot avatar May 03 '21 12:05 tekton-robot

/assign @sthaha

06kellyjac avatar May 03 '21 12:05 06kellyjac

/ok-to-test /assign /unassign @sthaha

vdemeester avatar May 03 '21 12:05 vdemeester

Just to repeat the question from the initial post

Should I change the cache dir to tkn like the config dir to standardize things? or leave it as tekton?

https://github.com/tektoncd/cli/blob/6e25e77040467c92638ada00d21950f081269779/pkg/utils/utils.go#L27

https://github.com/tektoncd/cli/blob/6e25e77040467c92638ada00d21950f081269779/pkg/utils/utils.go#L35


Also I just noticed the docs have my user name in them because the os.GetXDir functions are already expanded :sweat_smile:

https://github.com/tektoncd/cli/blame/6e25e77040467c92638ada00d21950f081269779/docs/cmd/tkn_bundle_list.md#L40

06kellyjac avatar May 03 '21 13:05 06kellyjac

@vdemeester: GitHub didn't allow me to request PR reviews from the following users: pierretasci.

Note that only tektoncd members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

I like tkn better than tekton, but I'ld like for other to chim in 🙃 /cc @tektoncd/cli-maintainers @pierretasci

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tekton-robot avatar May 03 '21 13:05 tekton-robot

I've added some tests. I tried to avoid changing env with os.Setenv because that could affect other tests

It looks like go 1.17 will have a t.Setenv function but that would come with the tradeoff of requiring parallel testing be disabled https://github.com/golang/go/commit/2e794c2bb1302af764670dba894bbfe537bd63f0

06kellyjac avatar May 03 '21 17:05 06kellyjac

The following is the coverage report on the affected files. Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cli/dirs.go Do not exist 33.3%

tekton-robot avatar May 03 '21 17:05 tekton-robot

The following is the coverage report on the affected files. Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cli/dirs.go Do not exist 33.3%

tekton-robot avatar May 03 '21 17:05 tekton-robot

/test pull-tekton-cli-unit-tests

chmouel avatar May 07 '21 15:05 chmouel

/lgtm

chmouel avatar May 11 '21 07:05 chmouel

I need to modify the contract test so it doesnt fail on windows but other than that I guess things are good.

Is there a way to ask tekton users about their preference for ~/.config vs ~/Library/Whatever on darwin?

I guess we could have it like this until people complain but then there will me the matter of migrating people across if people want it to move to ~/.config...

06kellyjac avatar May 11 '21 08:05 06kellyjac

New changes are detected. LGTM label has been removed.

tekton-robot avatar May 11 '21 21:05 tekton-robot

The following is the coverage report on the affected files. Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cli/dirs.go Do not exist 33.3%

tekton-robot avatar May 11 '21 21:05 tekton-robot

Tests now pass on windows. Although I noticed when doing a full make test quite a few tests fail on windows :sweat_smile:

If we're happy trying out ~/Library/whatever on mac to see what people say then the only thing remaining that I'm concerned about is the docs generating differently between Linux, Mac, and Windows due to the tkn bundle list --help output having the line --cache-dir string A directory to cache Tekton bundles in. (default "~/.tekton/bundles") where default will be different It's just going to end up with people having to manually change that back each time if they're developing on mac or we scrub that out from the docs??

06kellyjac avatar May 11 '21 21:05 06kellyjac

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Oct 15 '21 02:10 tekton-robot

Before merging this. I was thinking there's a way to solve the default value (which is different across platforms) going into the docs I'd like to try

06kellyjac avatar Oct 15 '21 08:10 06kellyjac

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Jan 13 '22 09:01 tekton-robot

/remove-lifecycle stale

I plan on getting back on this soon

06kellyjac avatar Jan 13 '22 10:01 06kellyjac

@06kellyjac: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tekton-robot avatar Mar 31 '22 12:03 tekton-robot

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Jun 29 '22 13:06 tekton-robot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten with a justification. Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

tekton-robot avatar Jul 29 '22 13:07 tekton-robot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen with a justification. Mark the issue as fresh with /remove-lifecycle rotten with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

tekton-robot avatar Aug 28 '22 13:08 tekton-robot

@tekton-robot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen with a justification. Mark the issue as fresh with /remove-lifecycle rotten with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tekton-robot avatar Aug 28 '22 13:08 tekton-robot

/remove-lifecycle rotten

piyush-garg avatar Sep 28 '22 13:09 piyush-garg

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

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:

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

tekton-robot avatar Sep 28 '22 13:09 tekton-robot

@06kellyjac please rebase the PR

piyush-garg avatar Sep 28 '22 13:09 piyush-garg

@06kellyjac: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-tekton-cli-unit-tests d987c52cc56cce0ab3cacfe6cd7315528a7f524e link true /test pull-tekton-cli-unit-tests
pull-tekton-cli-integration-tests d987c52cc56cce0ab3cacfe6cd7315528a7f524e link true /test pull-tekton-cli-integration-tests
pull-tekton-cli-build-tests d987c52cc56cce0ab3cacfe6cd7315528a7f524e link true /test pull-tekton-cli-build-tests
pull-tekton-cli-build-cross-tests d987c52cc56cce0ab3cacfe6cd7315528a7f524e link true /test pull-tekton-cli-build-cross-tests

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

tekton-robot avatar Sep 28 '22 13:09 tekton-robot

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Dec 27 '22 14:12 tekton-robot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten with a justification. Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

tekton-robot avatar Jan 26 '23 14:01 tekton-robot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen with a justification. Mark the issue as fresh with /remove-lifecycle rotten with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

tekton-robot avatar Feb 25 '23 14:02 tekton-robot

@tekton-robot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen with a justification. Mark the issue as fresh with /remove-lifecycle rotten with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tekton-robot avatar Feb 25 '23 14:02 tekton-robot