Skip to content

Commit

Permalink
Merge pull request #17 from jenkinsci/SEI/feature/SEI-3523-1
Browse files Browse the repository at this point in the history
feat: [SEI-3523]: - SEI on Harness - Jenkins support
  • Loading branch information
ashish-levelops authored Dec 21, 2023
2 parents d3d0ca2 + 95d4c39 commit 057979c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</profiles>

<properties>
<revision>1.0.30</revision>
<revision>1.0.31</revision>
<!-- <changelist>999999-SNAPSHOT</changelist> -->
<changelist></changelist>
<product.build.sourceEncoding>UTF-8</product.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ public enum ApplicationType {

SEI_LEGACY("SEI-LEGACY-US", "https://api.propelo.ai"),
SEI_LEGACY_EU("SEI-LEGACY-EU", "https://eu1.api.propelo.ai"),
SEI_LEGACY_ASIA("SEI-LEGACY-ASIA", "https://asia1.api.propelo.ai"),
SEI_HARNESS("SEI-HARNESS", "https://app.harness.io/sei/api"),
SEI_HARNESS_COMPLIANCE("SEI-HARNESS-COMPLIANCE", "https://app3.harness.io/sei/api");
SEI_HARNESS_PROD1("SEI-HARNESS-PROD1", "https://app.harness.io/prod1/sei/api"),
SEI_HARNESS_PROD2("SEI-HARNESS-PROD2", "https://app.harness.io/gratis/sei/api"),
SEI_HARNESS_PROD3("SEI-HARNESS-PROD3", "https://app3.harness.io/sei/api");

private String applicationType;
private String targetUrl;
Expand All @@ -27,14 +27,14 @@ public String getTargetUrl(){
}

public static ApplicationType fromString(@Nullable String value) {
if(SEI_HARNESS.getApplicationType().equalsIgnoreCase(value)) {
return SEI_HARNESS;
}else if(SEI_HARNESS_COMPLIANCE.getApplicationType().equalsIgnoreCase(value)) {
return SEI_HARNESS_COMPLIANCE;
if(SEI_HARNESS_PROD1.getApplicationType().equalsIgnoreCase(value)) {
return SEI_HARNESS_PROD1;
}else if(SEI_HARNESS_PROD3.getApplicationType().equalsIgnoreCase(value)) {
return SEI_HARNESS_PROD3;
}else if(SEI_LEGACY_EU.getApplicationType().equalsIgnoreCase(value)) {
return SEI_LEGACY_EU;
}else if(SEI_LEGACY_ASIA.getApplicationType().equalsIgnoreCase(value)) {
return SEI_LEGACY_ASIA;
}else if(SEI_HARNESS_PROD2.getApplicationType().equalsIgnoreCase(value)) {
return SEI_HARNESS_PROD2;
}else {
return SEI_LEGACY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@
checkUrl="'${rootURL}/plugin/${it.urlName}/checkJenkinsInstanceName?value='+escape(this.value)"/>
</f:entry>

<f:entry name="applicationType" description="Select the application type" title="Choose Application Type" field="applicationType">
<select name="applicationType" selected = "${applicationType}">
<option value="SEI-Harness-PROD1" selected="${applicationType.equals('SEI-Harness-PROD1') ? 'true':null}">SEI-Harness-PROD1</option>
<option value="SEI-Harness-PROD2" selected="${applicationType.equals('SEI-Harness-PROD2') ? 'true':null}">SEI-Harness-PROD2</option>
<option value="SEI-Harness-PROD3" selected="${applicationType.equals('SEI-Harness-PROD3') ? 'true':null}">SEI-Harness-PROD3</option>
<option value="SEI-Legacy-US" selected="${applicationType.equals('SEI-Legacy-US') ? 'true':null}">SEI-Legacy-US</option>
<option value="SEI-Legacy-EU" selected="${applicationType.equals('SEI-Legacy-EU') ? 'true':null}">SEI-Legacy-EU</option>
</select>
</f:entry>


<f:entry title="SEI API Key" description="SEI API Key Obtained from the Harness SEI webapp." field="levelOpsApiKey"
help="/plugin/${it.urlName}/help/help-levelOpsApiKey.html">
<f:password value="${it.configuration.levelOpsApiKey}" name="levelOpsApiKey"
Expand All @@ -26,15 +37,7 @@
<f:readOnlyTextbox value="${it.jenkinsStatus}" name="levelOpsStatus"
checkUrl="'${rootURL}/plugin/${it.urlName}/checkLevelOpsStatus?value='+escape(this.value)"/>
</f:entry>
<f:entry name="applicationType" title="Choose Application Type" field="applicationType">
<select name="applicationType">
<option value="SEI-Harness">SEI-Harness</option>
<option value="SEI-Harness-Compliance">SEI-Harness-Compliance</option>
<option value="SEI-Legacy-US">SEI-Legacy-US</option>
<option value="SEI-Legacy-EU">SEI-Legacy-EU</option>
<option value="SEI-Legacy-ASIA">SEI-Legacy-ASIA</option>
</select>
</f:entry>

</f:section>

<f:section title="Monitoring settings">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public void testApplicationType() throws Exception {

PropeloPluginImpl propeloPlugin = new PropeloPluginImpl();

propeloPlugin.setApplicationType("SEI-Harness");
propeloPlugin.setApplicationType("SEI-Harness-PROD1");
ApplicationType applicationType = PropeloPluginImpl.getInstance().getApplicationType();
Assert.assertEquals(applicationType, ApplicationType.SEI_HARNESS);
Assert.assertEquals(applicationType, ApplicationType.SEI_HARNESS_PROD1);

propeloPlugin.setApplicationType("SEI-Harness-Compliance");
propeloPlugin.setApplicationType("SEI-Harness-PROD3");
applicationType = PropeloPluginImpl.getInstance().getApplicationType();
Assert.assertEquals(applicationType, ApplicationType.SEI_HARNESS_COMPLIANCE);
Assert.assertEquals(applicationType, ApplicationType.SEI_HARNESS_PROD3);

propeloPlugin.setApplicationType("SEI-Legacy");
applicationType = PropeloPluginImpl.getInstance().getApplicationType();
Expand All @@ -29,8 +29,8 @@ public void testApplicationType() throws Exception {
applicationType = PropeloPluginImpl.getInstance().getApplicationType();
Assert.assertEquals(applicationType, ApplicationType.SEI_LEGACY_EU);

propeloPlugin.setApplicationType("SEI-Legacy-ASIA");
propeloPlugin.setApplicationType("SEI-Harness-PROD2");
applicationType = PropeloPluginImpl.getInstance().getApplicationType();
Assert.assertEquals(applicationType, ApplicationType.SEI_LEGACY_ASIA);
Assert.assertEquals(applicationType, ApplicationType.SEI_HARNESS_PROD2);
}
}

0 comments on commit 057979c

Please sign in to comment.