eclipse-ankaios / eclipse-ankaios/ank-sdk-rust

Speed up example workload builds

Open
#39 2 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## Description
Currently, the [Dockerfile for example workloads](https://github.com/eclipse-ankaios/ank-sdk-rust/blob/main/examples/app/Dockerfile) includes some cache mount to improve the builds. However, this caching mechanism does not seem to have a suitable effect on the build time.
The build time is very long and no dependencies are cached.

Since a user tries out the examples and might use the existing examples as a starting point for next changes, we can speed up the building time here to speed up incremental builds that are very common when developing a new workload or enhancing the examples.

For this, there are a few tools available handling different types / or all types of caching of a Rust build.

- [cargo chef](https://github.com/LukeMathWalker/cargo-chef): it caches dependencies and builds by putting everything in respect to Cargo.toml into a `receipe.json` similiar to Python's `requirements.txt` file
- [sccache](https://github.com/mozilla/sccache): caches dependencies individually compared to `chef` caching all dependencies at once

The tools can also be used in combination.

A migration from a simple Rust Dockerfile to a newer one inlcuding the optimal caching is easy and works. However, in case of the Rust sdk examples there are more things to consider:
- Prod mode: #10
- Switching examples copies into the main.rs file the content from the example the user chooses and might invalidate the "hash" comparison, so maybe it is anyway treat as "changed" code and recompiled => this must be tested

## Goals

Speeding up workload example build time for incremental development.

## Final result

### Summary

**To be filled when the final solution is sketched.**

### Tasks

- [ ] Assign yourself as `assignee`;
- [ ] Fix the issue;
- [ ] Add a utest for this issue, if it's needed;
- [ ] Document the code similar to how it's done for the other code;
- [ ] Check and fix utests, coverage, clippy and doc;
- [ ] Create Pull Request and fix possible workflow failures;
- [ ] Add the `ready_for_review` label.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.