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 ) ; } } }
This method uses the configured git credentials and repo to test its validity . In addition in case the user requested creation of a new tag it checks that another tag with the same name doesn t exist