cli icon indicating copy to clipboard operation
cli copied to clipboard

tektoncd-cli is attempting to write to $HOME during tests

Open 06kellyjac opened this issue 3 years ago • 11 comments

    list_test.go:134: failed to read layer sha256:901234178dd17a534133fe551efa1ade1869bfd2a0491fcc8d7a86daa5ae8cfd: Failed to read image layer: mkdir /homeless-shelter: permission denied
    list_test.go:137:
        Unexpected output:
          string(
        -       "Error: failed to read layer sha256:901234178dd17a534133fe551efa1ade1869bfd2a0491fcc8d7a86daa5ae8cfd: Failed to read image layer: mkdir /homeless-shelter: permission denied\n",
        +       "task.tekton.dev/foobar\n",
          )


        Expected
        task.tekton.dev/foobar


        Actual
        Error: failed to read layer sha256:901234178dd17a534133fe551efa1ade1869bfd2a0491fcc8d7a86daa5ae8cfd: Failed to read image layer: mkdir /homeless-shelter: permission denied

$HOME is /homeless-shelter and it's readonly

related: https://github.com/NixOS/nixpkgs/pull/120890#discussion_r622015585

06kellyjac avatar Apr 28 '21 10:04 06kellyjac

/kind bug

vdemeester avatar Apr 28 '21 10:04 vdemeester

/area testing

vdemeester avatar Apr 28 '21 10:04 vdemeester

When I changed the $HOME to a tmpdir I found it created .tekton/bundles:

$ ls -al $HOME/.tekton/bundles
drwx------ 2 nixbld nixbld  80 Apr 28 10:39 .
drwx------ 3 nixbld nixbld  60 Apr 28 10:39 ..
-rw-r--r-- 1 nixbld nixbld 656 Apr 28 10:39 sha256:3ced8f29b39be8be2dbf00be4d1c797b3474834869d9e2356d8181ebc31df08f
-rw-r--r-- 1 nixbld nixbld 660 Apr 28 10:39 sha256:62fa51776f3782973ea01c445d228255fdb7f9d5a32d825e8c3bfb8303f5e86a

06kellyjac avatar Apr 28 '21 10:04 06kellyjac

https://github.com/tektoncd/cli/blob/2bcf91faf15e6f235b8e0a15a9044c09e0eebf88/pkg/cmd/bundle/list.go#L69-L72 https://github.com/tektoncd/cli/blob/c996b3004650658c73ae8b1c0ce98f5165107af5/pkg/bundle/flags.go#L64

I strongly recommend this be changed soon to avoid a painful migration later from ~/.tekton to use the XDG spec

the cache should use ${XDG_CACHE_HOME:-$HOME/.cache}/tekton/bundles, if you really want you can fall back to an existing ~/.tekton but since the tool I'd advise a clean break.

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html https://wiki.archlinux.org/index.php/XDG_user_directories

There are many people (myself included) who are in a war with our home directories in an effort to put everything in the correct XDG directories to keep things clean

For Mac there are many tools that follow the XDG spec, there are some slightly different rules you can follow (utilizing ~/Library - https://stackoverflow.com/questions/3373948/equivalents-of-xdg-config-home-and-xdg-data-home-on-mac-os-x/5084892#5084892) but quite a lot of Mac users prefer the XDG spec so all their config is in ~/.config etc

06kellyjac avatar Apr 28 '21 11:04 06kellyjac

/cc @tektoncd/cli-maintainers

vdemeester avatar Apr 28 '21 11:04 vdemeester

agreed, we should use xdg cache

chmouel avatar Apr 28 '21 15:04 chmouel

I might give this a crack. Looks like the os library already has functions to help with this:

https://golang.org/pkg/os/#UserCacheDir https://github.com/aquasecurity/trivy/blob/main/pkg/utils/utils.go#L17-L24

06kellyjac avatar May 03 '21 11: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 Jan 03 '22 12:01 tekton-robot

/remove-lifecycle stale

being handled by #1365

06kellyjac avatar Jan 06 '22 12:01 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 Aug 01 '22 12:08 tekton-robot

/remove-lifecycle stale

vdemeester avatar Aug 03 '22 09:08 vdemeester

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 Nov 01 '22 09:11 tekton-robot

/remove-lifecycle stale

chmouel avatar Nov 01 '22 18:11 chmouel

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 30 '23 19:01 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 Mar 01 '23 19:03 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 Mar 31 '23 19:03 tekton-robot

@tekton-robot: Closing this issue.

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 Mar 31 '23 19:03 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 May 03 '23 05:05 tekton-robot

@tekton-robot: Closing this issue.

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 May 03 '23 05:05 tekton-robot