1

I have gitlab deployment activem and I want to get the deploy script to have some custom information about the deployment process (like $CI_PIPELINE_ID).

However, the script doesn't get the variables, instead it gets the "raw text".

the call performed by the script is: $ python deploy/deploy.py $CI_COMMIT_TAG $CI_ENVIRONMENT_URL $CI_PIPELINE_ID

How can i get it to use the variables?

My .gitlab-ci.yml:

image: python:2.7

before_script:
  - whoami
  - sudo apt-get --quiet update --yes
  - sudo chmod +x deploy/deploy.py
deploy_production:
  stage: deploy
  environment: Production
  only:
      - tags
      - trigger
  except:
      # - develop
      - /^feature\/.*$/
      - /^hotfix\/.*$/
      - /^release\/.*$/

  script:
    - python deploy/deploy.py $CI_COMMIT_TAG $CI_ENVIRONMENT_URL $CI_PIPELINE_ID

2 Answers 2

3

It looks like potentially that you could be using a different environmental variable that you should be using.

  • bash/sh $variable
  • windows batch %variable%
  • PowerShell $env:variable

See using CI variables in your job script.

Sign up to request clarification or add additional context in comments.

Comments

0

I don't get what you mean with "raw text", but you can declare the variables in your project settings. Also, have you configured you're runner?

Go to Settings->CI/CD->Secret Variables and just put them right there.

You can also find valuable information in the documentation.

Comments

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.