Skip to content

Commit

Permalink
Merge branch 'master' into 32-add-a-fat-jar-release
Browse files Browse the repository at this point in the history
  • Loading branch information
munishchouhan authored Dec 5, 2023
2 parents 33557f2 + 9c925b7 commit abc8eaa
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 13 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ on:
- '!refs/tags/.*'
tags-ignore:
- '*'
pull_request:
types: [opened, reopened, synchronize]
branches:
- '*'
- '!refs/tags/.*'
tags-ignore:
- '*'
jobs:
build:
name: Wave on ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.1.1
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'io.seqera.wave.cli.java-application-conventions'
id 'groovy'
id 'org.graalvm.buildtools.native' version '0.9.24'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'org.graalvm.buildtools.native' version '0.9.28'
}

java {
Expand All @@ -22,7 +22,7 @@ repositories {

dependencies {
implementation 'io.seqera:wave-api:0.5.0'
implementation 'io.seqera:wave-utils:0.7.8'
implementation 'io.seqera:wave-utils:0.8.0'
implementation 'info.picocli:picocli:4.6.1'
implementation 'com.squareup.moshi:moshi:1.14.0'
implementation 'com.squareup.moshi:moshi-adapters:1.14.0'
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/io/seqera/wave/cli/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,6 @@ protected void validateArgs() {
if( !isEmpty(platform) && !VALID_PLATFORMS.contains(platform) )
throw new IllegalCliArgumentException(String.format("Unsupported container platform: '%s'", platform));

if( singularity && !isEmpty(platform) && platform.contains("arm64") )
throw new IllegalCliArgumentException("Options --platform is currently not supported by Singularity native build");

}

protected Client client() {
Expand Down
13 changes: 12 additions & 1 deletion app/src/main/java/io/seqera/wave/cli/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
package io.seqera.wave.cli;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
Expand Down Expand Up @@ -146,11 +148,20 @@ protected HttpResponse<String> httpSend(HttpRequest req) {
});
}

protected String protocol(String endpoint) {
if( StringUtils.isEmpty(endpoint) )
return "https://";
try {
return new URL(endpoint).getProtocol() + "://";
} catch (MalformedURLException e) {
throw new RuntimeException("Invalid endpoint URL: " + endpoint, e);
}
}

protected URI imageToManifestUri(String image) {
final int p = image.indexOf('/');
if( p==-1 ) throw new IllegalArgumentException("Invalid container name: "+image);
final String result = "https://" + image.substring(0,p) + "/v2" + image.substring(p).replace(":","/manifests/");
final String result = protocol(endpoint) + image.substring(0,p) + "/v2" + image.substring(p).replace(":","/manifests/");
return URI.create(result);
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/resources/META-INF/build-info.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
#

name=wave-cli
version=0.7.0
version=1.1.0
commitId=unknown
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class AppCondaOptsTest extends Specification {
&& micromamba install -y -n base conda-forge::procps-ng \\
&& micromamba clean -a -y
USER root
ENV PATH="$MAMBA_ROOT_PREFIX/bin:$PATH"
'''.stripIndent()
and:
new String(req.condaFile.decodeBase64()) == CONDA_RECIPE
Expand All @@ -162,6 +163,7 @@ class AppCondaOptsTest extends Specification {
&& micromamba install -y -n base conda-forge::procps-ng \\
&& micromamba clean -a -y
USER root
ENV PATH="$MAMBA_ROOT_PREFIX/bin:$PATH"
'''.stripIndent()
and:
new String(req.condaFile.decodeBase64()) == '''\
Expand Down Expand Up @@ -192,6 +194,7 @@ class AppCondaOptsTest extends Specification {
&& micromamba install -y -n base conda-forge::procps-ng \\
&& micromamba clean -a -y
USER root
ENV PATH="$MAMBA_ROOT_PREFIX/bin:$PATH"
'''.stripIndent()
and:
req.condaFile == null
Expand Down Expand Up @@ -222,6 +225,7 @@ class AppCondaOptsTest extends Specification {
&& micromamba install -y -n base conda-forge::procps-ng \\
&& micromamba clean -a -y
USER root
ENV PATH="$MAMBA_ROOT_PREFIX/bin:$PATH"
RUN one
RUN two
'''.stripIndent()
Expand Down
15 changes: 11 additions & 4 deletions app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,25 @@ class AppTest extends Specification {
noExceptionThrown()
}

def 'should not allow platform arm64 with singularity' () {
def 'should allow platform arm64 with singularity' () {
given:
def app = new App()
String[] args = ['--singularity', "--platform", 'linux/arm64', '-i', 'ubuntu', '--freeze', '--build-repo', 'docker.io/foo', '--tower-token', 'xyz']
String[] args = [ '--singularity', "--platform", 'linux/arm64', '-i', 'ubuntu', '--freeze', '--build-repo', 'docker.io/foo', '--tower-token', 'xyz']

when:
new CommandLine(app).parseArgs(args)
and:
app.validateArgs()

then:
def e = thrown(IllegalCliArgumentException)
e.message == "Options --platform is currently not supported by Singularity native build"
noExceptionThrown()
and:
app.@platform == 'linux/arm64'
app.@image == 'ubuntu'
app.@singularity
app.@freeze
app.@buildRepository == 'docker.io/foo'
app.@towerToken == 'xyz'
}

}
43 changes: 43 additions & 0 deletions app/src/test/groovy/io/seqera/wave/cli/ClientTest.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2023, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package io.seqera.wave.cli

import spock.lang.Specification
import spock.lang.Unroll

/**
*
* @author Paolo Di Tommaso <[email protected]>
*/
class ClientTest extends Specification {

@Unroll
def 'should get endpoint protocol' () {
given:
def client = new Client()
expect:
client.protocol(ENDPOINT) == EXPECTED

where:
ENDPOINT | EXPECTED
null | 'https://'
'http://foo' | 'http://'
'https://bar.com' | 'https://'

}
}
11 changes: 11 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
WAVE CLI CHANGE-LOG
===================
1.1.1 - 30 Nov 2023
- Fix invalid protol prefix with await option [d37faca1]
- Fix execute CI tests on pull requests (#44) [5e236b0a]
- Fix error when a context file path is longer than 100 chars (#26) [d8eed21b]
- Bump org.graalvm.buildtools.native to 0.9.28 (#40) [244be075]
- Bump gradle 8.4 (#39) [399f0b22]

1.1.0 - 10 Nov 2023
- Add ability to specify platform for Singularity build [c19727a5]
- Improve err handling for missing files [98df6ea3]

1.0.0 - 16 Oct 2023
- Initial release
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit abc8eaa

Please sign in to comment.