Good day everyone. I am trying to solve a problem with a build depending on the git branch.
Expected Result: After "if = master" the master folder should be created. If it is "if! = Master" then various. I suspect that the condition does not work at all, because the folder is always created.
I tried like this:
SET branch=%GIT_BRANCH:*/=%
if ($ branch -eq "test") {
Write-Output "Branch test"
}
if ($ branch = "master") {
MD "C: Jenkins workspace Api Api_DEV API_Build_Master_Test Master"
}
else {
MD "C: Jenkins workspace Api Api_DEV API_Build_Master_Test Various"
}
But this method does not work at all, it gives the following error C: Jenkins workspace Api Api_DEV API_Build_Master_Test> SET branch = test-eq was unexpected at this time. I make steps for windows in jenkins, that is, I execute under cmd
question from:https://stackoverflow.com/questions/65845066/build-in-jenkins-depending-on-git-branch