We use Jenkins with the 'copyArtifact-Plugin' to archive files from a build job. Now we moved our Jenkins Master into a docker container.
This archive features works very well:
archive artifacts
copy artifacts from other projekts
This archive features doesn't work:
The link 'artifacts of the last succesful builds' from the projekt
website to show and download the archive in browser produces a
jenkins devil with this exception:
java.lang.IllegalArgumentException: The parent does not exist
at hudson.FilePath$IsDescendant.invoke(FilePath.java:3315)
at hudson.FilePath$IsDescendant.invoke(FilePath.java:3295)
Does anybody knows why the link from the project site only works wenn the archive path is directly in the docker container? When the archive path ist outside the docker container and mapped inside the container you can't get the archive. The build results are also outside the container but the master can read this informations.
Related
I need to split a teamcity build that builds and pushes a docker image into a docker registry into two separate builds.
a) The one that builds the docker image and publishes it as an artifact
b) The one that accepts the docker artifact from the first build and pushes it into a registry
The log says, that there are these three commands running:
docker build -t thingy -f /opt/teamcity-agent/work/55abcd6/docker/thingy/Dockerfile /opt/teamcity-agent/work/55abcd6
docker tag thingy docker.thingy.net/thingy/thingy:latest
docker push docker.thingy.net/thingy/thingy:latest
There's plenty of other stuff going on, but I figured that this is the important part.
So I have copied the initial build two times, with the first command in the first build, and the next two in the second build.
I have set the first build as a snapshot dependency for the second build, and run it. And what I get is:
FileNotFoundError: [Errno 2] No such file or directory: 'docker': 'docker'
Which probably is because some of the files are missing.
Now, I did want to publish the docker image as an artifact, and make the first build an artifact dependency, but I can't find where does the docker put its files and all of the searches containing a "docker" and a "file" in them just lead to a bunch of articles about what the Dockerfile is.
So what can I do to make it so that the second build could use the resulting image and/or enviroment from the first build?
in all honesty I didn't understand what exactly you are trying to do here.
However, this might help you:
You can save the image as a tar file:
docker save -o <image_file_name>.tar <image_tag>
This archive can then be moved and imported somewhere else.
You can get a lot of information about an image or a container with "docker inspect":
docker inspect <image_tag>
Hope this helps.
New to Jenkins so apologise in advance as I'm sure this answer is out there somewhere. Just not sure exactly how to search for what I'm after. I'm struggling a bit with the copyback process in Jenkins.
When I build, I'm running some unit tests that create some log files which I want to be stored as part of the Jenkins build. I'm running on Windows 10 and everything is running on my laptop (I'm purely trying to learn Jenkins so this is fine for me).
So my test results will always appear in C:\TestLogs\*.log. I want the results copied to my build directory which is URL: http://localhost:8080/job/loadrunner_test/1/ absolute: C:\Program Files (x86)\Jenkins\jobs\loadrunner_test\builds\1
I'm a bit confused with which plugin I should use in my post build step? Copy Artifact plugin looks as if it's meant to pass data between builds. For each build, I just want to copy C:\TestLogs*.* to the current build directory so I can see them when I click on the link for #1 in the Build History.
Many thanks!
Tim
WindowsDir
Jenkins Build
You can copy it with additional step.
Select Execute Windows batch command for that step and add this line:
xcopy C:\TestLogs C:\Program Files (x86)\Jenkins\jobs\jenkins_test\builds\%BUILD_NUMBER% /s /e
You can also check configuration for your test if you can set path location.
Build failed on slave server only due to unable to delete only Jar directory.
We are trying to load balance the Jenkins and hence launch the slave node, where we mounted workspace of Master to slave node. We are getting the following error while doing ant clean from the /var/lib/jenkins/workspace/TEST/. However, this is working fine on Master and giving error only on Slave node. Tried upgrading ant version on Slave but no luck. Also check permission and its fine. How can i solve this.
/var/lib/jenkins/workspace/TEST/build.xml:115: Unable to delete directory /var/lib/jenkins/workspace/TEST/jar
Adding to it if there are files inside Jar then only it fails. However, if Jar is empty then it works fine.
Im trying to setup jenkins in my company and Ive got some problems.
Im using this commands to build the project:
SET MSBuild="C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe"
SET BUILDS=C:\Program Files (x86)\Jenkins\jobs\xxx\builds\
SET OUTPUT_PATH="%BUILDS%%BUILD_NUMBER%"
SET RSVARS="C:\Program Files (x86)\Embarcadero\RAD Studio\10.0\bin\rsvars.bat"
CALL %RSVARS%
SET PATH=%PATH%;D:\komponenty\DXE3\ADSI
%MSBuild% xxx.dproj /t:Build /p:Config=Debug;Platform=Win32;DCC_ExeOutput=%OUTPUT_PATH% /maxcpucount:4
It works fine when i type this in cmd but. I gave administrive privileges to jenkins service. When I try to build project with jenkins i receive error like this:
F1026: File not found: 'ADSI.dcu
this is a component for Delphi and i have this component on second partition. Jenkins has access for many components on this partition but not for this one.
The difference between the two will be your current directory.
Jenkins will start you off in a specific working folder for the job (possibly C:\Users\<User-ID>\.jenkins\jobs\<Job-Name>\workspace).
Add the following to your Jenkins commands to see where you're doing the build from:
echo Current Folder: %cd%
A simple "solution" would be to just add a command in Jenkins to change directory to the same folder you're in when you test from the command-line.
However, I suggest you rather do the following:
Ensure Jenkins gets the latest source from your source repository into its working folder. (There are various plugins depending on what particular tool you use.)
Ensure you cd (change directory) to the correct folder within the workspace folder.
I have a multi-configuration Jenkins job which runs my tests in parallel on multiple slave nodes. I want to collect some artifacts from those slave builds back on the master, and then run a post build step to build a custom HTML page from them.
I have everything set up so those files appear to be copied back onto the master, but then I can't seem to access them. Does anybody have a working example of this configuration that they can share?
Here's the job configuration of the matrix axes:
and the build, which just creates a tmp.txt file:
and fingerprint, archiving artifacts and then post build step to copy that file back to the master:
The slave Console Output says the copy succeeded (and we can see from the plugin source code that any error would be reported - and I've definitely seen these errors getting logged when things go wrong):
17:39:23 [copy-to-slave] Copying '**/tmp.txt', excluding nothing, from 'file:/scratch/jenkins/workspace/Test%20Matrix%20Build%202/label/android/node_index/1/' on 'com.cloudbees.jenkins.plugins.mtslavescloud.MansionSlave#c9964fd8' to 'file:/home/<myaccount>/hudson_home/workspace/Test%20Matrix%20Build%202/label/android/node_index/1/' on the master.
However, I can't seem to access those files from a Post Build script running on the master:
17:39:24 + cat label/android/node_index/1/tmp.txt
17:39:24 cat: label/android/node_index/1/tmp.txt: No such file or directory
The files seem to be listed in the Workspace of the master:
I tried versions of the same command using the $WORKSPACE environment variable and they didn't work either, e.g.
20:40:13 + cat '/scratch/jenkins/workspace/Test Matrix Build 2/label/android/node_index/1/tmp.txt'
20:40:13 cat: /scratch/jenkins/workspace/Test Matrix Build 2/label/android/node_index/1/tmp.txt: No such file or directory
...and since "ws" was in the URL I tried adding that in as well (also didn't work):
20:42:51 + cat '/scratch/jenkins/workspace/Test Matrix Build 2/ws/label/android/node_index/1/tmp.txt'
20:42:51 cat: /scratch/jenkins/workspace/Test Matrix Build 2/ws/label/android/node_index/1/tmp.txt: No such file or directory