I am creating CICD variables from program and same variables i am passing as parameter to another program in CICD pipeline… Both jobs are calling in single job… because CICD variables creation will be one time job…At the time of first time execution of CICD pipeline, it failed because for second programs CICD variables are not getting any value as parameters. Please suggest any solution for this issue.
Please paste for sanitized
.gitlab-ci.yml file so we can see how it is setup.
Please see the below gitlab yaml example where i need your suggestion/help to solve this issue…
- Call to python code1 to create CICD variables
- Call to python code2 which is referring CICD variable which are setup from code1
But, I am facing issue, code 2 is not getting variables which were set from code1. I tried to solve this issue by incorporating sleep 30 seconds in between code1 and code 2 but its not working as ex. Please help me out to solve this problem.
You cannot set Shell environment variables from Python. Any environment variable that you set in
python code1 is available only within this process and any child/sub process.
If you need to pass stuff from
code2 I suggest to export it as JSON/YAML file in
code1 and load it in
Please provide me some example for the above mentioned solution by export it as JSON/YAML file. Please do the needful.
Here are the docs how to work with Yaml in Python https://pyyaml.org/wiki/PyYAMLDocumentation