Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: ods-deployments file repeats image in mono repository setup #1023

Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2c9d4eb
Adds a check for 'resourceName'
serverhorror Jul 24, 2023
05d0b93
codeNarc: Fix indentation
serverhorror Jul 24, 2023
22b3571
Fix changelog enforcer
serverhorror Jul 24, 2023
f76dfba
Fix build
serverhorror Jul 24, 2023
86e1d58
codeNarc: Fix parameterCount warning
serverhorror Jul 24, 2023
0a034e4
Add ChangeLog entry for unrelated change
serverhorror Jul 24, 2023
6020434
Fix test for 'run successfully with helm'
serverhorror Jul 24, 2023
547205a
Fix test for 'run successfully with helm'
serverhorror Jul 24, 2023
3e8a759
(chore): Removed MaxPermSize as this had no effect since Java8
serverhorror Jul 25, 2023
f919820
Fix call to checkForPodData in test
serverhorror Jul 25, 2023
4998663
update changelog to reflect all changes
serverhorror Jul 25, 2023
0da017a
Simplify code
serverhorror Jul 26, 2023
be3cb51
test parsePodJson (called from checkPodData) with multiple pods as input
serverhorror Jul 26, 2023
78a2d15
(chore) fix formatting
serverhorror Jul 28, 2023
6b40e51
Merge branch 'master' into bugfix/ods-deployments-file-repeats-image-…
serverhorror Oct 5, 2023
203db89
make CodeNarc happ[y|ier]
serverhorror Oct 5, 2023
e014da5
Merge branch 'master' into bugfix/ods-deployments-file-repeats-image-…
serverhorror Nov 8, 2023
06e1e65
Merge remote-tracking branch 'origin/master' into bugfix/ods-deployme…
serverhorror Dec 13, 2023
e2273fa
re-introduce resourceName
serverhorror Feb 6, 2024
c394de4
Merge branch 'master' into bugfix/ods-deployments-file-repeats-image-…
serverhorror Feb 6, 2024
d7c0157
delete prototypical code that was introduced by mistake
serverhorror Feb 6, 2024
bf8eccb
Merge branch 'master' into bugfix/ods-deployments-file-repeats-image-…
serverhorror Feb 28, 2024
1d36f72
Merge branch 'master' into bugfix/ods-deployments-file-repeats-image-…
hrcornejo Apr 30, 2024
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Changelog

## Unreleased

