Jenkins MSBuild plugin not working with cygwin on windows slave - windows

I am trying to run msbuild on a slave with cygwin (the master is ubuntu)
I am getting the following error:
FATAL: /cygdrive/c/Windows/Microsoft.NET/Framework64/v4.0.30319/MSBuild.exe doesn't exist
The file does exist in the said location. (and I was case sensitive)
I have also installed the "cygpath" jenkins plugin, but I am still getting the same error
I also changed the path to C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
but getting the same error (but with relevant path)

It seems that :
c:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\MSBuild.exe
does the trick

Related

Command line too long on maven when building hadoop from source in windows 10

I am trying to build hadoop from source as explained in this article. When building Apache common, everything fails with this error message: command line too long.
So, Here's what I have tried(I will update this when I try more):
As said in this
Stackoverflow answer, the way to overcome this error is to shorten the path as much as possible. So, I cut repository files from C:\user_name\.m2\repository\ to another directory and made an empty drive and have that point to this new directory which i have moved files to, like this
subst M: D:\maven-2.0.8\repository and changed <localRepository>M:</localRepository> tag in "settings.xml" from C:\apache-maven-2.0.8\conf to point to M:. And after doing all this, I restart my system and try to build hadoop again. But, as I can see from the error, maven still downloads packages to C:\Users\user_name\.m2\repository\, not M: and the error of command line too long error persists.
To shorten the path as much as possible, i made a directory in C:\mrepo and have this directory symbolically link to the C:\user_name\.m2\repository\ like this: mklink /J C:\mrepo C:\Users\.m2\repository. And after doing all this, I restart my system and try to build hadoop again. But, as I can see from the error, maven still downloads packages to C:\Users\user_name\.m2\repository\, not M: and the error of command line too long error persists.
EDIT 1:
I have also set an environment variable named M2_HOME with value M:\. And made changes in my \conf\settings.xml: <localRepository>${M2_HOME}</localRepository>. The issue still persisits.
How do I fix this and build hadoop successfully?
Are you using IntelliJ?
Because in IntelliJ you have some options to shorten your command line.
Go to Run/Debug Configurations.
Shorten command line, you can try the classpath file option.
You can find more information about it in this blog post.
If you want to set the .m2 directory to something explicit, you do can so by overriding the default.
All Users:
Edit the \conf\settings.xml global configuration file. Change the value of the localRepository key to the absolute path of the local repository cache.
Your user: I think you should be able to set the M2_HOME environment variable in your user settings.

error when pushing changes to git from teamcity (ssh_askpass: exec(/usr/lib/ssh/ssh-askpass))

I am getting
ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights.
This error occurs when trying to push changes to GitHub from TeamCity build.
How can I avoid this error message?
The TeamCity support page includes
I needed to set the environment variable SSH_ASKPASS to point to "C:\Program Files\Git\mingw64\libexec\git-core\git-askpass.exe".
This somehow overrides the unix path with the given correct one
That would assume your TeamCity is running on a Windows server.

Three identical build server, same build script: "Unable to determine workspace" error only on one

We implemented three identical build servers and when we run the same script it fails on one of them with the following error:
Error: Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.
The issue is identical to this one, so we probably need to add the tf workfold /map command:
FInalBuilder 7 and TFS2010 - Get Latest
Now the question is, if we need to add the command above, how it can run correctly many times on the other two build servers?
[Team Foundation Check Out [ C:\BuildAgent\work\27a5ec307fc309bf\Core\Geometry\Source ]]
Path to Executable: C:\Program Files (x86)\Microsoft Visual Studio\2017\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe
Workspace Directory: C:\BuildAgent\work\27a5ec307fc309bf\Core\Geometry\Source
Command line: checkout /lock:none "Properties\assemblyInfo.cs"
Error: Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.
Failed!
The problem was a ghost workspace, I was able to delete it using Attrice Sidekick for TFS and the instructions found here: https://stackoverflow.com/a/37284964/261010

NiFi Build Errors

I'm trying to build Apache NiFi after cloning it from https://github.com/apache/nifi and it keeps failing on the tests on the nifi-standard-processors project. I opened up the output file in the surefire-reports directory and there's the below error that it can't run program "cmd" in directory /var/test, because no such file or directory exists. The first time I ran the install it didn't exist, but I created it and I still get the error message. I do a sanity check every time to make sure the directory still does exist. Does anyone have any idea what might be causing this issue? I'm only taking a very few steps to do this. They are posted below. I'm logged on as root on a CentOS Linux VM. Thanks in advance for any help.
Steps:
cd /tmp
git clone https://github.com/apache/nifi
cd nifi
mvn clean install
[main] ERROR org.apache.nifi.processors.standard.ExecuteProcess - ExecuteProcess[id=a8d6b3a3-befa-4b74-a962-330bd021ec7b] Failed to create process due to java.io.IOException: Cannot run program "cmd" (in directory "/var/test"): error=2, No such file or directory: java.io.IOException: Cannot run program "cmd" (in directory "/var/test"): error=2, No such file or directory
I believe this is due to a recent commit "solving" this ticket[1]. I actually already reopened[2] it due to failures on TravisCI and the contributor is currently working on a fix.
In order to build now, you can tell maven to "skip tests" by running the command with the proper flag: mvn clean install -Dmaven.test.skip=true
[1] https://issues.apache.org/jira/browse/NIFI-2905
[2] https://issues.apache.org/jira/browse/NIFI-2905?focusedCommentId=15603258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15603258

