microsoft / fabrikate

Making GitOps with Kubernetes easier one component at a time
MIT License
38 stars 5 forks source link

"permission denied" regression on helm_repo path during `fab install` with 0.15.1 #228

Closed timfpark closed 5 years ago

timfpark commented 5 years ago

Describe the bug:

With 0.15.1, I am seeing an error when I do a fab install on a deployment that looks like:

INFO[16-07-2019 06:58:04] 👈  Finished install for component: istio-service
INFO[16-07-2019 06:58:04] 👉  Starting install for component: istio-service
INFO[16-07-2019 06:58:04] 👈  Finished install for component: istio-service
INFO[16-07-2019 06:58:05] 🚚  Copying /var/folders/7j/4yvbvdvd7qbcrwddj828lxnh0000gn/T/531b0169-d390-41fe-b42d-d89b50db3a15 => /Users/timothypark/dev/deployment-definition/helm_repos/postgres-operator
Error: open helm_repos/postgres-operator/.git/objects/pack/pack-f573c9b55a327f19aa501a9437f0ee63a9f21975.idx: permission denied

This does not occur with 0.15.0

To Reproduce:

Not sure if this is broadly reproducible or a race condition that I am running into.

Expected behavior:

Able to install without failure.

Screenshots:

Additional context:

Desktop (please complete the following information):

Additional context

evanlouie commented 5 years ago

Does this always occur with your component definition? or does it only happen intermittently?

evanlouie commented 5 years ago

@timfpark can you provide the component.yaml that caused this?

maarek commented 5 years ago

I see this as well with 0.15.3.

$ ls -la slips/policy/block/helm_repos/block/.git/objects/pack 
total 504
drwxr-xr-x  4 user  staff     128 Sep  2 12:43 .
drwxr-xr-x  4 user  staff     128 Sep  2 12:43 ..
-r--r--r--  1 user  staff    7792 Sep  2 12:43 pack-b28a3f8b93fc672cc5c6be73371f70e0ab6c2c18.idx
-r--r--r--  1 user  staff  247830 Sep  2 12:43 pack-b28a3f8b93fc672cc5c6be73371f70e0ab6c2c18.pack

component.yaml

name: block
type: helm
source: https://dev.azure.com/org/proj/_git/charts
method: git
path: stable/block
subcomponents: []

access.yaml

https://dev.azure.com/org/proj/_git/charts: ACCESS_TOKEN_SECRET
evanlouie commented 5 years ago

@maarak we've been having a hard time finding a stable reproduction scenario. Does your component reproduce the error 100% of the time?

smartpcr commented 5 years ago

after downgraded to v0.15.0, I am still having this problem (only on WSL/windows, mac/linux seems to be ok).

INFO[03-09-2019 16:30:57] 🚁  Performing checkout commit 'f4743a18769c5405413e1d6cd897bd9c877ce1b1' for repo 'https://github.com/helm/charts' on branch ''
INFO[03-09-2019 16:31:04] 🚚  Copying /tmp/c73d0e2b-5814-4f05-b727-c5aa6a3591b9 => /mnt/c/work/sace/HLD/infra/helm_repos/prometheus-operator
Error: open helm_repos/prometheus-operator/.git/objects/pack/pack-42c93c135170eba90b25da74192b007fcd2e6397.idx: permission denied

component file

name: "fabrikate-prometheus-operator"
type: static
path: "./manifests"
hooks:
  before-install:
    - echo 'installing prometheus-operator'
  after-install:
    - echo 'installed prometheus-operator'
subcomponents:
  - name: "prometheus-operator"
    type: helm
    source: "https://github.com/helm/charts"
    method: "git"
    path: "stable/prometheus-operator"
    version: "f4743a18769c5405413e1d6cd897bd9c877ce1b1"
evanlouie commented 5 years ago

@smartpcr does this reproduce 100% of the time on wsl? Never on mac/linux?

maarek commented 5 years ago

@evanlouie I am on OSX only and this occurs 100% of the time.

Update 1: Using the tmp folder pulled by fabrikate as the base and the same copy library, I can replicate the issue on my machine using a simple go app and copying the folder to the same location twice.

I didn't use Fabrikate on 0.15.0, I just know that it's not working on my machine right now. I will continue to investigate and see if anything stands out on a fix.

Update 2: I don't have the ability to copy a git repo with cli 'copy -R repo' to the same location twice due to the pack files being read only.

timfpark commented 5 years ago

I ran into this again today and think I isolated a repro case:

https://github.com/timfpark/fabrikate-bug

To reproduce:

  1. Clone the repo above
  2. Run fab install in the root. This will succeed.
  3. Run fab install again in the root. This will fail with the following:
$ fab install
INFO[05-09-2019 17:11:21] fab version 0.16.0
INFO[05-09-2019 17:11:21] 🔍  Using git: /usr/local/bin/git
INFO[05-09-2019 17:11:21] 🔍  Using helm: /usr/local/bin/helm
INFO[05-09-2019 17:11:21] 🔍  Using sh: /bin/sh
INFO[05-09-2019 17:11:21] 🔍  Using curl: /usr/bin/curl
INFO[05-09-2019 17:11:21] 👉  Initializing Helm
INFO[05-09-2019 17:11:21] 💾  Loading component.yaml
INFO[05-09-2019 17:11:21] 👉  Starting install for component: test
INFO[05-09-2019 17:11:21] 👈  Finished install for component: test
INFO[05-09-2019 17:11:21] 💾  Loading functions/component.yaml
INFO[05-09-2019 17:11:21] 👉  Starting install for component: functions
INFO[05-09-2019 17:11:21] 👈  Finished install for component: functions
INFO[05-09-2019 17:11:21] 👉  Starting install for component: stage-2
INFO[05-09-2019 17:11:21] 👉  Starting install for component: stage-1
INFO[05-09-2019 17:11:21] 🚁  Component 'stage-2' requesting helm chart in path 'https://github.com/timfpark/fabrikate-azure-function' from git repository 'functions'
INFO[05-09-2019 17:11:21] 🚁  Component requested latest commit: fast cloning at --depth 1
INFO[05-09-2019 17:11:21] 🚁  Component 'stage-1' requesting helm chart in path 'https://github.com/timfpark/fabrikate-azure-function' from git repository 'functions'
INFO[05-09-2019 17:11:21] 🏧  Previously cloned 'https://github.com/timfpark/fabrikate-azure-function@master:head' this install; reusing cached result
INFO[05-09-2019 17:11:21] 🚁  Cloning https://github.com/timfpark/fabrikate-azure-function@master:head => /var/folders/7j/4yvbvdvd7qbcrwddj828lxnh0000gn/T/6954ea71-8651-4262-80fa-2d47dda36e71
INFO[05-09-2019 17:11:21] 🚚  Copying /var/folders/7j/4yvbvdvd7qbcrwddj828lxnh0000gn/T/6954ea71-8651-4262-80fa-2d47dda36e71 => /Users/timothypark/dev/trailguru/dep-def-simple/functions/helm_repos/stage-2
INFO[05-09-2019 17:11:21] 🚚  Copying /var/folders/7j/4yvbvdvd7qbcrwddj828lxnh0000gn/T/6954ea71-8651-4262-80fa-2d47dda36e71 => /Users/timothypark/dev/trailguru/dep-def-simple/functions/helm_repos/stage-1
Error: open functions/helm_repos/stage-2/.git/objects/15/d3f268d8143a019e79ee007c695964282773e8: permission denied