Jenkins copy to hdfs - hadoop

I have tried several artifacts plugins for Jenkins but so far have been unsuccessful with the task:
I use hadoop as a file system for deployments and deploy my app from hadoop (mesos/marathon can only access http or hdfs). How do I make Jenkins save the artifact zip from sbt to hdfs? I doesnt give me the option to run a shellcommand

The plugin Hudson Post build task lets you run shell commands and copies the necessary files to hadoop as a shell script

Related

How to setup a Jenkins job for Veracode Scan in a Node application?

My Jenkins runs on AWS EC2 instance and I'm creating a freestyle job to run Veracode Scan. I configured my Veracode portal API credentials with the Job. Installed the Veracode Jenkins plugin as well. And the Git repo also set upped in the pipeline. So my plan was to Zip the git repo by running below shell script
Then in the post build section I configured to upload the zip file like shown in below image.
When i build the job it throws below error.
it says that zip is not found. What may be the reason for this error? Also am I approaching this in a correct way?

Jenkins execute shell not able to find gradle commands

I am trying to trigger gradle command in execute shell of a particular node from jenkins master and it's trowing an exception as-
gradle: command not found
Build step 'Execute shell' marked build as failure
However, gradle command works if am trying to execute shell in the same node itself under local workspace.
What I understood-
Triggering any job from remote by default try to search executable like 'adb', 'gradle' in /usr/local/bin of node machine (Macintosh)
read-write access should be there for '.gradle' folder
What I have done-
added .gradle inside /usr/local/bin of slave
granted read-write access to .gradle
Here, both node-jenkins and master-jenkins have gradle v2.5 installed. Why execute shell triggered from master jenkins not able to find gradle in slave jenkins, any help would be appreciated.
try run env before your try to run gradle. and compare it to env from the command line. I think that Jenkins use another path.
I was also facing same issue where gradle command working fine on machine where jenkins is installed but the same command was not working on slave.
Solution:
You need to set GRADLE_HOME on slave.
Most important: set PATH into the slave configuration [copy the exact PATH path from slave machine and copy it into Jenkins slave configuration under Jenkins--> Manage Jenkins--> Manage Node--> NodeName(your node name)--> Configure and search for Node Properties-->Environment variables]
save
In my case I have added additional PATH env variable, then it worked.
I was also facing same issue
verify you add Gradle Plugin to your jenkins
Verify that you inside the Folder where exist the "gradle.build" file
my example: the location of my gradle.build was insifr the foulder automation-api

How to extract and export artifact files (SNAPSHOT.jar) from Jenkins to a network drive

My team has code being built and tested in Jenkins and when the build process is done Jenkins produces a SNAPSHOT.jar file. I need to unpacked the snapshot.jar file and send the extracted files and folders to a network drive. What is the best way to do that?
I've tried a few Jenkins plugins, the most recent being artifactDeployer, but when the plugins deploy the artifacts, as a post-build action, they don't unpack the jar files; I would have to execute a windows batch command after they are deployed to unpack them but I cant because the plugin runs as a "post-build action" and the batch commands are done before the post-build actions. Is there a way to deploy the artifacts and unpack them without using a plugin? Or is there a plugin that will do both? What is the best way to achieve this?
The way I accomplished this was by using 7zip in a Windows batch command as a post-step in the jenkins project configuration.
The command is:
`7z x %WORKSPACE%\target\*.jar -oX:\"mapped network drive location" -y`
This extracts the artifacts out of the snapshot.jar file and places those artifacts into the network drive. I needed the files contained in the snapshot.jar to be sent to the network drive when the build completed. I am new to jenkins and the plugins I tried were post-build actions and only copied the snapshot.jar to a given location; they did not extract the artifacts out of the jar file. That is why I chose this route.

How to execute remote bat file using build step in TeamCity?

I have TeamCity installed on centos. I have only one Linux BuildAgent for now. My build configuration execute a maven script and using ant upload WAR artifact to Windows Server on FTP. After this step i have to execute BAT file on remote Windows Server. I read that i can do this using psexec/RemCom, but i can't understand how i can do this in TeamCity? Build Step or different Build Configuration should contain steps to execute psexec/RemCom or i can insert Build Step into existed Build Configuration?
Single build configuration could potentially consists of multiple build steps. Think of them as a actions you would like to do. So I suppose that right now you have a maven step in your build configuration. I would suggest you to add Command Line step, where you can do what ever you want -- it's like bash/batch script. You can put script contents directly to the build step, or you can write script and execute it.
But as you mentioned that you have CentOS, it could be you have to do extra configuration on the build agent for PsExec to be available.

how to execute shell to install a file from artifacts dir in jenkins

I have a build step that builds my projects and packs it into a myfile.jar and put it in my artifacts dir.
i have also told jenkins to archive the myfile.jar.
now i want to add another build step to execute shell command java -jar myfile.jar and install it for further testings
how can i tell jenkins to point to myfile.jar when executing the shell command ? i don't know the artifacts dir name since it's dynamically created with build number etc...
thanks.
The artifacts directory is on the master, not the slave.
If both are on the same machine for you, the artifacts reside at:
$JENKINS_HOME/jobs/$JOB_NAME/$BUILD_ID/archive
However, like Anders Lindahl said, archiving an artifact does not delete it from the workspace; why not use it directly from there. Generally, you do not want to disturb the archives directories...

Resources