Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

### Changed
* Add component information in automatic release close notes ([#1254](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1254))

### Fixed
* Log correct error message for wrong preview-branch value ([#1249](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1249))
Expand Down
15 changes: 15 additions & 0 deletions src/org/ods/orchestration/usecase/JiraUseCase.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,20 @@ class JiraUseCase {
this.jira.updateBuildNumber(projectKey, changeId, buildNumber)
}

List buildComponentsDataForRelease() {
def components = []
this.project.data.metadata.repositories.each { repo ->
if (repo.include == true) {
components.add([
id: repo.id,
commit: repo.data?.git?.commit,
failed: repo.data?.failedStage ? true : false,
])
}
}
return components
}

void updateJiraReleaseStatusResult(String message, boolean isError) {
if (!this.jira) {
logger.warn("updateJiraReleaseStatusResult: Could *NOT* update release status result because jira has invalid value.")
Expand Down Expand Up @@ -418,6 +432,7 @@ class JiraUseCase {
],
status: status,
env: env,
components: this.buildComponentsDataForRelease(),
startDateTimestamp: this.steps.currentBuild.startTimeInMillis,
]

Expand Down
24 changes: 24 additions & 0 deletions test/groovy/org/ods/orchestration/usecase/JiraUseCaseSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,12 @@ class JiraUseCaseSpec extends SpecHelper {
def testResults = new TestResults();
testResults.setFailed(1)
project.getAggregatedTestResults() >> testResults
project.data.metadata.repositories[0].data << [
git: [
commit: 1234
],
failedStage: true
]

def error = new RuntimeException("Oh no!")

Expand All @@ -891,6 +897,12 @@ class JiraUseCaseSpec extends SpecHelper {
],
status: "Failed",
env: 'D',
components: [
['id':'demo-app-carts', 'commit':1234, 'failed':true],
['id':'demo-app-catalogue', 'commit':null, 'failed':false],
['id':'demo-app-front-end', 'commit':null, 'failed':false],
['id':'demo-app-tests', 'commit':null, 'failed':false]
],
startDateTimestamp: "1234567890",
])

Expand All @@ -907,6 +919,12 @@ class JiraUseCaseSpec extends SpecHelper {
def testResults = new TestResults();
testResults.setSucceeded(1)
project.getAggregatedTestResults() >> testResults
project.data.metadata.repositories[0].data << [
git: [
commit: 1234
],
failedStage: true
]

when:
usecase.updateJiraReleaseStatusResult("", false)
Expand All @@ -923,6 +941,12 @@ class JiraUseCaseSpec extends SpecHelper {
],
status: "Successful",
env: 'D',
components: [
['id':'demo-app-carts', 'commit':1234, 'failed':true],
['id':'demo-app-catalogue', 'commit':null, 'failed':false],
['id':'demo-app-front-end', 'commit':null, 'failed':false],
['id':'demo-app-tests', 'commit':null, 'failed':false]
],
startDateTimestamp: "1234567890",
])
}
Expand Down