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
7 changes: 4 additions & 3 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.80</version>
<version>6.2116.v7501b_67dc517</version>
<relativePath />
</parent>
<groupId>de.taimos</groupId>
Expand All @@ -23,7 +23,7 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>2928.ved44ea_84e034</version>
<version>5054.v620b_5d2b_d5e6</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down Expand Up @@ -79,9 +79,10 @@
<revision>1.46</revision>
<changelist>-SNAPSHOT</changelist>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.414</jenkins.baseline>
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<ban-commons-lang-2.skip>false</ban-commons-lang-2.skip>
</properties>
<build>
<plugins>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/de/taimos/pipeline/aws/AWSClientFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import hudson.EnvVars;
import hudson.FilePath;
import hudson.model.TaskListener;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.workflow.steps.StepContext;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
Expand Down Expand Up @@ -90,8 +89,9 @@
if (clientBuilder == null) {
throw new IllegalArgumentException("ClientBuilder must not be null");
}
if (StringUtils.isNotBlank(vars.get(AWS_ENDPOINT_URL))) {
clientBuilder.setEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(vars.get(AWS_ENDPOINT_URL), vars.get(AWS_REGION)));
String endpointUrl = vars.get(AWS_ENDPOINT_URL);
if (endpointUrl != null && !endpointUrl.isBlank()) {

Check warning on line 93 in src/main/java/de/taimos/pipeline/aws/AWSClientFactory.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 93 is only partially covered, one branch is missing
clientBuilder.setEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpointUrl, vars.get(AWS_REGION)));
} else {
clientBuilder.setRegion(AWSClientFactory.getRegion(vars).getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public Map<String, String> create(String templateBody, String templateUrl, Colle
CreateStackRequest req = new CreateStackRequest();
req.withStackName(this.stack).withCapabilities(Capability.CAPABILITY_IAM, Capability.CAPABILITY_NAMED_IAM, Capability.CAPABILITY_AUTO_EXPAND).withEnableTerminationProtection(enableTerminationProtection);
req.withTemplateBody(templateBody).withTemplateURL(templateUrl).withParameters(params).withTags(tags).withNotificationARNs(notificationARNs)
.withTimeoutInMinutes(pollConfiguration.getTimeout() == null ? null : (int) pollConfiguration.getTimeout().toMinutes())

@gbhat618 gbhat618 Jul 27, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pollConfiguration.getTimeout() is @NonNull no need of null check

.withTimeoutInMinutes((int) pollConfiguration.getTimeout().toMinutes())
.withRoleARN(roleArn)
.withOnFailure(OnFailure.valueOf(onFailure));
this.client.createStack(req);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.List;
import java.util.concurrent.ExecutionException;

import org.apache.commons.lang.StringUtils;
import org.apache.http.concurrent.BasicFuture;

import com.amazonaws.AmazonWebServiceRequest;
Expand All @@ -50,16 +49,6 @@
import de.taimos.pipeline.aws.cloudformation.utils.TimeOutRetryStrategy;
import hudson.model.TaskListener;

import org.apache.commons.lang.StringUtils;
import org.apache.http.concurrent.BasicFuture;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutionException;

Comment on lines -53 to -62

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead imports

class EventPrinter {

private static final int DEFAULT_TIMEOUT_IN_MINUTES = 60;
Expand Down Expand Up @@ -173,7 +162,7 @@
}

private void printLine() {
this.listener.getLogger().println(StringUtils.repeat("-", 231));
this.listener.getLogger().println("-".repeat(231));

Check warning on line 165 in src/main/java/de/taimos/pipeline/aws/cloudformation/EventPrinter.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 165 is not covered by tests
}

private void printStackName(String stackName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package de.taimos.pipeline.aws.cloudformation;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;

import java.time.Duration;

@Value
@Builder(toBuilder = true)
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") // Lombok @NonNull check
public class PollConfiguration {

public static final PollConfiguration DEFAULT = builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import hudson.Extension;
import hudson.model.TaskListener;
import lombok.Getter;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.workflow.steps.Step;
import org.jenkinsci.plugins.workflow.steps.StepContext;
import org.jenkinsci.plugins.workflow.steps.StepDescriptor;
Expand Down Expand Up @@ -186,35 +185,35 @@
if (isEcsOrLambdaDeployment()) {
return null;
}
if (StringUtils.isEmpty(fileExistsBehavior)) {
if (fileExistsBehavior == null || fileExistsBehavior.isEmpty()) {
return FileExistsBehavior.DISALLOW;
}
return FileExistsBehavior.fromValue(fileExistsBehavior);
}

private boolean isEcsOrLambdaDeployment() {
AmazonCodeDeploy codeDeploy = AWSClientFactory.create(AmazonCodeDeployClientBuilder.standard(), this.getContext());

try {
GetDeploymentGroupRequest request =
new GetDeploymentGroupRequest()
.withApplicationName(step.getApplicationName())
.withDeploymentGroupName(step.getDeploymentGroupName());

GetDeploymentGroupResult response =
codeDeploy.getDeploymentGroup(request);

String computePlatform = response.getDeploymentGroupInfo().getComputePlatform();

return "ECS".equalsIgnoreCase(computePlatform) || "Lambda".equalsIgnoreCase(computePlatform);
} catch (Exception e) {
// Log the exception or handle it as appropriate for your use case
return false;
}
}

private RevisionLocation getRevisionLocation() {
if (StringUtils.isNotEmpty(step.getS3Bucket())) {
if (step.getS3Bucket() != null && !step.getS3Bucket().isEmpty()) {

Check warning on line 216 in src/main/java/de/taimos/pipeline/aws/code/deploy/CreateDeployStep.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 188-216 are not covered by tests
final S3Location s3Location = new S3Location().withBucket(step.getS3Bucket())
.withKey(step.getS3Key())
.withBundleType(step.getS3BundleType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void shortNamesAreNotStripped() {

@Test
public void nameLongerThanAWSLimitAreStripped() {
String jobName = org.apache.commons.lang.StringUtils.repeat("s", 64);
String jobName = "s".repeat(64);
String buildNumber = "123";
final RoleSessionNameBuilder roleSessionNameBuilder = RoleSessionNameBuilder.withJobName(jobName)
.withBuildNumber(buildNumber);
Expand All @@ -49,7 +49,7 @@ public void nameLongerThanAWSLimitAreStripped() {

@Test
public void nameEqualToAWSLimitAreStripped() {
String jobName = org.apache.commons.lang.StringUtils.repeat("s", 52);
String jobName = "s".repeat(52);
String buildNumber = "123";
final RoleSessionNameBuilder roleSessionNameBuilder = RoleSessionNameBuilder.withJobName(jobName)
.withBuildNumber(buildNumber);
Expand Down
Loading