Skip to content

Commit

Permalink
chore(md): make sending git config the default behavior (spinnaker#4099)
Browse files Browse the repository at this point in the history
  • Loading branch information
emjburns authored Mar 15, 2021
1 parent 82fb71b commit e52dc9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,16 @@ constructor(
context.repoType, context.projectKey, context.repositorySlug, context.directory, context.manifest, context.ref
)

if (context.sendGitInfo) {
//todo eb: make this normal and not behind this flag
val metadata: MutableMap<String, Any?> = objectMapper.convertValue(deliveryConfig.getOrDefault("metadata", emptyMap<String, Any?>()))
val gitMetadata = processTriggerGitInfo(trigger, stage)
log.debug("Publishing manifest ${context.manifest} to keel on behalf of $user with git metadata")
val metadata: MutableMap<String, Any?> = objectMapper.convertValue(deliveryConfig.getOrDefault("metadata", emptyMap<String, Any?>()))
val gitMetadata = processTriggerGitInfo(trigger, stage)
if (gitMetadata != null) {
metadata["gitMetadata"] = gitMetadata
deliveryConfig["metadata"] = metadata
}

log.debug("Publishing manifest ${context.manifest} to keel on behalf of $user")
keelService.publishDeliveryConfig(deliveryConfig)

TaskResult.builder(ExecutionStatus.SUCCEEDED).context(emptyMap<String, Any?>()).build()
} catch (e: RetrofitError) {
handleRetryableFailures(e, context)
Expand Down Expand Up @@ -262,8 +261,7 @@ constructor(
var ref: String? = null,
var attempt: Int = 1,
val maxRetries: Int? = MAX_RETRIES,
var errorFromLastAttempt: String? = null,
var sendGitInfo: Boolean = false
var errorFromLastAttempt: String? = null
)

fun ImportDeliveryConfigContext.incrementAttempt() = this.also { attempt += 1 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ internal class ImportDeliveryConfigTaskTests : JUnit5Minutests {

context("parsing git metadata") {
test("parses correctly") {
execute(mutableMapOf("sendGitInfo" to true))
execute(mutableMapOf())
val submittedConfig = slot<DeliveryConfig>()
verify(exactly = 1) {
keelService.publishDeliveryConfig(capture(submittedConfig))
Expand Down

0 comments on commit e52dc9c

Please sign in to comment.