-
Notifications
You must be signed in to change notification settings - Fork 25
feat(mounts): Implement mounts option for Recipe and Module #716
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
Open
Aex12
wants to merge
9
commits into
blue-build:main
Choose a base branch
from
Aex12:feat/recipe-mounts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ca4e949
feat: implement mounts option in recipe
Aex12 059f3a8
chore: mounts code review
Aex12 f9def9f
feat: mounts support for modules
Aex12 880f2f2
chore(test-files): add mounts schema to module entry in recipe-v1
Aex12 f84e1e9
fix(mounts): correct selinux labeling for build engine oci
Aex12 c1e5298
chore(mounts): add integration tests
Aex12 720516a
chore(mounts): update schema base url for integration tests
Aex12 a25793a
fix: add missing serde default to recipe mounts
Aex12 a29644c
fix: add cache mounts to all integration tests recipes
Aex12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| #[derive(Debug, Serialize, Deserialize, Clone)] | ||
| pub enum MountCacheSharing { | ||
| /// The cache is shared between all builds. | ||
| #[serde(rename = "shared")] | ||
| Shared, | ||
|
|
||
| /// The cache is private to the current build. | ||
| #[serde(rename = "private")] | ||
| Private, | ||
|
|
||
| /// The cache is shared between builds, but only one build can use it at a time. | ||
| #[serde(rename = "locked")] | ||
| Locked, | ||
| } | ||
| impl std::fmt::Display for MountCacheSharing { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| match self { | ||
| Self::Shared => write!(f, "shared"), | ||
| Self::Private => write!(f, "private"), | ||
| Self::Locked => write!(f, "locked"), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug, Serialize, Deserialize, Clone)] | ||
| #[serde(tag = "type")] | ||
| pub enum Mount { | ||
| /// A bind mount, which mounts a file or directory from the host. | ||
| #[serde(rename = "bind")] | ||
| Bind { | ||
| /// The source path on the host. | ||
| source: String, | ||
| /// The destination path in the container. | ||
| destination: String, | ||
| /// Whether the mount is read-only. | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| read_only: Option<bool>, | ||
| }, | ||
|
|
||
| /// A tmpfs mount, which mounts a temporary file system in memory. | ||
| #[serde(rename = "tmpfs")] | ||
| Tmpfs { | ||
| /// The destination path. | ||
| destination: String, | ||
| /// The size of the tmpfs. Can be specified in bytes or with a suffix (e.g. "100m" for 100 megabytes). | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| size: Option<String>, | ||
| }, | ||
|
|
||
| /// A cache mount, which mounts a cache directory that can be shared between builds. | ||
| #[serde(rename = "cache")] | ||
| Cache { | ||
| /// The destination path. | ||
| destination: String, | ||
| /// The cache ID, which is used to identify the cache. | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| id: Option<String>, | ||
| /// The cache sharing mode. | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| sharing: Option<MountCacheSharing>, | ||
| }, | ||
| } | ||
|
|
||
| impl std::fmt::Display for Mount { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| match self { | ||
| Self::Bind { | ||
| source, | ||
| destination, | ||
| read_only, | ||
| } => { | ||
| write!(f, "type=bind,source={source},dst={destination}")?; | ||
| if let Some(read_only) = read_only | ||
| && *read_only | ||
| { | ||
| write!(f, ",readonly")?; | ||
| } | ||
| } | ||
| Self::Tmpfs { destination, size } => { | ||
| write!(f, "type=tmpfs,dst={destination}")?; | ||
| if let Some(size) = size { | ||
| write!(f, ",size={size}")?; | ||
| } | ||
| } | ||
| Self::Cache { | ||
| destination, | ||
| id, | ||
| sharing, | ||
| } => { | ||
| write!(f, "type=cache")?; | ||
| if let Some(sharing) = sharing { | ||
| write!(f, ",sharing={sharing}")?; | ||
| } | ||
| write!(f, ",dst={destination}")?; | ||
| if let Some(id) = id { | ||
| write!(f, ",id={id}")?; | ||
| } | ||
| } | ||
| } | ||
| Ok(()) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.