Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ repositories {
}

dependencies {
implementation 'io.seqera:wave-api:0.14.0'
implementation 'io.seqera:wave-utils:0.15.0'
implementation 'io.seqera:wave-api:0.16.0'
implementation 'io.seqera:wave-utils:0.15.1'
implementation 'info.picocli:picocli:4.6.1'
implementation 'com.squareup.moshi:moshi:1.15.2'
implementation 'com.squareup.moshi:moshi-adapters:1.15.2'
Expand Down
9 changes: 9 additions & 0 deletions app/conf/reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@
{
"name":"groovy.lang.Closure"
},
{
"name":"io.seqera.wave.api.BuildCompression",
"allDeclaredFields":true,
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"io.seqera.wave.api.BuildCompression$Mode",
"fields":[{"name":"estargz"}, {"name":"gzip"}, {"name":"zstd"}]
},
{
"name":"io.seqera.wave.api.BuildContext",
"allDeclaredFields":true,
Expand Down
17 changes: 14 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 @@ -185,18 +185,22 @@ public class App implements Runnable {
@Option(names = {"--include"}, paramLabel = "''", description = "Include one or more containers in the specified base image")
private List<String> includes;

@Option(names = {"--name-strategy"}, paramLabel = "false", description = "Specify the name strategy for the container name, it can be 'none' or 'tagPrefix' or 'imageSuffix'")
@Option(names = {"--name-strategy"}, paramLabel = "<value>", description = "Specify the name strategy for the container name, it can be 'none' or 'tagPrefix' or 'imageSuffix'")
private ImageNameStrategy nameStrategy;

@Option(names = {"-m","--mirror"}, paramLabel = "false", description = "Enable container mirror mode'")
private boolean mirror;

@Option(names = {"--scan-mode"}, paramLabel = "false", description = "Specify container security scan mode, it can be 'none', 'async' or 'required'")
@Option(names = {"--scan-mode"}, paramLabel = "<value>", description = "Specify container security scan mode, it can be 'none', 'async' or 'required'")
private ScanMode scanMode;

@Option(names = {"--scan-level"}, paramLabel = "false", description = "Specify one or more security scan vulnerabilities level allowed in the container e.g. low,medium,high,critical")
@Option(names = {"--scan-level"}, paramLabel = "<value>", description = "Specify one or more security scan vulnerabilities level allowed in the container e.g. low,medium,high,critical")
private List<ScanLevel> scanLevels;

@Option(names = {"--build-compression"}, paramLabel = "<value>", description = "Specify the compression algorithm to be used for the build context, it can be 'gzip', 'zstd' or 'estargz'")
private BuildCompression.Mode buildCompression;


@CommandLine.Parameters
List<String> prompt;

Expand Down Expand Up @@ -413,9 +417,16 @@ protected SubmitContainerTokenRequest createRequest() {
.withMirror(mirror)
.withScanMode(scanMode)
.withScanLevels(scanLevels)
.withBuildCompression(compression(buildCompression))
;
}

BuildCompression compression(BuildCompression.Mode mode) {
if( mode==null )
return null;
return new BuildCompression().withMode(mode);
}

public void inspect() {
final Client client = client();
final ContainerInspectRequest req = new ContainerInspectRequest()
Expand Down
27 changes: 27 additions & 0 deletions app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import java.nio.file.Files
import java.time.Duration
import java.time.Instant

import io.seqera.wave.api.BuildCompression
import io.seqera.wave.api.ContainerStatus
import io.seqera.wave.api.ContainerStatusResponse
import io.seqera.wave.api.ImageNameStrategy
Expand Down Expand Up @@ -308,6 +309,32 @@ class AppTest extends Specification {
req.scanLevels == List.of(ScanLevel.LOW, ScanLevel.MEDIUM)
}

def 'should set build compression gzip' () {
given:
def app = new App()
String[] args = ["--build-compression", 'gzip']

when:
new CommandLine(app).parseArgs(args)
and:
def req = app.createRequest()
then:
req.buildCompression == new BuildCompression().withMode(BuildCompression.Mode.gzip)
}

def 'should set build compression estargz' () {
given:
def app = new App()
String[] args = ["--build-compression", 'estargz']

when:
new CommandLine(app).parseArgs(args)
and:
def req = app.createRequest()
then:
req.buildCompression == new BuildCompression().withMode(BuildCompression.Mode.estargz)
}

def 'should not allow dry-run and await' () {
given:
def app = new App()
Expand Down