[HAP-1051]  Artifactory Release Staging stopped working after update to 2.15 Created: 30/Mar/18  Updated: 01/Apr/18  Resolved: 01/Apr/18

Status: Resolved
Project: Jenkins Artifactory Plug-in
Component/s: None
Affects Version/s: 2.15.0
Fix Version/s: 2.15.1

Type: Bug Priority: Blocker
Reporter: Piotr Chmielnik Assignee: Bar Belity
Resolution: Fixed Votes: 0
Labels: None


 Description   

Artifactory Release Staging stopped working after update to version 2.15

[RELEASE] Release build triggered
 > git config --get remote.origin.url # timeout=10
[RELEASE] Checking if tag 'multitenancy-context-1.4.1' exists.
 > git tag -l multitenancy-context-1.4.1 # timeout=10
 > git config --get remote.origin.url # timeout=10
[RELEASE] Creating tag 'multitenancy-context-1.4.1_test' with message 'this is a test tag'
 > git tag -a -f -m this is a test tag multitenancy-context-1.4.1_test # timeout=10
 > git config --get remote.origin.url # timeout=10
[RELEASE] Attempting to push tag multitenancy-context-1.4.1_test with --dry-run
 > git config --get remote.origin.url # timeout=10
[RELEASE] Checking if tag 'multitenancy-context-1.4.1_test' exists.
 > git tag -l multitenancy-context-1.4.1_test # timeout=10
 > git config --get remote.origin.url # timeout=10
[RELEASE] Deleting local tag: multitenancy-context-1.4.1_test
 > git tag -d multitenancy-context-1.4.1_test # timeout=10
[RELEASE] ERROR: Failed while attempting push dry-run: Failed to retrieve git credentials

It seems that plugin tries to make some test dry run and stuck during that phase. I see that such option has been introduced in 2.15


git diff artifactory-2.14.0 artifactory-2.15.0 GitCoordinator.java
diff --git a/src/main/java/org/jfrog/hudson/release/scm/git/GitCoordinator.java b/src/main/java/org/jfrog/hudson/release/scm/git/GitCoordinator.java
index cc24f33..56cd95b 100644
--- a/src/main/java/org/jfrog/hudson/release/scm/git/GitCoordinator.java
+++ b/src/main/java/org/jfrog/hudson/release/scm/git/GitCoordinator.java
@@ -19,7 +19,6 @@ package org.jfrog.hudson.release.scm.git;
 import hudson.model.AbstractBuild;
 import hudson.model.BuildListener;
 import hudson.model.Result;
-import org.apache.commons.lang.StringUtils;
 import org.jfrog.hudson.release.ReleaseAction;
 import org.jfrog.hudson.release.ReleaseRepository;
 import org.jfrog.hudson.release.scm.AbstractScmCoordinator;
@@ -59,6 +58,25 @@ public class GitCoordinator extends AbstractScmCoordinator {
         checkoutBranch = scmManager.getBranchNameWithoutRemote(gitBranchName);
     }
 
+    public void pushDryRun() throws Exception {
+        if (releaseAction.isCreateVcsTag()) {
+            if (scmManager.isTagExists(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), releaseAction.getTagUrl())) {
+                throw new Exception(String.format("Tag with name '%s' already exists", releaseAction.getTagUrl()));
+            }
+        }
+
+        String testTagName = releaseAction.getTagUrl() + "_test";
+        try {
+            scmManager.testPush(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), testTagName);
+        } catch (Exception e) {
+            throw new Exception(String.format("Failed while attempting push dry-run: %s", e.getMessage()), e);
+        } finally {
+            if (scmManager.isTagExists(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), testTagName)) {
+                scmManager.deleteLocalTag(testTagName);
+            }
+        }
+    }
+
     public void beforeReleaseVersionChange() throws IOException, InterruptedException {
         if (releaseAction.isCreateReleaseBranch()) {
             // create a new branch for the release and start it



 Comments   
Comment by Bar Belity [ 01/Apr/18 ]

The issue happens as a result of running 'push dry-run', as part of Artifactory Release Staging. The issue seems to affect only when authenticating with Git using ssh protocol.

For now, this fix skips 'push dry-run' when using ssh.

Generated at Sun Oct 20 00:35:05 UTC 2019 using JIRA 7.6.16#76018-sha1:9ed376192612a49536ac834c64177a0fed6290f5.