0

I'm triggering job via API, passing custom variables.

Here is example request: curl -X POST -F token=${TRIGGER_TOKEN} -F ref=${branch} -F "variables[SHOULD_COPY_ASSETS]=false"

This how job in the .yml file looks:

copy-assets:
    stage: copy
    script:
      - echo -e "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ./.npmrc
      - npm ci
      - npm run copy-develop-ci
    artifacts:
        paths:
          - assets-shared-tmp
        expire_in: 1 week
    rules:
      - if: $SHOULD_COPY_ASSETS

As you can see $SHOULD_COPY_ASSETS was set to false, but this job is running anyway. What do I do wrong?

2

if: $SHOULD_COPY_ASSETS checks for the existence of the variable, not its value. You want something like if: $SHOULD_COPY_ASSETS != "false"

1
  • Thank you very much! This clears this up.
    – monz777
    Sep 9 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.