Jenkins upload slave build to a server from master - ios

Jenkins is running in a windows machine.
Slave is a mac building iPhone apps. (using ssh)
This configuration building successfully.
If I archive the artifact (e.g. Output/.) it saves in the master (windows machine).
But when I try to run any bat command to copy files in the post build steps, it runs in the slave machine.
How can I run command in the master (Windows), in the post build steps? Or there is other ways to do it?
I want to upload the build artifact to a server accessible only from the windows (master) machine. How can I do that?
How to tell Jenkins, to take the build artifacts from the slave and run some command (copy files) on those files in the master.

Use the Publish Over FTP Plugin. Create an ftp in master and using Publish Over FTP Plugin, copy the build artifacts to master machine.
Thanks,
Manu

Related

Execute cmd file on windows deployment server from Jenkins linux server

We have one Jenkins master (Linux) and one Jenkins slave (windows). We are working on .NET Web application.
Initially our deployment was to prepare the artifacts through TeamCity and invoke a cmd file manually in the deployment server and the deployment happens. The cmd file invoke nant internally and deploy the all required things.
Now we are using Jenkins to implement the CI/CD pipeline.
We have been able to successfully prepare the artifacts and also copied the artifacts to the deployment server through Jenkins. Build and artifact preparation are happening at Jenkins slave.
Pending is , we just need to execute the "cmd" file in the deployment server.
Can anyone please guide me, how to execute the "cmd" file in the deployment server from Jenkins ?
We are using Freestyle project in jenkins.
First install & configure a Jenkins agent on the deployment server(install, configure)
After selecting your build node:
Open the dropdown in the build section and click on Execute Windows Batch Command:
After selecting the option, a box will appear to enter the commands.

How to automatically copy artefacts from Jenkins job into given network drive?

I'd like the files generated by Jenkins script to be automatically copied into a given directory on the local network.
Is there a plugin or script for doing that ?
In my case it worked by using SCP in a build step "Execute shell". The remote server needs to be accessible via ssh.
If your artifacts are the result of a maven build, maybe a Nexus Repository Manager is what you are looking for. A simple mvn deploy would do the job.

Copy files from Bitbucket via Jenkins to a production server

I have got my code files in bitbucket and have configured a jenkins build job to run where there is a change in the bitbucket repository. At the end of which it has to copy the files from the repo to a directory located at a production server from where the application is running.
Is there a away to copy the files from repo to a server using a script inputed to jenkins?
I asume you have the files in the workspace of the job. How about copying the files via the command line? If you want to do so, insert a batch block for windows nodes or a shell block for linux nodes and use
cp original_file new_file
You have 2 possibilites:
Run a slave on the production server
In this case you run a slave on the production server, which connects to your master jenkins. The slave has to be run under a user, which is able to write the directory, where you want to copy the files too.
2 Variations of this possibility:
You can execute the clone (checkout) of the bitbucket repository on the master and then use stash to make the files accessible on the slave, running on the production server (https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#stash-stash-some-files-to-be-used-later-in-the-build).
You run the whole pipeline on the slave, which is running on the production server, which means the production server needs access to bitbucket.
There are several possibilities to connect a slave to a master: https://wiki.jenkins.io/display/JENKINS/Distributed+builds#Distributedbuilds-Differentwaysofstartingagents
Use remote copy possibilites
You copy the files with eg. scp in linux.
This has some security implications:
You have to add the password of the production to the jenkins credential store and pass it to the copy command
if using keys (recommended). You have to add the private key to the jenkins credential store and pass it to the command.

How to deploy a jar on Windows server through Jenkins job?

We have a jenkins job which is getting triggered after every push to gitlab.
It creates a build. Upon successful build we want to copy the jar to some Windows server.
We are able to set SSH credentials for Linux server. How do we do it for Windows server.
Thanks
Install the slave on windows machine & trigger the .bat file through jenkine's job.

How to copy file from remote host to jenkins server

I am using jenkins for build process. I am running some scripts on remote server using jenkins server. It's fine but remote host generates some html file. I want to copy that file back to jenkins server. Is it possible to do it from jenkins server?
If you want to archive it permanently, you can use the Archive Artifacts option in the Post-build step in Jenkins. In the case of builds that happen on slaves, Archive Artifacts copies the artifacts back to the Jenkins server for archiving and reuse.
If you want to then use this in a subsequent build, you can use the Copy Artifacts step to introduce an artifact from another build into your subsequent process on any Jenkins slave.
We use this to move production builds into our test environment after packaging and it works great.
Copy to slave plugin also copies files back from slaves to the master. Might be worth the look.

Resources