From 4e96a060718c93a231a2f04612e47ddb9f5691f5 Mon Sep 17 00:00:00 2001 From: Roberto Perez Alcolea Date: Wed, 17 Jan 2024 13:31:30 -0800 Subject: [PATCH] Improve error logging for tag push --- .../nebula/plugin/release/ReleasePluginIntegrationSpec.groovy | 2 +- .../groovy/nebula/plugin/release/git/base/ReleaseTask.groovy | 4 ++-- .../plugin/release/git/command/GitWriteCommandsUtil.groovy | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy b/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy index a5286eb..8647db8 100644 --- a/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy @@ -1212,7 +1212,7 @@ class ReleasePluginIntegrationSpec extends GitVersioningIntegrationTestKitSpec { git.checkout(branch: 'main', createBranch: true) when: - def result = runTasks('final') + def result = runTasks('final', '-i') then: result.task(':final').outcome == TaskOutcome.SUCCESS diff --git a/src/main/groovy/nebula/plugin/release/git/base/ReleaseTask.groovy b/src/main/groovy/nebula/plugin/release/git/base/ReleaseTask.groovy index c611001..b07d3a5 100644 --- a/src/main/groovy/nebula/plugin/release/git/base/ReleaseTask.groovy +++ b/src/main/groovy/nebula/plugin/release/git/base/ReleaseTask.groovy @@ -31,10 +31,10 @@ abstract class ReleaseTask extends DefaultTask { GitWriteCommandsUtil gitCommands = gitWriteCommandsUtil.get() String tagName = tagStrategy.get().maybeCreateTag(gitCommands, projectVersion.get()) if (tagName) { - logger.warn('Pushing changes in {} to {}', tagName, remote.get()) + logger.info('Pushing changes in {} to {}', tagName, remote.get()) gitCommands.pushTag(remote.get(), tagName) } else { - logger.warn('No new tags to push for {}', remote.get()) + logger.info('No new tags to push for {}', remote.get()) } } } diff --git a/src/main/groovy/nebula/plugin/release/git/command/GitWriteCommandsUtil.groovy b/src/main/groovy/nebula/plugin/release/git/command/GitWriteCommandsUtil.groovy index 00ce6eb..acabc53 100644 --- a/src/main/groovy/nebula/plugin/release/git/command/GitWriteCommandsUtil.groovy +++ b/src/main/groovy/nebula/plugin/release/git/command/GitWriteCommandsUtil.groovy @@ -38,6 +38,9 @@ class GitWriteCommandsUtil implements Serializable { try { executeGitCommand("push", remote, tag) } catch (Exception e) { + if(e.message.contains("* [new tag]")){ + return + } logger.error("Failed to push tag ${tag} to remote ${remote}", e) } }