I have a script in python and to automate the launch, I made a jenkins pipeline where I run the script in a dock container.
However, when it comes to the part of the code:
Then an error is returned that there is no such file or directory
I have a script in python and to automate the launch, I made a jenkins pipeline where I run the script in a dock container.
However, when it comes to this part of the code:
ssl_context=ssl.create_default_context(ssl.Purpose.SERVER_AUTH) ssl_context.load_cert_chain(certfile=cert_path,keyfile=key_path,password=None) ssl_context.load_verify_locations(cafile=chain_path)
Then an error is returned that there is no such file or directory
I pass the variables as follows:
chain_path = sys.argv[1]
cert_path = sys.argv[2]
key_path = sys.argv[3]
Because you can no longer store certificates in the project itself in the IDE
In jenkins, I decided to put the chain cert key certificates in the Credentials section with the secret file type
And accordingly, I pass them as parameters:
CHAIN_FILE = chain_file
KEY_FILE = key_afile
CERT_FILE = cert_file
part of the pipeline script:
sh "docker build -t python-311-with-libs ."
withCredentials([file(credentialsId: "chain_file", variable: "CHAIN_FILE"),
file(credentialsId: "key_file", variable: "KEY_FILE"),
file(credentialsId: "cert_file", variable: "CERT_FILE")]){
sh "docker run --rm -v ${WORKSPACE}:/tmp python-311-with-libs python3 '/tmp/${SCRIPT_NAME}' '/tmp/${SOURCE_CATALOG}' '${CHAIN_FILE}' '${CERT_FILE}' '${KEY_FILE}' '${MONITORING_URL}'"
}