Add link to Gradle build scan in Slack notifications
See gh-22490
This commit is contained in:
parent
c3f439417e
commit
f0564b746a
|
@ -10,7 +10,6 @@ plugins {
|
||||||
id "com.github.ben-manes.versions" version '0.24.0'
|
id "com.github.ben-manes.versions" version '0.24.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/gradle/build-scan-user-data.gradle"
|
|
||||||
ext {
|
ext {
|
||||||
moduleProjects = subprojects.findAll { it.name.startsWith("spring-") }
|
moduleProjects = subprojects.findAll { it.name.startsWith("spring-") }
|
||||||
javaProjects = subprojects - project(":framework-bom")
|
javaProjects = subprojects - project(":framework-bom")
|
||||||
|
|
|
@ -30,6 +30,7 @@ resources:
|
||||||
branch: ((branch))
|
branch: ((branch))
|
||||||
- name: every-morning
|
- name: every-morning
|
||||||
type: time
|
type: time
|
||||||
|
icon: alarm
|
||||||
source:
|
source:
|
||||||
start: 8:00 AM
|
start: 8:00 AM
|
||||||
stop: 9:00 AM
|
stop: 9:00 AM
|
||||||
|
@ -166,7 +167,11 @@ jobs:
|
||||||
params: { state: "failure", commit: "git-repo" }
|
params: { state: "failure", commit: "git-repo" }
|
||||||
- put: slack-alert
|
- put: slack-alert
|
||||||
params:
|
params:
|
||||||
text: ":concourse-failed: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!>"
|
text: >
|
||||||
|
:concourse-failed: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!
|
||||||
|
[<https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|build log>]
|
||||||
|
[<$TEXT_FILE_CONTENT|build scan>]
|
||||||
|
text_file: git-repo/build/build-scan-uri.txt
|
||||||
silent: true
|
silent: true
|
||||||
icon_emoji: ":concourse:"
|
icon_emoji: ":concourse:"
|
||||||
username: concourse-ci
|
username: concourse-ci
|
||||||
|
@ -227,7 +232,11 @@ jobs:
|
||||||
params: { state: "failure", commit: "git-repo" }
|
params: { state: "failure", commit: "git-repo" }
|
||||||
- put: slack-alert
|
- put: slack-alert
|
||||||
params:
|
params:
|
||||||
text: ":concourse-failed: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!>"
|
text: >
|
||||||
|
:concourse-failed: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!
|
||||||
|
[<https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|build log>]
|
||||||
|
[<$TEXT_FILE_CONTENT|build scan>]
|
||||||
|
text_file: git-repo/build/build-scan-uri.txt
|
||||||
silent: true
|
silent: true
|
||||||
icon_emoji: ":concourse:"
|
icon_emoji: ":concourse:"
|
||||||
username: concourse-ci
|
username: concourse-ci
|
||||||
|
@ -259,7 +268,11 @@ jobs:
|
||||||
params: { state: "failure", commit: "git-repo" }
|
params: { state: "failure", commit: "git-repo" }
|
||||||
- put: slack-alert
|
- put: slack-alert
|
||||||
params:
|
params:
|
||||||
text: ":concourse-failed: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!>"
|
text: >
|
||||||
|
:concourse-failed: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!
|
||||||
|
[<https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|build log>]
|
||||||
|
[<$TEXT_FILE_CONTENT|build scan>]
|
||||||
|
text_file: git-repo/build/build-scan-uri.txt
|
||||||
silent: true
|
silent: true
|
||||||
icon_emoji: ":concourse:"
|
icon_emoji: ":concourse:"
|
||||||
username: concourse-ci
|
username: concourse-ci
|
||||||
|
@ -291,7 +304,11 @@ jobs:
|
||||||
params: { state: "failure", commit: "git-repo" }
|
params: { state: "failure", commit: "git-repo" }
|
||||||
- put: slack-alert
|
- put: slack-alert
|
||||||
params:
|
params:
|
||||||
text: ":concourse-failed: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!>"
|
text: >
|
||||||
|
:concourse-failed: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!
|
||||||
|
[<https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|build log>]
|
||||||
|
[<$TEXT_FILE_CONTENT|build scan>]
|
||||||
|
text_file: git-repo/build/build-scan-uri.txt
|
||||||
silent: true
|
silent: true
|
||||||
icon_emoji: ":concourse:"
|
icon_emoji: ":concourse:"
|
||||||
username: concourse-ci
|
username: concourse-ci
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
addCustomJavaHomeMetadata()
|
|
||||||
addCustomJavaSourceVersionMetadata()
|
|
||||||
|
|
||||||
void addCustomJavaHomeMetadata() {
|
|
||||||
def customJavaHome = System.getProperty("customJavaHome")
|
|
||||||
if (customJavaHome) {
|
|
||||||
buildScan.value "Custom JAVA_HOME", customJavaHome
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void addCustomJavaSourceVersionMetadata() {
|
|
||||||
def customJavaSourceVersion = System.getProperty("customJavaSourceVersion")
|
|
||||||
if (customJavaSourceVersion) {
|
|
||||||
buildScan.value "Custom Java Source Version", customJavaSourceVersion
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -41,3 +41,21 @@ rootProject.name = "spring"
|
||||||
rootProject.children.each {project ->
|
rootProject.children.each {project ->
|
||||||
project.buildFileName = "${project.name}.gradle"
|
project.buildFileName = "${project.name}.gradle"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings.gradle.projectsLoaded {
|
||||||
|
gradleEnterprise {
|
||||||
|
buildScan {
|
||||||
|
if (settings.gradle.rootProject.hasProperty('customJavaHome')) {
|
||||||
|
value("Custom JAVA_HOME", settings.gradle.rootProject.getProperty('customJavaHome'))
|
||||||
|
}
|
||||||
|
if (settings.gradle.rootProject.hasProperty('customJavaSourceVersion')) {
|
||||||
|
value("Custom Java Source Version", settings.gradle.rootProject.getProperty('customJavaSourceVersion'))
|
||||||
|
}
|
||||||
|
settings.gradle.rootProject.getBuildDir().mkdirs()
|
||||||
|
new File(settings.gradle.rootProject.getBuildDir(), "build-scan-uri.txt").text = "(build scan not generated)"
|
||||||
|
buildScanPublished { scan ->
|
||||||
|
new File(settings.gradle.rootProject.getBuildDir(), "build-scan-uri.txt").text = "${scan.buildScanUri}\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue