Passing jenkins "parameters" to python subprocess module

Jenkins setup:

Jenkins: 2.401.2
OS: Linux - 5.4.0-156-generic
Java: 11.0.19 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)

How can I pass a parameter named “FILENAME” that is defined under jenkins “This project is parameterized” inside of a python script? The script is like the one below:

$ cat
import os
import subprocess
result =[“ls”, “$FILENAME”])

Here the script should run “ls -l /etc/passwd”


Parameters are available as environment variables

1 Like