Skip to content

Commit

Permalink
[release] bump version 0.13.0-B1
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Sep 29, 2024
1 parent aa20564 commit a61e34e
Show file tree
Hide file tree
Showing 16 changed files with 557 additions and 22 deletions.
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ pluginManagement {


rootProject.name = 'libseqera'
include('lib-mail')
include('wave-api')
include('wave-utils')
2 changes: 1 addition & 1 deletion wave-api/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.0
0.13.0-B1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public enum Status { PENDING, COMPLETED }
/** Build Id */
final public String id;

/** Status of image build */
/** ContainerStatus of image build */
final public Status status;

/** Build start time */
Expand Down Expand Up @@ -69,7 +69,12 @@ public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
BuildStatusResponse that = (BuildStatusResponse) object;
return Objects.equals(id, that.id) && status == that.status && Objects.equals(startTime, that.startTime) && Objects.equals(duration, that.duration) && Objects.equals(succeeded, that.succeeded);
return Objects.equals(id, that.id)
&& status == that.status
&& Objects.equals(startTime, that.startTime)
&& Objects.equals(duration, that.duration)
&& Objects.equals(succeeded, that.succeeded)
;
}

@Override
Expand Down
30 changes: 30 additions & 0 deletions wave-api/src/main/java/io/seqera/wave/api/ContainerStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.api;

/**
* Model a container provisioning request status
*
* @author Paolo Di Tommaso <[email protected]>
*/
public enum ContainerStatus {
PENDING,
BUILDING,
SCANNING,
READY
}
171 changes: 171 additions & 0 deletions wave-api/src/main/java/io/seqera/wave/api/ContainerStatusResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/*
* 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.api;

import java.time.Duration;
import java.time.Instant;
import java.util.Map;
import java.util.Objects;

/**
* Model the response of container provisioning status request
*
* @author Paolo Di Tommaso <[email protected]>
*/
public class ContainerStatusResponse {

/**
* Container request Id
*/
final public String id;

/**
* Container request status
*/
final public ContainerStatus status;

/**
* The build id associated with this request
*/
final public String buildId;

/**
* The mirror id associated with this request
*/
final public String mirrorId;

/**
* The security scan id associated with this request
*/
final public String scanId;

/**
* Security vulnerability summary
*/
final public Map<String,Integer> vulnerabilities;

/**
* Whenever the request is succeeded or not
*/
final public Boolean succeeded;

/**
* Descriptive reason for returned status, used for failures
*/
final public String reason;

/**
* Link to detail page
*/
final public String detailsUri;

/**
* Container request time
*/
final public Instant creationTime;

/**
* Duration to complete build
*/
final public Duration duration;

/*
* required for serialization/deserialization
*/
protected ContainerStatusResponse() {
this.id = null;
this.status = null;
this.buildId = null;
this.mirrorId = null;
this.creationTime = null;
this.duration = null;
this.succeeded = null;
this.scanId = null;
this.vulnerabilities = null;
this.reason = null;
this.detailsUri = null;
}

public ContainerStatusResponse(
String id,
ContainerStatus status,
String buildId,
String mirrorId,
String scanId,
Map<String,Integer> vulnerabilities,
Boolean succeeded,
String reason,
String detailsUri,
Instant creationTime,
Duration duration
)
{
this.id = id;
this.status = status;
this.buildId = buildId;
this.mirrorId = mirrorId;
this.scanId = scanId;
this.vulnerabilities = vulnerabilities;
this.succeeded = succeeded;
this.reason = reason;
this.detailsUri = detailsUri;
this.creationTime = creationTime;
this.duration = duration;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ContainerStatusResponse that = (ContainerStatusResponse) o;
return Objects.equals(id, that.id)
&& status == that.status
&& Objects.equals(buildId, that.buildId)
&& Objects.equals(mirrorId, that.mirrorId)
&& Objects.equals(scanId, that.scanId)
&& Objects.equals(creationTime, that.creationTime)
&& Objects.equals(duration, that.duration)
&& Objects.equals(succeeded, that.succeeded)
&& Objects.equals(vulnerabilities, that.vulnerabilities)
&& Objects.equals(reason, that.reason)
&& Objects.equals(detailsUri, that.detailsUri)
;
}

@Override
public int hashCode() {
return Objects.hash(id, status, buildId, mirrorId, scanId, creationTime, duration, succeeded, vulnerabilities, reason, detailsUri);
}

@Override
public String toString() {
return "ContainerStatusResponse{" +
"id='" + id + '\'' +
", status=" + status +
", buildId='" + buildId + '\'' +
", mirrorId='" + mirrorId + '\'' +
", scanId='" + scanId + '\'' +
", creationTime=" + creationTime +
", duration=" + duration +
", succeeded=" + succeeded +
", vulnerabilities=" + vulnerabilities +
", reason='" + reason + '\'' +
", detailsUri='" + detailsUri + '\'' +
'}';
}
}
30 changes: 30 additions & 0 deletions wave-api/src/main/java/io/seqera/wave/api/ScanLevel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.api;

/**
* Model a security scan vulnerability level
*
* @author Paolo Di Tommaso <[email protected]>
*/
public enum ScanLevel {
low,
medium,
high,
critical
}
36 changes: 36 additions & 0 deletions wave-api/src/main/java/io/seqera/wave/api/ScanMode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Wave, containers provisioning service
* Copyright (c) 2023-2024, Seqera Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package io.seqera.wave.api;

/**
* Define the possible container security scan modes
*
* @author Paolo Di Tommaso <[email protected]>
*/
public enum ScanMode {
none,
async,
sync,
lazy,
;

public boolean asBoolean() {
return this != none;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ public class SubmitContainerTokenRequest implements Cloneable {
*/
public String mirrorRegistry;

/**
* The request security scan mode
*/
public ScanMode scanMode;

/**
* Define the allows security vulnerabilities in the container request.
* Emtpy or null means no vulnerabilities are allowed.
*/
public List<ScanLevel> scanLevels;

public SubmitContainerTokenRequest copyWith(Map opts) {
try {
final SubmitContainerTokenRequest copy = (SubmitContainerTokenRequest) this.clone();
Expand Down Expand Up @@ -199,6 +210,10 @@ public SubmitContainerTokenRequest copyWith(Map opts) {
copy.nameStrategy = (ImageNameStrategy) opts.get("nameStrategy");
if( opts.containsKey("mirrorRegistry") )
copy.mirrorRegistry = (String) opts.get("mirrorRegistry");
if( opts.containsKey("scanMode") )
copy.scanMode = (ScanMode) opts.get("scanMode");
if( opts.containsKey("scanLevels"))
copy.scanLevels = (List<ScanLevel>) opts.get("scanLevels");
// done
return copy;
}
Expand Down Expand Up @@ -330,6 +345,16 @@ public SubmitContainerTokenRequest withMirrorRegistry(String value) {
return this;
}

public SubmitContainerTokenRequest withScanMode(ScanMode mode) {
this.scanMode = mode;
return this;
}

public SubmitContainerTokenRequest withScanLevels(List<ScanLevel> levels) {
this.scanLevels = levels;
return this;
}

public boolean formatSingularity() {
return "sif".equals(format);
}
Expand Down Expand Up @@ -360,6 +385,8 @@ public String toString() {
", packages=" + packages +
", nameStrategy=" + nameStrategy +
", mirrorRegistry=" + mirrorRegistry +
", scanMode=" + scanMode +
", scanLevels=" + scanLevels +
'}';
}
}
Loading

0 comments on commit a61e34e

Please sign in to comment.