Skip to content

Docker-based workflow with dynamic user fails #244

Description

@seyfahni

Summary

When running this action inside a Docker container that uses a dynamic user id the action fails.

Motivation

As a workaround for actions complaining about git repositories having dubious ownership one can set the GitHub Actions runner user id as the container's user. But some images might not have a user with the user id 1001.

See also: actions/runner#2033 (comment)

Details

Reproduction: https://github.com/seyfahni/ssh-agent-action-bug/blob/dde1c9506e9f358acff8ac084a049bde4dedbc7b/.github/workflows/dynamic-user.yml

container:
  image: debian # some image that does not have a user with id 1001
  options: --user 1001 # workaround for git "dubious ownership" issue
steps:
  - uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
    with:
      ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
Action Log
Run webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555
  with:
    ssh-private-key: ***
    log-public-key: true
/usr/bin/docker exec  bd46549c83edd10d4bce8bf5a656b31ab45d9e9f1feceacf7df427a2423dd691 sh -c "cat /etc/*release | grep ^ID"
node:os:306
    throw new ERR_SYSTEM_ERROR(ctx);
    ^

SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
    at Object.userInfo (node:os:306:11)
    at 972 (/__w/_actions/webfactory/ssh-agent/e83874834305fe9a4a2997156cb26c5de65a8555/dist/index.js:2903:18)
    at __webpack_require__ (/__w/_actions/webfactory/ssh-agent/e83874834305fe9a4a2997156cb26c5de65a8555/dist/index.js:22:30)
    at 104 (/__w/_actions/webfactory/ssh-agent/e83874834305fe9a4a2997156cb26c5de65a8555/dist/index.js:325:54)
    at __webpack_require__ (/__w/_actions/webfactory/ssh-agent/e83874834305fe9a4a2997156cb26c5de65a8555/dist/index.js:22:30)
    at startup (/__w/_actions/webfactory/ssh-agent/e83874834305fe9a4a2997156cb26c5de65a8555/dist/index.js:37:19)
    at /__w/_actions/webfactory/ssh-agent/e83874834305fe9a4a2997156cb26c5de65a8555/dist/index.js:41:18
    at Object.<anonymous> (/__w/_actions/webfactory/ssh-agent/e83874834305fe9a4a2997156cb26c5de65a8555/dist/index.js:44:10)
    at Module._compile (node:internal/modules/cjs/loader:1812:14)
    at Object..js (node:internal/modules/cjs/loader:1943:10) {
  code: 'ERR_SYSTEM_ERROR',
  info: {
    errno: -2,
    code: 'ENOENT',
    message: 'no such file or directory',
    syscall: 'uv_os_get_passwd'
  },
  errno: [Getter/Setter],
  syscall: [Getter/Setter]
}

Node.js v24.14.0

Workaround

Extend the Docker image by adding this line to the Dockerfile:

RUN useradd -m -c 'GitHub Actions User' -u 1001 runner

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions