Closed youtalk closed 3 months ago
The workflow namings are unclear, so I would like to refactor and rename them in another PR. ref. https://github.com/autowarefoundation/autoware/pull/4747
Unfortunately, this PR still has an issue where the docker-build-and-push-main
workflows cannot restore the cache, even though a fully matching cache is already available. However, since this issue can be resolved in a separate PR, we would like to consider this PR is ready for review for now.
Cache not found for input keys: cache-amd64-cuda-0187c3f0f9a23c6232cfe50f211e9deee563e665bcd440c1d921e03bb67898cc, cache-amd64-cuda-, cache-amd64-
https://github.com/autowarefoundation/autoware/actions/runs/9500467708/job/26183604143#step:6:13
https://github.com/autowarefoundation/autoware/actions/caches
Unfortunately, this PR still has an issue where the
docker-build-and-push-main
workflows cannot restore the cache, even though a fully matching cache is already available. However, since this issue can be resolved in a separate PR, we would like to consider this PR is ready for review for now.
This is happens because the workflow trigger of schedule isolates the cache.
Only scheduled build-main
can get the cache of another scheduled build-main
job, nothing else.
I guess not even workflow_dispatch
event can reach it.
For this to work as intended, docker-build-and-push-main
should maintain its own cache.
Also
cache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('autoware.repos') }}
ccache-build-main-${{ runner.arch }}-humble-${{ github.sha }}
Reasons:
${{ inputs.platform }}
because ${{ runner.arch }}
gives the similar result by using more generic variables.
X86
, X64
, ARM
, or ARM64
.${{ inputs.name }}
is cuda
or no-cuda
cuda
version. Because no-cuda
packages are a subset of cuda
packages.no-cuda
version can restore and use the same cache.actions/cache/save@v4
and actions/cache/restore@v4
actions instead of just using actions/cache@v4
action.
The reason for -${{ github.sha }}
is to know where the cache was created from.
restore-keys: |
ccache-build-main-${{ runner.arch }}-humble-
Will fetch the most fresh version anyways. As long as it is unique, it will be enough.
@youtalk -san, I know you are busy this week and I would like to implement all I've mentioned until wednesday, is that OK?
@xmfcx It's my pleasure! Please go ahead.
Description
The
reproducible-containers/buildkit-cache-dance
action introduced in https://github.com/autowarefoundation/autoware/pull/4854, unfortunately, might not support extracting the cache from thedocker buildx bake
and only supportsdocker build
.I confirmed that replacing
docker/bake-action
withdocker/build-and-push-action
as per the official sample code does indeed enable the cache to work. https://github.com/reproducible-containers/buildkit-cache-dance?tab=readme-ov-file#examplesTherefore, in this PR, we will create a cache by running
docker/build-and-push-action
in thebuild-main
andbuild-main-self-hosted
workflows, which are scheduled to run daily, and in the sequentially executeddocker-build-and-push-main
anddocker-build-and-push-main-self-hosted
workflows, we will rundocker/bake-action
as in the past and only load the cache.It turns out that the cache was effective in https://github.com/autowarefoundation/autoware/pull/4854 because I forgot to delete the cache from the commit during my experiment, which caused the cache to be effective. I apologize for the oversight.
Tests performed
Using this commit to temporarily run the
build-main
workflows in this PR, we confirmed that the execution time from the second run onwards was drastically reduced from the previous 2.5 hours to 1 hour.https://autowarefoundation.github.io/autoware-ci-metrics/
Effects on system behavior
Not applicable.
Interface changes
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.