This is the Kotlin DSL to generate Gitlab CI yaml file
gitlabCi {
default {
image("openjdk:8u162")
cache("./gradle/wrapper", "./gradle/caches")
beforeScript("export GRADLE_USER_HOME=\$(pwd)/.gradle")
}
stages {
+"test"
+"release"
}
job("build") {
stage = "test"
script("./gradlew clean build")
artifacts {
whenUpload = WhenUploadType.ALWAYS
paths("build/test-results", "build/reports")
expireIn = Duration(days = 7)
reports {
junit("build/test-results/test/TEST-*.xml")
}
}
}
job("release") {
stage = "release"
script("./gradlew publishToMavenLocal")
only {
master()
}
artifacts {
whenUpload = WhenUploadType.ON_SUCCESS
paths("build/libs")
expireIn = Duration(days = 7)
}
}
}
Library is available in Central Maven Repository
<dependency>
<groupId>com.github.pcimcioch</groupId>
<artifactId>gitlab-ci-kotlin-dsl</artifactId>
<version>1.4.1</version>
</dependency>
implementation("com.github.pcimcioch:gitlab-ci-kotlin-dsl:1.4.1")
All supported features are documented in Features Page
.gitlab-ci.yml
file. Example.gitlab-ci.yml
file. ExampleSome real applications using this plugin include: