diff options
author | 2019-06-29 20:45:25 -0700 | |
---|---|---|
committer | 2019-06-29 20:45:25 -0700 | |
commit | 972d8d75c9d5ce62e5e5e1bf1e05e7e491b922cf (patch) | |
tree | 6f730b64b8a56dc8d6a908afad9197cd8f11d75c | |
parent | Test unset vars (diff) |
Test conditions
-rw-r--r-- | azure-pipelines.yml | 88 |
1 files changed, 51 insertions, 37 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 469fe51..98e17e5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,40 +1,54 @@ # https://aka.ms/yaml jobs: -- job: test - displayName: 'Lint & Test' - - pool: - vmImage: 'Ubuntu-16.04' - - steps: - - task: ShellScript@2 - inputs: - scriptPath: scripts/check_dockerfiles.sh - name: check2 - displayName: 'Check If Images Need to Be Built' - enabled: false - - - script: | - echo blah - # echo "##vso[task.setvariable variable=BASE_CHANGED;isOutput=true]false" - # echo "##vso[task.setvariable variable=VENV_CHANGED;isOutput=true]false" - # echo "##vso[task.setvariable variable=BASE_PULL;isOutput=true]true" - name: check - - - script: echo $(check.BASE_PULL) - -- job: build - displayName: 'Build' - dependsOn: test - - variables: - BASE_CHANGED: $[ coalesce(dependencies.test.outputs['check.BASE_CHANGED'], true) ] - VENV_CHANGED: $[ coalesce(dependencies.test.outputs['check.VENV_CHANGED'], true) ] - BASE_PULL: $[ coalesce(dependencies.test.outputs['check.BASE_PULL'], false) ] - - steps: - - script: | - echo "${BASE_CHANGED}" - echo "${VENV_CHANGED}" - echo "${BASE_PULL}" + - job: test + displayName: 'Lint & Test' + + pool: + vmImage: 'Ubuntu-16.04' + + steps: + - task: ShellScript@2 + inputs: + scriptPath: scripts/check_dockerfiles.sh + name: check2 + displayName: 'Check If Images Need to Be Built' + enabled: false + + - script: | + echo "##vso[task.setvariable variable=BASE_CHANGED;isOutput=true]false" + echo "##vso[task.setvariable variable=VENV_CHANGED;isOutput=true]false" + echo "##vso[task.setvariable variable=BASE_PULL;isOutput=true]true" + name: check + displayName: 'Set Variables' + + - script: echo $(check.BASE_PULL) + displayName: 'Echo Output Variable in Same Job' + + - script: echo foo + condition: and(succeeded(), eq(check.BASE_PULL, 'true')) + displayName: 'Use Output Variable in Condition' + + - job: build + displayName: 'Build' + dependsOn: test + + variables: + BASE_CHANGED: $[ coalesce(dependencies.test.outputs['check.BASE_CHANGED'], true) ] + VENV_CHANGED: $[ coalesce(dependencies.test.outputs['check.VENV_CHANGED'], true) ] + BASE_PULL: $[ coalesce(dependencies.test.outputs['check.BASE_PULL'], false) ] + + steps: + - script: | + echo "${BASE_CHANGED}" + echo "${VENV_CHANGED}" + echo "${BASE_PULL}" + displayName: 'Echo All Variables' + + - script: echo bar + condition: and(succeeded(), eq(variables.BASE_PULL, 'true')) + displayName: 'Compare String' + + - script: echo baz + condition: and(succeeded(), variables.BASE_PULL) + displayName: 'Compare Implicit Cast' |