diff options
author | 2019-05-28 14:47:24 -0700 | |
---|---|---|
committer | 2019-05-28 14:47:24 -0700 | |
commit | 6e7be6272be95f93714c234f5fe026921d015de6 (patch) | |
tree | 8e7f21f74503c7a340d4a99728c650308594cf13 | |
parent | Don't install dev dependencies in Docker image (diff) |
Build venv image in PRs when Pipfiles change
-rw-r--r-- | azure-pipelines.yml | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 164e11d..146cd95 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,7 +36,6 @@ jobs: variables: BASE_CHANGED: true VENV_CHANGED: true - PIPFILE_CHANGED: true steps: - task: Docker@1 @@ -74,16 +73,9 @@ jobs: if [[ -z "$(docker images -q pythondiscord/snekbox-venv:latest)" ]]; then echo "The venv image does not exist so it will be built." - else - if [[ -z "$(git diff $PREV_COMMIT -- docker/venv.Dockerfile)" ]]; then - echo "No changes detected in docker/venv.Dockerfile. The venv image will not be built." - echo "##vso[task.setvariable variable=VENV_CHANGED]false" - fi - - if [[ -z "$(git diff $PREV_COMMIT -- Pipfile*)" ]]; then - echo "No changes detected in Pipfile or Pipfile.lock. The venv image will not be built, unless venv.Dockerfile changed or the image doesn't exist." - echo "##vso[task.setvariable variable=PIPFILE_CHANGED]false" - fi + elif [[ -z "$(git diff $PREV_COMMIT -- docker/venv.Dockerfile Pipfile*)" ]]; then + echo "No changes detected in docker/venv.Dockerfile or the Pipfiles. The venv image will not be built." + echo "##vso[task.setvariable variable=VENV_CHANGED]false" fi else echo "No previous commit was retrieved. Either the previous build is too old and was deleted or the branch was empty before this build. All images will be built." @@ -96,7 +88,7 @@ jobs: - script: docker build -t pythondiscord/snekbox-venv:latest -f docker/venv.Dockerfile . displayName: 'Build Virtual Environment Image' - condition: and(succeeded(), or(eq(variables.BASE_CHANGED, 'true'), eq(variables.VENV_CHANGED, 'true'), and(eq(variables.PIPFILE_CHANGED, 'true'), ne(variables['Build.Reason'], 'PullRequest')))) + condition: and(succeeded(), or(eq(variables.BASE_CHANGED, 'true'), eq(variables.VENV_CHANGED, 'true'))) - script: docker build -t pythondiscord/snekbox:latest -f docker/Dockerfile . displayName: 'Build Final Image' @@ -108,7 +100,7 @@ jobs: - script: docker push pythondiscord/snekbox-venv:latest displayName: 'Push Virtual Environment Image to Dockerhub' - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or(eq(variables.BASE_CHANGED, 'true'), eq(variables.VENV_CHANGED, 'true'), eq(variables.PIPFILE_CHANGED, 'true'))) + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or(eq(variables.BASE_CHANGED, 'true'), eq(variables.VENV_CHANGED, 'true'))) - script: docker push pythondiscord/snekbox:latest displayName: 'Push Final Image to Dockerhub' |