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: Used absolute path to index.js in entrypoint #176

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

devatherock
Copy link
Contributor

When this image is used as a docker executor in CircleCI, the entrypoint gets disabled and the user has to explicitly invoke the entrypoint script. So the effective docker run command that gets executed would look something like below:

docker run --rm -v $PWD:/workspace \
              -e DOCKERHUB_PASSWORD \
              -e DOCKERHUB_USERNAME \
              -e DOCKERHUB_REPOSITORY='someuser/some-repo' \
              -e SHORT_DESCRIPTION='Some description' \
              -e README_FILEPATH='README.md' \
              -w /workspace \
              --entrypoint='' \
              peterevans/dockerhub-description:3.4.1 /entrypoint.sh

In such a case, the run fails with exit code 1 without displaying any error message. The contents of the action.log, when viewed manually, are below:

internal/modules/cjs/loader.js:818
  throw err;
  ^

Error: Cannot find module '/workspace/index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Using an absolute path in the node command as node /index.js instead of node index.js fixes the above error.

As for the container exiting before the error messages are displayed, it is due to the set -e line. To exit the container after displaying the errors, I have removed the set -e statement, captured the exit code of the node command which I have used as the exit code for the script after displaying the contents of action.log

@peter-evans
Copy link
Owner

@devatherock Thank you for contributing!

Sounds good to me. Doesn't look like this will break existing behaviour.

@peter-evans peter-evans enabled auto-merge (squash) June 20, 2023 07:30
@peter-evans peter-evans merged commit dc67fad into peter-evans:main Jun 20, 2023
4 checks passed
@peter-evans
Copy link
Owner

Released as v3.4.2 / v3

@devatherock devatherock deleted the use-abs-path branch June 20, 2023 10:43
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.

None yet

2 participants