I have a hard time to force wget command to wait until download finish's, problem occurs inside Jenkins
sh '''script place '''
. I have wrote the script in .sh
file, where it runs without any issues, but after moving it into Jenkins other command in Jenkins executes before the download completes.
script I'm using looks like this
sh '''
ssh -i "${keyfile}" -v -o StrictHostKeyChecking=no myuser@myVM << ENDSSH
cd /toFolder
ls -l
echo
if [ -f *.zip ]
then
echo "zip file already exists. Aborting"
exit 1
fi
wget ${URL}
sleep 1
export ZIP_FILENAME=ls *.zip
echo run: deployment.sh -j $ZIP_FILENAME
echo
deployment.sh -j $ZIP_FILENAME
ENDSSH
'''
for the sake of pasting this code here I have moved ENDSSH
on the last line under deployment script to keep it inside the code block. (I know it should be far left of the script)
so my problem is that finding the file name which has to be deployed with deployment.sh is executed before download is completed.
Tried to use wait
command, as well as sleep
, which I do not think is a best way to do it, but wait command does not wait at all and sleep command works from time to time. curl
behavior is exactly the same. any advices will be much appreciated, as long as I'm not with enough knowledge in Linux scripting.
Asked by Re Viki
(1 rep)
Jun 24, 2022, 01:22 PM
Last activity: Aug 18, 2023, 07:01 AM
Last activity: Aug 18, 2023, 07:01 AM