-
Notifications
You must be signed in to change notification settings - Fork 50
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
Feature/scmm pr handling #50
Conversation
Signed-off-by: Philipp Markiewka <philipp.markiewka@cloudogu.com>
Signed-off-by: Philipp Markiewka <philipp.markiewka@cloudogu.com>
Signed-off-by: Philipp Markiewka <philipp.markiewka@cloudogu.com>
Signed-off-by: Philipp Markiewka <philipp.markiewka@cloudogu.com>
Signed-off-by: Philipp Markiewka <philipp.markiewka@cloudogu.com>
Signed-off-by: Philipp Markiewka <philipp.markiewka@cloudogu.com>
Signed-off-by: Philipp Markiewka <philipp.markiewka@cloudogu.com>
Signed-off-by: Philipp Markiewka <philipp.markiewka@cloudogu.com>
Don't expose methods that return SCM-Mananger specific data, as we might want to abstract a SCM interface that might be implemented by SCM-Manager, GitHub, etc.
httpCode = httpCode.trim() | ||
script.echo "Creating pull request yields httpCode: ${httpCode}" | ||
if (httpCode != "201") { | ||
script.unstable 'Could not create pull request' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be more versatile to return false
here?
This way the caller can decide what to do about it.
We could even think about adding a createOrUpdate()
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the execution continues after the unstable call!
That is, it causes an exception java.lang.NullPointerException: Cannot invoke method split() on null object
because the following is still executed return httpResponse.headers.location.split("/")[-1]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have needed this several times in libs and also in Jenkinsfiles. In addition implementing it inside a functional class such as Git or SCMManager, is the opposite of separation of concerns.
"java.lang.NullPointerException: Cannot invoke method split() on null object" cause by ongoing control flow after script.unstable.
5016ef9
to
5bf1c43
Compare
Use HttpClient mock and JsonOutput instead of raw curl outputs.
Allows for extension, not just PRs. Also extends test: - also assert URLs, content type and body - removes unit tests for protected method (it's only used internally, is is tested via public API)
Signed-off-by: Marek Markiewka <marek.markiewka@cloudogu.com>
… unstable Signed-off-by: Philipp Markiewka <philipp.markiewka@cloudogu.com>
Implements pull request handling for the SCM-Manager