-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
61 lines (52 loc) · 2.09 KB
/
Jenkinsfile
File metadata and controls
61 lines (52 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!groovy
@Library('github.com/cloudogu/ces-build-lib@4.1.1')
import com.cloudogu.ces.cesbuildlib.*
// Creating necessary git objects, object cannot be named 'git' as this conflicts with the method named 'git' from the library
gitWrapper = new Git(this, "cesmarvin")
gitWrapper.committerName = 'cesmarvin'
gitWrapper.committerEmail = 'cesmarvin@cloudogu.com'
gitflow = new GitFlow(this, gitWrapper)
github = new GitHub(this, gitWrapper)
changelog = new Changelog(this)
gpg = new Gpg(this, docker)
Makefile makefile = new Makefile(this)
// Configuration of repository
repositoryOwner = "cloudogu"
repositoryName = "ces-control-api"
// Configuration of branches
productionReleaseBranch = "main"
developmentBranch = "develop"
currentBranch = "${env.BRANCH_NAME}"
node('docker') {
timestamps {
properties([
// Keep only the last x builds to preserve space
buildDiscarder(logRotator(numToKeepStr: '10')),
// Don't run concurrent builds for a branch, because they use the same workspace directory
disableConcurrentBuilds(),
])
stage('Checkout') {
checkout scm
}
stage('Lint') {
// most mistakes can be automatically fixed with:
// docker run --volume "$(pwd):/workspace" --workdir /workspace yoheimuta/protolint lint -fix grpc-protobuf
new Docker(this)
.image("yoheimuta/protolint:0.53.0")
.mountJenkinsUser()
.inside("--volume ${WORKSPACE}:/workspace -w /workspace") {
sh "protolint lint grpc-protobuf"
}
}
if (gitflow.isReleaseBranch()) {
String releaseVersion = gitWrapper.getSimpleBranchName()
String version = makefile.getVersion()
stage('Finish Release') {
gitflow.finishRelease(releaseVersion, productionReleaseBranch)
}
stage('Add Github-Release') {
releaseId = github.createReleaseWithChangelog(releaseVersion, changelog, productionReleaseBranch)
}
}
}
}