Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak CI to fix build-docker-android on main branch #899

Merged
merged 3 commits into from
Jul 19, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/actions/build-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,21 @@ 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."
fi;
Patrik-Stas marked this conversation as resolved.
Show resolved Hide resolved
else
echo "Will just have to build the image from scratch."
fi
echo "Pulled image from previous CI run on the 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."
Patrik-Stas marked this conversation as resolved.
Show resolved Hide resolved
fi;

- name: "If NOT found in cache, build and cache image."
if: steps.loadcachedimg.outputs.cache-hit != 'true'
shell: bash
Expand Down