Skip to content

Commit d7c21b3

Browse files
authored
Merge of #52
2 parents e728a8b + 5b856ed commit d7c21b3

6 files changed

Lines changed: 24 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ jobs:
148148
run: sudo chown -R "$(id -u):$(id -g)" mkosi.output/
149149

150150
- name: Save kernel cache
151-
if: github.ref == 'refs/heads/main'
151+
if: github.ref == 'refs/heads/main' && steps.kernel-cache.outputs.cache-hit != 'true'
152152
uses: actions/cache/save@v4
153153
with:
154154
path: |
@@ -198,7 +198,7 @@ jobs:
198198
run: ./build.py tools
199199

200200
- name: Save tools cache
201-
if: github.ref == 'refs/heads/main'
201+
if: github.ref == 'refs/heads/main' && steps.tools-cache.outputs.cache-hit != 'true'
202202
uses: actions/cache/save@v4
203203
with:
204204
path: |
@@ -245,6 +245,13 @@ jobs:
245245
name: tools-${{ matrix.arch }}
246246
path: mkosi.output/tools/${{ matrix.arch }}
247247

248+
- name: Restore tool binary permissions
249+
run: |
250+
# GitHub Actions artifact upload/download strips execute permissions.
251+
# Restore +x on all tool binaries so they work inside the initramfs.
252+
chmod +x mkosi.output/tools/${{ matrix.arch }}/usr/local/bin/*
253+
chmod +x mkosi.output/tools/${{ matrix.arch }}/opt/cni/bin/*
254+
248255
- name: Refresh apt cache
249256
run: sudo apt-get update
250257

captain/cli/_commands.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ def _clean_version(cfg: Config, clog: StageLogger) -> None:
123123
mkosi_output / "kernel" / kver / cfg.arch,
124124
mkosi_output / "initramfs" / kver / cfg.arch,
125125
mkosi_output / "iso" / kver / cfg.arch,
126-
mkosi_output / "iso-staging" / kver / cfg.arch,
127126
]
128127

129128
has_docker = shutil.which("docker") is not None
@@ -195,13 +194,12 @@ def _clean_all(cfg: Config, clog: StageLogger) -> None:
195194
" /work/mkosi.output/kernel"
196195
" /work/mkosi.output/tools"
197196
" /work/mkosi.output/iso"
198-
" /work/mkosi.output/iso-staging"
199197
" /work/mkosi.cache",
200198
],
201199
)
202200
else:
203201
# No Docker available — remove directly (may need sudo for root-owned mkosi files)
204-
for pattern in ("image*", "initramfs", "kernel", "tools", "iso", "iso-staging"):
202+
for pattern in ("image*", "initramfs", "kernel", "tools", "iso"):
205203
for p in mkosi_output.glob(pattern):
206204
if p.is_dir():
207205
shutil.rmtree(p, ignore_errors=True)

captain/cli/_stages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ def _build_iso_stage(cfg: Config) -> None:
188188
isolog,
189189
[
190190
"/work/mkosi.output/iso",
191-
"/work/mkosi.output/iso-staging",
192191
"/work/out",
193192
],
194193
)

captain/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,4 @@ def iso_output(self) -> Path:
198198
@property
199199
def iso_staging(self) -> Path:
200200
"""Per-version, per-arch staging directory for assembling the ISO filesystem."""
201-
return self.project_dir / "mkosi.output" / "iso-staging" / self.kernel_version / self.arch
201+
return self.iso_output / "staging"

captain/iso.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def build(cfg: Config) -> None:
6565
6666
The ISO layout is::
6767
68-
iso-staging/{arch}/
68+
iso/{version}/{arch}/staging/
6969
├── boot/
7070
│ ├── grub/
7171
│ │ └── grub.cfg

mkosi.finalize

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ if [[ -f "$BUILDROOT/init" ]]; then
3636
echo " /init made executable"
3737
fi
3838

39+
# Ensure tool binaries are executable.
40+
# GitHub Actions artifact upload/download and some archive tools strip
41+
# the execute bit. Re-apply +x to every tool directory so containerd,
42+
# runc, nerdctl, and CNI plugins can actually run.
43+
for dir in usr/local/bin opt/cni/bin; do
44+
target="$BUILDROOT/$dir"
45+
if [[ -d "$target" ]]; then
46+
find "$target" -type f -exec chmod +x {} +
47+
echo " +x restored on $dir/*"
48+
fi
49+
done
50+
3951
# ---------------------------------------------------------------------------
4052
# Trim kernel modules not needed for provisioning.
4153
# The kernel is built with a broad defconfig (modules as =m) so the full set

0 commit comments

Comments
 (0)