Skip to content

Commit b6cfaf2

Browse files
committed
Initial
0 parents  commit b6cfaf2

Some content is hidden

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

68 files changed

+7169
-0
lines changed

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
classes/
2+
target/
3+
*/src/*/java/META-INF
4+
*/src/META-INF/
5+
*/src/*/java/META-INF/
6+
.classpath
7+
.springBeans
8+
.project
9+
.DS_Store
10+
.settings/
11+
.idea/
12+
out/
13+
bin/
14+
intellij/
15+
build/
16+
*.log
17+
*.log.*
18+
*.iml
19+
*.ipr
20+
*.iws
21+
.gradle/
22+
atlassian-ide-plugin.xml
23+
!etc/eclipse/.checkstyle
24+
.checkstyle
25+
s101plugin.state

Jenkinsfile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
def projectProperties = [
2+
[$class: 'BuildDiscarderProperty',
3+
strategy: [$class: 'LogRotator', numToKeepStr: '5']],
4+
pipelineTriggers([cron('@daily')])
5+
]
6+
properties(projectProperties)
7+
8+
def SUCCESS = hudson.model.Result.SUCCESS.toString()
9+
currentBuild.result = SUCCESS
10+
11+
try {
12+
parallel check: {
13+
stage('Check') {
14+
node {
15+
checkout scm
16+
try {
17+
sh "./gradlew clean assemble check --no-daemon --stacktrace"
18+
} catch(Exception e) {
19+
currentBuild.result = 'FAILED: check'
20+
throw e
21+
} finally {
22+
junit '**/build/test-results/*/*.xml'
23+
}
24+
}
25+
}
26+
}
27+
28+
if(currentBuild.result == 'SUCCESS') {
29+
parallel deploy: {
30+
stage('Deploy Application') {
31+
node {
32+
checkout scm
33+
sh "./ci/scripts/install-cf.sh"
34+
withCredentials([usernamePassword(credentialsId: 'backportbot-cf', passwordVariable: 'CF_PASSWORD', usernameVariable: 'CF_USERNAME')]) {
35+
sh "./cf login -a api.run.pivotal.io -o FrameworksAndRuntimes -s rwinch -u '$CF_USERNAME' -p '$CF_PASSWORD'"
36+
}
37+
withCredentials([string(credentialsId: 'backportbot-issuemaster-personal-access-token', variable: 'ISSUEMASTER_PERSONAL_ACCESS_TOKEN')]) {
38+
withCredentials([usernamePassword(credentialsId: 'backportbot-client-registration', passwordVariable: 'CLIENT_SECRET', usernameVariable: 'CLIENT_ID')]) {
39+
withCredentials([string(credentialsId: 'backportbot-github-webhook-secret', variable: 'GITHUB_WEBHOOK_SECRET')]) {
40+
sh "./ci/scripts/cf-push.sh backportbot \"--var CLIENT_ID=$CLIENT_ID --var CLIENT_SECRET=$CLIENT_SECRET --var GITHUB_WEBHOOK_SECRET=$GITHUB_WEBHOOK_SECRET --var ISSUEMASTER_PERSONAL_ACCESS_TOKEN=$ISSUEMASTER_PERSONAL_ACCESS_TOKEN --var INFO_VERSION=build-${env.BUILD_NUMBER}\""
41+
}
42+
}
43+
}
44+
}
45+
}
46+
}
47+
}
48+
} catch(Exception e) {
49+
currentBuild.result = 'FAILED: deploys'
50+
throw e
51+
} finally {
52+
def buildStatus = currentBuild.result
53+
def buildNotSuccess = !SUCCESS.equals(buildStatus)
54+
def lastBuildNotSuccess = !SUCCESS.equals(currentBuild.previousBuild?.result)
55+
56+
if(buildNotSuccess || lastBuildNotSuccess) {
57+
58+
stage('Notifiy') {
59+
node {
60+
final def RECIPIENTS = [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']]
61+
62+
def subject = "${buildStatus}: Build ${env.JOB_NAME} ${env.BUILD_NUMBER} status is now ${buildStatus}"
63+
def details = """The build status changed to ${buildStatus}. For details see ${env.BUILD_URL}"""
64+
65+
emailext (
66+
subject: subject,
67+
body: details,
68+
recipientProviders: RECIPIENTS,
69+
70+
)
71+
}
72+
}
73+
}
74+
}

README.adoc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BackportBot handles backports
2+
3+
= Behavior
4+
5+
The BackportBot assists in creating backport issues and automatically closing backport issues.
6+
7+
== Creating Backport
8+
9+
The BackportBot can create issues in two different ways.
10+
In either case the following logic is used:
11+
12+
* If backport issue does not exist:
13+
* Create a new backport issue with the additional label `is: backport`
14+
* Update the existing issue with the label `is: backported`
15+
* Automatically remove the `backport: <branch-name>` label from the existing issue
16+
17+
=== Via Labels
18+
19+
You can add a label in the form of `backport: <branch-name>` (i.e. backport: 5.1.x) and
20+
adding the label to a ticket will create a backport for the branch `<branch-name` (i.e. 5.1.x).
21+
22+
=== Pushing to Branch
23+
24+
You can create a backport by pushing to a branch that ends in `.x` with `Fixes: gh-<number>` in the commit message.
25+
26+
== Closing Backport
27+
28+
If a branch ending in `.x` is pushed to, the BackportBot will look at the commit message for the pattern `Fixes: gh-<number>`.
29+
If the pattern is found, it looks up the issue `<number>` and closes the backport that has a milestone corresponding to the gradle.properties in the branch that is being pushed to.

build.gradle

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
buildscript {
2+
ext {
3+
kotlinVersion = '1.2.71'
4+
springBootVersion = '2.1.2.RELEASE'
5+
}
6+
repositories {
7+
mavenCentral()
8+
gradlePluginPortal()
9+
}
10+
dependencies {
11+
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
12+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
13+
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
14+
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.0.0"
15+
}
16+
}
17+
18+
apply plugin: 'kotlin'
19+
apply plugin: 'kotlin-spring'
20+
apply plugin: 'eclipse'
21+
apply plugin: 'org.springframework.boot'
22+
apply plugin: 'io.spring.dependency-management'
23+
apply plugin: "com.gorylenko.gradle-git-properties"
24+
25+
group = 'io.spring'
26+
version = '0.0.1-SNAPSHOT'
27+
sourceCompatibility = 1.8
28+
compileKotlin {
29+
kotlinOptions {
30+
freeCompilerArgs = ["-Xjsr305=strict"]
31+
jvmTarget = "1.8"
32+
}
33+
}
34+
compileTestKotlin {
35+
kotlinOptions {
36+
freeCompilerArgs = ["-Xjsr305=strict"]
37+
jvmTarget = "1.8"
38+
}
39+
}
40+
41+
repositories {
42+
mavenCentral()
43+
}
44+
45+
46+
dependencies {
47+
implementation('org.springframework.boot:spring-boot-starter-security')
48+
implementation('org.springframework.boot:spring-boot-starter-oauth2-client')
49+
implementation('org.springframework.boot:spring-boot-starter-thymeleaf')
50+
implementation('org.springframework.boot:spring-boot-starter-actuator')
51+
implementation('org.springframework.boot:spring-boot-devtools')
52+
implementation('nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect')
53+
implementation('org.springframework.boot:spring-boot-starter-web')
54+
implementation('org.springframework.boot:spring-boot-starter-webflux')
55+
implementation('com.fasterxml.jackson.module:jackson-module-kotlin')
56+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
57+
implementation("org.jetbrains.kotlin:kotlin-reflect")
58+
59+
compile('org.webjars:webjars-locator-core')
60+
compile('org.webjars:bootstrap:3.3.6')
61+
compile('org.webjars:jquery:1.11.3')
62+
63+
testImplementation('com.squareup.okhttp3:mockwebserver:3.12.0')
64+
testImplementation('org.springframework.boot:spring-boot-starter-test')
65+
testImplementation('org.springframework.security:spring-security-test')
66+
testImplementation('io.projectreactor:reactor-test')
67+
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0"
68+
testImplementation "org.skyscreamer:jsonassert:1.5.0"
69+
}

ci/scripts/cf-push.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
##########################################################################################
4+
# ci/scripts/cf-push.sh backportbot "--var CLIENT_ID=$ID --var CLIENT_SECRET=$SECRET --var GITHUB_WEBHOOK_SECRET=$HOOK --var ISSUEMASTER_PERSONAL_ACCESS_TOKEN=$TOKEN --var INFO_VERSION=$VERSION"
5+
6+
APP_NAME=$1
7+
# --var CLIENT_ID=$CLIENT_ID --var CLIENT_SECRET=$CLIENT_SECRET --var ISSUEMASTER_PERSONAL_ACCESS_TOKEN=$ISSUEMASTER_PERSONAL_ACCESS_TOKEN --var GITHUB_WEBHOOK_SECRET=$GITHUB_WEBHOOK_SECRET --var INFO_VERSION=$INFO_VERSION
8+
PUSH_ARGS=$2
9+
##########################################################################################
10+
11+
# the name that the current production application will get temporarily while we deploy
12+
# the new app to APP_NAME
13+
VENERABLE_APP_NAME="$APP_NAME-venerable"
14+
15+
cf delete $VENERABLE_APP_NAME -f
16+
cf rename $APP_NAME $VENERABLE_APP_NAME
17+
18+
if cf push $APP_NAME -p build/libs/*.jar $PUSH_ARGS ; then
19+
# the app started successfully so remove venerable app
20+
cf delete $VENERABLE_APP_NAME -f
21+
else
22+
# the app failed to start so delete the newly deployed app and rename old app back
23+
cf delete $APP_NAME -f
24+
cf rename $VENERABLE_APP_NAME $APP_NAME
25+
fi

ci/scripts/install-cf.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
curl -L "https://cli.run.pivotal.io/stable?release=linux64-binary&source=github" | tar -zx

gradle/wrapper/gradle-wrapper.jar

54.9 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)