I'm trying to set up Jenkins for continuous integration.
At the moment, I'm trying to do something very simple but am running into issues and I'm not sure if I'm doing something wrong or what I'm trying to do just isn't possible.
I currently have a file, which shows up on PC as a Windows batch file and on Mac as a Unix executable file. I run it from Mac and it uses xcodebuild and xcrun to make and share archives.
What I want to do for now is just have Jenkins do this for me (I'll add more stuff later) so I add added a build step and typed in the path to the batch file:
users/mcbuild/documents/work/fts/ArchiveFTS.bat
However, when I click build I get this:
Started by user anonymous
Building in workspace /Users/Shared/Jenkins/Home/jobs/FTS Build/workspace
[workspace] $ cmd /c call /var/folders/2n/gysykb914qlgtg2b0flhvh4r00007c/T/hudson6994878138376885970.bat
FATAL: command execution failed
java.io.IOException: Cannot run program "cmd" (in directory "/Users/Shared/Jenkins/Home/jobs/FTS Build/workspace"): error=2, No such file or directory
From searching around, I found a couple of possible solutions:
Had to specify the shell to C\windows\system32\cmd.exe
I'm not sure what this means or how to do this, can someone explain this please?
I'm not sure but doesn't it look like Hudson is trying to execute a .bat script on a Unix system?
Does that mean what I'm trying to do isn't possible and if not, what are my options please?
Some suggestions involve checking which user you're using Hudson as and maybe changing that
I'm not sure what user I am using it as or why it comes up as anonymous
Is there an issue with it being anonymous and if so, how do I change it please?
Thanks in advance for your help. If you need any more information please let me know.
It appears that you added a build step of type "Execute Windows batch command", but you are running this job on a Mac. What you need to do is run your xcode/xcrun file from an "Execute shell" build step. If you still have problems, make sure you can manually run the same file from a command prompt on the Mac (not by clicking on it). If you get an error about "Cannot run program sh", you may need to configure the path to sh. Type "which sh" at a command prompt to find out where sh is located. Click on Manage Jenkins, then Configure System, and enter the path under Shell Executable.
Related
I have a C/C++ project which is imported to an eclipse based IDE (STM32CubeIDE) on Win 11.
Inorder to compile the project, I have to enter some commands in git-bash. so for simplicity I wrote them into an .sh which is named build.sh and put it in the project folder, since then I just need to run this bash like this:
source build.sh
in git-bash, and here is its content:
#!/bin/sh
source Q:/stm32.sh
cd Q:/dev/my_project
make build_all
Right now, I want this script to be called, whenever I press the Build button of the IDE.
I found out that for this I have to change the build command from Propertise->C/C++ Build, uncheck the use default build command and then enter the proper command for running the script.
But I could have not do this by now.
I've tried to solve this problem by entering this
${workspace_loc:/${ProjName}/build.sh}
into the build command, which didn't work.
So my question is that what should I enter here to run the build.sh?
Do you know a better solution for my problem?
I have a java code under eclipse that is calling a .ksh script. The OS is Windows7.
I am a complete noob in shell things and the code (both java and ksh) were not written by me (and I cannot change it).
Anyway, when it tries to launch the script, the common Windows popup appears to let me choose a proper application. Given that, I have installed cygwin, but in cygwin/bin/ there is no ksh.exe at all. Even more, I didn't find any on google.
Is there any other way to launch the ksh under Windows?
Thanks in advance
I finally found a log:
C:\Users\Andrea\Desktop\AppXXX\Scripts\Model\Launchksh[35]: mkdir: not found
C:\Users\Andrea\Desktop\AppXXX\Scripts\Model\Launch.ksh[37]: can't create /rep/log/Launch_model.log: No such file or directory
It doesn't find mkdir, is it not an issue related with cygwin?
You need to install the mksh (MirBSD Korn Shell) package. Re-run setup and select mksh.
Ok, I solved the mistery. In the PATH variable there was no reference to the cygwin/bin folder. I manually add it and now it runs!
Thanks all
As you can see near the screenshot Logs infos pic, the .sh Script can run normal inside terminal, but failed to run via Xcode custom behavior, Is there missing some configuration? I've Googled a lot of infos. still can't solve it. I really need someone's help. Thanks
XCode version: Version 8.3.2 (8E2002)
Add a New Run Script Phase in your projects Build Phases to run a Shell script. You do not need to open -a Terminal:
Update:
How I understand your comment, your actual question is how to get the Xcode project directory. Xcode provides a enviromental variable for this, ${PROJECT_DIR}:
prints:
You can find a list of Xcodes enviromental variables in this repo and helpful information in Apples documentation.
I'm currently setting up a Jenkins server on Windows 10, in the hope of being able to make the build scripts more cross platform I was hoping to take advantage of the bash environment that is available in Windows 10.
I hoped this could be done just by setting the path to the shell in Jenkins to be the bash executable, however I've encountered some problems with trying to get this to work.
Firstly when I set the path to be C:\Windows\System32\bash.exe but Jenkins didn't seem to be able to see this path.
I assumed this was because Jenkins was running as 32-bit and changed the path to be C:\Windows\sysnative\bash.exe but when I try and use this I get the error
[workspace] $ C:\Windows\sysnative\bash.exe -xe C:\Users\Jenkins\AppData\Local\Temp\hudson4346151084156392102.sh
Error: 0x80070005
Build step 'Execute shell' marked build as failure
I think I'm poking around in the dark a bit so I didn't know if anyone had any experience of trying to use the bash shell on Windows 10 within Jenkins?
The error 0x80070005 usually appears during Windows Update or by specific applications, because of the .DLL files permission being denied. Look at your permissions and then try again.
You can run this on Windows in order to execute a bash shell script:
bash -c /mnt/c/Users/$LOGNAME/Downloads/abc.sh
Make sure that the script is executable (chmod +x)
(Only works on Windwos 10 with a linux subsystem installed)
I have a matlab compiled .exe file, it can run well with double-click, but when run with task scheduler, the following error pops out:
while actually I have installed the 7.17 of MCR, otherwise it will not run with double click. Anyone can help with this? Thanks a lot!
You need to include the MCR installation folder on the PATH environment variable. See here for instructions how (you might need to log off/on for it to take effect).
Note that if you are using the SET command in the command prompt, changes made are not permanent, and they would apply to the current CMD prompt only and remain only until the command prompt is closed.