Skip to content

Instantly share code, notes, and snippets.

@thomast1906
Created November 29, 2023 16:36
Show Gist options
  • Save thomast1906/d95ac1ae17038ff4711b9bb19b9b239b to your computer and use it in GitHub Desktop.
Save thomast1906/d95ac1ae17038ff4711b9bb19b9b239b to your computer and use it in GitHub Desktop.
n/a
name: $(BuildDefinitionName)_$(date:yyyyMMdd)$(rev:.r)
parameters:
- name: tests
type: object
default: ['example1', 'example2']
stages:
- ${{ each test in parameters.tests }}:
- stage: thomas_${{test }}
jobs:
- job: ThomasT
displayName: 'example'
steps:
- task: Bash@3
displayName: 'Echo Test'
name: 'ADO_variables'
inputs:
targetType: inline
script: |
VALUE1=${{ test }}
if [ "$VALUE1" == "example1" ]; then
echo "A"
echo "test ${{ test }}"
echo "##vso[task.setvariable variable=NEW_VALUE;isOutput=true]value1"
elif [ "$VALUE1" == "example2" ]; then
echo "B"
echo "test ${{ test }}"
echo "##vso[task.setvariable variable=NEW_VALUE;isOutput=true]value2"
else
echo "C"
echo "test ${{ test }}"
echo "##vso[task.setvariable variable=NEW_VALUE;isOutput=true]value3"
fi
- stage: thomas2_${{test }}
dependsOn: thomas_${{test }}
jobs:
- job: ThomasT2
variables:
NEW_VALUE_EXAMPLE: $[stageDependencies.thomas_${{test }}.ThomasT.outputs['ADO_variables.NEW_VALUE']]
displayName: 'example'
steps:
- task: Bash@3
displayName: 'Echo Test'
inputs:
targetType: inline
script: |
echo "new value is $NEW_VALUE_EXAMPLE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment