From 113ca53c028a3564e34e83debaff85c0f5d7bc2f Mon Sep 17 00:00:00 2001 From: Johannes Schnatterer Date: Thu, 5 Nov 2020 11:25:26 +0100 Subject: [PATCH] Jenkins: Set build description Write info about gitOps commit into build description in order to show more transparently what was done. --- Jenkinsfile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9e2e74fcd..b92563925 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 {