From f3cf55b15732b5b82f848daa88a4436c9258f0af Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Wed, 15 Nov 2023 14:30:57 +0100 Subject: [PATCH] Move check_marked_as_integrated from master to main --- .../check_marked_as_integrated.sh | 68 +++++++++---------- 1 file changed, 31 insertions(+), 37 deletions(-) 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 be8c3b84..b5c52de7 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 @@ -9,9 +9,8 @@ #gitcmd: git cli path #gitdir: git directory with integration.git repo #gitremotename: integration.git remote name -#currentmaster: Deprecated, use devbranches instead. The final major version current master will be (e.g. 32). #devbranches: the next major versions ($branch) under development, comma separated. Ordered by release "distance". -# Since 3.10 (310) always use 3 digits. The last element in the list is assumed to be "master", +# Since 3.10 (310) always use 3 digits. The last element in the list is assumed to be "main", # The rest are MOODLE_branch_STABLE ones. Normally only one, but when we are in parallel # development periods, for example: 310,400 (3.10 and 4.0) @@ -22,11 +21,6 @@ if [ -z "$gitremotename" ]; then gitremotename="origin" fi -# TODO: Remove these backward compatibility lines after some prudential time (say, in 2021). -if [ -z "$devbranches" ] && [ -n "$currentmaster" ]; then - devbranches=$currentmaster -fi - # Verify everything is set required="WORKSPACE jiraclicmd jiraserver jirauser jirapass gitcmd gitdir gitremotename devbranches" for var in $required; do @@ -77,17 +71,17 @@ ${gitcmd} fetch ${gitremotename} # While looking at all the issues in integration, capture some variables to use # for unowned commits check later. -# Pre-fill them with current development branches, note that last element is master, no MOODLE_branch_STABLE. +# Pre-fill them with current development branches, note that last element is main, no MOODLE_branch_STABLE. for devbranchcode in "${devbranchesarr[@]}"; do if [[ ${devbranchesarr[${#devbranchesarr[@]}-1]} != ${devbranchcode} ]]; then activebranches+=(MOODLE_${devbranchcode}_STABLE) else - activebranches+=(master) + activebranches+=(main) fi done issues=() # The list of issues in current integration. declare -A branchesbyissue # Associative array, issues as key, branches from fix versions - # in the tracker as value. Format: [MDL-123]=>MOODLE_311_STABLE, master + # in the tracker as value. Format: [MDL-123]=>MOODLE_311_STABLE, main #### # Iterate over issues in integration and check their commits are integrated in the @@ -95,7 +89,7 @@ declare -A branchesbyissue # Associative array, issues as key, branches from fix #### issueslist=$( cat "${resultfile}" ) while read -r line; do - ismasteronly= + ismainonly= issue=$( echo ${line} | sed -n 's/^"\(MDL-[0-9]*\)".*/\1/p' ) issues+=($issue) @@ -106,9 +100,9 @@ while read -r line; do echo "Processing ${issue}" - if [[ $line == *"master-only"* ]] + if [[ $line == *"main-only"* ]] then - ismasteronly=1 + ismainonly=1 fi fixversions=$( echo ${line} \ @@ -124,7 +118,7 @@ while read -r line; do devfound=0 stablefound=0 - masterfixversionfound= + mainfixversionfound= branchesfromfixversion= while read -r tagversion; do @@ -141,10 +135,10 @@ while read -r line; do if [[ ${devbranchesarr[@]} =~ $majorversion ]]; then devfound=$((devfound+1)) - # Last element corresponds to master, previous ones to MOODLE_branch_STABLE + # Last element corresponds to main, previous ones to MOODLE_branch_STABLE if [[ ${devbranchesarr[${#devbranchesarr[@]}-1]} == $majorversion ]]; then - branchname=master - masterfixversionfound=${tagversion} + branchname=main + mainfixversionfound=${tagversion} else branchname="MOODLE_${majorversion}_STABLE" fi @@ -171,9 +165,9 @@ while read -r line; do done <<< "${fixversions}" - # And, if master is missing... add it, we'll need it later. - if [[ ! ${branchesfromfixversion} =~ master ]]; then - branchesfromfixversion+=master + # And, if main is missing... add it, we'll need it later. + if [[ ! ${branchesfromfixversion} =~ main ]]; then + branchesfromfixversion+=main fi # Add the branches from the tracker fix versions to the branchesbyissue associative array. branchesbyissue[${issue}]=${branchesfromfixversion} @@ -187,27 +181,27 @@ while read -r line; do # If we haven't checked all dev branches (we don't add dev versions to fixVersion) we # check it here. May report false positives, but normally everything going to stables # must go also to ALL dev branches (unless the skip-ci-version-check is used for the issue). - # Only allowed exception is when an issue only has master commits and the "master-only" label. + # Only allowed exception is when an issue only has main commits and the "main-only" label. if [ $devfound -lt ${#devbranchesarr[@]} ]; then - examiningmaster= + examiningmain= for devbranchcode in "${devbranchesarr[@]}"; do if [[ ${devbranchesarr[${#devbranchesarr[@]}-1]} != ${devbranchcode} ]]; then branch=${gitremotename}/MOODLE_${devbranchcode}_STABLE - examiningmaster= + examiningmain= else - branch=${gitremotename}/master - examiningmaster=1 + branch=${gitremotename}/main + examiningmain=1 fi # If the commit doesn't exits... if ! check_issue "${gitcmd}" "${issue}" "${branch}"; then - # Only allowed exception is having the master-only label when examining non-master branches - if [[ -n "$ismasteronly" ]] && [[ -z "$examiningmaster" ]]; then - echo " - has the "master-only" label, not looking for "${branch}" commits." + # Only allowed exception is having the main-only label when examining non-main branches + if [[ -n "$ismainonly" ]] && [[ -z "$examiningmain" ]]; then + echo " - has the "main-only" label, not looking for "${branch}" commits." else - # If no master-only label and missing commit is not in master, personalize the error about that. - if [[ -z "$ismasteronly" ]] && [[ -z "$examiningmaster" ]]; then - errors+=("${issue} - no commit present in ${branch}. Maybe correct and the issue is 'master-only' ? Add the label if that's the case.") + # If no main-only label and missing commit is not in main, personalize the error about that. + if [[ -z "$ismainonly" ]] && [[ -z "$examiningmain" ]]; then + errors+=("${issue} - no commit present in ${branch}. Maybe correct and the issue is 'main-only' ? Add the label if that's the case.") else errors+=("${issue} - no commit present in ${branch}. Add 'skip-ci-version-check' label if this is expected.") fi @@ -215,9 +209,9 @@ while read -r line; do # If the commit exists... else - # If the issue has the master-only label and we have found commits in non-master dev branches, something is wrong. - if [[ -n "$ismasteronly" ]] && [[ -z "$examiningmaster" ]]; then - errors+=("${issue} - commit found in ${branch}. Check if the 'master-only' label in the issue is correct.") + # If the issue has the main-only label and we have found commits in non-main dev branches, something is wrong. + if [[ -n "$ismainonly" ]] && [[ -z "$examiningmain" ]]; then + errors+=("${issue} - commit found in ${branch}. Check if the 'main-only' label in the issue is correct.") fi fi done @@ -234,10 +228,10 @@ while read -r line; do errors+=("${issue} - cannot set multiple dev fix versions in the Tracker (earliest to be released wins). Please solve that.") fi - # Under parallel development only, if has master as fix version, then it must have the "master-only" branch. + # Under parallel development only, if has main as fix version, then it must have the "main-only" branch. if [ ${#devbranchesarr[@]} -gt 1 ]; then - if [[ -n "$masterfixversionfound" ]] && [[ -z "$ismasteronly" ]]; then - errors+=("${issue} - cannot use the master ($masterfixversionfound) fix version without setting the "master-only" label.") + if [[ -n "$mainfixversionfound" ]] && [[ -z "$ismainonly" ]]; then + errors+=("${issue} - cannot use the main ($mainfixversionfound) fix version without setting the "main-only" label.") fi fi