net.nemerosa.ontrack.kdsl.spec.extension.general.MetricsValidationExtensions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-kdsl Show documentation
Show all versions of ontrack-kdsl Show documentation
Ontrack module: ontrack-kdsl
package net.nemerosa.ontrack.kdsl.spec.extension.general
import com.apollographql.apollo.api.Input
import net.nemerosa.ontrack.kdsl.connector.graphql.convert
import net.nemerosa.ontrack.kdsl.connector.graphql.schema.ValidateWithMetricsMutation
import net.nemerosa.ontrack.kdsl.connector.graphql.schema.type.MetricsEntryInput
import net.nemerosa.ontrack.kdsl.connector.graphqlConnector
import net.nemerosa.ontrack.kdsl.spec.Build
fun Build.validateWithMetrics(
validation: String,
description: String = "",
status: String,
metrics: Map,
) {
graphqlConnector.mutate(
ValidateWithMetricsMutation(
id.toInt(),
Input.fromNullable(description),
validation,
Input.fromNullable(status),
metrics.map { (name, value) ->
MetricsEntryInput.builder()
.name(name)
.value(value)
.build()
}
)
) {
it?.validateBuildByIdWithMetrics()?.fragments()?.payloadUserErrors()?.convert()
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy