pcimcioch.gitlabci.dsl.workflow.WorkflowDsl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gitlab-ci-kotlin-dsl Show documentation
Show all versions of gitlab-ci-kotlin-dsl Show documentation
Library providing Kotlin DSL to configure GitlabCI file
package pcimcioch.gitlabci.dsl.workflow
import kotlinx.serialization.Serializable
import pcimcioch.gitlabci.dsl.DslBase
import pcimcioch.gitlabci.dsl.job.RuleListDsl
@Serializable
class WorkflowDsl : DslBase() {
var rules: RuleListDsl? = null
fun rules(block: RuleListDsl.() -> Unit = {}) = ensureRules().apply(block)
override fun validate(errors: MutableList) {
addErrors(errors, "[workflow]", rules)
}
private fun ensureRules() = rules ?: RuleListDsl().also { rules = it }
companion object {
init {
addSerializer(WorkflowDsl::class, serializer())
}
}
}