Jenkins: Set build description

Write info about gitOps commit into build description in order to show more transparently what was done.
This commit is contained in:
Johannes Schnatterer 2020-11-05 11:25:26 +01:00
parent 9963f6307d
commit 113ca53c02

19
Jenkinsfile vendored
View file

@ -77,7 +77,8 @@ node {
]
]
pushToConfigRepo(gitopsConfig)
String pushedChanges = pushToConfigRepo(gitopsConfig)
currentBuild.description = createBuildDescription(pushedChanges, imageName)
} else {
echo 'Skipping deploy, because build not successful'
}
@ -217,6 +218,22 @@ void createPullRequest(Map gitopsConfig) {
}
}
private String createBuildDescription(String pushedChanges, String imageName) {
String description = ''
description += "GitOps commits: "
if (pushedChanges) {
description += pushedChanges
} else {
description += 'No changes'
}
description += "\nImage: ${imageName}"
return description
}
/** Queries and stores info about current repo and HEAD commit */
class GitRepo {