Skip to content

Commit bba0c38

Browse files
committed
fix: use just_executable for ci
1 parent 72f1622 commit bba0c38

File tree

2 files changed

+46
-45
lines changed

2 files changed

+46
-45
lines changed

.github/workflows/reusable-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
with:
5959
target-dir: /var/lib/containers
6060
mount-opts: compress-force=zstd:2
61-
loopback-free: '1'
61+
loopback-free: "1"
6262

6363
- name: Maximize build space
6464
uses: ublue-os/remove-unwanted-software@695eb75bc387dbcd9685a8e72d23439d8686cba6 # v10

Justfile

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,33 @@ export SUDO_DISPLAY := if `if [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-
1616
export SUDOIF := if `id -u` == "0" { "" } else if SUDO_DISPLAY == "true" { "sudo --askpass" } else { "sudo" }
1717
export PODMAN := if path_exists("/usr/bin/podman") == "true" { env("PODMAN", "/usr/bin/podman") } else if path_exists("/usr/bin/docker") == "true" { env("PODMAN", "docker") } else { env("PODMAN", "exit 1 ; ") }
1818
export PULL_POLICY := if PODMAN =~ "docker" { "missing" } else { "newer" }
19+
just := just_executable()
1920

2021
[private]
2122
default:
22-
@just --list
23+
@{{ just }} --list
2324

2425
# Check Just Syntax
2526
[group('Just')]
2627
check:
2728
#!/usr/bin/env bash
2829
find . -type f -name "*.just" | while read -r file; do
2930
echo "Checking syntax: $file"
30-
just --unstable --fmt --check -f $file
31+
{{ just }} --unstable --fmt --check -f $file
3132
done
3233
echo "Checking syntax: Justfile"
33-
just --unstable --fmt --check -f Justfile
34+
{{ just }} --unstable --fmt --check -f Justfile
3435

3536
# Fix Just Syntax
3637
[group('Just')]
3738
fix:
3839
#!/usr/bin/env bash
3940
find . -type f -name "*.just" | while read -r file; do
4041
echo "Checking syntax: $file"
41-
just --unstable --fmt -f $file
42+
{{ just }} --unstable --fmt -f $file
4243
done
4344
echo "Checking syntax: Justfile"
44-
just --unstable --fmt -f Justfile || { exit 1; }
45+
{{ just }} --unstable --fmt -f Justfile || { exit 1; }
4546

4647
# Clean Repo
4748
[group('Utility')]
@@ -53,7 +54,7 @@ clean $image="sarkinite" $tag="stable" $flavor="main":
5354
rm -f previous.manifest.json
5455
rm -f changelog.md
5556
rm -f output.env
56-
image_name=$(just image_name {{ image }} {{ tag }} {{ flavor }})
57+
image_name=$({{ just }} image_name {{ image }} {{ tag }} {{ flavor }})
5758
${PODMAN} rmi localhost/"${image_name}":"${tag}" || true
5859

5960
# Check if valid combo
@@ -98,10 +99,10 @@ build $image="sarkinite" $tag="stable" $flavor="main" rechunk="0" ghcr="0" pipel
9899
set -eoux pipefail
99100

100101
# Validate
101-
just validate "${image}" "${tag}" "${flavor}"
102+
{{ just }} validate "${image}" "${tag}" "${flavor}"
102103

103104
# Image Name
104-
image_name=$(just image_name {{ image }} {{ tag }} {{ flavor }})
105+
image_name=$({{ just }} image_name {{ image }} {{ tag }} {{ flavor }})
105106

106107
# Target
107108
target="base"
@@ -113,10 +114,10 @@ build $image="sarkinite" $tag="stable" $flavor="main" rechunk="0" ghcr="0" pipel
113114
if [[ {{ ghcr }} == "0" ]]; then
114115
rm -f /tmp/manifest.json
115116
fi
116-
fedora_version=$(just fedora_version '{{ image }}' '{{ tag }}' '{{ flavor }}' '{{ kernel_pin }}')
117+
fedora_version=$({{ just }} fedora_version '{{ image }}' '{{ tag }}' '{{ flavor }}' '{{ kernel_pin }}')
117118

118119
# Verify Base Image with cosign
119-
just verify-container "kinoite-main:${fedora_version}"
120+
{{ just }} verify-container "kinoite-main:${fedora_version}"
120121

121122
# Kernel Release/Pin
122123
if [[ -z "${kernel_pin:-}" ]]; then
@@ -126,14 +127,14 @@ build $image="sarkinite" $tag="stable" $flavor="main" rechunk="0" ghcr="0" pipel
126127
fi
127128

128129
# Verify Containers with Cosign
129-
just verify-container "akmods:${akmods_flavor}-${fedora_version}-${kernel_release}"
130+
{{ just }} verify-container "akmods:${akmods_flavor}-${fedora_version}-${kernel_release}"
130131
if [[ "${akmods_flavor}" =~ coreos ]]; then
131-
just verify-container "akmods-zfs:${akmods_flavor}-${fedora_version}-${kernel_release}"
132+
{{ just }} verify-container "akmods-zfs:${akmods_flavor}-${fedora_version}-${kernel_release}"
132133
fi
133134
if [[ "${flavor}" =~ nvidia ]]; then
134-
just verify-container "akmods-nvidia-open:${akmods_flavor}-${fedora_version}-${kernel_release}"
135+
{{ just }} verify-container "akmods-nvidia-open:${akmods_flavor}-${fedora_version}-${kernel_release}"
135136
fi
136-
just verify-container "brew:latest"
137+
{{ just }} verify-container "brew:latest"
137138

138139
# Get Version
139140
if [[ "${tag}" =~ stable ]]; then
@@ -207,17 +208,17 @@ build $image="sarkinite" $tag="stable" $flavor="main" rechunk="0" ghcr="0" pipel
207208

208209
# Rechunk
209210
if [[ "{{ rechunk }}" == "1" && "{{ ghcr }}" == "1" && "{{ pipeline }}" == "1" ]]; then
210-
just rechunk "${image}" "${tag}" "${flavor}" 1 1
211+
{{ just }} rechunk "${image}" "${tag}" "${flavor}" 1 1
211212
elif [[ "{{ rechunk }}" == "1" && "{{ ghcr }}" == "1" ]]; then
212-
just rechunk "${image}" "${tag}" "${flavor}" 1
213+
{{ just }} rechunk "${image}" "${tag}" "${flavor}" 1
213214
elif [[ "{{ rechunk }}" == "1" ]]; then
214-
just rechunk "${image}" "${tag}" "${flavor}"
215+
{{ just }} rechunk "${image}" "${tag}" "${flavor}"
215216
fi
216217

217218
# Build Image and Rechunk
218219
[group('Image')]
219220
build-rechunk image="sarkinite" tag="stable" flavor="main" kernel_pin="":
220-
@just build {{ image }} {{ tag }} {{ flavor }} 1 0 0 {{ kernel_pin }}
221+
@{{ just }} build {{ image }} {{ tag }} {{ flavor }} 1 0 0 {{ kernel_pin }}
221222

222223
# Build Image with GHCR Flag
223224
[group('Image')]
@@ -227,13 +228,13 @@ build-ghcr image="sarkinite" tag="stable" flavor="main" kernel_pin="":
227228
echo "Must Run with sudo or as root..."
228229
exit 1
229230
fi
230-
just build {{ image }} {{ tag }} {{ flavor }} 0 1 0 {{ kernel_pin }}
231+
{{ just }} build {{ image }} {{ tag }} {{ flavor }} 0 1 0 {{ kernel_pin }}
231232

232233
# Build Image for Pipeline:
233234
[group('Image')]
234235
build-pipeline image="sarkinite" tag="stable" flavor="main" kernel_pin="":
235236
#!/usr/bin/env bash
236-
${SUDOIF} just build {{ image }} {{ tag }} {{ flavor }} 1 1 1 {{ kernel_pin }}
237+
${SUDOIF} {{ just }} build {{ image }} {{ tag }} {{ flavor }} 1 1 1 {{ kernel_pin }}
237238

238239
# Rechunk Image
239240
[group('Image')]
@@ -245,15 +246,15 @@ rechunk $image="sarkinite" $tag="stable" $flavor="main" ghcr="0" pipeline="0":
245246
set -eoux pipefail
246247

247248
# Validate
248-
just validate "${image}" "${tag}" "${flavor}"
249+
{{ just }} validate "${image}" "${tag}" "${flavor}"
249250

250251
# Image Name
251-
image_name=$(just image_name {{ image }} {{ tag }} {{ flavor }})
252+
image_name=$({{ just }} image_name {{ image }} {{ tag }} {{ flavor }})
252253

253254
# Check if image is already built
254255
ID=$(${PODMAN} images --filter reference=localhost/"${image_name}":"${tag}" --format "'{{ '{{.ID}}' }}'")
255256
if [[ -z "$ID" ]]; then
256-
just build "${image}" "${tag}" "${flavor}"
257+
{{ just }} build "${image}" "${tag}" "${flavor}"
257258
fi
258259

259260
# Load into Rootful Podman
@@ -387,8 +388,8 @@ rechunk $image="sarkinite" $tag="stable" $flavor="main" ghcr="0" pipeline="0":
387388

388389
# Pipeline Checks
389390
if [[ {{ pipeline }} == "1" && -n "${SUDO_USER:-}" ]]; then
390-
sudo -u "${SUDO_USER}" just load-rechunk "${image}" "${tag}" "${flavor}"
391-
sudo -u "${SUDO_USER}" just secureboot "${image}" "${tag}" "${flavor}"
391+
sudo -u "${SUDO_USER}" {{ just }} load-rechunk "${image}" "${tag}" "${flavor}"
392+
sudo -u "${SUDO_USER}" {{ just }} secureboot "${image}" "${tag}" "${flavor}"
392393
fi
393394

394395
# Load OCI into Podman Store
@@ -398,10 +399,10 @@ load-rechunk image="sarkinite" tag="stable" flavor="main":
398399
set -eou pipefail
399400

400401
# Validate
401-
just validate {{ image }} {{ tag }} {{ flavor }}
402+
{{ just }} validate {{ image }} {{ tag }} {{ flavor }}
402403

403404
# Image Name
404-
image_name=$(just image_name {{ image }} {{ tag }} {{ flavor }})
405+
image_name=$({{ just }} image_name {{ image }} {{ tag }} {{ flavor }})
405406

406407
# Load Image
407408
OUT_NAME="${image_name}_build"
@@ -419,15 +420,15 @@ run $image="sarkinite" $tag="stable" $flavor="main":
419420
set -eoux pipefail
420421

421422
# Validate
422-
just validate "${image}" "${tag}" "${flavor}"
423+
{{ just }} validate "${image}" "${tag}" "${flavor}"
423424

424425
# Image Name
425-
image_name=$(just image_name {{ image }} {{ tag }} {{ flavor }})
426+
image_name=$({{ just }} image_name {{ image }} {{ tag }} {{ flavor }})
426427

427428
# Check if image exists
428429
ID=$(${PODMAN} images --filter reference=localhost/"${image_name}":"${tag}" --format "'{{ '{{.ID}}' }}'")
429430
if [[ -z "$ID" ]]; then
430-
just build "$image" "$tag" "$flavor"
431+
{{ just }} build "$image" "$tag" "$flavor"
431432
fi
432433

433434
# Run Container
@@ -440,10 +441,10 @@ build-iso $image="sarkinite" $tag="stable" $flavor="main" ghcr="0" pipeline="0":
440441
set -eoux pipefail
441442

442443
# Validate
443-
just validate "${image}" "${tag}" "${flavor}"
444+
{{ just }} validate "${image}" "${tag}" "${flavor}"
444445

445446
# Image Name
446-
image_name=$(just image_name {{ image }} {{ tag }} {{ flavor }})
447+
image_name=$({{ just }} image_name {{ image }} {{ tag }} {{ flavor }})
447448

448449
build_dir="${image_name}_build"
449450
mkdir -p "$build_dir"
@@ -463,7 +464,7 @@ build-iso $image="sarkinite" $tag="stable" $flavor="main" ghcr="0" pipeline="0":
463464
IMAGE_REPO=localhost
464465
ID=$(${PODMAN} images --filter reference=localhost/"${image_name}":"${tag}" --format "'{{ '{{.ID}}' }}'")
465466
if [[ -z "$ID" ]]; then
466-
just build "$image" "$tag" "$flavor"
467+
{{ just }} build "$image" "$tag" "$flavor"
467468
fi
468469
fi
469470

@@ -559,7 +560,7 @@ build-iso $image="sarkinite" $tag="stable" $flavor="main" ghcr="0" pipeline="0":
559560
# Build ISO using GHCR Image
560561
[group('ISO')]
561562
build-iso-ghcr image="sarkinite" tag="stable" flavor="main":
562-
@just build-iso {{ image }} {{ tag }} {{ flavor }} 1
563+
@{{ just }} build-iso {{ image }} {{ tag }} {{ flavor }} 1
563564

564565
# Run ISO
565566
[group('ISO')]
@@ -568,14 +569,14 @@ run-iso $image="sarkinite" $tag="stable" $flavor="main":
568569
set -eoux pipefail
569570

570571
# Validate
571-
just validate "${image}" "${tag}" "${flavor}"
572+
{{ just }} validate "${image}" "${tag}" "${flavor}"
572573

573574
# Image Name
574-
image_name=$(just image_name {{ image }} {{ tag }} {{ flavor }})
575+
image_name=$({{ just }} image_name {{ image }} {{ tag }} {{ flavor }})
575576

576577
# Check if ISO Exists
577578
if [[ ! -f "${image_name}_build/${image_name}-${tag}.iso" ]]; then
578-
just build-iso "$image" "$tag" "$flavor"
579+
{{ just }} build-iso "$image" "$tag" "$flavor"
579580
fi
580581

581582
# Determine which port to use
@@ -648,10 +649,10 @@ secureboot $image="sarkinite" $tag="stable" $flavor="main":
648649
set -eou pipefail
649650

650651
# Validate
651-
just validate "${image}" "${tag}" "${flavor}"
652+
{{ just }} validate "${image}" "${tag}" "${flavor}"
652653

653654
# Image Name
654-
image_name=$(just image_name ${image} ${tag} ${flavor})
655+
image_name=$({{ just }} image_name ${image} ${tag} ${flavor})
655656

656657
# Get the vmlinuz to check
657658
kernel_release=$(${PODMAN} inspect "${image_name}":"${tag}" | jq -r '.[].Config.Labels["ostree.linux"]')
@@ -698,7 +699,7 @@ secureboot $image="sarkinite" $tag="stable" $flavor="main":
698699
fedora_version image="sarkinite" tag="stable" flavor="main" $kernel_pin="":
699700
#!/usr/bin/env bash
700701
set -eou pipefail
701-
just validate {{ image }} {{ tag }} {{ flavor }}
702+
{{ just }} validate {{ image }} {{ tag }} {{ flavor }}
702703
skopeo inspect --retry-times 3 docker://quay.io/fedora/fedora-coreos:{{ tag }} > /tmp/manifest.json
703704
fedora_version=$(jq -r '.Labels["org.opencontainers.image.version"]' < /tmp/manifest.json | grep -oE '^[0-9]+')
704705
if [[ -n "${kernel_pin:-}" ]]; then
@@ -713,7 +714,7 @@ fedora_version image="sarkinite" tag="stable" flavor="main" $kernel_pin="":
713714
image_name image="sarkinite" tag="stable" flavor="main":
714715
#!/usr/bin/env bash
715716
set -eou pipefail
716-
just validate {{ image }} {{ tag }} {{ flavor }}
717+
{{ just }} validate {{ image }} {{ tag }} {{ flavor }}
717718
if [[ "{{ flavor }}" =~ main ]]; then
718719
image_name={{ image }}
719720
else
@@ -732,9 +733,9 @@ generate-build-tags image="sarkinite" tag="stable" flavor="main" kernel_pin="" g
732733
if [[ {{ ghcr }} == "0" ]]; then
733734
rm -f /tmp/manifest.json
734735
fi
735-
FEDORA_VERSION="$(just fedora_version '{{ image }}' '{{ tag }}' '{{ flavor }}' '{{ kernel_pin }}')"
736-
DEFAULT_TAG=$(just generate-default-tag {{ tag }} {{ ghcr }})
737-
IMAGE_NAME=$(just image_name {{ image }} {{ tag }} {{ flavor }})
736+
FEDORA_VERSION="$({{ just }} fedora_version '{{ image }}' '{{ tag }}' '{{ flavor }}' '{{ kernel_pin }}')"
737+
DEFAULT_TAG=$({{ just }} generate-default-tag {{ tag }} {{ ghcr }})
738+
IMAGE_NAME=$({{ just }} image_name {{ image }} {{ tag }} {{ flavor }})
738739
# Use Build Version from Rechunk
739740
if [[ -z "${version:-}" ]]; then
740741
version="{{ tag }}-${FEDORA_VERSION}.$(date +%Y%m%d)"

0 commit comments

Comments
 (0)