registry-image-resource icon indicating copy to clipboard operation
registry-image-resource copied to clipboard

HOME directory is not writable for source image user

Open Berber31 opened this issue 3 years ago • 0 comments

Executing a task with registry-image v1.4.0, the HOME directory is not writable for the user defined in the source image.

example:

jobs:
  - name: boxboat-kubectl
    plan:
      - in_parallel:

        - task: kubectl-registry-image-user-default-dans-home
          config:
            platform: linux
            image_resource:  
              type: registry-image
              source:
                repository: ((docker_poleemploi.registre))/boxboat/kubectl
                tag: 1.20.5
            run:
              path: /bin/sh
              args:
                - -euc
                - |       
                  id
                  ls -lart $HOME
                  echo "test" > $HOME/.kubeconfig

fails producing:

uid=1000(alpine) gid=1000(alpine)
total 8
drwxr-xr-x    3 root     root          4096 Sep 23 13:20 ..
drwxr-xr-x    2 root     root          4096 Sep 23 13:20 .

/bin/sh: can't create /home/alpine/.kubeconfig: Permission denied

However with docker-image resource it does not fail:

        - task: kubectl-docker-image    
          config:
            platform: linux
            image_resource:  
              type: docker-image
              source:
                repository: ((docker_poleemploi.registre))/boxboat/kubectl
                tag: 1.20.5
            run:
              path: /bin/sh
              args:
                - -euc
                - |             
                  id
                  ls -lart $HOME
                  echo "coucou" > $HOME/.kubeconfig    

success with:

uid=1000(alpine) gid=1000(alpine)
total 8
drwxr-xr-x    3 root     root          4096 Sep 23 08:55 ..
drwxr-sr-x    2 alpine   alpine        4096 Sep 23 08:55 .

Berber31 avatar Sep 23 '21 13:09 Berber31