Skip to content

Commit b14a4b3

Browse files
valituguranzxBCN Valeriu_Tuguran,Constantin (IT EDP) EXTERNAL
andauthored
Update automatic release component information with N/A when pipelines have not run yet (#1257)
Fill component data with N/A for automatic release when pipelines have not run yet. --------- Co-authored-by: zxBCN Valeriu_Tuguran,Constantin (IT EDP) EXTERNAL <constantin.valeriu_tuguran.ext@boehringer-ingelheim.com>
1 parent 019389e commit b14a4b3

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66

77
### Changed
8+
* Update automatic release component information with N/A when pipelines have not run yet ([#1257](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1257))
89
* Enhance Helm strategy and support of Statefullset/Cronjob ([#1253](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1253))
910
* Add component information in automatic release close notes ([#1254](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1254))
1011

src/org/ods/orchestration/usecase/JiraUseCase.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,11 @@ class JiraUseCase {
391391
def components = []
392392
this.project.data.metadata.repositories.each { repo ->
393393
if (repo.include == true) {
394+
def gitSHA = repo.data?.git?.commit
394395
components.add([
395396
id: repo.id,
396-
commit: repo.data?.git?.commit,
397-
failed: repo.data?.failedStage ? true : false,
397+
commit: gitSHA ? gitSHA : 'N/A',
398+
status: gitSHA ? (repo.data?.failedStage ? 'FAILURE' : 'SUCCESS') : 'N/A',
398399
])
399400
}
400401
}

test/groovy/org/ods/orchestration/usecase/JiraUseCaseSpec.groovy

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,11 @@ class JiraUseCaseSpec extends SpecHelper {
879879
],
880880
failedStage: true
881881
]
882+
project.data.metadata.repositories[1].data << [
883+
git: [
884+
commit: 5678
885+
]
886+
]
882887

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

@@ -898,10 +903,10 @@ class JiraUseCaseSpec extends SpecHelper {
898903
status: "Failed",
899904
env: 'D',
900905
components: [
901-
['id':'demo-app-carts', 'commit':1234, 'failed':true],
902-
['id':'demo-app-catalogue', 'commit':null, 'failed':false],
903-
['id':'demo-app-front-end', 'commit':null, 'failed':false],
904-
['id':'demo-app-tests', 'commit':null, 'failed':false]
906+
['id':'demo-app-carts', 'commit':1234, 'status':'FAILURE'],
907+
['id':'demo-app-catalogue', 'commit':5678, 'status':'SUCCESS'],
908+
['id':'demo-app-front-end', 'commit':'N/A', 'status':'N/A'],
909+
['id':'demo-app-tests', 'commit':'N/A', 'status':'N/A']
905910
],
906911
startDateTimestamp: "1234567890",
907912
])
@@ -925,6 +930,11 @@ class JiraUseCaseSpec extends SpecHelper {
925930
],
926931
failedStage: true
927932
]
933+
project.data.metadata.repositories[1].data << [
934+
git: [
935+
commit: 5678
936+
]
937+
]
928938

929939
when:
930940
usecase.updateJiraReleaseStatusResult("", false)
@@ -942,10 +952,10 @@ class JiraUseCaseSpec extends SpecHelper {
942952
status: "Successful",
943953
env: 'D',
944954
components: [
945-
['id':'demo-app-carts', 'commit':1234, 'failed':true],
946-
['id':'demo-app-catalogue', 'commit':null, 'failed':false],
947-
['id':'demo-app-front-end', 'commit':null, 'failed':false],
948-
['id':'demo-app-tests', 'commit':null, 'failed':false]
955+
['id':'demo-app-carts', 'commit':1234, 'status':'FAILURE'],
956+
['id':'demo-app-catalogue', 'commit':5678, 'status':'SUCCESS'],
957+
['id':'demo-app-front-end', 'commit':'N/A', 'status':'N/A'],
958+
['id':'demo-app-tests', 'commit':'N/A', 'status':'N/A']
949959
],
950960
startDateTimestamp: "1234567890",
951961
])

0 commit comments

Comments
 (0)