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

Release 4.5.4 #1142

Merged
merged 4 commits into from
Jul 17, 2024
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
### Fixed
* Fix Tailor deployment drifts for D, Q envs ([#1055](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1055))

## [4.5.4] - 2024-07-17

### Changed
* In test results, labels not related to execution persist ([#1138](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1138))

### Fixed
* Fix excluded ods-infra components failing on deploy stage ([#1139](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1139))
* Fix Finalize stage for ods-library components ([#1140](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1140))

## [4.5.3] - 2024-07-08

### Fixed
Expand Down
39 changes: 25 additions & 14 deletions src/org/ods/orchestration/DeployStage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,34 @@ class DeployStage extends Stage {
}

private void loadOdsInfraTypeData (Map repo) {
if (repo.data == null) { repo.data = [:] }
ILogger logger = ServiceRegistry.instance.get(Logger)
def steps = ServiceRegistry.instance.get(PipelineSteps)
if (repo.include) {
if (repo.data == null) {
repo.data = [:]
}
def steps = ServiceRegistry.instance.get(PipelineSteps)

// collect test results
if (repo.data.tests == null) {
repo.data.tests = [:]
}
repo.data.tests << [installation: getTestResults(steps, repo, Project.TestType.INSTALLATION)]

// collect test results
if (repo.data.tests == null) { repo.data.tests = [:] }
repo.data.tests << [installation: getTestResults(steps, repo, Project.TestType.INSTALLATION)]

// collect log data
if (repo.data.logs == null) { repo.data.logs = [:] }
repo.data.logs << [created: getLogReports(steps, repo, Project.LogReportType.CHANGES)]
repo.data.logs << [target: getLogReports(steps, repo, Project.LogReportType.TARGET)]
repo.data.logs << [state: getLogReports(steps, repo, Project.LogReportType.STATE)]
if (repo.data.logs.state.content) {
repo.data.logs.state.content = JsonOutput.prettyPrint(repo.data.logs.state.content[0])
// collect log data
if (repo.data.logs == null) {
repo.data.logs = [:]
}
repo.data.logs << [created: getLogReports(steps, repo, Project.LogReportType.CHANGES)]
repo.data.logs << [target: getLogReports(steps, repo, Project.LogReportType.TARGET)]
repo.data.logs << [state: getLogReports(steps, repo, Project.LogReportType.STATE)]
if (repo.data.logs.state.content) {
repo.data.logs.state.content = JsonOutput.prettyPrint(repo.data.logs.state.content[0])
} else {
logger.warn("No log state for ${repo.data} found!")
}
} else {
logger.warn("No log state for ${repo.data} found!")
logger.debug("Include flag is set to false so not loading ODS Infrastructure/Configuration Management " +
"component type data for '${repo.id}'")
}
}

Expand Down
1 change: 1 addition & 0 deletions src/org/ods/orchestration/FinalizeStage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class FinalizeStage extends Stage {
if (repo.include) {
def repoType = repo.type?.toLowerCase()
if ((repoType != MROPipelineUtil.PipelineConfig.REPO_TYPE_ODS_TEST &&
repoType != MROPipelineUtil.PipelineConfig.REPO_TYPE_ODS_LIB &&
repoType != MROPipelineUtil.PipelineConfig.REPO_TYPE_ODS_INFRA &&
repoType != MROPipelineUtil.PipelineConfig.REPO_TYPE_ODS_SAAS_SERVICE)) {
repoIntegrateTasks << [(repo.id): { doIntegrateIntoMainBranches(steps, repo, git) }]
Expand Down
9 changes: 7 additions & 2 deletions src/org/ods/orchestration/usecase/JiraUseCase.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ class JiraUseCase {
// Handle Jira test issues for which a corresponding test exists in testResults
def matchedHandler = { result ->
result.each { testIssue, testCase ->
// Remove all the results from preceding executions
this.jira.removeLabelsFromIssue(testIssue.key, TestIssueLabels.values().collect() { it.name() })

def issueLabels = [TestIssueLabels.Succeeded as String]
if (testCase.error) {
issueLabels = [TestIssueLabels.Error as String]
Expand All @@ -98,14 +101,16 @@ class JiraUseCase {
issueLabels = [TestIssueLabels.Skipped as String]
}

this.jira.setIssueLabels(testIssue.key, issueLabels)
this.jira.addLabelsToIssue(testIssue.key, issueLabels)
}
}

// Handle Jira test issues for which no corresponding test exists in testResults
def unmatchedHandler = { result ->
result.each { testIssue ->
this.jira.setIssueLabels(testIssue.key, [TestIssueLabels.Missing as String])
// Remove all the results from preceding executions
this.jira.removeLabelsFromIssue(testIssue.key, TestIssueLabels.values().collect() { it.name() })
this.jira.addLabelsToIssue(testIssue.key, [TestIssueLabels.Missing as String])
}
}

Expand Down
23 changes: 23 additions & 0 deletions test/groovy/org/ods/orchestration/FinalizeStageSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,27 @@ class FinalizeStageSpec extends SpecHelper {
1 * gitService.createTag(project.targetTag)
1 * gitService.pushForceBranchWithTags(project.gitReleaseBranch)
}

def "integrateIntoMainBranchRepos if repo of type is #type"() {
given:
def repos = project.data.metadata.repositories
repos.each { repo ->
repo.type = type
}

def finalStageNotInstallable = Spy(new FinalizeStage(script, project, repos))

when:
finalStageNotInstallable.integrateIntoMainBranchRepos(steps, gitService)

then:
0 * finalStageNotInstallable.doIntegrateIntoMainBranches(_)

where:
type | _
'ods-test' | _
'ods-library' | _
'ods-infra' | _
'ods-saas-service' | _
}
}
25 changes: 15 additions & 10 deletions test/groovy/org/ods/orchestration/usecase/JiraUseCaseSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,29 @@ class JiraUseCaseSpec extends SpecHelper {
usecase.applyXunitTestResultsAsTestIssueLabels(testIssues, testResults)

then:
1 * jira.setIssueLabels("JIRA-1", ["Succeeded"])
0 * jira.setIssueLabels("JIRA-1", _)
1 * jira.removeLabelsFromIssue("JIRA-1", ['Error', 'Failed', 'Missing', 'Skipped', 'Succeeded'])
1 * jira.addLabelsToIssue("JIRA-1", ["Succeeded"])
0 * jira.addLabelsToIssue("JIRA-1", _)

then:
1 * jira.setIssueLabels("JIRA-2", ["Error"])
0 * jira.setIssueLabels("JIRA-2", _)
1 * jira.removeLabelsFromIssue("JIRA-2", ['Error', 'Failed', 'Missing', 'Skipped', 'Succeeded'])
1 * jira.addLabelsToIssue("JIRA-2", ["Error"])
0 * jira.addLabelsToIssue("JIRA-2", _)

then:
1 * jira.setIssueLabels("JIRA-3", ["Failed"])
0 * jira.setIssueLabels("JIRA-3", _)
1 * jira.removeLabelsFromIssue("JIRA-3", ['Error', 'Failed', 'Missing', 'Skipped', 'Succeeded'])
1 * jira.addLabelsToIssue("JIRA-3", ["Failed"])
0 * jira.addLabelsToIssue("JIRA-3", _)

then:
1 * jira.setIssueLabels("JIRA-4", ["Skipped"])
0 * jira.setIssueLabels("JIRA-4", _)
1 * jira.removeLabelsFromIssue("JIRA-4", ['Error', 'Failed', 'Missing', 'Skipped', 'Succeeded'])
1 * jira.addLabelsToIssue("JIRA-4", ["Skipped"])
0 * jira.addLabelsToIssue("JIRA-4", _)

then:
1 * jira.setIssueLabels("JIRA-5", ["Missing"])
0 * jira.setIssueLabels("JIRA-5", _)
1 * jira.removeLabelsFromIssue("JIRA-5",['Error', 'Failed', 'Missing', 'Skipped', 'Succeeded'])
1 * jira.addLabelsToIssue("JIRA-5", ["Missing"])
0 * jira.addLabelsToIssue("JIRA-5", _)
}

def "check Jira issue matches test case"() {
Expand Down
Loading