From ce6f3ac7a84256d09dbde612469e8d02cc2a4e7c Mon Sep 17 00:00:00 2001 From: Matheus Albino Brunhara Date: Thu, 3 Oct 2024 09:36:59 -0300 Subject: [PATCH] Updates git-commit-with-jira.sh and jira-get-packages-with-closed-issues.sh --- scripts/shell/job/git-commit-with-jira.sh | 6 ++-- .../jira-get-packages-with-closed-issues.sh | 36 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/shell/job/git-commit-with-jira.sh b/scripts/shell/job/git-commit-with-jira.sh index fe0d310..e94e917 100755 --- a/scripts/shell/job/git-commit-with-jira.sh +++ b/scripts/shell/job/git-commit-with-jira.sh @@ -1,10 +1,10 @@ #!/bin/bash -jira_ticket=$(echo $(pwd) | grep -oE "(ETICS|CDK|IM)-[0-9]+" | tail -n1) +jira_ticket=$(echo $(pwd) | grep -oE "(ETICS|CDK|IM|OM|ITSM|GPMAPS)-[0-9]+" | tail -n1) if [ -z $jira_ticket ]; then - echo "[ERROR] No Jira Ticket was found in current working directory" - exit 1 + echo "[ERROR] No Jira Ticket was found in current working directory" + exit 1 fi commit_message=$1 diff --git a/scripts/shell/job/jira-get-packages-with-closed-issues.sh b/scripts/shell/job/jira-get-packages-with-closed-issues.sh index eabd95d..7a56709 100755 --- a/scripts/shell/job/jira-get-packages-with-closed-issues.sh +++ b/scripts/shell/job/jira-get-packages-with-closed-issues.sh @@ -7,29 +7,29 @@ echo -n Password for user "$USER": read -s password for gp_repo in ${GP_REPOS[@]}; do - packages_path=$(jf rt search --include-dirs=true --recursive=false "$gp_repo/*" | jq -r '.[].path' | grep 'ETICS-') + packages_path=$(jf rt search --include-dirs=true --recursive=false "$gp_repo/*" | jq -r '.[].path' | grep 'ETICS-') - for package in ${packages_path[@]}; do - package_jira=$(grep -Eo 'ETICS-[[:digit:]]*' <<<"$package") + for package in ${packages_path[@]}; do + package_jira=$(grep -Eo 'ETICS-[[:digit:]]*' <<<"$package") - jira_json=$(curl --silent --user $USER:$password https://jira.cpqd.com.br/rest/api/2/issue/$package_jira) + jira_json=$(curl --silent --user $USER:$password https://jira.cpqd.com.br/rest/api/2/issue/$package_jira) - jira_fields=$(jq '.fields' <<<$jira_json) - jira_status=$(jq '.status.name' <<<$jira_fields) + jira_fields=$(jq '.fields' <<<$jira_json) + jira_status=$(jq '.status.name' <<<$jira_fields) - # if [[ $jira_status == *"Closed"* ]]; then - jira_assignee=$(jq '.assignee.name' <<<$jira_fields) - jira_reporter=$(jq '.reporter.name' <<<$jira_fields) + if [[ "$jira_status" == *"Closed"* || "$jira_status" == *"Fechado"* ]]; then + jira_assignee=$(jq '.assignee.name' <<<$jira_fields) + jira_reporter=$(jq '.reporter.name' <<<$jira_fields) - echo -e "\n" + echo -e "\n" - echo "Pacote: \"$package\"" - echo "Jira: \"$package_jira\" (https://jira.cpqd.com.br/browse/$package_jira)" - echo "Status: \"$jira_status\"" - echo "Responsável: $jira_assignee" - echo "Reportador: $jira_reporter" + echo "Pacote: \"$package\"" + echo "Jira: \"$package_jira\" (https://jira.cpqd.com.br/browse/$package_jira)" + echo "Status: \"$jira_status\"" + echo "Responsável: $jira_assignee" + echo "Reportador: $jira_reporter" - echo -e "\n" - # fi - done + echo -e "\n" + fi + done done