Skip to content

Commit 4640b76

Browse files
author
Devyn Goetsch
committed
Initial commit
1 parent c3333a0 commit 4640b76

File tree

1,535 files changed

+21741
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,535 files changed

+21741
-0
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Set up JDK
13+
uses: actions/setup-java@v1
14+
with:
15+
java-version: 11.0.5
16+
- name: Gradle Command
17+
uses: eskatos/gradle-command-action@v1
18+
with:
19+
arguments: build
20+

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.gradle/
2+
.idea/
3+
*.ipr
4+
*.iml
5+
build/
6+
out/
7+
core/build/
8+
core/out/
9+
dsl/build/
10+
dsl/out
11+
examples/build/
12+
examples/out/
13+
internal/build/
14+
interna/out

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Dynamic Declarative Jenkinsfile in Kotlin
2+
3+
pipelinekt is a kotlin library that generates Jenkinsfiles.
4+
5+
## Why:
6+
7+
1. Generate Jenkins Declarative Pipelines dynamically, a feature which is not supported by Jenkins
8+
2. Use Kotlin to build your pipeline models
9+
1. IDE integration
10+
2. Tab Completion
11+
3. Compile time validation
12+
3. Share code with sane defaults
13+
1. for example, cleanWs on each stage that defines an agent by default.
14+
2. dynamic stage definitions means any part of the pipeline can be pulled out into a method, and that means more
15+
shared configuration and less code duplication
16+
17+
## Subprojects
18+
19+
* core - The base framework for the dsl
20+
* internal - internal implementation for most dsl methods; not exposed to end users
21+
* dsl - end user interface
22+
* examples - code examples
23+
24+
# Documentation
25+
26+
* [Examples](examples/src/main/kotlin)
27+
* [The Docs](docs/index.md)
28+
29+
# getting started
30+
Please see the [quickstart guide](docs/quickstart.md)
31+

build.gradle.kts

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
import org.jetbrains.dokka.gradle.DokkaTask
2+
3+
val kotlinVersion = "1.3.61"
4+
5+
plugins {
6+
base
7+
kotlin("jvm") version "1.3.21"
8+
id("idea")
9+
maven
10+
id("com.diffplug.gradle.spotless").version("3.26.1")
11+
id("org.jetbrains.dokka").version("0.10.0")
12+
id("io.gitlab.arturbosch.detekt").version("1.2.2")
13+
jacoco
14+
}
15+
16+
val groupName = "com.code42.jenkins"
17+
val baseProjectName = "pipelinekt"
18+
val publishedProjects = listOf("core", "internal", "dsl")
19+
20+
val version = "0.13.1-SNAPSHOT"
21+
22+
23+
24+
repositories {
25+
mavenCentral()
26+
jcenter()
27+
}
28+
allprojects {
29+
group = "com.code42.lib.jenkins"
30+
31+
repositories {
32+
repositories {
33+
jcenter()
34+
mavenCentral()
35+
}
36+
}
37+
}
38+
39+
val dokka by tasks.getting(DokkaTask::class) {
40+
outputFormat = "gfm"
41+
outputDirectory = "${project.rootDir}/docs/dokka"
42+
configuration {
43+
sourceLink {
44+
path = "./"
45+
url = "https://github.com/code42/pipelinekt/tree/master"
46+
lineSuffix = "#L"
47+
}
48+
49+
subProjects = publishedProjects
50+
}
51+
52+
53+
}
54+
55+
tasks.build {
56+
finalizedBy("dokka")
57+
}
58+
59+
subprojects {
60+
val sourcesJar by tasks.registering(Jar::class) {
61+
classifier = "sources"
62+
from(sourceSets.main.get().allSource)
63+
}
64+
65+
apply {
66+
plugin("org.jetbrains.kotlin.jvm")
67+
plugin("org.gradle.maven")
68+
if(publishedProjects.contains(project.name)) {
69+
plugin("org.gradle.maven-publish")
70+
}
71+
}
72+
73+
dependencies {
74+
implementation(kotlin("stdlib-jdk8", kotlinVersion))
75+
implementation(kotlin("reflect", kotlinVersion))
76+
testImplementation("org.jetbrains.kotlin:kotlin-test")
77+
testImplementation( "org.jetbrains.kotlin:kotlin-test-junit")
78+
}
79+
80+
81+
82+
83+
84+
if(publishedProjects.contains(project.name)) {
85+
apply(plugin = "com.diffplug.gradle.spotless")
86+
apply(plugin = "io.gitlab.arturbosch.detekt")
87+
apply(plugin = "org.gradle.jacoco")
88+
89+
90+
tasks.withType<JacocoReport> {
91+
reports {
92+
xml.isEnabled = false
93+
csv.isEnabled = false
94+
html.isEnabled = true
95+
html.destination = file("$buildDir/reports/coverage")
96+
}
97+
}
98+
99+
tasks.build {
100+
finalizedBy("jacocoTestReport")
101+
}
102+
103+
spotless {
104+
kotlin {
105+
ktlint()
106+
}
107+
kotlinGradle {
108+
109+
target("*.gradle.kts'", "additionalScripts/*.gradle.kts")
110+
111+
ktlint()
112+
}
113+
}
114+
115+
detekt {
116+
input = files("src/main/kotlin", "src/test/kotlin")
117+
baseline = file("detekt-${project.name}-baseline.xml") // Just if you want to create a baseline file.
118+
}
119+
120+
tasks.withType<io.gitlab.arturbosch.detekt.Detekt> {
121+
exclude(".*/resources/.*,.*/build/.*")
122+
}
123+
}
124+
}
125+
126+

core/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.gradle
2+
build/
3+
out/
4+
.idea/
5+
ssh/
6+
jenkins_home/
7+
# Ignore Gradle GUI config
8+
gradle-app.setting
9+
10+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
11+
!gradle-wrapper.jar
12+
13+
# Cache of project
14+
.gradletasknamecache

0 commit comments

Comments
 (0)