diff --git a/jira.sh b/jira.sh new file mode 100755 index 00000000..832c758c --- /dev/null +++ b/jira.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# +# This file contains the standard configuration relating to all queries used for tracker automations. +# Any use of numeric custom fields or filters should be defined here. +# This file should be sourced by any script that needs to use the tracker. + +set -e + +customfield_automatedTestResults=17112 +customfield_componentLeadReview=15810 +customfield_currentlyInIntegration=10211 +customfield_integrationDate=10210 +customfield_integrationPriority=12210 +customfield_integrator=10110 +customfield_pullFromRepository=10100 +customfield_tester=10011 + +filter_candidatesForCLR=23329 +filter_candidatesForIntegration=14000 +filter_integrationCLRDecision=23535 +filter_issuesHeldUntilAfterRelease=21366 +filter_issuesVotedToUnhold=22054 +filter_issuesWaitingForReviewOrInProgress=22610 +filter_mustFixIssues=21363 + +# Verify everything is set +required="jiraclicmd jiraserver jirauser jirapass" +for var in $required; do + if [ -z "${!var}" ]; then + echo "Error: ${var} environment variable is not defined. See the script comments." + exit 1 + fi +done + +# Set the base request command. +basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" diff --git a/tracker_automations/bulk_precheck_issues/bulk_precheck_issues.sh b/tracker_automations/bulk_precheck_issues/bulk_precheck_issues.sh index 529c1f16..28252ef3 100755 --- a/tracker_automations/bulk_precheck_issues/bulk_precheck_issues.sh +++ b/tracker_automations/bulk_precheck_issues/bulk_precheck_issues.sh @@ -4,9 +4,9 @@ #jiraserver: jira server url we are going to connect to #jirauser: user that will perform the execution #jirapass: password of the user -#cf_repository: id for "Pull from Repository" custom field (customfield_10100) -#cf_branches: pairs of moodle branch and id for "Pull XXXX Branch" custom field (main:customfield_10111,....) -#cf_testinginstructions: id for testing instructions custom field (customfield_10117) +#cf_repository: id for "Pull from Repository" custom field (customfield_XXXXX) +#cf_branches: pairs of moodle branch and id for "Pull XXXX Branch" custom field (main:customfield_XXXXX,....) +#cf_testinginstructions: id for testing instructions custom field (customfield_XXXXX) #criteria: "awaiting peer review", "awaiting integration", "developer request" #informtofiles: comma separated list of files where each MDL processed will be informed (format MDL-xxxx unixseconds) #$maxcommitswarn: Max number of commits accepted per run. Warning if exceeded. Defaults to 10. @@ -22,7 +22,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass cf_repository cf_branches cf_testinginstructions criteria quiet jenkinsjobname jenkinsserver publishserver" +required="WORKSPACE cf_repository cf_branches cf_testinginstructions criteria quiet jenkinsjobname jenkinsserver publishserver" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -30,6 +30,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # wipe the workspace rm -fr "${WORKSPACE}"/* @@ -38,8 +43,6 @@ resultfile=${WORKSPACE}/bulk_precheck_issues echo -n > "${resultfile}" # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" # Normalise criteria criteria=${criteria// /_} diff --git a/tracker_automations/bulk_prelaunch_jobs/bulk_prelaunch_jobs.sh b/tracker_automations/bulk_prelaunch_jobs/bulk_prelaunch_jobs.sh index ee10266d..36ba0437 100755 --- a/tracker_automations/bulk_prelaunch_jobs/bulk_prelaunch_jobs.sh +++ b/tracker_automations/bulk_prelaunch_jobs/bulk_prelaunch_jobs.sh @@ -8,9 +8,9 @@ #jenkinsauth: String that defines the method to connect to the jenkins server, can be -ssh # (requiring keys to be in place and jenkins ssh enabled), or also -html (and then # use a combination of user and password or token). See Jenkins CLI docs for more info. -#cf_repository: id for "Pull from Repository" custom field (customfield_10100) +#cf_repository: id for "Pull from Repository" custom field (customfield_XXXXX) #cf_branches: comma separated trios of moodle branch, id for "Pull XXXX Branch" custom field and php version. -# Trios are colon separated, example: main:customfield_10111:7.3,....). All them required. +# Trios are colon separated, example: main:customfield_XXXXX:7.3,....). All them required. #criteria: "awaiting integration"... #schedulemins: Frecuency (in minutes) of the schedule (cron) of this job. IMPORTANT to ensure that they match or there will be issues processed more than once or skipped. #jobtype: defaulting to "all", allows to just pick one of the available jobs: phpunit, behat-(firefox|chrome|nonjs|all). @@ -20,7 +20,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass jenkinsserver jenkinsauth cf_repository cf_branches criteria schedulemins quiet" +required="WORKSPACE jenkinsserver jenkinsauth cf_repository cf_branches criteria schedulemins quiet" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -28,6 +28,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # wipe the workspace rm -fr "${WORKSPACE}"/* @@ -36,8 +41,6 @@ resultfile=${WORKSPACE}/bulk_prelaunch_jobs echo -n > "${resultfile}" # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" # Normalise criteria criteria=${criteria// /_} diff --git a/tracker_automations/bulk_prelaunch_jobs/criteria/list_of_mdls_sdev/query.sh b/tracker_automations/bulk_prelaunch_jobs/criteria/list_of_mdls_sdev/query.sh index 0921d3ae..942582cf 100755 --- a/tracker_automations/bulk_prelaunch_jobs/criteria/list_of_mdls_sdev/query.sh +++ b/tracker_automations/bulk_prelaunch_jobs/criteria/list_of_mdls_sdev/query.sh @@ -1,7 +1,7 @@ ${basereq} --action getIssueList \ --jql "project = 'Moodle' \ AND issue IN (${issueslist}) \ - AND cf[10100] ~ 'integration/security-testing' \ + AND cf[${customfield_pullFromRepository}] ~ 'integration/security-testing' \ AND level IS NOT EMPTY \ ORDER BY priority DESC, votes DESC, 'Last comment date' ASC" \ --outputFormat 101 \ diff --git a/tracker_automations/check_marked_as_integrated/check_marked_as_integrated.sh b/tracker_automations/check_marked_as_integrated/check_marked_as_integrated.sh index b5c52de7..5e48df80 100755 --- a/tracker_automations/check_marked_as_integrated/check_marked_as_integrated.sh +++ b/tracker_automations/check_marked_as_integrated/check_marked_as_integrated.sh @@ -22,7 +22,7 @@ if [ -z "$gitremotename" ]; then fi # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass gitcmd gitdir gitremotename devbranches" +required="WORKSPACE gitcmd gitdir gitremotename devbranches" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -30,13 +30,16 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile="$WORKSPACE/check_marked_as_integrated.csv" echo -n > "${resultfile}" # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" IFS=',' read -a devbranchesarr <<< "$devbranches" # Convert devbranches to array. # Include some utility functions diff --git a/tracker_automations/close_tested_issues/close_tested_issues.sh b/tracker_automations/close_tested_issues/close_tested_issues.sh index 4d6e88d5..21e86fa9 100755 --- a/tracker_automations/close_tested_issues/close_tested_issues.sh +++ b/tracker_automations/close_tested_issues/close_tested_issues.sh @@ -16,7 +16,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass" +required="WORKSPACE" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -24,6 +24,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/close_tested_issues.csv echo -n > "${resultfile}" @@ -32,8 +37,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/close_tested_issues.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" # Set closedate and closecomment if not specified @@ -59,8 +62,8 @@ for issue in $( sed -n 's/^"\(MDL-[0-9]*\)".*/\1/p' "${resultfile}" ); do --issue ${issue} \ --transition "Mark as committed" \ --resolution "Fixed" \ - --field "customfield_10211=" \ - --field "customfield_10210=${altdate}" \ + --field "customfield_${customfield_currentlyInIntegration}=" \ + --field "customfield_${customfield_integrationDate}=${altdate}" \ --comment "${altcomment}" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue}" >> "${logfile}" done diff --git a/tracker_automations/component_leads_integration_mover/component_leads_integration_mover.sh b/tracker_automations/component_leads_integration_mover/component_leads_integration_mover.sh index 5f0ba1d8..227dea39 100755 --- a/tracker_automations/component_leads_integration_mover/component_leads_integration_mover.sh +++ b/tracker_automations/component_leads_integration_mover/component_leads_integration_mover.sh @@ -15,7 +15,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass jsonclrurl releasedate" +required="WORKSPACE jsonclrurl releasedate" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -23,6 +23,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # We need curl to execute this script. if [[ ! $(which curl) ]]; then echo "Error: This script needs \"curl\" installed to work" @@ -46,8 +51,6 @@ logfile=${WORKSPACE}/component_leads_integration_mover.log clrfile=${WORKSPACE}/clr.json # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" if [[ "${clearcache}" == "true" ]]; then @@ -110,9 +113,8 @@ if [ "${nowdate}" -ge "${freezedate}" ] && [ "${nowdate}" -lt "${onsyncenddate}" fi # Search for all the issues awaiting for integration and not being decided between CLR/IR. -# Note: customfield_10118 is the peer reviewer custom field. ${basereq} --action getIssueList \ - --jql "filter = 23535 ${excludequery}" \ + --jql "filter = ${filter_integrationCLRDecision} ${excludequery}" \ --columns="Key,Assignee,Peer reviewer,Components,Security Level,Summary" \ --outputFormat=4 \ --outputType=json \ @@ -159,13 +161,13 @@ jq -c '.[]' ${resultfile} | while read -r json; do # we are setting some custom fields not available (on purpose) on that screen. So we have created a # global transition, only available to the bots, not transitioning but bringing access to all the fields # via special screen. So we'll ne using that global transition via transitionIssue instead. - # customfield_15810 is the "Component Lead Review" field (Yes => CLR, No => IR, empty => undecided). + # "Component Lead Review" field: (Yes => CLR, No => IR, empty => undecided). if [[ "${outcome}" == "IR" ]]; then # No CLR. Just update the field. ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_15810=No" + --field "customfield_${customfield_componentLeadReview}=No" else # CLR. Real transition to Waiting for CLR. ${basereq} --action transitionIssue \ diff --git a/tracker_automations/continuous_manage_queues/continuous_manage_queues.sh b/tracker_automations/continuous_manage_queues/continuous_manage_queues.sh index 5ccf952b..b0c876c4 100755 --- a/tracker_automations/continuous_manage_queues/continuous_manage_queues.sh +++ b/tracker_automations/continuous_manage_queues/continuous_manage_queues.sh @@ -44,7 +44,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass releasedate" +required="WORKSPACE releasedate" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -52,6 +52,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/continuous_manage_queues.csv echo -n > "${resultfile}" @@ -60,8 +65,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/continuous_manage_queues.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" source ${mydir}/lib.sh # Add all the functions. diff --git a/tracker_automations/continuous_manage_queues/lib.sh b/tracker_automations/continuous_manage_queues/lib.sh index 9c83484c..abff99e8 100755 --- a/tracker_automations/continuous_manage_queues/lib.sh +++ b/tracker_automations/continuous_manage_queues/lib.sh @@ -6,7 +6,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass releasedate" +required="WORKSPACE releasedate" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -14,6 +14,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # A1, add the "integration_held" + standard comment to any new feature or improvement arriving to candidates (IR & CLR) function run_A1() { # Note this could be done by one unique "runFromIssueList" action, but we are splitting @@ -25,9 +30,9 @@ function run_A1() { # Get the list of issues. ${basereq} --action getIssueList \ - --jql "(filter=14000) \ + --jql "(filter=${filter_candidatesForIntegration}) \ AND type IN ('New Feature', Improvement) \ - AND NOT filter = 22054 \ + AND NOT filter = ${filter_issuesVotedToUnhold} \ AND NOT (status changed FROM 'Waiting for component lead review' TO 'Waiting for integration review' AFTER -2h)" \ --file "${resultfile}" @@ -58,10 +63,10 @@ If you want Moodle HQ to consider including it into the incoming major release p function run_A2() { # Get the list of issues. ${basereq} --action getIssueList \ - --jql "filter=14000 - AND NOT filter = 21366 + --jql "filter=${filter_candidatesForIntegration} + AND NOT filter = ${filter_issuesHeldUntilAfterRelease} AND ( - filter = 21363 OR + filter = ${filter_mustFixIssues} OR labels IN (mdlqa) OR level IS NOT EMPTY )" \ @@ -95,14 +100,14 @@ function run_A2() { # that non-transitional transition and use normal update. #${basereq} --action updateIssue \ # --issue ${issue} \ - # --field="customfield_10110=" --field="customfield_10210=" --field="customfield_10211=Yes" + # --field="customfield_${customfield_integrator}=" --field="customfield_${customfield_integrationDate}=" --field="customfield_${customfield_currentlyInIntegration}=Yes" ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_10211=Yes" \ - --field "customfield_15810=No" \ - --field "customfield_10110=" \ - --field "customfield_10011=" \ + --field "customfield_${customfield_currentlyInIntegration}=Yes" \ + --field "customfield_${customfield_componentLeadReview}=No" \ + --field "customfield_${customfield_integrator}=" \ + --field "customfield_${customfield_tester}=" \ --comment "Continuous queues manage: Moving to current because it's important" \ --role "Integrators" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue} moved to current: important" >> "${logfile}" @@ -129,7 +134,7 @@ function run_A3a() { if [[ "$counter" -lt "$currentmin" ]]; then # Get an ordered list of issues in the candidate queue. ${basereq} --action getIssueList \ - --jql "filter=14000 \ + --jql "filter=${filter_candidatesForIntegration} \ ORDER BY Rank ASC" \ --file "${resultfile}" @@ -167,14 +172,14 @@ function run_A3a() { # that non-transitional transition and use normal update. #${basereq} --action updateIssue \ # --issue ${issue} \ - # --field="customfield_10110=" --field="customfield_10210=" --field="customfield_10211=Yes" + # --field="customfield_${customfield_integrator}=" --field="customfield_${customfield_integrationDate}=" --field="customfield_${customfield_currentlyInIntegration}=Yes" ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_10211=Yes" \ - --field "customfield_15810=No" \ - --field "customfield_10110=" \ - --field "customfield_10011=" \ + --field "customfield_${customfield_currentlyInIntegration}=Yes" \ + --field "customfield_${customfield_componentLeadReview}=No" \ + --field "customfield_${customfield_integrator}=" \ + --field "customfield_${customfield_tester}=" \ --comment "Continuous queues manage: Moving to current given we are below the threshold ($currentmin)" \ --role "Integrators" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue} moved to current: threshold (before ${lastweekdate})" >> "${logfile}" @@ -189,9 +194,9 @@ function run_A3b() { # - Must-fix issues # - mdlqa issues ${basereq} --action getIssueList \ - --jql "filter=14000 OR ( - filter=23329 AND NOT ( - filter = 21363 OR + --jql "filter=${filter_candidatesForIntegration} OR ( + filter=${filter_candidatesForCLR} AND NOT ( + filter = ${filter_mustFixIssues} OR labels IN (mdlqa) ) )" \ @@ -237,7 +242,7 @@ function run_B1b() { if [[ "$counter" -lt "$currentmin" ]]; then # Get an ordered list of issues in the candidate queue. ${basereq} --action getIssueList \ - --jql "filter=14000 \ + --jql "filter=${filter_candidatesForIntegration} \ ORDER BY Rank ASC" \ --file "${resultfile}" @@ -275,14 +280,14 @@ function run_B1b() { # that non-transitional transition and use normal update. #${basereq} --action updateIssue \ # --issue ${issue} \ - # --field="customfield_10110=" --field="customfield_10210=" --field="customfield_10211=Yes" + # --field="customfield_${customfield_integrator}=" --field="customfield_${customfield_integrationDate}=" --field="customfield_${customfield_currentlyInIntegration}=Yes" ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_10211=Yes" \ - --field "customfield_15810=No" \ - --field "customfield_10110=" \ - --field "customfield_10011=" \ + --field "customfield_${customfield_currentlyInIntegration}=Yes" \ + --field "customfield_${customfield_componentLeadReview}=No" \ + --field "customfield_${customfield_integrator}=" \ + --field "customfield_${customfield_tester}=" \ --comment "Continuous queues manage: Moving to current given we are below the threshold ($currentmin)" \ --role "Integrators" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue} moved to current on-sync: threshold" >> "${logfile}" @@ -300,9 +305,9 @@ function run_B1a() { # Get the list of issues. ${basereq} --action getIssueList \ - --jql "(filter=14000 OR filter=23329) \ + --jql "(filter=${filter_candidatesForIntegration} OR filter=${filter_candidatesForCLR}) \ AND type IN ('New Feature', Improvement) \ - AND NOT filter = 22054" \ + AND NOT filter = ${filter_issuesVotedToUnhold}" \ --file "${resultfile}" # Iterate over found issues and perform the actions with them. @@ -388,13 +393,13 @@ function run_C() { # that non-transitional transition and use normal update. #${basereq} --action updateIssue \ # --issue ${issue} \ - # --field="customfield_10110=" --field="customfield_10210=" --field="customfield_10211=Yes" + # --field="customfield_${customfield_integrator}=" --field="customfield_${customfield_integrationDate}=" --field="customfield_${customfield_currentlyInIntegration}=Yes" ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_10211=" \ - --field "customfield_10110=" \ - --field "customfield_10011=" \ + --field "customfield_${customfield_currentlyInIntegration}=" \ + --field "customfield_${customfield_integrator}=" \ + --field "customfield_${customfield_tester}=" \ --comment "Continuous queues manage: Moving out from current because it's held" \ --role "Integrators" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue} moved out from current: held" >> "${logfile}" diff --git a/tracker_automations/count_delayed_last_cycle/count_delayed_last_cycle.sh b/tracker_automations/count_delayed_last_cycle/count_delayed_last_cycle.sh index 320aae07..12880e7a 100755 --- a/tracker_automations/count_delayed_last_cycle/count_delayed_last_cycle.sh +++ b/tracker_automations/count_delayed_last_cycle/count_delayed_last_cycle.sh @@ -4,7 +4,7 @@ #jiraserver: jira server url we are going to connect to #jirauser: user that will perform the execution #jirapass: password of the user -#integrationdate_cf: id of the 'Integration date' custom field (customfield_10210) +#integrationdate_cf: id of the 'Integration date' custom field # Let's go strict (exit on error) set -e @@ -13,7 +13,7 @@ set -e quiet='--quiet' # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass integrationdate_cf" +required="WORKSPACE integrationdate_cf" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -21,6 +21,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # temp file for intermediate storing of results tempfile="${WORKSPACE}/count_delayed_temp.csv" echo -n > "${tempfile}" @@ -48,8 +53,7 @@ echo "Last integration cycle ended with info ${lastintegrationjira} on ${lastint allintegrationfile="${WORKSPACE}/count_delayed_all_cycles.csv" # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass} ${quiet}" +basereq="${basereq} ${quiet}" # Let's search the latest Integration date in the Tracker # (we cannot get the Integration date with this query because diff --git a/tracker_automations/count_reopened_last_cycle/count_reopened_last_cycle.sh b/tracker_automations/count_reopened_last_cycle/count_reopened_last_cycle.sh index 015d7d97..8e5a605b 100755 --- a/tracker_automations/count_reopened_last_cycle/count_reopened_last_cycle.sh +++ b/tracker_automations/count_reopened_last_cycle/count_reopened_last_cycle.sh @@ -4,13 +4,13 @@ #jiraserver: jira server url we are going to connect to #jirauser: user that will perform the execution #jirapass: password of the user -#integrationdate_cf: id of the 'Integration date' custom field (customfield_10210) +#integrationdate_cf: id of the 'Integration date' custom field (customfield_XXXXX) # Let's go strict (exit on error) set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass integrationdate_cf" +required="WORKSPACE integrationdate_cf" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -18,6 +18,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # temp file for intermediate storing of results tempfile="${WORKSPACE}/count_reopened_temp.csv" echo -n > "${tempfile}" @@ -45,8 +50,6 @@ echo "Last integration cycle ended with info ${lastintegrationjira} on ${lastint allintegrationfile="${WORKSPACE}/count_reopened_all_cycles.csv" # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" # Let's search the latest Integration date in the Tracker # (we cannot get the Integration date with this query because diff --git a/tracker_automations/count_test_failed_last_cycle/count_test_failed_last_cycle.sh b/tracker_automations/count_test_failed_last_cycle/count_test_failed_last_cycle.sh index 4c0d09c2..81a254e0 100755 --- a/tracker_automations/count_test_failed_last_cycle/count_test_failed_last_cycle.sh +++ b/tracker_automations/count_test_failed_last_cycle/count_test_failed_last_cycle.sh @@ -4,13 +4,13 @@ #jiraserver: jira server url we are going to connect to #jirauser: user that will perform the execution #jirapass: password of the user -#integrationdate_cf: id of the 'Integration date' custom field (customfield_10210) +#integrationdate_cf: id of the 'Integration date' custom field (customfield_XXXXX) # Let's go strict (exit on error) set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass integrationdate_cf" +required="WORKSPACE integrationdate_cf" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -18,6 +18,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # temp file for intermediate storing of results tempfile="${WORKSPACE}/count_test_failed_temp.csv" echo -n > "${tempfile}" @@ -45,8 +50,6 @@ echo "Last integration cycle ended with info ${lastintegrationjira} on ${lastint allintegrationfile="${WORKSPACE}/count_test_failed_all_cycles.csv" # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" # Let's search the latest Integration date in the Tracker # (we cannot get the Integration date with this query because diff --git a/tracker_automations/delay_awaiting_issues/delay_awaiting_issues.sh b/tracker_automations/delay_awaiting_issues/delay_awaiting_issues.sh index 89106dcf..8e8ea4dc 100755 --- a/tracker_automations/delay_awaiting_issues/delay_awaiting_issues.sh +++ b/tracker_automations/delay_awaiting_issues/delay_awaiting_issues.sh @@ -13,7 +13,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass" +required="WORKSPACE" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -21,6 +21,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/delay_awaiting_issues.csv echo -n > "${resultfile}" @@ -29,8 +34,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/delay_awaiting_issues.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" # Set comment if not specified @@ -56,12 +59,12 @@ ${basereq} --action getIssueList \ for issue in $( sed -n 's/^"\(MDL-[0-9]*\)".*/\1/p' "${resultfile}" ); do echo "Processing ${issue}" # We use transitionIssue instead of updateIssue because some of the fileds are not available in the default screen. - # (current in integration = customfield_10211, integration priority = customfield_12210) + # (current in integration = customfield_XXXXX, integration priority = customfield_XXXXX) ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_10211=" \ - --field "customfield_12210=1" \ + --field "customfield_${customfield_currentlyInIntegration}=" \ + --field "customfield_${customfield_integrationPriority}=1" \ --comment "${altcomment}" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue}" >> "${logfile}" done diff --git a/tracker_automations/manage_waiting_for_feedback/manage_waiting_for_feedback.sh b/tracker_automations/manage_waiting_for_feedback/manage_waiting_for_feedback.sh index 351cb022..4077e365 100755 --- a/tracker_automations/manage_waiting_for_feedback/manage_waiting_for_feedback.sh +++ b/tracker_automations/manage_waiting_for_feedback/manage_waiting_for_feedback.sh @@ -26,7 +26,7 @@ set -e # Verify everything is set. -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass daystoreopen" +required="WORKSPACE daystoreopen" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -34,6 +34,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # File where tracker results will be sent. resultfile=$WORKSPACE/manage_waiting_for_feedback.csv echo -n > "${resultfile}" @@ -42,8 +47,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/manage_waiting_for_feedback.log # Calculate some variables. -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" # Set defaults. @@ -132,8 +135,8 @@ ${basereq} --action getIssueList \ # Iterate over found issues, adding the comment # (Note that the 'Waiting for Feedback Notifications' interim filed will be cleaned by the workflow). # Here we update: -# - Component Lead Review (customfield_15810) = reset to blank/empty. -# - Currently in integration (customfield_10211) = reset to blank/empty. +# - Component Lead Review (customfield_XXXXX) = reset to blank/empty. +# - Currently in integration (customfield_XXXXX) = reset to blank/empty. for issue in $( sed -n 's/^"\(MDL-[0-9]*\)".*/\1/p' "${resultfile}" ); do echo "Processing ${issue} - Reopen notification" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue}: Reopen notification" >> "${logfile}" @@ -141,8 +144,8 @@ for issue in $( sed -n 's/^"\(MDL-[0-9]*\)".*/\1/p' "${resultfile}" ); do ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "Reopen Issue" \ - --field "customfield_10211=" \ - --field "customfield_15810=" \ + --field "customfield_${customfield_currentlyInIntegration}=" \ + --field "customfield_${customfield_componentLeadReview}=" \ --comment "${comment}" done diff --git a/tracker_automations/move_to_current_integration/move_to_current_integration.sh b/tracker_automations/move_to_current_integration/move_to_current_integration.sh index 4108b2ff..cebee818 100755 --- a/tracker_automations/move_to_current_integration/move_to_current_integration.sh +++ b/tracker_automations/move_to_current_integration/move_to_current_integration.sh @@ -14,7 +14,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass" +required="WORKSPACE" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -22,6 +22,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/move_to_current_integration.csv echo -n > "${resultfile}" @@ -30,8 +35,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/move_to_current_integration.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" # Note this could be done by one unique "runFromIssueList" action, but we are splitting @@ -58,15 +61,15 @@ for issue in $( sed -n 's/^"\(MDL-[0-9]*\)".*/\1/p' "${resultfile}" ); do # that non-transitional transition and use normal update. #${basereq} --action updateIssue \ # --issue ${issue} \ - # --field="customfield_10110=" --field="customfield_10210=" --field="customfield_10211=Yes" + # --field="customfield_${customfield_integrator}=" --field="customfield_${customfield_integrationDate}=" --field="customfield_${customfield_currentlyInIntegration}}=Yes" ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_10110=" \ - --field "customfield_10210=" \ - --field "customfield_10211=Yes" \ - --field "customfield_15810=No" \ - --field "customfield_10011=" \ + --field "customfield_${customfield_integrator}=" \ + --field "customfield_${customfield_integrationDate}=" \ + --field "customfield_${customfield_currentlyInIntegration}=Yes" \ + --field "customfield_${customfield_componentLeadReview}=No" \ + --field "customfield_${customfield_tester}=" \ --comment "Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!" ${basereq} --action removeLabels \ --issue ${issue} \ diff --git a/tracker_automations/mv_reopened_out_from_current/mv_reopened_out_from_current.sh b/tracker_automations/mv_reopened_out_from_current/mv_reopened_out_from_current.sh index bb646a19..46a9b3f3 100755 --- a/tracker_automations/mv_reopened_out_from_current/mv_reopened_out_from_current.sh +++ b/tracker_automations/mv_reopened_out_from_current/mv_reopened_out_from_current.sh @@ -10,7 +10,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass mustfixversion" +required="WORKSPACE mustfixversion" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -18,6 +18,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/mv_reopened_out_from_current.csv echo -n > "${resultfile}" @@ -26,8 +31,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/mv_reopened_out_from_current.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" # Note this could be done by one unique "runFromIssueList" action, but we are splitting @@ -72,17 +75,15 @@ while read line; do # that non-transitional transition and use normal update. #${basereq} --action updateIssue \ # --issue ${issue} \ - # --field "customfield_10211=" \ + # --field "customfield_${customfield_currentlyInIntegration}=" \ # --comment "Moving this reopened issue out from current integration. Please, re-submit it for integration once ready." # - # Note: customfield_10211 represents the "Currently in integration" field, and customfield_17112 represents - # the "Automated test results" field. ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ --fixVersions "${keepversion}" \ - --field "customfield_10211=" \ - --field "customfield_17112=" \ + --field "customfield_${customfield_currentlyInIntegration}=" \ + --field "customfield_${customfield_automatedTestResults}=" \ --comment "Moving this reopened issue out from current integration. Please, re-submit it for integration once ready." echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue}" >> "${logfile}" done < "${resultfile}" diff --git a/tracker_automations/normal_manage_queues/lib.sh b/tracker_automations/normal_manage_queues/lib.sh index b104eb61..6587da15 100755 --- a/tracker_automations/normal_manage_queues/lib.sh +++ b/tracker_automations/normal_manage_queues/lib.sh @@ -6,7 +6,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass" +required="WORKSPACE" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -14,14 +14,19 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # A, move "important" issues from candidates to current function run_A() { # Get the list of issues. ${basereq} --action getIssueList \ - --jql "filter=14000 - AND NOT filter = 21366 + --jql "filter=${filter_candidatesForIntegration} + AND NOT filter = ${filter_issuesHeldUntilAfterRelease} AND ( - filter = 21363 OR + filter = ${filter_mustFixIssues} OR labels IN (mdlqa) OR priority IN (Critical, Blocker) OR level IS NOT EMPTY OR @@ -57,14 +62,14 @@ function run_A() { # that non-transitional transition and use normal update. #${basereq} --action updateIssue \ # --issue ${issue} \ - # --field="customfield_10110=" --field="customfield_10210=" --field="customfield_10211=Yes" + # --field="customfield_${customfield_integrator}=" --field="customfield_${customfield_integrationDate}=" --field="customfield_${customfield_currentlyInIntegration}=Yes" ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_10211=Yes" \ - --field "customfield_15810=No" \ - --field "customfield_10110=" \ - --field "customfield_10011=" \ + --field "customfield_${customfield_currentlyInIntegration}=Yes" \ + --field "customfield_${customfield_componentLeadReview}=No" \ + --field "customfield_${customfield_integrator}=" \ + --field "customfield_${customfield_tester}=" \ --comment "Normal queues manage: Moving to current because it's important" \ --role "Integrators" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue} moved to current: important" >> "${logfile}" @@ -91,7 +96,7 @@ function run_B() { if [[ "$counter" -lt "$currentmin" ]]; then # Get an ordered list of up to issues in the candidate queue. ${basereq} --action getIssueList \ - --jql "filter=14000 \ + --jql "filter=${filter_candidatesForIntegration} \ ORDER BY Rank ASC" \ --file "${resultfile}" @@ -129,14 +134,14 @@ function run_B() { # that non-transitional transition and use normal update. #${basereq} --action updateIssue \ # --issue ${issue} \ - # --field="customfield_10110=" --field="customfield_10210=" --field="customfield_10211=Yes" + # --field="customfield_${customfield_integrator}=" --field="customfield_${customfield_integrationDate}=" --field="customfield_${customfield_currentlyInIntegration}=Yes" ${basereq} --action transitionIssue \ - --issue ${issue} \ - --transition "CI Global Self-Transition" \ - --field "customfield_10211=Yes" \ - --field "customfield_15810=No" \ - --field "customfield_10110=" \ - --field "customfield_10011=" \ + --issue ${issue} \ + --transition "CI Global Self-Transition" \ + --field "customfield_${customfield_currentlyInIntegration}=Yes" \ + --field "customfield_${customfield_componentLeadReview}=No" \ + --field "customfield_${customfield_integrator}=" \ + --field "customfield_${customfield_tester}=" \ --comment "Normal queues manage: Moving to current given we are below the threshold ($currentmin)" \ --role "Integrators" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue} moved to current: threshold" >> "${logfile}" @@ -147,7 +152,7 @@ function run_B() { function run_C() { # Get the list of issues. ${basereq} --action getIssueList \ - --jql "filter=14000 + --jql "filter=${filter_candidatesForIntegration} AND 'Integration priority' = 0 AND NOT (issueLinkType = 'blocks' OR issueLinkType = 'is blocked by') AND NOT status CHANGED AFTER -${waitingdays}d" \ @@ -170,11 +175,11 @@ function run_C() { # that non-transitional transition and use normal update. #${basereq} --action updateIssue \ # --issue ${issue} \ - # --field="customfield_10110=" --field="customfield_10210=" --field="customfield_10211=Yes" + # --field="customfield_${customfield_integrator}=" --field="customfield_${customfield_integrationDate}=" --field="customfield_${customfield_currentlyInIntegration}=Yes" ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_12210=1" \ + --field "customfield_${customfield_integrationPriority}=1" \ --comment "Normal queues manage: Raising integration priority after ${waitingdays} days awaiting" \ --role "Integrators" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue} raised integration priority" >> "${logfile}" diff --git a/tracker_automations/normal_manage_queues/normal_manage_queues.sh b/tracker_automations/normal_manage_queues/normal_manage_queues.sh index ced331a6..a8204586 100755 --- a/tracker_automations/normal_manage_queues/normal_manage_queues.sh +++ b/tracker_automations/normal_manage_queues/normal_manage_queues.sh @@ -45,7 +45,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass" +required="WORKSPACE" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -53,6 +53,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/normal_manage_queues.csv echo -n > "${resultfile}" @@ -61,8 +66,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/normal_manage_queues.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" source ${mydir}/lib.sh # Add all the functions. diff --git a/tracker_automations/progress_automated_tested/progress_automated_tested.sh b/tracker_automations/progress_automated_tested/progress_automated_tested.sh index dc879df3..e13d4155 100755 --- a/tracker_automations/progress_automated_tested/progress_automated_tested.sh +++ b/tracker_automations/progress_automated_tested/progress_automated_tested.sh @@ -12,7 +12,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass" +required="WORKSPACE" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -20,6 +20,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/progress_automated_testing.txt echo -n > "${resultfile}" @@ -28,8 +33,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/progress_automated_waiting_testing.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" # Let's search 1a) Waiting for testing => Testing in progress (via Start testing) diff --git a/tracker_automations/remove_ci_label_from_waiting_integration/remove_ci_label_from_waiting_integration.sh b/tracker_automations/remove_ci_label_from_waiting_integration/remove_ci_label_from_waiting_integration.sh index a1ed5791..79e26676 100755 --- a/tracker_automations/remove_ci_label_from_waiting_integration/remove_ci_label_from_waiting_integration.sh +++ b/tracker_automations/remove_ci_label_from_waiting_integration/remove_ci_label_from_waiting_integration.sh @@ -10,7 +10,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass" +required="WORKSPACE" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -18,6 +18,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/remove_ci_label_from_waiting_integration.csv echo -n > "${resultfile}" @@ -27,8 +32,6 @@ logfile=$WORKSPACE/remove_ci_label_from_waiting_integration.log lastfile=$WORKSPACE/remove_ci_label_from_waiting_integration_latest.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" now=$(date +%s) diff --git a/tracker_automations/remove_ci_label_from_wip/remove_ci_label_from_wip.sh b/tracker_automations/remove_ci_label_from_wip/remove_ci_label_from_wip.sh index a5615000..72088059 100755 --- a/tracker_automations/remove_ci_label_from_wip/remove_ci_label_from_wip.sh +++ b/tracker_automations/remove_ci_label_from_wip/remove_ci_label_from_wip.sh @@ -9,7 +9,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass" +required="WORKSPACE" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -17,6 +17,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/remove_ci_label_from_wip.csv echo -n > "${resultfile}" @@ -25,8 +30,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/remove_ci_label_from_wip.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" # Note this could be done by one unique "runFromIssueList" action, but we are splitting diff --git a/tracker_automations/send_rebase_message/send_rebase_message.sh b/tracker_automations/send_rebase_message/send_rebase_message.sh index 29f91d1b..9029117b 100755 --- a/tracker_automations/send_rebase_message/send_rebase_message.sh +++ b/tracker_automations/send_rebase_message/send_rebase_message.sh @@ -17,7 +17,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass" +required="WORKSPACE" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -25,6 +25,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/send_rebase_message.csv echo -n > "${resultfile}" @@ -33,8 +38,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/send_rebase_message.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" # Set altcommentcandidate for candidate queue issues if not specified @@ -50,7 +53,7 @@ fi # Let's search all the issues under candidates queue. ${basereq} --action getIssueList \ - --jql "filter = 14000" \ + --jql "filter = ${filter_candidatesForIntegration}" \ --file "${resultfile}" # Iterate over found issues and perform the actions with them @@ -72,7 +75,7 @@ TIA and ciao :-)"} # Let's search all the issues under current integration waiting for review or in progress. ${basereq} --action getIssueList \ - --jql "filter = 22610" \ + --jql "filter = ${filter_issuesWaitingForReviewOrInProgress}" \ --file "${resultfile}" # Iterate over found issues and perform the actions with them. diff --git a/tracker_automations/set_integration_priority_to_one/set_integration_priority_to_one.sh b/tracker_automations/set_integration_priority_to_one/set_integration_priority_to_one.sh index 3bf7de99..51332025 100755 --- a/tracker_automations/set_integration_priority_to_one/set_integration_priority_to_one.sh +++ b/tracker_automations/set_integration_priority_to_one/set_integration_priority_to_one.sh @@ -10,7 +10,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass mustfixversion" +required="WORKSPACE mustfixversion" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -18,6 +18,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/set_integration_priority_to_one.csv echo -n > "${resultfile}" @@ -26,8 +31,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/set_integration_priority_to_one.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" # Note this could be done by one unique "runFromIssueList" action, but we are splitting @@ -104,7 +107,7 @@ for issue in $( sed -n 's/^"\(MDL-[0-9]*\)".*/\1/p' "${resultfile}" ); do ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_12210=1" + --field "customfield_${customfield_integrationPriority}=1" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue}" >> "${logfile}" echo done diff --git a/tracker_automations/set_integration_priority_to_zero/set_integration_priority_to_zero.sh b/tracker_automations/set_integration_priority_to_zero/set_integration_priority_to_zero.sh index d1002b2c..7a26bbdf 100755 --- a/tracker_automations/set_integration_priority_to_zero/set_integration_priority_to_zero.sh +++ b/tracker_automations/set_integration_priority_to_zero/set_integration_priority_to_zero.sh @@ -9,7 +9,7 @@ set -e # Verify everything is set -required="WORKSPACE jiraclicmd jiraserver jirauser jirapass" +required="WORKSPACE" for var in $required; do if [ -z "${!var}" ]; then echo "Error: ${var} environment variable is not defined. See the script comments." @@ -17,6 +17,11 @@ for var in $required; do fi done +mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Load Jira Configuration. +source "${mydir}/../../jira.sh" + # file where results will be sent resultfile=$WORKSPACE/set_integration_priority_to_zero.csv echo -n > "${resultfile}" @@ -25,8 +30,6 @@ echo -n > "${resultfile}" logfile=$WORKSPACE/set_integration_priority_to_zero.log # Calculate some variables -mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -basereq="${jiraclicmd} --server ${jiraserver} --user ${jirauser} --password ${jirapass}" BUILD_TIMESTAMP="$(date +'%Y-%m-%d_%H-%M-%S')" # Note this could be done by one unique "runFromIssueList" action, but we are splitting @@ -47,13 +50,13 @@ ${basereq} --action getIssueList \ )" \ --file "${resultfile}" -# Iterate over found issues and set their integration priority (customfield_12210) to 0. +# Iterate over found issues and set their integration priority to 0. for issue in $( sed -n 's/^"\(MDL-[0-9]*\)".*/\1/p' "${resultfile}" ); do echo "Processing ${issue}" ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_12210=0" + --field "customfield_${customfield_integrationPriority}=0" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue}" >> "${logfile}" done @@ -128,7 +131,7 @@ for issue in $( sed -n 's/^"\(MDL-[0-9]*\)".*/\1/p' "${resultfile}" ); do ${basereq} --action transitionIssue \ --issue ${issue} \ --transition "CI Global Self-Transition" \ - --field "customfield_12210=0" + --field "customfield_${customfield_integrationPriority}=0" echo "$BUILD_NUMBER $BUILD_TIMESTAMP ${issue}" >> "${logfile}" echo done