Skip to content

Commit 9df00c2

Browse files
Merge pull request #528 from appdevforall/fix/K2GO-377-rootfs-artifact-rebrand
K2GO-377 chore(rootfs): rebrand the rootfs artifacts
2 parents c48343d + 7ac1fe2 commit 9df00c2

5 files changed

Lines changed: 51 additions & 17 deletions

File tree

‎.github/workflows/bake-rootfs.yml‎

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ on:
2626
env:
2727
BUCKET_NAME: k2go-rootfs
2828
R2_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
29-
# Public base that goes into the .meta4 <url>. Path-based route
30-
# k2go-download.appdevforall.org/rootfs/* -> k2go-rootfs.
31-
ROOTFS_PUBLIC_BASE: ${{ vars.ROOTFS_PUBLIC_BASE || 'https://k2go-download.appdevforall.org/rootfs' }}
29+
# Public base that goes into the .meta4 <url> — where the APK actually downloads the
30+
# rootfs FROM, so it has to name the bucket that holds it. The two buckets are separate
31+
# and so are their names: k2go-download.appdevforall.org serves the APK repo only.
32+
# K2GO-90: this defaulted to k2go-download.appdevforall.org/rootfs, a path-based route that
33+
# was never created. The metalinks published with it resolved to 404 — and since
34+
# --reset-mirrors leaves a single source, there was nothing to fall back to.
35+
ROOTFS_PUBLIC_BASE: ${{ vars.ROOTFS_PUBLIC_BASE || 'https://pub-d64c885cef6c42db8c7925144d73d0ee.r2.dev' }}
3236
# Key prefix inside the bucket. Empty when the route strips /rootfs/ (keys at root);
3337
# set to 'rootfs/' if the route keeps the prefix.
3438
R2_KEY_PREFIX: ${{ vars.ROOTFS_KEY_PREFIX }}
@@ -133,7 +137,7 @@ jobs:
133137
134138
# 1) Big artifacts FIRST (data before any pointer that resolves to them).
135139
shopt -s nullglob
136-
for f in iiab-oa_*.tar.gz; do
140+
for f in k2go_*.tar.gz; do
137141
echo ">> upload artifact $f"
138142
aws s3 cp "$f" "s3://${BUCKET_NAME}/${PFX}${f}" --endpoint-url "$ENDPOINT"
139143
done
@@ -157,12 +161,12 @@ jobs:
157161
158162
# 4) Prune: keep only the newest $KEEP batches per (tier,arch); delete older + sidecars.
159163
# Only the heavy dated tarballs accumulate (they carry <date>_<sha>); logs and the
160-
# TSV overwrite in place, so they never pile up. The prefix filter matches iiab-oa_*
164+
# TSV overwrite in place, so they never pile up. The prefix filter matches k2go_*
161165
# only, so proot-distro-v*/ is never touched.
162166
for meta in latest_*_"${ARCH}".meta4; do
163167
base="${meta%.meta4}"; te="${base#latest_}"; tier="${te%_${ARCH}}"
164168
mapfile -t keys < <(aws s3api list-objects-v2 --bucket "$BUCKET_NAME" \
165-
--prefix "${PFX}iiab-oa_" --endpoint-url "$ENDPOINT" \
169+
--prefix "${PFX}k2go_" --endpoint-url "$ENDPOINT" \
166170
--query "sort_by(Contents,&LastModified)[?contains(Key,'_${tier}_') && ends_with(Key,'_${ARCH}.tar.gz')].Key" \
167171
--output text | tr '\t' '\n' | sed '/^$/d')
168172
n=${#keys[@]}
@@ -174,4 +178,26 @@ jobs:
174178
done
175179
done
176180
fi
181+
182+
# K2GO-377 (TRANSITIONAL — remove before merging). The retention above keeps the
183+
# newest $KEEP k2go_ batches; the pre-rename iiab-oa_ artifacts have no pointer left
184+
# once this tier republished, so they go in full rather than ageing out $KEEP deep at
185+
# ~1.7 GB each. It sits INSIDE this loop on purpose: it only ever touches the tier and
186+
# arch this job just republished, so a tier that failed to build keeps the artifact its
187+
# metalink still names.
188+
#
189+
# Removal is gated on evidence, not on this run finishing. Delete the block only when
190+
# aws s3api list-objects-v2 --bucket "$BUCKET_NAME" --prefix "iiab-oa_" \
191+
# --endpoint-url "$ENDPOINT" --query "length(Contents)" --output text
192+
# reports None/0 — otherwise the leftovers outlive the only code that would clear them.
193+
mapfile -t legacy < <(aws s3api list-objects-v2 --bucket "$BUCKET_NAME" \
194+
--prefix "${PFX}iiab-oa_" --endpoint-url "$ENDPOINT" \
195+
--query "Contents[?contains(Key,'_${tier}_') && ends_with(Key,'_${ARCH}.tar.gz')].Key" \
196+
--output text | tr '\t' '\n' | sed '/^$/d')
197+
for key in "${legacy[@]}"; do
198+
echo ">> sweep legacy $key (+ sidecars)"
199+
for ext in '' .meta4 .sha256 .installed .torrent; do
200+
aws s3 rm "s3://${BUCKET_NAME}/${key}${ext}" --endpoint-url "$ENDPOINT" || true
201+
done
202+
done
177203
done

‎controller/app/src/main/java/org/iiab/controller/backup/domain/BackupEngine.java‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,20 @@ public final class BackupEngine {
2929

3030
private BackupEngine() {}
3131

32-
/** Suggested external filename: {@code iiab-oa_YYYY.DDD_<epochSecs>_<arch>.tar.gz}. */
32+
/**
33+
* Suggested external filename: {@code k2go_YYYY.DDD_<epochSecs>_<arch>.tar.gz}.
34+
*
35+
* <p>K2GO-377: the prefix follows the built rootfs artifacts onto the product's own name. It is
36+
* only ever a suggestion for the SAF picker — nothing reads it back, and a restore identifies an
37+
* archive by the manifest inside it, so backups written under the old name keep working.
38+
*/
3339
public static String suggestedFileName(Context ctx) {
3440
java.util.Calendar c = java.util.Calendar.getInstance();
3541
int year = c.get(java.util.Calendar.YEAR);
3642
int day = c.get(java.util.Calendar.DAY_OF_YEAR);
3743
String abi = org.iiab.controller.deploy.data.RootfsManifest.appAbiId();
3844
String arch = abi != null && abi.contains("64") ? "aarch64" : "armhf";
39-
return String.format(java.util.Locale.US, "iiab-oa_%04d.%03d_%d_%s.tar.gz",
45+
return String.format(java.util.Locale.US, "k2go_%04d.%03d_%d_%s.tar.gz",
4046
year, day, System.currentTimeMillis() / 1000L, arch);
4147
}
4248

‎controller/app/src/test/java/org/iiab/controller/deploy/domain/ExtractProgressTest.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public void ordinaryNamesAreStillShown() {
3232
public void shortHexLikeWordsAreNotMistakenForDigests() {
3333
assertEquals("deadbeef.conf", ExtractProgress.fileLabel("etc/deadbeef.conf"));
3434
assertEquals("facade.png", ExtractProgress.fileLabel("share/facade.png"));
35-
assertEquals("iiab-oa_2026.224_standard.tar.gz",
36-
ExtractProgress.fileLabel("downloads/iiab-oa_2026.224_standard.tar.gz"));
35+
assertEquals("k2go_2026.224_standard.tar.gz",
36+
ExtractProgress.fileLabel("downloads/k2go_2026.224_standard.tar.gz"));
3737
}
3838

3939
/** Fails open: a name we cannot classify is shown, never hidden on a guess. */

‎controller/app/src/test/java/org/iiab/controller/download/domain/MetalinkFileTest.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ public class MetalinkFileTest {
2121
private static final String META4 =
2222
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
2323
+ "<metalink xmlns=\"urn:ietf:params:xml:ns:metalink\" version=\"4.0\">\n"
24-
+ " <file name=\"iiab-oa_2026.192_standard_17dd521_arm64-v8a.tar.gz\">\n"
24+
+ " <file name=\"k2go_2026.192_standard_17dd521_arm64-v8a.tar.gz\">\n"
2525
+ " <size>1453144579</size>\n"
2626
+ " <hash type=\"sha-256\">" + FILE_HASH + "</hash>\n"
2727
+ " <pieces type=\"sha-256\" length=\"1048576\">\n"
2828
+ " <hash type=\"sha-256\">" + FIRST_PIECE_HASH + "</hash>\n"
2929
+ " <hash type=\"sha-256\">67c19c9e0509ff1aaeb104fce7498f53f02052acb18a241409b6d58c9c114142</hash>\n"
3030
+ " </pieces>\n"
31-
+ " <url>https://iiab.switnet.org/android/rootfs/iiab-oa_2026.192_standard_17dd521_arm64-v8a.tar.gz</url>\n"
32-
+ " <url>https://mirror2.example.org/iiab-oa_2026.192_standard_17dd521_arm64-v8a.tar.gz</url>\n"
31+
+ " <url>https://pub-d64c885cef6c42db8c7925144d73d0ee.r2.dev/k2go_2026.192_standard_17dd521_arm64-v8a.tar.gz</url>\n"
32+
+ " <url>https://mirror2.example.org/k2go_2026.192_standard_17dd521_arm64-v8a.tar.gz</url>\n"
3333
+ " </file>\n"
3434
+ "</metalink>\n";
3535

@@ -40,7 +40,7 @@ private MetalinkFile parse() throws Exception {
4040
}
4141

4242
@Test public void parsesFileName() throws Exception {
43-
assertEquals("iiab-oa_2026.192_standard_17dd521_arm64-v8a.tar.gz", parse().fileName());
43+
assertEquals("k2go_2026.192_standard_17dd521_arm64-v8a.tar.gz", parse().fileName());
4444
}
4545

4646
@Test public void parsesSize() throws Exception {

‎tools/rootfs-builder/build-iiab-rootfs.sh‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
# branch (git ls-remote, then the REST API). --iiab-commit overrides everything.
2323
#
2424
# Output:
25-
# - iiab-oa_<date>_<tier>_<iiab-sha>_<arch>.tar.gz (top-level = installed-rootfs/iiab/)
26-
# - iiab-oa_<...>.tar.gz.meta4 / .torrent (per-artifact, mkmetalink)
25+
# - k2go_<date>_<tier>_<iiab-sha>_<arch>.tar.gz (top-level = installed-rootfs/iiab/)
26+
# - k2go_<...>.tar.gz.meta4 / .torrent (per-artifact, mkmetalink)
2727
# - latest_<tier>_<arch>.meta4 (STABLE pointer the APK requests; a copy of the
2828
# per-artifact .meta4. Inside it, <url> mirrors point at the full-named tarball,
2929
# so this stable name always resolves to the newest build.)
@@ -744,7 +744,9 @@ fi
744744
[[ -n "$IIAB_SHA" ]] || die "Could not determine the iiab/iiab commit id. Pass --iiab-commit <sha>."
745745
log "iiab/iiab id: ${IIAB_SHA} [source: ${IIAB_SRC}]"
746746

747-
ARTIFACT="iiab-oa_${STAMP}_${TIER_NAME}_${IIAB_SHA}_${ARCH}.tar.gz"
747+
# K2GO-377: the artifacts carry the product name. The stable pointers do not change —
748+
# latest_<tier>_<arch>.meta4/.installed never carried a product prefix.
749+
ARTIFACT="k2go_${STAMP}_${TIER_NAME}_${IIAB_SHA}_${ARCH}.tar.gz"
748750
META4="latest_${TIER_NAME}_${ARCH}.meta4"
749751
INSTALLED="latest_${TIER_NAME}_${ARCH}.installed" # ADFA-5110: stable uncompressed-size sidecar
750752

0 commit comments

Comments
 (0)