forest icon indicating copy to clipboard operation
forest copied to clipboard

[CI] Enable sccache in docker build and publish ci job

Open hanabi1224 opened this issue 2 years ago • 11 comments

Issue summary

Since we have switched sccache backend to DO space, we can enable sccache in build stage with below changes

  • [ ] Implement a build arg flag (e.g. SCCACHE_ENABLED=true) for enabling sccache
  • [ ] Set RUSTC_WRAPPER=sccache when the flag above is on
  • [ ] Download and install proper prebuilt sccache binaries for amd64-linux and arm64-linux respectively
  • [ ] Pass sccache s3 env args via build arg

To convert build arg to env var

ARG SCCACHE_ENDPOINT
ENV SCCACHE_ENDPOINT=$SCCACHE_ENDPOINT

To disable/enable sccache

ARG SCCACHE_ENABLED
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
ENV RUSTC_WRAPPER=${SCCACHE_ENABLED:+sccache}

Other information and links

hanabi1224 avatar May 16 '23 01:05 hanabi1224

@hanabi1224 Is it the same as https://github.com/ChainSafe/forest/issues/2519? If so, let's close one of them.

LesnyRumcajs avatar May 16 '23 06:05 LesnyRumcajs

This one seems to be easier to impl than using action, closed the other one

hanabi1224 avatar May 16 '23 07:05 hanabi1224

@hanabi1224 This is done, right?

lemmih avatar Sep 01 '23 13:09 lemmih

@hanabi1224 bump

LesnyRumcajs avatar Sep 19 '23 09:09 LesnyRumcajs

@lemmih @LesnyRumcajs No I don't think we have enabled sccache in docker build. I can prioritize this task

hanabi1224 avatar Sep 19 '23 09:09 hanabi1224

Do we need it? I mean, is there a compelling reason to have this? What time gains are we talking about?

LesnyRumcajs avatar Sep 19 '23 10:09 LesnyRumcajs

@LesnyRumcajs I think the major benefit is that, we could save some $ by switching from buildjet to GH hosted runners

hanabi1224 avatar Sep 19 '23 10:09 hanabi1224

If it's feasible, then it's all good for me!

LesnyRumcajs avatar Sep 19 '23 14:09 LesnyRumcajs

@hanabi1224 Do we plan to do it?

LesnyRumcajs avatar Apr 11 '24 09:04 LesnyRumcajs

@LesnyRumcajs I believe this has been implemented in https://github.com/ChainSafe/forest/pull/3510 but superseded by the buildjet to fuzzy switch.

hanabi1224 avatar Apr 11 '24 09:04 hanabi1224

We're not running this on fuzzy anymore, given it introduced some nasty race conditions.

LesnyRumcajs avatar Apr 11 '24 09:04 LesnyRumcajs

If this task had been easy, it would already have been done. Closing as our time is worth more than what we spend on buildjet.

lemmih avatar Aug 02 '24 11:08 lemmih