Skip to content

Commit

Permalink
Feature/flexible r2p jira workflow (#936)
Browse files Browse the repository at this point in the history
* Developer preview uses the release branch if exists, the branch in Release Manager's metadata.yml cfg if not. (#917)

* changelog

* Logging we need to see what is going on.

* Small refactor to clarify what source code does.

* Use release branch if it exists, in dev mode.

* Checkout release branch for developer preview if available.

Co-authored-by: Victor Pablos Ceruelo <victor.pablos_ceruelo.ext@boehringer-ingelheim.com>

* Feature/edpc 1323 dev preview from release branch if exists (#920)

* changelog

* Logging we need to see what is going on.

* Small refactor to clarify what source code does.

* Use release branch if it exists, in dev mode.

* Checkout release branch for developer preview if available.

* Log in debug mode undone jira issues and chapters.

* Log in debug mode comment added to Jira Release Status

* Do branch checkout for non-release repos too-.

* gitReleaseBranch id needs to be saved for future usage in pipeline.

* If release manager branch is master, other comp. branch is defined in yaml.

* Need to push to the branch we are looking for.

* Initialize map before using it.

* typo

* Tests for InitStage

* tests for MROPipelineUtil.

* changelog

Co-authored-by: Victor Pablos Ceruelo <victor.pablos_ceruelo.ext@boehringer-ingelheim.com>

* Removes DIL_P doc. (#914)

* Removes DIL_P doc.

* Trying to log what is being sent to jira

* Correct way to log variable.

* Pretty print map using json format.

* Revert "Correct way to log variable."

This reverts commit 8ae309a.

* Revert "Trying to log what is being sent to jira"

This reverts commit 0367847.

* jcenter is no more available.

* Removes from test checking that DIL_P is generated.

* changelog

Co-authored-by: zxBCN Pablos_Ceruelo,Victor (IT EDS) EXTERNAL <victor.pablos_ceruelo.ext@boehringer-ingelheim.com>

* Sets rePromote field to true by default + tests.

* Check if tag exists.

* Fixes tests readability.

* Need to eval locally if tag exists before creating it.

* edpc 1323 dev preview from release branch if exists (#925)

* changelog

* Logging we need to see what is going on.

* Small refactor to clarify what source code does.

* Use release branch if it exists, in dev mode.

* Checkout release branch for developer preview if available.

* Log in debug mode undone jira issues and chapters.

* Log in debug mode comment added to Jira Release Status

* Do branch checkout for non-release repos too-.

* gitReleaseBranch id needs to be saved for future usage in pipeline.

* If release manager branch is master, other comp. branch is defined in yaml.

* Need to push to the branch we are looking for.

* Initialize map before using it.

* typo

* Tests for InitStage

* tests for MROPipelineUtil.

* changelog

* Reverts problematic change.

Co-authored-by: Victor Pablos Ceruelo <victor.pablos_ceruelo.ext@boehringer-ingelheim.com>

* Feature/edpc 1335 allow to redeploy in D, Q and P (#926)

* Sets rePromote field to true by default + tests.

* Check if tag exists.

* Fixes tests readability.

* Need to eval locally if tag exists before creating it.

* changelog

Co-authored-by: zxBCN Pablos_Ceruelo,Victor (IT EDS) EXTERNAL <victor.pablos_ceruelo.ext@boehringer-ingelheim.com>

* changelog

* Feature/edpc 1335 set repromote to true if unset (#927)

* Sets rePromote field to true by default + tests.

* Check if tag exists.

* Fixes tests readability.

* Need to eval locally if tag exists before creating it.

* changelog

Co-authored-by: zxBCN Pablos_Ceruelo,Victor (IT EDS) EXTERNAL <victor.pablos_ceruelo.ext@boehringer-ingelheim.com>
Co-authored-by: Martinez,Angel (IT EDS) BI-ES-S <angel_2.martinez@boehringer-ingelheim.com>

* Force push in RM tags with redeploy

* Adds log to every single step where we can fail sending status to Jira.

* Including more logs to see where the problem is.

Co-authored-by: Victor Pablos Ceruelo <victor.pablos_ceruelo.ext@boehringer-ingelheim.com>
Co-authored-by: Martinez,Angel (IT EDS) BI-ES-S <angel_2.martinez@boehringer-ingelheim.com>
Co-authored-by: Jorge Romero <jorge.romeropalma@gmail.com>
Co-authored-by: Rodriguez,Hector (IT EDS) <hector_2.rodriguez@boehringer-ingelheim.com>
  • Loading branch information
5 people authored Aug 31, 2022
1 parent a4e1bbd commit 59d3d7b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/org/ods/orchestration/FinalizeStage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class FinalizeStage extends Stage {
'FAILED', "Release Manager for commit: ${project.gitData.commit}")
}

logger.debug(message)
util.failBuild(message)
throw new IllegalStateException(message)
} else {
Expand Down
16 changes: 13 additions & 3 deletions src/org/ods/orchestration/usecase/JiraUseCase.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ class JiraUseCase {
}

String getVersionFromReleaseStatusIssue() {
if (!this.jira) return ""
if (!this.jira) {
logger.warn("WARNING: this.jira has an invalid value.")
return ""
}

def releaseStatusIssueKey = this.project.buildParams.releaseStatusJiraIssueKey as String
def releaseStatusIssueFields = this.project.getJiraFieldsForIssueType(JiraUseCase.IssueTypes.RELEASE_STATUS)
Expand Down Expand Up @@ -353,12 +356,14 @@ class JiraUseCase {

void updateJiraReleaseStatusResult(String message, boolean isError) {
if (!this.jira) {
logger.warn("JiraUseCase: jira has an invalid value.")
logger.warn("updateJiraReleaseStatusResult: Could *NOT* update release status result because jira has invalid value.")
return
}

def status = isError ? 'Failed' : 'Successful'

logger.info("Updating Jira release status with result ${status} and comment ${message}")

def releaseStatusIssueKey = this.project.buildParams.releaseStatusJiraIssueKey
def releaseStatusIssueFields = this.project.getJiraFieldsForIssueType(JiraUseCase.IssueTypes.RELEASE_STATUS)

Expand All @@ -373,7 +378,12 @@ class JiraUseCase {
void addCommentInReleaseStatus(String message) {
def releaseStatusIssueKey = this.project.buildParams.releaseStatusJiraIssueKey
if (message) {
this.jira.appendCommentToIssue(releaseStatusIssueKey, "${message}\n\nSee: ${this.steps.env.RUN_DISPLAY_URL}")
String commentToAdd = "${message}\n\nSee: ${this.steps.env.RUN_DISPLAY_URL}"
logger.debug("Adding comment to Jira issue with key ${releaseStatusIssueKey}: ${commentToAdd}")
this.jira.appendCommentToIssue(releaseStatusIssueKey, commentToAdd)
logger.info("Comment was added to Jira issue with key ${releaseStatusIssueKey}: ${commentToAdd}")
} else {
logger.warn("*NO* Comment was added to Jira issue with key ${releaseStatusIssueKey}")
}

}
Expand Down
22 changes: 18 additions & 4 deletions src/org/ods/orchestration/util/Project.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ class Project {
this.logger.debug "WIP_Jira_Chapters: ${this.data.jira.undoneDocChapters}"

if (this.hasWipJiraIssues()) {
this.logger.warn "WIP_Jira_Issues: ${this.data.jira.undone}"
String message = ProjectMessagesUtil.generateWIPIssuesMessage(this)

if(!this.isWorkInProgress){
Expand Down Expand Up @@ -1124,6 +1125,16 @@ class Project {
logger.info("Versioning not supported for this release")
result = this.loadFullJiraData(projectKey)
}
} else {
logger.warn("WARNING: Could *not* retrieve data from Jira.")
if (! this.jiraUseCase) {
logger.warn("WARNING: Reason: this.jiraUseCase has no value")
} else {
if (! this.jiraUseCase.jira) {
logger.warn("WARNING: Reason: this.jiraUseCase.jira has no value")
}
}
logger.warn("WARNING: Without Jira data, we might not work as expected.")
}

return result
Expand Down Expand Up @@ -1181,13 +1192,13 @@ class Project {
}

if (previousVersionId) {
logger.info("Found a predecessor project version with ID '${previousVersionId}'. Loading its data.")
logger.info("loadJiraData: Found a predecessor project version with ID '${previousVersionId}'. Loading its data.")
def savedDataFromOldVersion = this.loadSavedJiraData(previousVersionId)
def mergedData = this.mergeJiraData(savedDataFromOldVersion, newData)
result << this.addKeyAndVersionToComponentsWithout(mergedData)
result.previousVersion = previousVersionId
} else {
logger.info("No predecessor project version found. Loading only data from Jira.")
logger.info("loadJiraData: No predecessor project version found. Loading only data from Jira.")
result << this.addKeyAndVersionToComponentsWithout(newData)
}

Expand Down Expand Up @@ -1434,14 +1445,17 @@ class Project {

void reportPipelineStatus(String message = '', boolean isError = false) {
if (!this.jiraUseCase) {
logger.warn("Project: jiraUseCase has an invalid value.")
logger.warn("reportPipelineStatus: Could *NOT* update release status because jiraUseCase has invalid value.")
return
}
this.jiraUseCase.updateJiraReleaseStatusResult(message, isError)
}

void addCommentInReleaseStatus(String message) {
if (!this.jiraUseCase) return
if (!this.jiraUseCase) {
logger.warn("addCommentInReleaseStatus: Could *NOT* add comment because jiraUseCase has invalid value.")
return
}
this.jiraUseCase.addCommentInReleaseStatus(message)
}

Expand Down

0 comments on commit 59d3d7b

Please sign in to comment.