Skip to content
Open
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
2 changes: 1 addition & 1 deletion aip-console-jenkins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<packaging>hpi</packaging>
<properties>
<!-- Console Tools version -->
<revision>2.11.0-SNAPSHOT</revision>
<revision>2.10.4</revision>
<!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. -->
<jenkins.version>2.60.3</jenkins.version>
<!-- The 2.303.3 version doesn't work properly by now, and needs slight more works for adoption -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.concurrent.TimeUnit;

import static io.jenkins.plugins.aipconsole.Messages.GenericError_DescriptorImpl_bad_server_version;
import static io.jenkins.plugins.aipconsole.Messages.GenericError_DescriptorImpl_feature_maxVersion_notCompatible;
import static io.jenkins.plugins.aipconsole.Messages.GenericError_DescriptorImpl_feature_notCompatible;
import static io.jenkins.plugins.aipconsole.Messages.GenericError_error_accessDenied;
import static io.jenkins.plugins.aipconsole.Messages.GenericError_error_noApiKey;
Expand Down Expand Up @@ -140,6 +141,10 @@ public Result getDefaultResult() {

protected abstract VersionInformation getFeatureMinVersion();

protected VersionInformation getFeatureMaxVersion() {
return null;
}

protected abstract void performClient(@Nonnull Run<?, ?> var1, @Nonnull FilePath var2, @Nonnull Launcher var3, @Nonnull TaskListener var4) throws InterruptedException, IOException;


Expand Down Expand Up @@ -204,6 +209,11 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
run.setResult(Result.FAILURE);
return;
}
if (getFeatureMaxVersion() != null && getFeatureMaxVersion().isLowerThan(serverApiVersion)) {
listener.error(GenericError_DescriptorImpl_feature_maxVersion_notCompatible(apiVersion, getFeatureMaxVersion().toString()));
run.setResult(Result.FAILURE);
return;
}
}
}
performClient(run, workspace, launcher, listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,20 @@ private static VersionInformation getMinVersion() {
return VersionInformation.fromVersionString("2.8.0");
}

private static VersionInformation getMaxVersion() {
return VersionInformation.fromVersionString("2.10.4");
}

@Override
protected VersionInformation getFeatureMinVersion() {
return getMinVersion();
}

@Override
protected VersionInformation getFeatureMaxVersion() {
return getMaxVersion();
}

public String getSnapshotName() {
return snapshotName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,15 @@ private static VersionInformation getMinVersion() {
return VersionInformation.fromVersionString("2.8.0");
}

private static VersionInformation getMaxVersion() {
return VersionInformation.fromVersionString("2.10.4");
}

@Override
protected VersionInformation getFeatureMaxVersion() {
return getMaxVersion();
}

@Override
protected VersionInformation getFeatureMinVersion() {
return getMinVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ GenericError.error.noServerUrl=AIP Console Server URL is empty, unable to run st
GenericError.error.accessDenied=Unable to access to AIP Console at the following URL : ''{0}''
#
GenericError.DescriptorImpl.feature.notCompatible=This feature is not compatible with the CAST Imaging Console version {0}. Please upgrade to minimum version {1}.
GenericError.DescriptorImpl.feature.maxVersion.notCompatible=This feature is not compatible with the CAST Imaging Console version {0}. The highest supported version is {1}. Please download the related version.
GenericError.DescriptorImpl.bad.server.version=The CAST Imaging Console version {0} is not compatible with this Automation Tools. Please upgrade to version {1} or higher.
# Create application Builder Display Name
CreateApplicationBuilder.DescriptorImpl.displayName=Console Create Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ public Integer call() throws Exception {
, apiVersion, getMinVersion().toString());
return Constants.RETURN_SERVER_VERSION_NOT_COMPATIBLE;
}
if (getMaxVersion() != null && getMaxVersion().isLowerThan(serverApiVersion)) {
log.error("This feature is not compatible with the CAST Imaging Console version {}." +
" The highest supported version is {}." +
" Please download the related version."
, apiVersion, getMaxVersion().toString());
return Constants.RETURN_SERVER_VERSION_NOT_COMPATIBLE;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class OnboardApplicationDeepAnalysisCommand extends BasicCallable {

//This version can be null if failed to convert from string
private static final VersionInformation MIN_VERSION = VersionInformation.fromVersionString("2.8.0");
private static final VersionInformation MAX_VERSION = VersionInformation.fromVersionString("2.10.4");

public OnboardApplicationDeepAnalysisCommand(RestApiService restApiService, JobsService jobsService, UploadService uploadService, ApplicationService applicationService) {
super(restApiService, jobsService, uploadService, applicationService);
Expand Down Expand Up @@ -74,4 +75,9 @@ protected VersionInformation getMinVersion() {
return MIN_VERSION;
}

@Override
protected VersionInformation getMaxVersion() {
return MAX_VERSION;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class OnboardApplicationFastScanCommand extends BasicCallable {

//This version can be null if failed to convert from string
private static final VersionInformation MIN_VERSION = VersionInformation.fromVersionString("2.8.0");
private static final VersionInformation MAX_VERSION = VersionInformation.fromVersionString("2.10.4");

public OnboardApplicationFastScanCommand(RestApiService restApiService, JobsService jobsService, UploadService uploadService, ApplicationService applicationService) {
super(restApiService, jobsService, uploadService, applicationService);
Expand Down Expand Up @@ -88,9 +89,14 @@ public Integer processCallCommand() throws Exception {
.build();
return applicationService.fastScan(fastScanProperties);
}

@Override
protected VersionInformation getMinVersion() {
return MIN_VERSION;
}

@Override
protected VersionInformation getMaxVersion() {
return MAX_VERSION;
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</scm>

<properties>
<revision>2.11.0-SNAPSHOT</revision>
<revision>2.10.4</revision>
<java.version>1.8</java.version>
<spring-boot.version>${project.parent.version}</spring-boot.version>
<picocli.version>4.7.5</picocli.version>
Expand Down