Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

help, Jira with Bitbucket

Eduardo Suzart
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 22, 2019

i need help, how to do a jql in the Jira with the commit hash of Bitbucket, i need get the commit hash and write in the file .txt

1 answer

0 votes
Mikael Sandberg
Community Champion
April 22, 2019

You can use development[commits].all to get all issues that have commits associated with them. You would then have to use REST API provided by the integration to get the commit hash, see /rest/jira/1.0/issues/{issueKey}/commits.

Eduardo Suzart
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 22, 2019

Thank's for your answer, but i need run this in the Jenkinsfile, i'm mounting a JQL, and i want show the column with hash commits, example the down.

node {
stage('JIRA') {
withEnv(['JIRA_SITE=JiraConexao']) {

def searchResults = jiraJqlSearch jql: 'PROJECT = SS AND issuetype = Defeito AND status = "Aplicar Pacote" AND Fase in ("Fase 02", "Fase 01")'
def issues = searchResults.data.issues
for (i = 0; i <issues.size(); i++) {
def result = jiraGetIssue idOrKey: issues[i].key


string SS = result.data.key
echo result.data.key

GIT_COMMIT_HASH = sh (script: 'git log --pretty=format:"%h;%s" --no-merges | grep "'+ SS +'"' , returnStdout: true)
echo "${GIT_COMMIT_HASH}"

}
}

}

Mikael Sandberg
Community Champion
April 22, 2019

Jira doesn't hold the commit information, that is stored in Bitbucket so using JQL only will just get you halfway there. You need to use the REST API that comes with the integration to get the commit hashes.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events