- Fix ods-deployments file repeats image in mono repository setup ([#1011](https://github.com/opendevstack/ods-jenkins-shared-library/issues/1011))
- Fix parameter count warning in ([86e1d](https://github.com/opendevstack/ods-jenkins-shared-library/commit/86e1d583b271446ef1489339da0912f78406e40d))
- Remove `jvmArgs "-XX:MaxPermSize=256m"` from build.gradle as it is no longer supported (See https://docs.oracle.com/javase/9/migrate/#GUID-1F270BDA-50B0-49C8-807E-0B727CCC5169)
### Added

### Changed
Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ test {
systemProperty 'com.athaydes.spockframework.report.projectName', 'ods-jenkins-shared-library'
systemProperty 'com.athaydes.spockframework.report.projectVersion', version
maxHeapSize = "2048m"
Copy link
Contributor Author

@serverhorror serverhorror Jul 25, 2023

Choose a reason for hiding this comment

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

See the changelog entry, the jvmArgs "-XX:MaxPermSize=256m" option (specifically MaxPermSize) has been deprecated and will prohibit a JVM from starting. It was removed somewhere between 8 and 11, if my research is correct.

jvmArgs "-XX:MaxPermSize=256m"
systemProperty "testRecordMode", project.findProperty('testRecordMode')?: false
systemProperty "generateExpectedPdfFiles", project.findProperty('generateExpectedPdfFiles')?: false
systemProperty "nexusURL", project.findProperty('nexusURL')?: "http://nexus.odsbox.lan:7990"
Expand All @@ -137,7 +136,7 @@ test {
}

codenarc {
toolVersion = '1.5'
toolVersion = '1.6'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

please note: this is unrelated to the actual changes, it wouldn't let me build without that being set.

configFile = file('codenarc.groovy')
maxPriority1Violations = 0
maxPriority2Violations = 1
Expand Down
2 changes: 1 addition & 1 deletion src/org/ods/component/HelmDeploymentStrategy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class HelmDeploymentStrategy extends AbstractDeploymentStrategy {
resourceNames.each { resourceName ->

def podData = [:]
podData = openShift.checkForPodData(context.targetProject, options.selector)
podData = openShift.checkForPodData(context.targetProject, options.selector, resourceName)
context.addDeploymentToArtifactURIs("${resourceName}-deploymentMean",
[
'type': 'helm',
Expand Down
1 change: 1 addition & 0 deletions src/org/ods/orchestration/util/DocumentHistoryEntry.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class DocumentHistoryEntry implements Map, Serializable {
private final String docVersion
String rational

@SuppressWarnings('ParameterCount')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please not this is unrelated to the actual change, it was reported by codeNarc and I could get it to build without this.

DocumentHistoryEntry(Map map, Long entryId, String projectVersion,
String previousProjectVersion, String docVersion, String rational) {
def delegate = (Map) map.clone()
Expand Down
9 changes: 7 additions & 2 deletions src/org/ods/services/OpenShiftService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ class OpenShiftService {
// checkForPodData returns a subset of information from every pod, once
// all pods matching the label are "running". If this is not the case,
// it returns an empty list.
List<PodData> checkForPodData(String project, String label) {
List<PodData> checkForPodData(String project, String label, String resourceName=null) {
List<PodData> pods = []
def stdout = steps.sh(
script: "oc -n ${project} get pod -l ${label} -o json",
Expand All @@ -1033,7 +1033,12 @@ class OpenShiftService {
).toString().trim()
def podJson = new JsonSlurperClassic().parseText(stdout)
if (podJson && podJson.items.collect { it.status?.phase?.toLowerCase() }.every { it == 'running' }) {
pods = extractPodData(podJson)
if (podJson && resourceName && podJson.items.collect { it.metadata.name }.every {
it.startsWith(resourceName) }) {
pods = extractPodData(podJson)
} else {
pods = extractPodData(podJson)
}
}
pods
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class HelmDeploymentStrategySpec extends PipelineSpockTestBase {
def ctxData = contextData + [environment: 'dev', targetProject: 'foo-dev', openshiftRolloutTimeoutRetries: 5, chartDir: 'chart']
IContext context = new Context(null, ctxData, logger)
OpenShiftService openShiftService = Mock(OpenShiftService.class)
openShiftService.checkForPodData('foo-dev', 'app=foo-bar') >> [new PodData([deploymentId: "${contextData.componentId}-124"])]
openShiftService.checkForPodData(*_) >> [new PodData([deploymentId: "${contextData.componentId}-124"])]
ServiceRegistry.instance.add(OpenShiftService, openShiftService)

JenkinsService jenkinsService = Stub(JenkinsService.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class OdsComponentStageRolloutOpenShiftDeploymentSpec extends PipelineSpockTestB
openShiftService.rollout(*_) >> "${config.componentId}-124"
openShiftService.getPodDataForDeployment(*_) >> [new PodData([ deploymentId: "${config.componentId}-124" ])]
openShiftService.getImagesOfDeployment(*_) >> [[ repository: 'foo', name: 'bar' ]]
openShiftService.checkForPodData('foo-dev', 'app=foo-bar') >> [new PodData([deploymentId: "${config.componentId}-124"])]
openShiftService.checkForPodData(*_) >> [new PodData([deploymentId: "${config.componentId}-124"])]
ServiceRegistry.instance.add(OpenShiftService, openShiftService)
JenkinsService jenkinsService = Stub(JenkinsService.class)
jenkinsService.maybeWithPrivateKeyCredentials(*_) >> { args -> args[1]('/tmp/file') }
Expand Down
Loading