Skip to content

Commit

Permalink
Tweak CI to fix build-docker-android on main branch (#899)
Browse files Browse the repository at this point in the history
* Tweak CI to fix build-docker-android on main branch

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Fix docker image build CI

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Tweaked ci logs

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

---------

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
  • Loading branch information
Patrik-Stas authored Jul 19, 2023
1 parent 349d82e commit 3009224
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/actions/build-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,23 @@ runs:
GITHUB_REPOSITORY_LOWERCASE=`echo $GITHUB_REPOSITORY | awk '{print tolower($0)}'`
REMOTE_DOCKER_REPOSITORY="${URL_DOCKER_REGISTRY}/${GITHUB_REPOSITORY_LOWERCASE}/${{ inputs.docker-repo-local-name }}"
LAST_BRANCH_BUILD="$REMOTE_DOCKER_REPOSITORY:${{ inputs.branch-name }}"
if ! docker pull "$LAST_BRANCH_BUILD"; then
if [ "${{ inputs.skip-build-optimization }}" == "false" ]; then
if [ "${{ inputs.skip-build-optimization }}" == "false" ]; then
LAST_BRANCH_BUILD="$REMOTE_DOCKER_REPOSITORY:${{ inputs.branch-name }}"
if ! docker pull "$LAST_BRANCH_BUILD"; then
LAST_MASTER_BUILD="$REMOTE_DOCKER_REPOSITORY:${{ inputs.branch-main }}"
echo "Could not pull $LAST_BRANCH_BUILD, will try last master build $LAST_MASTER_BUILD"
if ! docker pull "$LAST_MASTER_BUILD"; then
echo "Could not pull $LAST_MASTER_BUILD either ¯\_(ツ)_/¯. Will just have to build the image from scratch."
else
echo "Pulled image from previous ${{ inputs.branch-main }} branch build. We'll try to reuse the layers from this image."
fi;
else
echo "Will just have to build the image from scratch."
fi
echo "Pulled image from previous CI run on this branch. We'll try to reuse the layers from this image."
fi;
else
echo "Build optimization is disabled, will not attempt to reuse docker layers from previous cached images."
fi;
- name: "If NOT found in cache, build and cache image."
if: steps.loadcachedimg.outputs.cache-hit != 'true'
shell: bash
Expand Down

0 comments on commit 3009224

Please sign in to comment.