diff options
author | 2019-05-12 13:11:43 -0700 | |
---|---|---|
committer | 2019-05-12 13:11:43 -0700 | |
commit | e12e270744b862d4b62d44a5a2f0709d9ab34546 (patch) | |
tree | f8197ddda1c3c7ed39aed2be7e0efcc4f12e75a8 | |
parent | Azure: Add build and push steps for base and venv images (diff) |
Use commit hash variable from variable group
-rw-r--r-- | azure-pipelines.yml | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ad9a7c8..6a77fbc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,6 +34,9 @@ jobs: dependsOn: test condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + variables: + - group: snekbox + steps: - task: Docker@1 displayName: 'Login: Docker Hub' @@ -44,11 +47,11 @@ jobs: command: 'login' - script: | - if [[ -n "$(git diff HEAD~ -- docker/base.Dockerfile)" ]]; then + if [[ -z $COMMIT_HASH ]] || [[ -n "$(git diff $COMMIT_HASH -- docker/base.Dockerfile)" ]]; then echo "##vso[task.setvariable variable=BASE_CHANGED]1" fi - if [[ -n "$(git diff HEAD~ -- Pipfile* docker/venv.Dockerfile)" ]]; then + if [[ -z $COMMIT_HASH ]] || [[ -n "$(git diff $COMMIT_HASH -- Pipfile* docker/venv.Dockerfile)" ]]; then echo "##vso[task.setvariable variable=VENV_CHANGED]1" fi displayName: 'Check Changed Files' @@ -72,5 +75,8 @@ jobs: displayName: 'Push Virtual Environment Image to Dockerhub' condition: and(succeeded(), or(variables.BASE_CHANGED, variables.VENV_CHANGED)) + - script: echo "##vso[task.setvariable variable=COMMIT_HASH]$Build.SourceVersion" + displayName: 'Update Saved Commit Hash' + - script: docker push pythondiscord/snekbox:latest displayName: 'Push Final Image to Dockerhub' |