Found errors in your .gitlab-ci.yml:
jobs:test-artifact:script config should be a string or a nested array of strings up to 10 levels deep
You can also test your .gitlab-ci.yml in CI Lint
Some one suggested to keep the : part in double quotes but it is already part of it.
test-artifact:
stage: build
allow_failure: false
needs: ["build-rpm"]
dependencies: # This is what gets the artifacts from the previous job
- build-rpm
extends:
- .ifadmindeploy
image: ubuntu:latest
script:
- yum update -y && yum install -y curl
- echo $CI_JOB_TOKEN
- mkdir test && cd test
- curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://myproject.gitlab.io/-/product/-/jobs/${CI_JOB_ID}/artifacts"
- curl --location --output artifacts1.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/myproject/product/-/jobs/${CI_JOB_ID}/artifacts"
- curl --location --output pipeline.rpm --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/myproject/product/-/jobs/${CI_JOB_ID}/artifacts/raw/dist/myproject-dev-default-nightlye2e.x86_64.rpm"
- curl --location --output pipeline.rpm --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://myproject.gitlab.io/-/product/-/jobs/${CI_JOB_ID}/artifacts/raw/dist/myproject-dev-default-nightlye2e.x86_64.rpm"
- ls -la
So, the lint is getting hung up on --header "JOB-TOKEN: $CI_JOB_TOKEN". If you take that out, then the lint can parse the config.
You might be able to mess around with quoting and escaping to make it work, but curl can read headers from a file, so it might be easier just to cat the headers to a file on disk and read them from there.
that won’t be possible as we want to use this command in the terraform aws ec2 user-data section.
can you suggest any other options.
the main idea is to copy this rpm tp the ec2 machine and use that in the user-data section of it.
file provision will happen only after user-data, so thought to use the link directly in the userdata with curl command.
Sorry for reviving this, but this exact error was such a headache for me to solve just now, especially as this is the only relevant result that comes up on the internet for this issue. So for anyone else hitting this problem, here’s an elegant solution for you:
Notice >- I added before “curl”. > is an indicator of YAML block folded style, meaning that line breaks between lines will be replaced with spaces, and text is processed literally (no interpretation of special symbols). - is a block chomping indicator stripping final line break.
${CI_JOB_ID} would most likely need to be exported beforehand so that you don’t use {}, but I’m not sure as have not used {} in my code