Open platipodium opened 1 year ago
Thanks for the report. I've updated the entryscript, so it will now reply with a more helpful message.
getopt: unrecognized option: c
Usage: /usr/local/bin/inara [OPTIONS] INPUT_FILE
Options:
-l: create log files for all formats
-m: article info file; YAML file contains article metadata
-o: comma-separated list of output format; defaults to jats,pdf
-p: flag to force the production of a publishing PDF
-v: increase verbosity; can be given multiple times
Curiously, I don't see how I would have set the option -c
. Here the .gitlab-ci.yml
section used to trigger the build (and fail)
joss-paper:
stage: deploy
image: 'openjournals/inara:latest'
script:
- inara -o pdf,cff doc/joss/paper.md
variables:
GIT_SHA: $CI_COMMIT_SHA
JOURNAL: joss
So why do I get the unrecognised option -c
error on the CI pipeline?
I have the same problem. This is because the Docker image is not able to handle what is happening in GitLab CI. Before the user-provided before_script
and script
are run, GitLab CI tries to clone your repo into the container. The first option it passes to git is -c
. You can reproduce this by running
docker run --rm openjournals/inara git -c
which gives the same result.
You can prevent this behaviour by setting the variable GIT_STRATEGY: none
in your .gitlab-ci.yml
. But then you will be missing the code for your paper as the repository is not cloned.
I would suggest reopening this issue and changing the title to reflect the actual problem: The container doesn't work with GitLab CI because you can not pass scripts to it; just arguments to the hard-coded program.
I think it would be quite valuable to have it working as GitLab is quite a common tool these days and is used in many research institutions, including the Helmholtz Association (for which both @platipodium and I, and thousands of other scientists work).
Thank you in advance!
Thank you for these details @zyzzyxdonta. One way to get around this might be to use the entrypoint
option for containers. See, for example, https://gitlab.com/pandoc/pandoc-ci-example. You may have to install git
first by running apk add git
in the container.
We should definitely document this properly if you can get it working. For the benefit of future users running into similar issues.
This is the first time I heard about the entrypoint option. 🙈 Thank you so much! Here is a working .gitlab-ci.yml
:
inara:
image:
name: "openjournals/inara"
entrypoint: ["/bin/sh", "-c"]
before_script:
- apk add git
script:
- /usr/local/bin/inara paper.md
artifacts:
paths:
- paper.*
Let me know if you want me to try anything else for the documentation.
Thanks for the hints above, I also got it to work with entrypoint
, does not seem to need git. Here's the production version from my .gitlab-ci.yml
FYR:
joss-inara:
stage: deploy
image:
name: openjournals/inara
entrypoint: ["/bin/sh", "-c"]
variables:
GIT_SHA: $CI_COMMIT_SHA
JOURNAL: joss
script:
- echo "Calling inara -o pdf,cff doc/joss/paper.md"
- inara -o pdf,cff doc/joss/paper.md
artifacts:
paths:
- ./doc/joss/paper.pdf
- ./doc/joss/CITATION.cff
needs: []
Thank you! Pinging @IlonaSilverwood who's the resident documentation wizard.
Inara Docker image in CI pipeline fails with
getopt: unrecognized option: c