Skip to content

Commit

Permalink
Merge pull request #16 from schottsfired/CPLT2-6668
Browse files Browse the repository at this point in the history
Move AWS Management Link to System Configuration
  • Loading branch information
jglick authored Jul 22, 2020
2 parents 6b8b68a + 7926149 commit 4bf99d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ work
.stignore
.vscode/
protojep.adoc
.idea/
aws-global-configuration.iml
18 changes: 12 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.2</version>
<version>4.4</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
Expand All @@ -14,7 +14,7 @@
<properties>
<revision>1.5</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.164.1</jenkins.version>
<jenkins.version>2.235.2</jenkins.version>
<java.level>8</java.level>
</properties>
<name>AWS Global Configuration Plugin</name>
Expand Down Expand Up @@ -48,23 +48,28 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.164.x</artifactId>
<version>9</version>
<artifactId>bom-2.235.x</artifactId>
<version>11</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.341</version>
<version>1.11.821</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>aws-credentials</artifactId>
<version>1.23</version>
<version>1.28</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -73,6 +78,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.4.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public String getDescription() {
return "Amazon Web Services Configuration";
}

@Override
public Category getCategory() { return Category.CONFIGURATION; }

@Override
public Descriptor<AwsManagementLink> getDescriptor() {
return Jenkins.get().getDescriptorOrDie(AwsManagementLink.class);
Expand All @@ -61,11 +64,11 @@ public Descriptor<AwsManagementLink> getDescriptor() {
@RequirePOST
public synchronized void doConfigure(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, Descriptor.FormException {
// for compatibility reasons, the actual value is stored in Jenkins
BulkChange bc = new BulkChange(Jenkins.getInstance());
BulkChange bc = new BulkChange(Jenkins.get());
try{
boolean result = configure(req, req.getSubmittedForm());
LOGGER.log(Level.FINE, "security saved: "+result);
Jenkins.getInstance().save();
Jenkins.get().save();
FormApply.success(req.getContextPath()+"/manage").generateResponse(req, rsp, null);
} finally {
bc.commit();
Expand All @@ -74,7 +77,8 @@ public synchronized void doConfigure(StaplerRequest req, StaplerResponse rsp) th

public boolean configure(StaplerRequest req, JSONObject json) throws Descriptor.FormException {
boolean result = true;
for(Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfig(FILTER)){
for(Descriptor<?> d : Functions.getSortedDescriptorsForGlobalConfigByDescriptor(descriptor ->
FILTER.apply(descriptor.getCategory()))){
result &= configureDescriptor(req,json,d);
}

Expand Down

0 comments on commit 4bf99d7

Please sign in to comment.