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

Change the build status to Unstable when Jira Issues not DONE and deploying to D #664

Merged
merged 13 commits into from
Jun 22, 2021

Conversation

jorge-romero
Copy link
Contributor

Change to unstable the result of the build in case of documents not closed

@metmajer metmajer changed the title Feature/edpc 691 Change the build status to Unstable when Documentation Issue not DONE and deploy to D Jun 15, 2021
@metmajer metmajer changed the title Change the build status to Unstable when Documentation Issue not DONE and deploy to D Change the build status to Unstable when Jira Issues not DONE and deploying to D Jun 15, 2021
message += '\n\n' + type.capitalize() + ': ' + values.join(', ')
}
}
message
Copy link
Member

Choose a reason for hiding this comment

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

If you get the chance to, please use return statements even though Groovy does not require it, but aids readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is done in the new class afte refactoring that we have created to deal with the message as @angelmp01 requested

Comment on lines +88 to +97
def cannotContinueAsHasOpenIssuesInClosingRelease = false
try {
result = new InitStage(this, project, repos, startAgentStage).execute()
} catch (OpenIssuesException ex) {
cannotContinueAsHasOpenIssuesInClosingRelease = true
}
if (cannotContinueAsHasOpenIssuesInClosingRelease) {
logger.warn('Cannot continue as it has open issues in the release.')
return
}
Copy link
Member

Choose a reason for hiding this comment

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

@jorge-romero why rather complex? wouldn't the logger.warn + return inside the catch block be enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's was my first implementation, but it was complaining about trying to finalize the pipeline within a catch block, that's why I had to rewrite in this ugly way unfortunally

Copy link
Contributor

Choose a reason for hiding this comment

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

Another solution may be logger.warn + result=false inside the catch block. And remove cannotContinueAsHasOpenIssuesInClosingRelease var.

message += '\n\n' + type.capitalize() + ': ' + values.join(', ')
}
}
String message = generateWIPIssuesMessage()
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use only the message inside the if, create it inside

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you check the whole code as in the diff looks different it is inside the if block :)

@@ -406,6 +397,21 @@ class Project {
return this
}

def generateWIPIssuesMessage() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can move the responsability of generate this message to another class instead Project class. Think that project class is too big.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to another class, and moved the tests for that specific functionallity to a new Spec for that class

@jorge-romero jorge-romero merged commit 30a9f77 into master Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants