-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add option to ignore source bundle upload failures #209
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,7 @@ import java.util.Properties | |||||||||||||||||||||||||||||
| import kotlin.io.path.Path | ||||||||||||||||||||||||||||||
| import kotlin.io.path.absolutePathString | ||||||||||||||||||||||||||||||
| import kotlin.test.assertEquals | ||||||||||||||||||||||||||||||
| import kotlin.test.assertFailsWith | ||||||||||||||||||||||||||||||
| import kotlin.test.assertTrue | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| class UploadSourceBundleTestIT { | ||||||||||||||||||||||||||||||
|
|
@@ -27,17 +28,54 @@ class UploadSourceBundleTestIT { | |||||||||||||||||||||||||||||
| baseDir: File, | ||||||||||||||||||||||||||||||
| skipPlugin: Boolean = false, | ||||||||||||||||||||||||||||||
| skipSourceBundle: Boolean = false, | ||||||||||||||||||||||||||||||
| ignoreSourceBundleUploadFailure: Boolean = false, | ||||||||||||||||||||||||||||||
| sentryCliPath: String? = null, | ||||||||||||||||||||||||||||||
| extraSourceRoots: List<String> = listOf(), | ||||||||||||||||||||||||||||||
| extraSourceContextDirs: List<String> = emptyList(), | ||||||||||||||||||||||||||||||
NINNiT marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||
| sentryUrl: String? = null, | ||||||||||||||||||||||||||||||
| ): String { | ||||||||||||||||||||||||||||||
| val pomContent = basePom(skipPlugin, skipSourceBundle, sentryCliPath, extraSourceRoots, extraSourceContextDirs) | ||||||||||||||||||||||||||||||
| val pomContent = | ||||||||||||||||||||||||||||||
| basePom( | ||||||||||||||||||||||||||||||
| skipPlugin, | ||||||||||||||||||||||||||||||
| skipSourceBundle, | ||||||||||||||||||||||||||||||
| ignoreSourceBundleUploadFailure, | ||||||||||||||||||||||||||||||
| sentryCliPath, | ||||||||||||||||||||||||||||||
| extraSourceRoots, | ||||||||||||||||||||||||||||||
| extraSourceContextDirs, | ||||||||||||||||||||||||||||||
| sentryUrl, | ||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Files.write(Path("${baseDir.absolutePath}/pom.xml"), pomContent.toByteArray(), StandardOpenOption.CREATE) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| return baseDir.absolutePath | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||
| fun `does not fail build when upload fails and ignoreSourceBundleUploadFailure is true`() { | ||||||||||||||||||||||||||||||
| val baseDir = setupProject() | ||||||||||||||||||||||||||||||
| val path = getPOM(baseDir, ignoreSourceBundleUploadFailure = true, sentryUrl = "http://unknown") | ||||||||||||||||||||||||||||||
| val verifier = Verifier(path) | ||||||||||||||||||||||||||||||
| verifier.isAutoclean = false | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| verifier.executeGoal("install") | ||||||||||||||||||||||||||||||
| verifier.verifyTextInLog("Source bundle upload failed, ignored by configuration") | ||||||||||||||||||||||||||||||
| verifier.resetStreams() | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a test to confirm that if the flag is set to false the build fails (i.e. old behaviour):
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
seems to do just fine. |
||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||
| fun `fails build when upload fails and ignoreSourceBundleUploadFailure is false`() { | ||||||||||||||||||||||||||||||
| val baseDir = setupProject() | ||||||||||||||||||||||||||||||
| val path = getPOM(baseDir, sentryUrl = "http://unknown") | ||||||||||||||||||||||||||||||
| val verifier = Verifier(path) | ||||||||||||||||||||||||||||||
| verifier.isAutoclean = false | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| assertFailsWith<VerificationException> { | ||||||||||||||||||||||||||||||
| verifier.executeGoal("install") | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| verifier.verifyTextInLog("Could not resolve hostname (Could not resolve host: unknown)") | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| @Test | ||||||||||||||||||||||||||||||
| @Throws(VerificationException::class, IOException::class) | ||||||||||||||||||||||||||||||
| fun `uploads source bundle`() { | ||||||||||||||||||||||||||||||
|
|
@@ -161,9 +199,7 @@ class UploadSourceBundleTestIT { | |||||||||||||||||||||||||||||
| verifier.resetStreams() | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| private fun setupEmptyProject(): File { | ||||||||||||||||||||||||||||||
| return setupProject(subdirectories = emptyList()) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| private fun setupEmptyProject(): File = setupProject(subdirectories = emptyList()) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| private fun setupProject( | ||||||||||||||||||||||||||||||
| baseDir: String = "base", | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.