aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-10-07 19:22:40 +0900
committerOphestra <cat@gensokyo.uk>2026-10-07 19:32:48 +0900
commit1c0d8abc5a3d4bc803b0cb3785d7a03b6b5993a3 (patch)
treed87d23171ba6de8ef6335f061e573d8b507a640c
parent1548b0b9778f4ca93a35e5d7645ec7c8064ad50f (diff)
internal/workflows: remove dedicated dist jobsstaging
It is much easier to obtain these dist tarballs via cmd/mbf, and gitea has been acting up again, taking minutes of retrying before finally accepting the artifacts. This change removes them altogether and reverts to contacting the cmd/mbf CI service. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--.gitea/workflows/test.yml2
-rwxr-xr-xinternal/workflows/build.sh2
-rw-r--r--internal/workflows/step.go50
-rw-r--r--internal/workflows/test.go45
4 files changed, 21 insertions, 78 deletions
diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml
index 4b3a4cfe..85841526 100644
--- a/.gitea/workflows/test.yml
+++ b/.gitea/workflows/test.yml
@@ -1 +1 @@
-{"name":"Test","on":["push"],"jobs":{"hakurei-legacy":{"name":"Hakurei (legacy)","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./cmd/hakurei/testsuite#checks.x86_64-linux.hakurei"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"hakurei-vm-output","path":"result/*","retention-days":1}}]},"hakurei-race-legacy":{"name":"Hakurei (legacy with race instrument)","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./cmd/hakurei/testsuite#checks.x86_64-linux.race"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"hakurei-race-vm-output","path":"result/*","retention-days":1}}]},"sandbox":{"name":"Sandbox","needs":["dist"],"runs-on":"rosa","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Download hakurei distribution","uses":"actions/download-artifact@v3","id":"download","with":{"name":"dist-${{ needs.dist.outputs.rev }}","path":"/tmp/dist"}},{"name":"Install hakurei","run":"HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)\" \u0026\u0026 tar -C /tmp/dist -xf /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64.tar.gz \u0026\u0026 /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64/install.sh \u0026\u0026 rm -rf /tmp/dist \u0026\u0026 sudo -u ubuntu hakurei version"},{"name":"Compile and run test suite","run":"unshare -n go run -tags=testsuite ./cmd/hakurei/testsuite/sandbox"}]},"sandbox-race":{"name":"Sandbox (with race instrument)","needs":["dist-race"],"runs-on":"rosa","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Download hakurei distribution","uses":"actions/download-artifact@v3","id":"download","with":{"name":"dist-${{ needs.dist-race.outputs.rev }}-race","path":"/tmp/dist"}},{"name":"Install hakurei","run":"HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)\" \u0026\u0026 tar -C /tmp/dist -xf /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64.tar.gz \u0026\u0026 /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64/install.sh \u0026\u0026 rm -rf /tmp/dist \u0026\u0026 sudo -u ubuntu hakurei version"},{"name":"Compile and run test suite","run":"unshare -n go run -tags=testsuite ./cmd/hakurei/testsuite/sandbox"}]},"sharefs":{"name":"ShareFS","needs":["dist"],"runs-on":"rosa","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Download hakurei distribution","uses":"actions/download-artifact@v3","id":"download","with":{"name":"dist-${{ needs.dist.outputs.rev }}","path":"/tmp/dist"}},{"name":"Install hakurei","run":"HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)\" \u0026\u0026 tar -C /tmp/dist -xf /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64.tar.gz \u0026\u0026 /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64/install.sh \u0026\u0026 rm -rf /tmp/dist \u0026\u0026 sudo -u ubuntu hakurei version"},{"name":"Mount sharefs","run":"useradd -ru 1023 -md /var/lib/sdcard -k /var/empty -s /sbin/nologin media_rw \u0026\u0026 install -dm0 /sdcard \u0026\u0026 sharefs -o rw,noexec,nosuid,nodev,noatime,allow_other,mkdir,source=/var/lib/sdcard,setuid=1023,setgid=1023 /sdcard"},{"name":"Compile and run test suite","run":"sharefs -V \u0026\u0026 go run -tags=testsuite ./cmd/sharefs/testsuite"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"fs_mark","path":"result/*","retention-days":1}}]},"dist":{"name":"Create distribution","runs-on":"rosa","outputs":{"rev":"${{ steps.dist.outputs.rev }}"},"steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Request distribution","id":"dist","run":"HAKUREI_REV=\"$(git rev-parse --short HEAD)\" \u0026\u0026 /rosa/bin/mbf ci dist -o result . \"$(cat cmd/dist/VERSION)-$HAKUREI_REV\" \u0026\u0026 echo \"rev=$HAKUREI_REV\" \u003e\u003e \"$GITHUB_OUTPUT\""},{"name":"Upload distribution","uses":"actions/upload-artifact@v3","with":{"name":"dist-${{ steps.dist.outputs.rev }}","path":"result/*","retention-days":1}}]},"dist-race":{"name":"Create distribution (with race instrument)","runs-on":"rosa","outputs":{"rev":"${{ steps.dist.outputs.rev }}"},"steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Request distribution","id":"dist","run":"HAKUREI_REV=\"$(git rev-parse --short HEAD)\" \u0026\u0026 /rosa/bin/mbf ci race -o result . \"$(cat cmd/dist/VERSION)-$HAKUREI_REV\" \u0026\u0026 echo \"rev=$HAKUREI_REV\" \u003e\u003e \"$GITHUB_OUTPUT\""},{"name":"Upload distribution","uses":"actions/upload-artifact@v3","with":{"name":"dist-${{ steps.dist.outputs.rev }}-race","path":"result/*","retention-days":1}}]}}}
+{"name":"Test","on":["push"],"jobs":{"hakurei-legacy":{"name":"Hakurei (legacy)","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./cmd/hakurei/testsuite#checks.x86_64-linux.hakurei"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"hakurei-vm-output","path":"result/*","retention-days":1}}]},"hakurei-race-legacy":{"name":"Hakurei (legacy with race instrument)","runs-on":"nix","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Run NixOS test","run":"nix build --out-link result --print-out-paths --print-build-logs ./cmd/hakurei/testsuite#checks.x86_64-linux.race"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"hakurei-race-vm-output","path":"result/*","retention-days":1}}]},"sandbox":{"name":"Sandbox","runs-on":"rosa","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Request distribution","id":"dist","run":"HAKUREI_REV=\"$(git rev-parse --short HEAD)\" \u0026\u0026 /rosa/bin/mbf ci dist -o /tmp/dist . \"$(cat cmd/dist/VERSION)-$HAKUREI_REV\" \u0026\u0026 echo \"rev=$HAKUREI_REV\" \u003e\u003e \"$GITHUB_OUTPUT\""},{"name":"Install hakurei","run":"HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)\" \u0026\u0026 tar -C /tmp/dist -xf /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64.tar.gz \u0026\u0026 /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64/install.sh \u0026\u0026 rm -rf /tmp/dist \u0026\u0026 sudo -u ubuntu hakurei version"},{"name":"Compile and run test suite","run":"unshare -n go run -tags=testsuite ./cmd/hakurei/testsuite/sandbox"}]},"sandbox-race":{"name":"Sandbox (with race instrument)","runs-on":"rosa","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Request distribution","id":"dist","run":"HAKUREI_REV=\"$(git rev-parse --short HEAD)\" \u0026\u0026 /rosa/bin/mbf ci race -o /tmp/dist . \"$(cat cmd/dist/VERSION)-$HAKUREI_REV\" \u0026\u0026 echo \"rev=$HAKUREI_REV\" \u003e\u003e \"$GITHUB_OUTPUT\""},{"name":"Install hakurei","run":"HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)\" \u0026\u0026 tar -C /tmp/dist -xf /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64.tar.gz \u0026\u0026 /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64/install.sh \u0026\u0026 rm -rf /tmp/dist \u0026\u0026 sudo -u ubuntu hakurei version"},{"name":"Compile and run test suite","run":"unshare -n go run -tags=testsuite ./cmd/hakurei/testsuite/sandbox"}]},"sharefs":{"name":"ShareFS","runs-on":"rosa","steps":[{"name":"Checkout","uses":"actions/checkout@v4"},{"name":"Request distribution","id":"dist","run":"HAKUREI_REV=\"$(git rev-parse --short HEAD)\" \u0026\u0026 /rosa/bin/mbf ci dist -o /tmp/dist . \"$(cat cmd/dist/VERSION)-$HAKUREI_REV\" \u0026\u0026 echo \"rev=$HAKUREI_REV\" \u003e\u003e \"$GITHUB_OUTPUT\""},{"name":"Install hakurei","run":"HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)\" \u0026\u0026 tar -C /tmp/dist -xf /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64.tar.gz \u0026\u0026 /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64/install.sh \u0026\u0026 rm -rf /tmp/dist \u0026\u0026 sudo -u ubuntu hakurei version"},{"name":"Mount sharefs","run":"useradd -ru 1023 -md /var/lib/sdcard -k /var/empty -s /sbin/nologin media_rw \u0026\u0026 install -dm0 /sdcard \u0026\u0026 sharefs -o rw,noexec,nosuid,nodev,noatime,allow_other,mkdir,source=/var/lib/sdcard,setuid=1023,setgid=1023 /sdcard"},{"name":"Compile and run test suite","run":"sharefs -V \u0026\u0026 go run -tags=testsuite ./cmd/sharefs/testsuite"},{"name":"Upload test output","uses":"actions/upload-artifact@v3","with":{"name":"fs_mark","path":"result/*","retention-days":1}}]}}}
diff --git a/internal/workflows/build.sh b/internal/workflows/build.sh
index f7b266a0..2df8656e 100755
--- a/internal/workflows/build.sh
+++ b/internal/workflows/build.sh
@@ -1,5 +1,5 @@
#!/bin/sh -e
TAG="git.gensokyo.uk/rosa/runner:latest"
-podman build -t "$TAG" --format docker .
+podman build -t "$TAG" --format docker "$(dirname -- "$0")"
podman push "$TAG"
diff --git a/internal/workflows/step.go b/internal/workflows/step.go
index b53671b6..5175d4d5 100644
--- a/internal/workflows/step.go
+++ b/internal/workflows/step.go
@@ -33,41 +33,23 @@ func newCIRequest(display, name, id string) Step {
}
}
-// download is a step to obtain a hakurei distribution.
-var download = Step{
- Name: "Download hakurei distribution",
- ID: "download",
- Uses: "actions/download-artifact@v3",
+var (
+ // dist is a step to obtain a hakurei distribution.
+ dist = newCIRequest("distribution", "dist -o /tmp/dist", "dist")
+ // _dist is like dist, but with race instrument.
+ _dist = newCIRequest("distribution", "race -o /tmp/dist", "dist")
- With: []KV[any]{
- {"name", "dist-${{ needs.dist.outputs.rev }}"},
- {"path", "/tmp/dist"},
- },
-}
-
-// _download is like download, but with race instrument.
-var _download = Step{
- Name: "Download hakurei distribution",
- ID: "download",
- Uses: "actions/download-artifact@v3",
-
- With: []KV[any]{
- {"name", "dist-${{ needs.dist-race.outputs.rev }}-race"},
- {"path", "/tmp/dist"},
- },
-}
-
-// install is a step to unpack and deploy a hakurei distribution created by a
-// step with identifier dist.
-var install = Step{
- Name: "Install hakurei",
- Run: "HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)\" && " +
- "tar -C /tmp/dist " +
- "-xf /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64.tar.gz && " +
- "/tmp/dist/hakurei-$HAKUREI_VERSION*-amd64/install.sh && " +
- "rm -rf /tmp/dist && " +
- "sudo -u ubuntu hakurei version",
-}
+ // install is a step to unpack and deploy a hakurei distribution in /tmp/dist.
+ install = Step{
+ Name: "Install hakurei",
+ Run: "HAKUREI_VERSION=\"$(cat cmd/dist/VERSION)\" && " +
+ "tar -C /tmp/dist " +
+ "-xf /tmp/dist/hakurei-$HAKUREI_VERSION*-amd64.tar.gz && " +
+ "/tmp/dist/hakurei-$HAKUREI_VERSION*-amd64/install.sh && " +
+ "rm -rf /tmp/dist && " +
+ "sudo -u ubuntu hakurei version",
+ }
+)
// newTestsuite returns a step for running an integration test suite.
func newTestsuite(name, prefix string) Step {
diff --git a/internal/workflows/test.go b/internal/workflows/test.go
index 6cea7842..5ca795c6 100644
--- a/internal/workflows/test.go
+++ b/internal/workflows/test.go
@@ -33,10 +33,9 @@ var _ = (&Workflow{
Name: "Sandbox",
On: "rosa",
- Needs: []string{"dist"},
Steps: []Step{
checkout,
- download,
+ dist,
install,
newTestsuite("hakurei/testsuite/sandbox", "unshare -n "),
},
@@ -46,10 +45,9 @@ var _ = (&Workflow{
Name: "Sandbox (with race instrument)",
On: "rosa",
- Needs: []string{"dist-race"},
Steps: []Step{
checkout,
- _download,
+ _dist,
install,
newTestsuite("hakurei/testsuite/sandbox", "unshare -n "),
},
@@ -59,10 +57,9 @@ var _ = (&Workflow{
Name: "ShareFS",
On: "rosa",
- Needs: []string{"dist"},
Steps: []Step{
checkout,
- download,
+ dist,
install,
{
@@ -83,41 +80,5 @@ var _ = (&Workflow{
newUploadArtifact("test output", "fs_mark"),
},
}},
-
- {"dist", Job{
- Name: "Create distribution",
- On: "rosa",
-
- Outputs: []KV[string]{
- {"rev", "${{ steps.dist.outputs.rev }}"},
- },
-
- Steps: []Step{
- checkout,
- newCIRequest("distribution", "dist -o result", "dist"),
- newUploadArtifact(
- "distribution",
- "dist-${{ steps.dist.outputs.rev }}",
- ),
- },
- }},
-
- {"dist-race", Job{
- Name: "Create distribution (with race instrument)",
- On: "rosa",
-
- Outputs: []KV[string]{
- {"rev", "${{ steps.dist.outputs.rev }}"},
- },
-
- Steps: []Step{
- checkout,
- newCIRequest("distribution", "race -o result", "dist"),
- newUploadArtifact(
- "distribution",
- "dist-${{ steps.dist.outputs.rev }}-race",
- ),
- },
- }},
},
}).mustWriteFile("test")