I am trying to run "configure" and "make" commands on windows platform (cygwin), from jenkins pipeline, running using this below command :
bat "${CYGWIN_EXECTION} /cygdrive/c/JDK_BUILD_64_32/configure_64.sh
${env.BUILD_NUMBER} ${JDK11_U_PATH_CYGWIN} ${params.snclabel} "
and
bat "${CYGWIN_EXECTION} /cygdrive/c/JDK_BUILD_64_32/make_64.sh
${env.BUILD_NUMBER} ${JDK11_U_PATH_CYGWIN} ${params.snclabel} "
where :
CYGWIN_EXECTION="C:\cygwin64\bin\mintty.exe -h start /bin/bash -l -e "
and
configure_64.sh contains below script:
./configure --with-freetype=bundled
--with-tools-dir=/cygdrive/c/progra~2/micros~1/2017/Enterprise/VC/Tools/
--with-jtreg=/cygdrive/c/jtreg-5.1-b01/ --with-version-pre=$SNCMID_VAR --with-version-build=$BUILD_NUMBER--with-version-opt= --with-boot-jdk=/cygdrive/c/jdk-10.0.2 --with-boot-jdk-jvmargs="-Xmx4G -enableassertions"
and make_64.sh contains below script:
./make clean SPEC=build/windows-x86_64-normal-server-release/spec.gmk
When triggered from jenkins, the jenkins pipeline did start to execute but did not wait for the execution to finish (simply closes the cygwin dialog box, did not wait for execution to finish).
please advise the resolution to make it to wait for the "./configure" execution to finish (before moving forward to run "./make" ) ?
Related
I'm trying to execute the command:
ssh nvidia#ubuntu-ip-address "/opt/ads2/arm-linux64/bin/ads2 svcd&"
This works so far except that it hangs in the remote terminal when "/opt/ads2/arm-linux64/bin/ads2 svcd&" is executed, unless i enter ctrl+c. So I'm looking for a command that, after executing the command, exits from the remote terminal and continue executing the local bash script.
thanks in advance
When you run a command in background on a terminal, regardless of weather it be local or remotely, if you attempt to logout most systems will warn you have running jobs. One further attempt to logout and your jobs get killed as you exit.
In order to avoid this you need to detach your running jobs from terminal.
if job is already running you can
disown -h <jobspec ar reported by jobs>
If you want to run something in background and then exit leaving it running you can use nohup
nohup command &
This is certainly ok on init systems ... not sure if it works exactly like this on systems that use systemd.
I created a pipeline in Azure with Ubuntu 18.04. My requirement was to run a docker image using bash script and for the same below script was created but on execution I received an error "docker command does not exist and docker: invalid reference format.
test.sh
#!/bin/bash
#
echo "=== docker Images==="
docker images
echo "==== Starut running a jmeter/image ===="
docker run "justb4/jmeter:latest"
echo "==== Finish ===="
Error
Starting: Bash Script scripts/test.sh
==============================================================================
Task : Bash
Description : Run a Bash script on macOS, Linux, or Windows
Version : 3.163.2
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
Formatted command: bash '/home/vsts/work/1/s/scripts/test.sh' 'justb4/jmeter:latest' mainTest.jmx qa-url 30 1 60 15 2 60 1000
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /home/vsts/work/_temp/5c641c31-4e55-4ab8-be9e-4cf850432bab.sh
=== docker Images===
docker: 'images
' is not a docker command.
See 'docker --help'
==== Starut running a jmeter/image ====
docker: invalid reference format.
See 'docker run --help'.
==== Finish ====
Finishing: Bash Script scripts/test.sh
To describe in detail, here are the tasks created on az pipeline :-
1. Install a docker
Output of Task1
2. Just for debugging purpose, I added below bash task **with inline commands** to see if docker
commands work and it worked perfectly fine with no issues. But in task3, when I tried to execute the
scripts with the same commands it failed.
Output of Task2
3. Task 3 to execute test.sh script having docker commands
Output of Task3
The problem was with Windows or DOS-style line endings but while executing in Azure pipeline it did not throw the actual error. Later it was understood that each line was being terminated with a Carriage Return followed by a Line Feed character. If a script file was saved with Windows line endings, Bash sees the file as
#!/bin/bash^M
^M
cd "src"^M
having a special character at the end.
Try running dos2unix on the script solved the problem.
http://dos2unix.sourceforge.net/
Or just rewrite the script in your Unix env using vi and test.
Unix uses different line endings so can't read the file you created on Windows. Hence it is seeing ^M as an illegal character.
I have a pipeline script running from a Linux master to a mac pro slave.
When running from a macpro master the build runs absolutely fine, however when executed from the Linux master it keeps filling the logs with:
"sh: sleep: command not found"
The only thing that it executes in the middle is :
GIT_COMMIT_HASH = sh (script: "git log -n 1 --pretty=format:'%h'", returnStdout: true)
The entire Jenkins file does not have any sleep command. I'm unable to locate as to why that error happens.
I waited for more than 30 mins and the build never progresses except filling the logs with the same lines over and over.
From the mac Linux master the entire build completed in less than 9 min.
checked the version of plugins and they match, tried updating the ones that were old. Checked the path variables etc'.
I have the same issue from the Solaris based Jenkins master and the Linux based Jenkins master.
script {
GIT_COMMIT_HASH = sh (script: "git log -n 1 --pretty=format:'%h'", returnStdout: true)
currentBuild.displayName = currentBuild.displayName + " $NODE_NAME $GIT_COMMIT_HASH"
...
}
I am using obsidian scheduler for scheduling various jobs written on a linux box. And trying to call shell scripts with a nohup command like
UPDATE 1:
nohup ./script.sh > output.txt &
UPDATE 2
This is the error when i use nohup.
nohup: failed to run command â./test.sh &>./load.log &â: No such file or directory
I dont see anything writing to the output file.
And secondly how can i verify that it is using nohup command to execute the script.
Thanks
Hello all I have build an CI server by jenkins. I want to execute remote bash shell on testing server (Ubuntu server 12.04 LTTS) by this sample script through ssh plugin
#!/bin/bash
cd "$(dirname "$0")"
echo "[INFO] Stopping service mix service"
cd /home/setup/Development/apache-servicemix-4.5.0/bin
./stop
echo "[INFO] Wait few secs for stopping service"
sleep 5
echo "[INFO] Start service"
./start
sleep 1
exit;
But the servicemix can not start, if I do manually ssh login from bash shell, then execute this script (stored in test server) it can work well.
Any Idea for this.
Thank you
I have resolve this. This is error failed load JAVA_HOME from script. Actually this run on different shell configuration environment that have not load configuration from my .profile. – TienHoang