24

GitLab :

.gitlab-ci.yml syntax error

docker exec -i XXX pip3 install -r ./requirements_os_specific.txt --target=./packages --platform=manylinux1_x86_64 --only-binary=:all:

this command giving a syntax error .

"Error: before_script config should be an array of strings"

This work fine if I remove "--only-binary=:all:"

variables :    IMAGE_NAME: xxx   

before_script:
  - whoami
  - echo $GitLabPassword
  - docker login -u Prasenjit.Chowdhury -p $GitLabPassword xxxxxxx
  - docker -v
  - docker exec -i abc python -V
  - docker exec -i abc aws --version
  - docker exec -i abc pip3 install -r ./requirements_os_specific.txt --target=./packages --platform=manylinux1_x86_64 --only-binary=:all:

:

This script works fine if I remove the last line

4
  • can you please add your gitlab-ci.yml file in question?. Error clearly says error while specifying the command you mentioned in before_script section. Commented Feb 25, 2019 at 11:41
  • If I remove the last line from the before_script section then its work fine. Specifically if I remove --only-binary=:all: then its work fine. Commented Feb 25, 2019 at 11:47
  • doest that command work fines without GitLab-ci.yml?. I mean in local where you are running your container or throws an error. I am trying to understand if issue with the command you mentioned. Commented Feb 25, 2019 at 11:52
  • Yes it works fine If I directly run it from terminal. Commented Feb 25, 2019 at 13:26

1 Answer 1

56

You have to escape a colon : in yaml. This can be done by surrounding the whole entry with quotes ".

Replace:

- docker exec -i abc pip3 install -r ./requirements_os_specific.txt --target=./packages --platform=manylinux1_x86_64 --only-binary=:all:

with:

- "docker exec -i abc pip3 install -r ./requirements_os_specific.txt --target=./packages --platform=manylinux1_x86_64 --only-binary=:all:"
Sign up to request clarification or add additional context in comments.

2 Comments

awesome, I thought when writing commands/argument that needs the ":" is an issue. You saved my life @sascha-frinken
One has to admit, that the error message is not particularly helpful in this case...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.