I'm trying to execute a docker run command by passing a local environment variable to sonar-scanner. This all gets executed in the Jenkins pipeline. However the result from os.getenv()
is always empty and dsonar.login=$SONAR_SCANNER
is not working.
run_image_command = \
f"docker run --rm -e SONAR_SCANNER {image_name} sonar-scanner \
-Dsonar.projectKey={domain}-{usecase} \
-Dsonar.sources={path} \
-Dsonar.host.url={url} \
-Dsonar.branch.name={branch} \
-Dsonar.login={os.getenv('SONAR_SCANNER')}"
run_cmd(run_image_command)