Jenkins can not clone Git repository over Git/SSH on Windows

I have successfully cloned Git repository in Jenkins over Git/SSH on Windows 2008 32-bit. When I tried to do the same on Windows 2008 64-bit, Console Output page gets stuck here:
Démarré par l'utilisateur anonymous
Checkout:book / C:\Jenkins\workspace\book - hudson.remoting.LocalChannel#1da691a
Using strategy: Default
Last Built Revision: Revision 5d7ce4ae23c91fb201ee005e6db17bcd795ca965 (origin/HEAD, origin/master)
Checkout:book / C:\Jenkins\workspace\book - hudson.remoting.LocalChannel#1da691a
Cloning the remote Git repository
Cloning repository origin
When I stop the build (after a few minutes of being stuck there), I get the rest of the error message:
ERROR: Error cloning remote repo 'origin' : Could not clone git#github.com:zeljkofilipin/watirbook.git
ERROR: Cause: Error performing command: C:\Git\bin\git.exe clone --progress -o origin git#github.com:zeljkofilipin/watirbook.git C:\Jenkins\workspace\book
null
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1042)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:968)
at hudson.FilePath.act(FilePath.java:785)
at hudson.FilePath.act(FilePath.java:767)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:968)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1193)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:567)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:455)
at hudson.model.Run.run(Run.java:1404)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:230)
I can clone the repository via Git read-only URL git://github.com/zeljkofilipin/watirbook.git from Jenkins on both machines
I can clone via Git/SSH URL git#github.com:zeljkofilipin/watirbook.git from the command line on both machines
I can clone via Git/SSH URL from Jenkins on 32-bit machine, but not on 64-bit machine.
The only difference I can notice between the two machines (not counting that one is a virtual machine on my laptop, and another is a real machine in Switzerland) is that the first one is 32-bit and the second one is 64-bit.
Not sure if that could be related, but 32-bit machine has location set to Croatia, and 64-bit machine to Switzerland (as you can see from Git output in French).
For more information please see my blog post: Jenkins, Windows and Git
I've gone through these pains recently. Especially frustrating is the lack of error logs in this scenario: probably because MSysgit prompts user on the console when trying to recover - which doesn't get through Jenkins console.
Based on my experience here are a few key elements to watch for:
a mix of both Msysgit and Cygwin installed: MSysgit worked better for me- but I assume you're using that too
some people have more luck with <MSYSGIT_ROOT>\cmd\git.cmd than <MSYSGIT_ROOT>\bin\git.exe
making sure your slave runs as the same user (which is not the default upon service-based installs).. - oh I see you got that too
setting HOME variable for windows slaves explicity
basically make sure the same .ssh keys are reached when under Jenkins.
for debugging, I found it useful to create a test job with no SCM, but run git clone in an "Execute shell/batch" build step. That should reveal a bit more info. BTW, you can do an env in the same step and maybe ls %HOME%/.ssh
I think the above is what gave me a working a Windows 7 64bit Jenkins slave with git support - although I thought this had more to do with some other fine config detail than with 64 vs 32 bits. Good luck anyhow!
In the latest version of git, had to use %GIT_HOME%/cmd/git.exe, rather than %GIT_HOME%/bin/git.exe and figuring out the home directory of the user running the jenkins service.
Another issue i faced with was, ssh.exe was not looking at the %userprofile%/.ssh folder for the key files. Instead it was looking to the folder C:\Program Files (x86)\Git\.ssh which was empty and which causes a hang due to ssh authentication prompt on the machine where git repo located.
We just copied the key files under %userprofile%/.ssh to C:\Program Files (x86)\Git\.ssh and the problem is resolved.
Notes from a hard learned lesson.
I had problems getting the ssh to work running Jenkins as a named user account for ssh+git.
Here is what I had to do to solve the problem:
Generate the key using ssh-keygen (note where they are located)
Set "HOME" to this location
I tried with puttygen and GET_SSH=plink that all failed very bad but no clear errors.
When you have to use any configuration options from a per-user configuration file eg. ~/.ssh/config you can put them in C:\Program Files (x86)\Git\etc\ssh\ssh_config, the key files can be put in C:\Program Files (x86)\Git.ssh
If your account is attached to domain. Then you need to make sure user for which the Jenkins Slave is ran. For the purpose open Settings->Properties of "Jenkins Slave"->Log On. and choose necessary user from domain for correct execution.
Since my Windows Jenkins was a slave, I needed to configure that node to find the git in cmd instead of bin as described by inger. To do this, go to Manage Jenkins, Manage Nodes, click on the appropriate node, click on Configure and then go to the Tool Locations. Find git in the drop-down and then specify the path to git.exe (including git.exe), like C:\Program Files\Git\cmd\git.exe.
I confirmed that the cmd/git.exe worked differently than the bin/git.exe from both command-line and with a temporary jenkins job using the git command (instead of an scm repo).
https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Plugin
Just add a ssh-enabled user logon to Jenkins and it should work smoothly.

Resources