Skip to main content

Posts

Showing posts from May, 2023

How to pass a variable value between Azure Pipeline jobs (within the same stage)?

Since the jobs operate in different namespaces, passing variable values between them is unlike passing a variable value from one function to another. In the example below, $app_Token is the variable name that needs to be sent from one job to another job but within the same stage. This issue can be resolved by dynamically storing the variable in the variable library and retrieving its value from there. The task.setvariable command, which is illustrated below, is required to store variables using PowerShell in the Azure Pipeline library. Full example:  # Maven # Build your Java project and run tests with Apache Maven. # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/java trigger: - master stages: - stage: VariableUpdateAutomation jobs: - job: Set_AppTokenValue pool: vmImage: ubuntu-latest steps: - task: PowerShell@2 name: Set_AppTokenValue i...