1 year ago

#69318

test-img

Sangathamilan Ravichandran

Cant access gitlab ci variables from inside python script building with maven

0

I have a python project which I build using maven. In my .gitlab-ci.yaml file I set some global variables.

variables:
  MAVEN_BASE_CLI_OPTS: ""
  MAVEN_CLI_OPTS: ${MAVEN_BASE_CLI_OPTS}
  LC_ALL: "C.UTF-8"
  LANG: "C.UTF-8"
  DOCKER_HOST: "tcp://docker:2155/"

I would like to access these variables inside my python script for testing. But during build i get the following error.

@pytest.mark.integration
[INFO]     def test_integration():
[INFO] >       val =  os.getenv("DOCKER_HOST")
               if val:
[INFO] E       TypeError: argument of type 'NoneType' is not iterable

How do i pass in the gitlab ci variables to the python script via maven build? I have seen jenkins variables added to maven-surefire-plugin. But I am unsure how to do it for gitlab ci.

python

maven

github

gitlab-ci

gitlab-ci-runner

0 Answers

Your Answer

Accepted video resources