I have a Jenkins job that successfully builds my project, now i am trying to push the build to remote Amazon EC2 server using the MsDeploy command as follows:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -allowUntrusted -source:contentPath="%WORKSPACE%\dist" -dest:auto,computerName="https://ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com:8172/MSDeploy.axd?site=Default Web Site",username="administrator",password="xxxxxxxxxxx",authtype="Basic",includeAcls="False"
This command is working from my local machine command prompt as well as from the Jenkins server command prompt but giving ERROR_USER_UNAUTHORIZED when ran as a Execute windows batch command build step from Jenkins Job. Below are the error details:
When i copy the password from the above formatted Msdeploy command from the Jenkins console output and try to remote into the respective server, it doesn't log me in. Whereas if i copy the password from else where say like notepad, word etc.. and try to remote into the server, its working. It looks like the problem is with the way Jenkins is formatting the Msdeploy command. Should i have to format it in a specific way or is there any specific order the arguments in the command has to be framed ?
I know there are other options like using the publish over ssh plugin in Jenkins, but wondering why it can't be achieved with a simple Msdeploy command.
Related
I have setup a Jenkins job to deploy our application to Jenkins. The build step runs a windows batch file on the slave machine which in turn invokes a powershell script to deploy our application to an on premise service fabric cluster. However, the job fails because it doesn't recognize Service Fabric commands. All other command work though.
Here is the content of the batch file that is invoked from Jenkins.
powershell -command "DeployRevCart.ps1 ; exit $LASTEXITCODE"
Below is the exception from slave machine
Running Connect-ServiceFabricCluster
The term 'Connect-ServiceFabricCluster' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Even this simplified batch command fails with same error.
powershell -command "Connect-ServiceFabricCluster"
However, if I run the script directly in the slave machine, everything works fine. So I appreciate any help in resolving the issue.
I have been struggling to get the Publish over FTP to successfully transfer my DotNetCore build artifact from my Jenkins Linux slave to my AzurePack server. This plugin worked for the same host and target server in the conventional Jenkins pipeline.
I would like to know why it is saying the transfer was successful when 0 files were transferred?
I would also like to know why it is not transferring any files when I am listing the source directory before and after the ftpPublish call and all of the files are being listed?
I would also like to know what should be in the paramPublish variable?
Below is my groovy code:
Publish over FTP stage in JPaC
Below is my console output from Jenkins:
Jenkins Console Output
I have a situation where in I need to copy set of files to a windows server through Jenkins. I see a lot of Jenkins plugins that will do this kind of job through ssh but not in my case. Jenkins is also hosted in a windows server and end server is also a windows, so I believe ssh is not an option. Any plugin available in the market to get the job done or writing our requirements in powershell/MSDos script is the only option?
Thanks in advance!
just execute a bat command with the following
copy C:\localfile.bak \\remotemachine\c$\Path\remotefile.bak
in the Using the Execute Windows batch command option in the build Step
How to run bat file in jenkins
When i get an empty Ubuntu server like 172.22... I want to install java ,download Apache-tomcat and install. After that build my appliaction and deploy it on the server. I have used Publish Over SSH Plugin to transfer some scripts to run when it on server but the problem is it only takes scripts from the application space where it is build.For that it this initial setup scripts must also be present inside every application i build.
In ideal scenario I want one job to setup a server by installing applications like java , tomcat.. etc. in remote server and then one job to build an application and deploy it on that remote server.Can't we do this using Jenkins ?
Possible sollution of deploy:
On jenkins server install plugin to execute Shell scripts. That allow us to run Curl command. To deploy .war on remote server use command with curl, example:
curl -T /var/lib/jenkins/jobs/(Path to war ) http://user:password#ip:port/manager/text/deploy?path=/(nameOfWar)&update=true
Also add role manager-script to Your tomcat user.
For deploy on linux servers i use plugin Deploy war/ear to a container. So it's all in Jenkins and Tomcat.
In case doing a remote install from one job i preffer to use ssh plugin, even better sollution is to write a perl script put it on server then run it. To run ssh command by perl for example use: $tomcat = apt get install tomcat; etc.
I'm running Jenkins as Windows service on my PC. I'm trying to learn to use it. For a dummy job, one of the build step is Execute Windows batch command with the following command
JLink -ip 10.12.1.234
When I build the job on Jenkins I get a build error saying JLink is not recognized as internal or external command, operable program or batch file. When I run the command from a command prompt, it runs without any problem. Windows path has been set to the path where JLink is installed. Should I be configure anything additionally in Jenkins?
Try putting the fully qualified path (or an environment variable) of the command in Configure Project. Your user must be different from jenkins service, which runs as system