From dafb82800aa6b172c247122517e2c61103a393e3 Mon Sep 17 00:00:00 2001 From: sitay Date: Wed, 22 May 2024 17:09:28 +0300 Subject: [PATCH 1/3] ignore BlockDevicesMode in stateful persistence --- .../java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java b/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java index e99032b..3f35862 100644 --- a/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java +++ b/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java @@ -284,8 +284,7 @@ protected BlResponse checkIsStatefulGroup() { if (groupPersistence != null) { result = BooleanUtils.isTrue(groupPersistence.getShouldPersistPrivateIp()) || BooleanUtils.isTrue(groupPersistence.getShouldPersistBlockDevices()) || - BooleanUtils.isTrue(groupPersistence.getShouldPersistRootDevice()) || - StringUtils.isNotEmpty(groupPersistence.getBlockDevicesMode()); + BooleanUtils.isTrue(groupPersistence.getShouldPersistRootDevice()); } } From 93cc74fb478118644aeabfa5aca8c0d52c5188e3 Mon Sep 17 00:00:00 2001 From: sitay Date: Tue, 28 May 2024 14:53:07 +0300 Subject: [PATCH 2/3] extract method --- .../spotinst/cloud/AwsSpotinstCloud.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java b/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java index 3f35862..1f749d5 100644 --- a/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java +++ b/src/main/java/hudson/plugins/spotinst/cloud/AwsSpotinstCloud.java @@ -274,19 +274,7 @@ protected BlResponse checkIsStatefulGroup() { ApiResponse groupResponse = awsGroupRepo.getGroup(groupId, this.accountId); if (groupResponse.isRequestSucceed()) { - Boolean result = false; - AwsGroup awsGroup = groupResponse.getValue(); - AwsGroupStrategy groupStrategy = awsGroup.getStrategy(); - - if (groupStrategy != null) { - AwsGroupPersistence groupPersistence = groupStrategy.getPersistence(); - - if (groupPersistence != null) { - result = BooleanUtils.isTrue(groupPersistence.getShouldPersistPrivateIp()) || - BooleanUtils.isTrue(groupPersistence.getShouldPersistBlockDevices()) || - BooleanUtils.isTrue(groupPersistence.getShouldPersistRootDevice()); - } - } + Boolean result = computeIfStatefulFromResponse(groupResponse); retVal = new BlResponse<>(result); } @@ -298,6 +286,24 @@ protected BlResponse checkIsStatefulGroup() { return retVal; } + private static Boolean computeIfStatefulFromResponse(ApiResponse groupResponse) { + boolean retVal = false; + AwsGroup awsGroup = groupResponse.getValue(); + AwsGroupStrategy groupStrategy = awsGroup.getStrategy(); + + if (groupStrategy != null) { + AwsGroupPersistence groupPersistence = groupStrategy.getPersistence(); + + if (groupPersistence != null) { + retVal = BooleanUtils.isTrue(groupPersistence.getShouldPersistPrivateIp()) || + BooleanUtils.isTrue(groupPersistence.getShouldPersistBlockDevices()) || + BooleanUtils.isTrue(groupPersistence.getShouldPersistRootDevice()); + } + } + + return retVal; + } + private void syncGroupStatefulInstances() { IAwsGroupRepo awsGroupRepo = RepoManager.getInstance().getAwsGroupRepo(); ApiResponse> statefulInstancesResponse = From 63a5d11863f65fe2abae4981f5ce78a9800e20ae Mon Sep 17 00:00:00 2001 From: sitay Date: Wed, 29 May 2024 11:42:45 +0300 Subject: [PATCH 3/3] add documentation JenkinsWiki.adoc --- JenkinsWiki.adoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/JenkinsWiki.adoc b/JenkinsWiki.adoc index b19e4bb..28cc0ab 100644 --- a/JenkinsWiki.adoc +++ b/JenkinsWiki.adoc @@ -40,6 +40,11 @@ termination" [SpotinstPlugin-Versionhistory] == Version history +[SpotinstPlugin-Version2.2.18(May29,2024)] +=== Version 2.2.18 (May 29, 2024) + +* AWS stateful groups: removed support of all "false" values persistence + [SpotinstPlugin-Version2.2.17(Mar18,2024)] === Version 2.2.17 (Mar 18, 2024)