diff options
author | 2019-05-13 02:16:25 -0700 | |
---|---|---|
committer | 2019-05-13 02:16:25 -0700 | |
commit | 02e348ac249c1aba2d378ecda9af2a9a8ac1c894 (patch) | |
tree | 65ddb65dc6d8fa20bc0fb1586157d190dc80195e | |
parent | Build images if their Dockerfiles change even in PRs (diff) |
Always build images if they do not exist
-rw-r--r-- | azure-pipelines.yml | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 86beadf..49f62f1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -65,19 +65,25 @@ jobs: if [[ -n $PREV_COMMIT ]]; then echo "Using $PREV_COMMIT to compare diffs." - if [[ -z "$(git diff $PREV_COMMIT -- docker/base.Dockerfile)" ]]; then + if [[ -z "$(docker images -q pythondiscord/snekbox-base:latest)" ]]; then + echo "The base image does not exist so it will be built." + elif [[ -z "$(git diff $PREV_COMMIT -- docker/base.Dockerfile)" ]]; then echo "No changes detected in docker/base.Dockerfile. The base image will not be built." echo "##vso[task.setvariable variable=BASE_CHANGED]false" fi - 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 its Dockerfile changed." - echo "##vso[task.setvariable variable=PIPFILE_CHANGED]false" + 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 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." |