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

CI enhancement: docker workflow speedup #2232

Merged
merged 8 commits into from
Nov 19, 2024

Conversation

aradwann
Copy link
Contributor

@aradwann aradwann commented Nov 7, 2024

I realized that sccache report always says that it is not used,
image
and docker layers aren't cached too

In this PR, I made the following changes:

  • Cached Docker layers: I fixed the gha docker layer cache, the bug was that env vars ACTIONS_CACHE_URL
    ACTIONS_RUNTIME_TOKEN shouldn't be set manually, it populated automatically by gha
  • Removed unnecessary sccache action: The sccache action was removed since it doesn't work with building a Docker image.
  • injected sccache cache between Docker builds: by using reproducible-containers/buildkit-cache-dance@v3

Performance Improvement

  • The Docker build and push workflow time has decreased from 13 minutes to approximately 7 minutes.
    image

this could help resolve restatedev/dev-tools#7

@aradwann aradwann changed the title bump actions Ci enhancement Nov 7, 2024
@aradwann aradwann marked this pull request as ready for review November 9, 2024 13:26
@aradwann aradwann changed the title Ci enhancement CI enhancement: docker workflow speedup Nov 11, 2024
show sccache stats

update cache from/to config

try to optimize dockerfile

fix dockerfile

fix chef command

try to use sccache directory of the gh runner

enable debug logs for sccache

use build context to mount runner sccache to container sccache

fix typo

update sccache dir

update target destination

test

test

test

test

test

test

debug

revert dockerfile changes

try to cache manually

change cache dir

Trigger pipeline: test caching

remove sccache dir

Trigger pipeline: test caching

remove uneeded args

remove mozilla-actions/sccache-action, it doesn't work anyway

Trigger pipeline: test caching docker layers manually

set a better cache invalidation policy

use cargo.lock for cache key better than toml files

Trigger pipeline: local cache should work

fix growing cache size issue

Trigger pipeline: test after fixing growing cache size

try to inject sccache into docker builds

change key for docker caching

debug sccache

add sccache just command

debug sccache env vars

update rust wrapper env var

remove sccache debug logs

Trigger pipeline: test latest state

include dev-tools dockerfile in creating cache key

use cache map

Trigger pipeline: test latest state

try gha cache after letting gha set env vars automatically

Trigger pipeline: test gha cache

clean up after gha worked and try warp build cache

Trigger pipeline: test gha warpbuild cache
@muhamadazmy
Copy link
Contributor

Hi @aradwann . Thank you so much for creating this PR. This LGTM! But i would love to wait for @slinkydeveloper to give his input on it :)

@@ -52,4 +57,4 @@ COPY --from=builder /etc/ssl /etc/ssl
# useful for health checks
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
WORKDIR /
ENTRYPOINT ["/usr/local/bin/restate-server"]
ENTRYPOINT ["/usr/local/bin/restate-server"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can the file continue to end in a newline?

Copy link
Contributor

@jackkleeman jackkleeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this all makes sense to me. I did notice recently that the sccache doesn't seem to be working on docker builds. Thank you!

@aradwann
Copy link
Contributor Author

@muhamadazmy @jackkleeman Thank you for the review 🚀🚀

@jackkleeman jackkleeman merged commit 85c97ed into restatedev:main Nov 19, 2024
9 checks passed
@aradwann aradwann deleted the ci-docker-enhancement branch November 19, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Building Restate in debug mode using the dev-tools docker image is super slow
3 participants