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
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
I want to scan file stored in my Jenkins project workspace.
for example, when I make a project named my_project, I will get report pattern from Jenkins like **/report.xml. and to find report.xml file, I will explore in my own plugin.
since when I print pwd on jenkins console, it prints where my plugin written, not jenkins workspace. so I need to know how to explore jenkins workspace in my plugin.
thanks!
If you're asking where your jenkins workspace is, it is in the workspace folder where you can find all your projects. It should be relative to your plugin folder: ../workspace. You can try to change directory using the relative path. Hope this helps.
When I run my tests in my local machine, report file is always created/overwritten in: C:\Temp\myLocalFolder\target\site\serenity\index.html
But when I run my tests using Jenkins(localhost:8080), report file is Not being generated in: C:\Users\me\.jenkins\workspace\myJenkinsFolder\target\site\serenity
In Jenkins, I've already added the Thucydides plugin, added it in Post-Build Actions, and set Report Path to target/site/serenity. I tried copying the index.html from my local folder to the jenkins folder, and after running I can view the same report. However I want it to be overwritten by the latest run on Jenkins. Any ideas?
Apprarently I just had to set Report Path in Jenkins to the same directory as my local folder (C:\Temp\myLocalFolder\target\site\serenity\index.html). I'm not sure if that's the correct approach. It won't work if I run from my online github repository. I will try that one next.
Right now i am using below mentioned cvs command line argument for checking out files from CVS repository.
# Module1_1_20_2017 is the tag name.
#Test/user_Test/work is the module name.
cvs checkout -r Module1_1_20_2017 Test/user_Test/workload
I want contents of this Test/user_Test/workload module to be checked out into a local workspace folder named as work which is located at C:\Jenkins\jobs\workspace\work.
But every time when i use the above command it creates empty directories after this C:\Jenkins\jobs\workspace\work local workspace as C:\Jenkins\jobs\workspace\work\Test\user_Test\workload.
I want to get rid of these entire folders Test\user_Test\workload and after checking out files from Test/user_Test/work this module the local workspace should look like C:\Jenkins\jobs\workspace\work (not C:\Jenkins\jobs\workspace\work\Test\user_Test\workload) and this local workspace C:\Jenkins\jobs\workspace\work should contain all the files of this Test/user_Test/workload module.
What cvs command line will satisfy this requirement?In short I want to create a local name as in jenkins job configuration shown in the picture attached below.
Use the form cvs checkout -d <path> <module>.
In your case that is cvs checkout -d work Test/user_Test/workload
(Did cvs checkout --help not give you this answer?)
I'm running Jenkins v1.581 and Publish artifacts to SCP Repository v1.8.
I am able to successfully copy my artifacts over SCP to a destination directory; so I know that server names, authentication, etc... are all correct.
My configuration looks something like this:
Source: tmp/distribution/target/deploy/opt/**
Destination: opt
When Jenkins puts the file over SCP it ends up in a directory structure of opt/tmp/distribution/target/deploy/opt/rest_of_path. It looks like it's keeping the original path of the file as it existed as an artifact and appending it to the destination path. This causes my artifacts to be deployed to an unexpected path.
My expectation is that they would end up as opt/rest_of_path. How do I fix this?
I replaced the Publish to SCP Repository with the Send build artifacts over SSH plugin. This plugin has an option for Remove prefix which does exactly what I wanted.
When working with the .travis.yml, is there an environment variable that contains the name of the current build directory in Travis-CI? Looking through the docs here I don't see one.
You probably want $TRAVIS_BUILD_DIR, which is the directory we clone the repository to and cd into afterwards, before running your tests.