Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Runners for Windows pipeline - 'If statement' does not execute?

Louis Elston
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 14, 2022

-----------------------------------------

#- if [ $Env:CHANGEBUILDNUMBER == 'Yes' ]; then ./ChangeBuildVersion2.bat $Env:BITBUCKET_BRANCH $Env:BUILDVERSIONNUMBER $Env:BITBUCKET_CLONE_DIR\eLookCommon > $Env:BITBUCKET_CLONE_DIR\Buildlogs\ChangeBuildVersion2.log; fi
The above commented out "if [" line fails because it is looking for an '(' after the if.
So, went to PowerShell format....
- if($Env:CHANGEBUILDNUMBER -eq "Yes") {
echo "CHANGEBUILDNUMBER Variable was Yes, so the build number will be changed."
./ChangeBuildVersion2.bat $Env:BITBUCKET_BRANCH $Env:BUILDVERSIONNUMBER $Env:BITBUCKET_CLONE_DIR\eLookCommon > $Env:BITBUCKET_CLONE_DIR\Buildlogs\ChangeBuildVersion2.log
}
#else
# {
# echo "CHANGEBUILDNUMBER was NOT Yes, so the build number will NOT be changed."
# }
-----------------------------
The  'if' line that you see above (and the commented out else code), do not execute and do not give any errors.  This is what the output look like, basically it is just showing the entire if statement...
NothingHappens.PNG
Is anyone using Bitbucket 'Runners for windows'?  There is absolutely no examples (that I can find).

1 answer

0 votes
Louis Elston
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 23, 2022

This works (using '()', and ';'...

- if ($Env:BUILDVERSIONNUMBER) {git add $Env:BITBUCKET_CLONE_DIR\eLookCommon\CommonAssemblyInfo.cs; git commit -m "Committing new build version number."; git push origin $Env:BITBUCKET_BRANCH}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events