Skip to content

Commit 3c7530a

Browse files
authored
fix(build, staged): fix cache mounts (#6714)
Signed-off-by: Yaroslav Pershin <62902094+iapershin@users.noreply.github.com>
1 parent 45696e1 commit 3c7530a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: pkg/buildah/native_linux.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -1148,9 +1148,14 @@ func generateRunMounts(mounts []*instructions.Mount) []string {
11481148
options = append(options, fmt.Sprintf("id=%s", mount.CacheID))
11491149
}
11501150
if mount.ReadOnly {
1151+
// Common Options:
1152+
// · ro, read-only: (default true for `type=bind`, false for `type=tmpfs`, `type=cache`).
1153+
// Options specific to cache:
1154+
// · ro, readonly: read only cache if set.
1155+
// rw is default, and if you specify it explicitly, it will not work
1156+
// Ref: https://github.com/containers/buildah/blob/main/docs/buildah-run.1.md
1157+
// possibly buildah bug
11511158
options = append(options, "ro")
1152-
} else {
1153-
options = append(options, "rw")
11541159
}
11551160
if mount.CacheSharing != "" {
11561161
options = append(options, fmt.Sprintf("sharing=%s", mount.CacheSharing))

0 commit comments

Comments
 (0)