From 9affc8ec988adbec293e8b8a30b9ee496ea5f51d Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Mon, 21 Sep 2026 17:07:54 +0200 Subject: [PATCH 1/2] Allow multi-platform builds for Singularity format Wave is gaining support for multi-architecture Singularity builds: two per-arch SIF images are built and pushed under a single `oras://` reference wrapped in an OCI image index, so one URL resolves to the right architecture at pull time. Remove the client-side guard that rejected `--singularity` combined with a multi-platform `--platform` value. Freeze mode remains mandatory for Singularity builds, and the `--mirror` and "nothing to build" conflicts are unchanged. Co-Authored-By: Claude Opus 5 --- README.md | 16 ++++++++++++- app/src/main/java/io/seqera/wave/cli/App.java | 3 --- .../groovy/io/seqera/wave/cli/AppTest.groovy | 23 ++++++++++++++++--- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b405166..69516b8 100644 --- a/README.md +++ b/README.md @@ -171,13 +171,27 @@ docker run --platform linux/arm64 $container sh -c 'fastp --version' #### Build a multi-architecture Conda package container (amd64 and arm64) Pass both platforms separated by a comma to build a single multi-architecture image -backed by an index manifest. Note: multi-platform builds are not supported for Singularity. +backed by an index manifest. ```bash container=$(wave --conda-package fastp --platform linux/amd64,linux/arm64) docker run $container sh -c 'fastp --version' ``` +#### Build a multi-architecture Singularity container (amd64 and arm64) + +The same applies to Singularity: a per-architecture SIF image is built for each platform and +published under a single `oras://` URL backed by an OCI image index. Freeze mode and a build +repository are required for Singularity builds. + +```bash +container=$(wave --conda-package fastp --singularity --freeze --build-repo --platform linux/amd64,linux/arm64) +apptainer pull --arch arm64 $container +``` + +Note: Apptainer resolves the architecture at pull time, whereas SingularityCE does not yet +support platform selection for `oras://` references. + #### Build a Singularity container using a Conda package and pushing to a OCI registry ```bash diff --git a/app/src/main/java/io/seqera/wave/cli/App.java b/app/src/main/java/io/seqera/wave/cli/App.java index 27268a0..d3f0398 100644 --- a/app/src/main/java/io/seqera/wave/cli/App.java +++ b/app/src/main/java/io/seqera/wave/cli/App.java @@ -427,9 +427,6 @@ protected void validateArgs() { } } - if( isMultiPlatform() && singularity ) - throw new IllegalCliArgumentException("Multi-platform builds are not supported for Singularity format"); - if( isMultiPlatform() && mirror ) throw new IllegalCliArgumentException("Multi-platform builds and --mirror conflict each other"); diff --git a/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy b/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy index e809bb5..7605c58 100644 --- a/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy +++ b/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy @@ -643,10 +643,27 @@ class AppTest extends Specification { app.@platform == "linux/amd64,linux/arm64" } - def 'should fail when specifying multi-platform and singularity' () { + def 'should allow multi-platform with singularity' () { given: def app = new App() - String[] args = ["--platform", "linux/amd64,linux/arm64", "--singularity", "--freeze", "-f", "Dockerfile"] + String[] args = ["--platform", "linux/amd64,linux/arm64", "--singularity", "--freeze", "-f", "Dockerfile", "--build-repo", "docker.io/foo", "--tower-token", "xyz"] + + when: + new CommandLine(app).parseArgs(args) + app.validateArgs() + + then: + noExceptionThrown() + and: + app.@platform == "linux/amd64,linux/arm64" + app.@singularity + app.@freeze + } + + def 'should fail when specifying multi-platform and singularity without freeze' () { + given: + def app = new App() + String[] args = ["--platform", "linux/amd64,linux/arm64", "--singularity", "-f", "Dockerfile", "--build-repo", "docker.io/foo", "--tower-token", "xyz"] when: new CommandLine(app).parseArgs(args) @@ -654,7 +671,7 @@ class AppTest extends Specification { then: def e = thrown(IllegalCliArgumentException) - e.getMessage() == "Multi-platform builds are not supported for Singularity format" + e.getMessage() == "Singularity build requires enabling freeze mode" } def 'should fail when specifying multi-platform and mirror' () { From 39f0a8036e8c5fc6078ef0d186402fb208e9599a Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Mon, 5 Oct 2026 14:59:03 +0200 Subject: [PATCH 2/2] Drop redundant test and clarify Singularity multi-arch README Co-Authored-By: Claude Opus 5.5 --- README.md | 6 +++--- .../test/groovy/io/seqera/wave/cli/AppTest.groovy | 14 -------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 69516b8..f7e4032 100644 --- a/README.md +++ b/README.md @@ -181,8 +181,8 @@ docker run $container sh -c 'fastp --version' #### Build a multi-architecture Singularity container (amd64 and arm64) The same applies to Singularity: a per-architecture SIF image is built for each platform and -published under a single `oras://` URL backed by an OCI image index. Freeze mode and a build -repository are required for Singularity builds. +published under a single `oras://` URL backed by an OCI image index. Freeze mode is required +for Singularity builds, and a build repository is typically required as well. ```bash container=$(wave --conda-package fastp --singularity --freeze --build-repo --platform linux/amd64,linux/arm64) @@ -190,7 +190,7 @@ apptainer pull --arch arm64 $container ``` Note: Apptainer resolves the architecture at pull time, whereas SingularityCE does not yet -support platform selection for `oras://` references. +support platform selection for `oras://` references (see [sylabs/singularity#4339](https://github.com/sylabs/singularity/pull/4339)). #### Build a Singularity container using a Conda package and pushing to a OCI registry diff --git a/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy b/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy index 7605c58..b9edddb 100644 --- a/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy +++ b/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy @@ -660,20 +660,6 @@ class AppTest extends Specification { app.@freeze } - def 'should fail when specifying multi-platform and singularity without freeze' () { - given: - def app = new App() - String[] args = ["--platform", "linux/amd64,linux/arm64", "--singularity", "-f", "Dockerfile", "--build-repo", "docker.io/foo", "--tower-token", "xyz"] - - when: - new CommandLine(app).parseArgs(args) - app.validateArgs() - - then: - def e = thrown(IllegalCliArgumentException) - e.getMessage() == "Singularity build requires enabling freeze mode" - } - def 'should fail when specifying multi-platform and mirror' () { given: def app = new App()