Issue
I am trying to fetch all git tags in descending order via groovy script. I am using below commands in my script.
def gettagsUrl = "git ls-remote --tags https://" + bitbucketUser + ":" + bitbucketPass +"bitbucket/scm/config/configurations-" + "Object" +".git" +"|" + command
def command = ['#!/bin/bash', '-c' , sort -Vr -k2 ]
But I am getting below error:-
groovy.lang.MissingPropertyException: No such property: sort for class: Script1 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
My git version is 1.8.3.1
Can anyone help here. TIA
Solution
for this version Groovy scripts work for me for fetching tag
def gettagsUrl =[ "/bin/bash","-c" , "git ls-remote https://" + bitbucketUser + ":" + bitbucketPass
+"bitbucket/scm/config/configurations-" + "Object" +".git" | awk '{print \$2}' | grep -v '\\^{}\$' | sort -r -V | sed 's@refs/tags/@@' " ]
Answered By - Parth Shah
Answer Checked By - David Goodson (JavaFixing Volunteer)