Skip to content

Commit

Permalink
Merge branch 'main' into z/k2
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers committed May 13, 2024
2 parents 9b788f6 + d33c56a commit a752edf
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/checkout@v4

- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v2
uses: gradle/actions/wrapper-validation@v3

- name: Install JDK
uses: actions/setup-java@v4
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
kotlin = "2.0.0-RC3"
kotlinx-serialization = "1.6.3"
ksp = "2.0.0-RC3-1.0.20"
ktfmt = "0.47"
ktfmt = "0.49"
jvmTarget = "17"
moshix = "0.27.0-alpha01"
moshi = "1.15.1"
Expand Down Expand Up @@ -39,4 +39,4 @@ junit = "junit:junit:4.13.2"
tikxml-htmlEscape = { module = "com.tickaroo.tikxml:converter-htmlescape", version.ref = "tikxml" }
truth = "com.google.truth:truth:1.4.2"
xmlutil-core = { module = "io.github.pdvrieze.xmlutil:core", version.ref = "xmlutil" }
xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", version.ref = "xmlutil" }
xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", version.ref = "xmlutil" }
18 changes: 9 additions & 9 deletions src/main/kotlin/slack/cli/buildkite/BuildkiteDataBindings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public data class MultiChannelMessage(
@Serializable
public enum class GithubNotification(public val value: String) {
@SerialName("github_check") GithubCheck("github_check"),
@SerialName("github_commit_status") GithubCommitStatus("github_commit_status")
@SerialName("github_commit_status") GithubCommitStatus("github_commit_status"),
}

@Serializable
Expand Down Expand Up @@ -404,7 +404,7 @@ public data class BlockStep(
public enum class BlockedState(public val value: String) {
@SerialName("failed") Failed("failed"),
@SerialName("passed") Passed("passed"),
@SerialName("running") Running("running")
@SerialName("running") Running("running"),
}

/** The step keys for a step to depend on */
Expand Down Expand Up @@ -640,7 +640,7 @@ public data class ScriptStep(
@Serializable
public enum class ConcurrencyMethod(public val value: String) {
@SerialName("eager") Eager("eager"),
@SerialName("ordered") Ordered("ordered")
@SerialName("ordered") Ordered("ordered"),
}

@Serializable
Expand Down Expand Up @@ -847,7 +847,7 @@ public enum class SignalReason(public val value: String) {
@SerialName("cancel") Cancel("cancel"),
@SerialName("*") Empty("*"),
@SerialName("none") None("none"),
@SerialName("process_run_error") ProcessRunError("process_run_error")
@SerialName("process_run_error") ProcessRunError("process_run_error"),
}

/** Whether to allow a job to be retried manually */
Expand Down Expand Up @@ -892,7 +892,7 @@ public data class Signature(
public enum class ScriptType(public val value: String) {
@SerialName("command") Command("command"),
@SerialName("commands") Commands("commands"),
@SerialName("script") Script("script")
@SerialName("script") Script("script"),
}

@Serializable
Expand Down Expand Up @@ -1094,7 +1094,7 @@ public enum class StepType(public val value: String) {
@SerialName("script") Script("script"),
@SerialName("trigger") Trigger("trigger"),
@SerialName("wait") Wait("wait"),
@SerialName("waiter") Waiter("waiter")
@SerialName("waiter") Waiter("waiter"),
}

@Serializable
Expand Down Expand Up @@ -1138,7 +1138,7 @@ public data class WaitStep(
@Serializable
public enum class WaitType(public val value: String) {
@SerialName("wait") Wait("wait"),
@SerialName("waiter") Waiter("waiter")
@SerialName("waiter") Waiter("waiter"),
}

/**
Expand All @@ -1151,7 +1151,7 @@ public enum class StringStep(public val value: String) {
@SerialName("block") Block("block"),
@SerialName("input") Input("input"),
@SerialName("wait") Wait("wait"),
@SerialName("waiter") Waiter("waiter")
@SerialName("waiter") Waiter("waiter"),
}

@Serializable
Expand All @@ -1164,5 +1164,5 @@ public enum class NestedBlockStepType(public val value: String) {
@SerialName("script") Script("script"),
@SerialName("trigger") Trigger("trigger"),
@SerialName("wait") Wait("wait"),
@SerialName("waiter") Waiter("waiter")
@SerialName("waiter") Waiter("waiter"),
}
3 changes: 2 additions & 1 deletion src/main/kotlin/slack/cli/sarif/MergeSarifReports.kt
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ public class MergeSarifReports : CliktCommand(help = DESCRIPTION) {
mapOf(
SRC_ROOT to
originalUri.copy(
uri = "file://${projectDir
uri =
"file://${projectDir
.toFile().canonicalPath}/"
)
),
Expand Down
40 changes: 30 additions & 10 deletions src/test/kotlin/slack/cli/shellsentry/ResultProcessorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ class ResultProcessorTest(private val useExtensions: Boolean) {
outputFile.writeText(
"""
${KnownIssues.ftlRateLimit.matchingText}
""".trimIndent().padWithTestLogs()
"""
.trimIndent()
.padWithTestLogs()
)
val signal = newProcessor().process("", 1, outputFile.toPath(), isAfterRetry = false)
check(signal is RetrySignal.RetryDelayed)
Expand All @@ -136,7 +138,9 @@ class ResultProcessorTest(private val useExtensions: Boolean) {
outputFile.writeText(
"""
${KnownIssues.oom.matchingText}
""".trimIndent().padWithTestLogs()
"""
.trimIndent()
.padWithTestLogs()
)
val signal = newProcessor().process("", 1, outputFile.toPath(), isAfterRetry = false)
check(signal is RetrySignal.RetryImmediately)
Expand All @@ -148,7 +152,9 @@ class ResultProcessorTest(private val useExtensions: Boolean) {
outputFile.writeText(
"""
${KnownIssues.fakeFailure.matchingText}
""".trimIndent().padWithTestLogs()
"""
.trimIndent()
.padWithTestLogs()
)
val signal = newProcessor().process("", 1, outputFile.toPath(), isAfterRetry = false)
check(signal is RetrySignal.Ack)
Expand All @@ -157,19 +163,27 @@ class ResultProcessorTest(private val useExtensions: Boolean) {
@Test
fun matchingPattern_matches() {
val outputFile = tmpFolder.newFile("logs.txt")
outputFile.writeText("""
outputFile.writeText(
"""
FAKE_FAILURE_a
""".trimIndent().padWithTestLogs())
"""
.trimIndent()
.padWithTestLogs()
)
val signal = newProcessor().process("", 1, outputFile.toPath(), isAfterRetry = false)
check(signal is RetrySignal.Ack)
}

@Test
fun matchingPattern_doesNotMatch() {
val outputFile = tmpFolder.newFile("logs.txt")
outputFile.writeText("""
outputFile.writeText(
"""
FAKE_FAILURE-a
""".trimIndent().padWithTestLogs())
"""
.trimIndent()
.padWithTestLogs()
)
val signal = newProcessor().process("", 1, outputFile.toPath(), isAfterRetry = false)
check(signal is RetrySignal.Unknown)
}
Expand All @@ -183,7 +197,9 @@ class ResultProcessorTest(private val useExtensions: Boolean) {
Publishing build scan...
$scanUrl
""".trimIndent().padWithTestLogs()
"""
.trimIndent()
.padWithTestLogs()

// Assert in both directions they match
assertThat(log.lines().parseBuildScan(url)).isEqualTo(scanUrl)
Expand All @@ -194,9 +210,13 @@ class ResultProcessorTest(private val useExtensions: Boolean) {
fun lowConfidenceMatch_isSkipped() {
assumeTrue(useExtensions)
val outputFile = tmpFolder.newFile("logs.txt")
outputFile.writeText("""
outputFile.writeText(
"""
FAKE_FAILURE_a
""".trimIndent().padWithTestLogs())
"""
.trimIndent()
.padWithTestLogs()
)
val signal =
newProcessor(config = ShellSentryConfig(knownIssues = emptyList(), minConfidence = 100))
.process("", 1, outputFile.toPath(), isAfterRetry = false)
Expand Down

0 comments on commit a752edf

Please sign in to comment.