Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix umask=false for images without a shell entrypoint #1298

Merged
merged 2 commits into from
Jul 22, 2024

Conversation

PigeonF
Copy link
Collaborator

@PigeonF PigeonF commented Jul 17, 2024

While checking #1297 I got an error with (essentially) the following CI file

---
build:
  image:
    name: gcr.io/kaniko-project/executor:v1.23.0-debug
    entrypoint: [""]
  script:
    - ls

failed for me with

$ gitlab-ci-local --umask=false
Using fallback git commit data
Unable to retrieve default remote branch, falling back to `main`.
Using fallback git remote data
parsing and downloads finished in 49 ms.
json schema validated in 206 ms
build starting gcr.io/kaniko-project/executor:v1.23.0-debug (test)
Error: Command failed with exit code 1: docker run --rm gcr.io/kaniko-project/executor:v1.23.0-debug sh -c echo "$(id -u):$(id -g)"
Error: unknown command "sh" for "executor"
Run 'executor --help' for usage.
    at makeError (/nix/store/c89rzb02w6k156nzfxdi3rkmlngg4ma4-gitlab-ci-local-4.52.1/lib/node_modules/gitlab-ci-local/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/nix/store/c89rzb02w6k156nzfxdi3rkmlngg4ma4-gitlab-ci-local-4.52.1/lib/node_modules/gitlab-ci-local/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Job.start (/nix/store/c89rzb02w6k156nzfxdi3rkmlngg4ma4-gitlab-ci-local-4.52.1/lib/node_modules/gitlab-ci-local/src/job.ts:494:34)
    at /nix/store/c89rzb02w6k156nzfxdi3rkmlngg4ma4-gitlab-ci-local-4.52.1/lib/node_modules/gitlab-ci-local/node_modules/p-map/index.js:57:22

The fix is to explicitly set the entrypoint to sh when spawning the image to check the UID and GID of the container, so that the UID and GID of containers that have their entrypoint set to something other than a shell can still be retrieved.

@PigeonF PigeonF changed the title Fix umask without sh entrypoint Fix umask=false for images without a shell entrypoint Jul 17, 2024
Copy link

@firecow firecow merged commit 9277472 into master Jul 22, 2024
10 checks passed
@firecow firecow deleted the fix-umask-without-sh-entrypoint branch July 22, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants