I'm trying to setup CD to staging for one of our apps. I have it set up to do the following:
- merge to master causes TFS Build and autodeploys to devlab
- build step kicks off e2e tests in tfs and runs tests against devlab
- IF e2e tests pass, I want to promote the build to staging then i'll repeat the steps (stopping short of auto-deploy to prod)
here's where I'm encountering my issue:
I've got a build step on the e2e test build called "promote project to octopus" - this build also runs on a scheduled cadence (nightly), so I only want the last step (promote project to octopus) IF the user who kicked off the test is octopus-user
(it's the name we gave the bot).
using this as a resource: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=azure-devops&tabs=yaml#examples
on the 'custom condition" of this build step, i've tried several different variables using the guidance provided in the link above. Here are 2 examples:
and(succeeded(),equals(variables['Build.RequestedBy],'octopus-user'))
and(succeeded(), equals(variables['Build.RequestedFor'], 'octopus-user'))
IF I remove this variable the build succeeds and promotes the build to staging, as expected. When I insert the variable/s I get different failures, anyone have guidance on how to set a variable to kick off if it's for kicked off by a specific user? (in this case octopus-user
) - could the issue be the format of the username, perhaps it needs to be the email address (though I've tried that, as well as the AD credentials for the user).