Sample Header Ad - 728x90

How can I echo/print the environment files of a directory/path in a Jenkinsfile during a build?

0 votes
0 answers
912 views
In a Jenkins file, I have the following code: #!/usr/bin/env groovy .... def env_prod = 'prod.env' def entrypoint = "${env.WORKSPACE} The above is then combined like this: ${env.WORKSPACE}/$env_prod And it is fed into a python script (through argparse); the Python script looks like: def get_package_reference_versions(packages, env_path, env_format): with open(env_path) as f: deps = f.read() .... In my Jenkins logs, I see: [2024-01-25T13:39:41.780Z] File "/opt/bmll/miniconda/lib/python3.11/site-packages/something/deployment.py", line 421, in get_package_reference_versions [2024-01-25T13:39:41.780Z] with open(env_path) as f: [2024-01-25T13:39:41.780Z] ^^^^^^^^^^^^^^ [2024-01-25T13:39:41.780Z] FileNotFoundError: [Errno 2] No such file or directory: '/home/ec2-user/jenkins/workspace/pipeline-deployments/js-deployment-cr/prod.env' Now I am trying to figure out what is inside the js-deployment-cr directory. Is there a way to print the environment files inside the js-deployment-cr directory? N.B. I CANNOT MAKE CHANGES IN THE PYTHON SCRIPT, because it sits in a different repository to the bash script. So I need to figure this out in the Jenkins file.
Asked by Patrick_Chong (111 rep)
Jan 26, 2024, 03:04 PM
Last activity: Jan 26, 2024, 03:53 PM