Home > other >  Jenkins local clone repo path
Jenkins local clone repo path

Time:06-07

I use jenkins to automate some jobs on a local cloned repo. The cloning of the repo is going well but when i call my script( its a py script) I need the full local cloned repo path.

for example I will call: python3.exe myscript.py -d ${params.REPO_DIR}
If I will look into the console it will get only a part of the path like /repo/dir/repo name ..not the full path like C:\user\repo etc.. Which is normal assuming I don't know how to get the full path.. Could some one tell me please how I am able to do that

CodePudding user response:

Assuming your script is in the cloned repo. You can get the current working directory path with ${env.WORKSPACE} or $WORKSPACE depending on where you are executing. Then you can append the relative path of the pythion script to the current working directory location. ${env.WORKSPACE}/${params.REPO_DIR}

  • Related