Question

I am trying to create a Jenkins build on a windows box, and am running into a situation where I am completely unsure of what to do. I have the following shell script which I need to convert to a windows batch script for when the build runs. I have I believe gotten the set correct for the variables, just not sure what to do with the rest of it:

#set POWERUSER=DTCURTISS
#set POWERPASS=password
set POWERUSER=auto
set POWERPASS=password
set TAG=$BUILD_NUMBER
set PATH=.env/bin:$PATH
set SAUCEUSER=DarthOpto
set ACCESSKEY=accesskey
set IGNOREPAGEHEADERLOCATION=True
set MAINMENUCLICKTILES=False
set LOGDIR=logs

source ../.env/bin/activate

cd trunk/automation/selenium/src
#pip install -r pip-requires.txt

rm -rf logs

nosetests --nocapture --with-xunitmp -a valallmod --processes=$THREADS --process-  timeout=5000
Was it helpful?

Solution

You are not going to get far if you don't know . Besides, simply "translating" bash to batch is not going to magically make it work on Windows.

Variables are referenced as %VARNAME%, not $VARNAME. Fix that first.

Windows uses \ as path separator, not /. Change all your paths to use \

When you want to append to PATH variable in Windows, you've got to make sure you don't destroy the existing PATH. You do this through set PATH=%PATH%;C:\whatever\yourpath\

Something similar to source would be batch's call followed by another batch file name. However you can't just pass it ../.env/bin/activate as that is not a batch file. You would need to convert that file to batch as well. And don't forget to convert the path separator to \. This is also where my second point comes into play. The file you pasted is rather simple. I've got no idea what's inside that other file or whether it can be "translated".

The # is not a valid comment in batch, you need to use REM or better yet ::

rm and it's flags is not a Windows command. An equivalent would be rmdir /s /q

Finally, nosetests is neither bash nor batch. It's an external program. You've got to make sure it is available in Windows. As a pre-emptive step before your next question, read this: 'nosetests' not recognized on Windows after being installed and added to PATH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top