Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 47 additions & 21 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,49 @@
node{
def MHD = tool name: "maven3.8.4"
stage('code'){
git branch: 'development', url: 'https://github.com/LandmakTechnology/web-app'
}
stage('BUILD'){
sh "${MHD}/bin/mvn clean package"

}
/*
stage('deploy'){
sshagent(['tomcat']) {
sh "scp -o StrictHostKeyChecking=no target/*war [email protected]:/opt/tomcat9/webapps/"
}
}
stage('email'){
emailext body: '''Build is over
pipeline {
agent any
stages {

stage('Transition Jira Issue to IN PROGRESS') {
steps {
script {
sh '''#!/bin/bash

Landmark
437212483''', recipientProviders: [developers(), requestor()], subject: 'Build', to: '[email protected]'
}
*/
JIRA_URL="https://team4techsolutions.atlassian.net/"
JIRA_USERNAME="[email protected]"
JIRA_API_TOKEN="ATATT3xFfGF0IsdAzJfFe2yEBJOu9NYEzRRNgVTr7lbeV2V2MAEUZYcgI029qRl-9ok5K9DTCXTnVIkx8bVJTc4fzwEvE21DcZqL7k0M-pKCoI_Uynsbwbmex_elUdbrfCuwy73M4Yv-w-_9njTUV25qFg0e7OqpMfpJOOafBOKobxdXS9VNtws=75C8017A"

# Extract the Jira issue key from the PR title
ISSUE_KEY=$(echo "$CHANGE_TITLE" | grep -oE 'DEV-[0-9]+')

# Fetch available transitions
TRANSITIONS_JSON=$(curl -s \
-H "Content-Type: application/json" \
-u "$JIRA_USERNAME:$JIRA_API_TOKEN" \
"${JIRA_URL}/rest/api/2/issue/$ISSUE_KEY/transitions")

echo "Available Transitions: $TRANSITIONS_JSON"

# Extract the ID for "IN PROGRESS"
TRANSITION_ID=$(echo "$TRANSITIONS_JSON" | jq '.transitions[] | select(.to.name | ascii_upcase == "IN PROGRESS") | .id' | tr -d '"')

# Logic to transition
if [ ! -z "$TRANSITION_ID" ]; then
TRANSITION_RESPONSE=$(curl -s -X POST \
-H "Content-Type: application/json" \
-u "$JIRA_USERNAME:$JIRA_API_TOKEN" \
-d '{
"transition": {
"id": "'"$TRANSITION_ID"'"
}
}' \
"${JIRA_URL}/rest/api/2/issue/$ISSUE_KEY/transitions")

echo "Transition Response: $TRANSITION_RESPONSE"
else
echo "The TRANSITION_ID is empty or not found."
fi
'''
}
}
}
}
}