From e6094ac33aaea4fa7f88979ebba77f5fab43f1e3 Mon Sep 17 00:00:00 2001 From: Achilleas Triantafyllou Date: Mon, 27 Mar 2023 14:57:23 +0300 Subject: [PATCH 1/4] Use committer_date instead of workflow created at date As summarized in this github issue: https://github.com/eddiewebb/circleci-queue/issues/95 Gather seems to have some issues with the way the original queue orb works and calculates which workflows should be blocked and not. This commit tries to tackle these issues. More details around the problem and the solution proposed can be found in the above issue (https://github.com/eddiewebb/circleci-queue/issues/95) --- src/commands/until_front_of_line.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/until_front_of_line.yml b/src/commands/until_front_of_line.yml index 046e398..0c15c69 100644 --- a/src/commands/until_front_of_line.yml +++ b/src/commands/until_front_of_line.yml @@ -172,13 +172,13 @@ steps: if [ "<>" = "true" ] ;then echo "Orb parameter block-workflow is true." echo "This job will block until no previous workflows have *any* jobs running." - oldest_running_build_num=`jq 'sort_by(.workflows.created_at)| .[0].build_num' /tmp/augmented_jobstatus.json` - oldest_commit_time=`jq 'sort_by(.workflows.created_at)| .[0].workflows.created_at' /tmp/augmented_jobstatus.json` + oldest_running_build_num=`jq 'sort_by(.committer_date)| .[0].build_num' /tmp/augmented_jobstatus.json` + oldest_commit_time=`jq 'sort_by(.committer_date)| .[0].committer_date' /tmp/augmented_jobstatus.json` else echo "Orb parameter block-workflow is false." echo "Only blocking execution if running previous jobs matching this job: ${JOB_NAME}" - oldest_running_build_num=`jq ". | map(select(.workflows.job_name | test(\"${JOB_NAME}\";\"sx\"))) | sort_by(.workflows.created_at)| .[0].build_num" /tmp/augmented_jobstatus.json` - oldest_commit_time=`jq ". | map(select(.workflows.job_name | test(\"${JOB_NAME}\";\"sx\"))) | sort_by(.workflows.created_at)| .[0].workflows.created_at" /tmp/augmented_jobstatus.json` + oldest_running_build_num=`jq ". | map(select(.workflows.job_name | test(\"${JOB_NAME}\";\"sx\"))) | sort_by(.committer_date)| .[0].build_num" /tmp/augmented_jobstatus.json` + oldest_commit_time=`jq ". | map(select(.workflows.job_name | test(\"${JOB_NAME}\";\"sx\"))) | sort_by(.committer_date)| .[0].committer_date" /tmp/augmented_jobstatus.json` fi if [ -z "$oldest_commit_time" ]; then echo "API Error - unable to load previous job timings. Report to developer." @@ -198,7 +198,7 @@ steps: } load_current_workflow_values(){ - my_commit_time=`jq '.[] | select( .build_num == '"${CIRCLE_BUILD_NUM}"').workflows.created_at' /tmp/augmented_jobstatus.json` + my_commit_time=`jq '.[] | select( .build_num == '"${CIRCLE_BUILD_NUM}"').committer_date' /tmp/augmented_jobstatus.json` } cancel_current_build(){ From 6c944d6e7929f2204ecb34862096baea64d644a8 Mon Sep 17 00:00:00 2001 From: Eddie Webb Date: Fri, 31 Mar 2023 12:40:39 -0400 Subject: [PATCH 2/4] Reverts downstream commit to include only timestamp changes. THIS WILL BREAK MANY BITBUCKET USERS. --- src/@orb.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/@orb.yml b/src/@orb.yml index 9f25c88..41f5516 100644 --- a/src/@orb.yml +++ b/src/@orb.yml @@ -6,6 +6,8 @@ description: | This orb requires the project to have an API key in order to query build states. It requires a single environment variable CIRCLECI_API_KEY which can be created in account settings - https://circleci.com/account/api. + + 2.0.0: Breaking change fixes dyanamic config, but drops some BB users. 1.10.0: Adds Server Support (@nanophate) 1.9.0: Doc update 1.8.4: Adds urlencode for branch names. (@andrew-barnett) From e6a228f42d6625311ea2bffbb40a4f4f48d2c25f Mon Sep 17 00:00:00 2001 From: Eddie Webb Date: Fri, 31 Mar 2023 13:26:29 -0400 Subject: [PATCH 3/4] fix semver issue --- .circleci/config.yml | 9 --------- src/@orb.yml | 7 ++++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 18821f1..836f28d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,15 +77,6 @@ jobs: if [ -z ${SEMVER_INCREMENT} ];then echo "Merge commit did not indicate which SemVer increment to make. Please ammend commit with [semver:FOO] where FOO is major, minor, or patch" exit 1 - elif [ "$SEMVER_INCREMENT" == "skip" ];then - echo "SEMVER in commit indicated to skip orb release" - echo "export PR_MESSAGE=\"Orb publish was skipped due to [semver:skip] in commit message.\"" >> $BASH_ENV - exit 0 - else - PUBLISH_MESSAGE=`circleci orb publish promote eddiewebb/<>@dev:<> ${SEMVER_INCREMENT} --token ${CIRCLECI_API_KEY}` - echo $PUBLISH_MESSAGE - ORB_VERSION=$(echo $PUBLISH_MESSAGE | sed -n 's/Orb .* was promoted to `\(.*\)`.*/\1/p') - echo "export PR_MESSAGE=\"BotComment: *Production* version of orb available for use - \\\`${ORB_VERSION}\\\`\"" >> $BASH_ENV fi publish: diff --git a/src/@orb.yml b/src/@orb.yml index 41f5516..9982fdd 100644 --- a/src/@orb.yml +++ b/src/@orb.yml @@ -6,9 +6,10 @@ description: | This orb requires the project to have an API key in order to query build states. It requires a single environment variable CIRCLECI_API_KEY which can be created in account settings - https://circleci.com/account/api. - - 2.0.0: Breaking change fixes dyanamic config, but drops some BB users. - 1.10.0: Adds Server Support (@nanophate) + 2.2.1: fixes release version bug + 2.2.0: Adds 'filter-by-workflow' (@soniqua) + 2.0.0: Breaking change fixes dyanamic config, but drops some BB users. + 1.12.0: Adds Server Support (@nanophate) 1.9.0: Doc update 1.8.4: Adds urlencode for branch names. (@andrew-barnett) 1.8.1: Adds content-type header to API calls (@kevinr-electric) and prints message on error (@AlexMeuer) From aba14f1bc0229fa768a5dbac06dd5e4c00bc61b9 Mon Sep 17 00:00:00 2001 From: Eddie Webb Date: Fri, 31 Mar 2023 14:03:02 -0400 Subject: [PATCH 4/4] address revert of committer_date --- src/@orb.yml | 2 +- src/commands/until_front_of_line.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/@orb.yml b/src/@orb.yml index 9982fdd..df43ba9 100644 --- a/src/@orb.yml +++ b/src/@orb.yml @@ -8,7 +8,7 @@ description: | 2.2.1: fixes release version bug 2.2.0: Adds 'filter-by-workflow' (@soniqua) - 2.0.0: Breaking change fixes dyanamic config, but drops some BB users. + 2.0.0: Breaking change fixes dyanamic config, but may break Bitbucket users. 1.12.0: Adds Server Support (@nanophate) 1.9.0: Doc update 1.8.4: Adds urlencode for branch names. (@andrew-barnett) diff --git a/src/commands/until_front_of_line.yml b/src/commands/until_front_of_line.yml index 8da4dd0..1d710c4 100644 --- a/src/commands/until_front_of_line.yml +++ b/src/commands/until_front_of_line.yml @@ -177,13 +177,13 @@ steps: echo "Orb parameter block-workflow is true." if [ "<>" = "*" ]; then echo "This job will block until no previous workflows have *any* jobs running." - oldest_running_build_num=`jq 'sort_by(.workflows.created_at)| .[0].build_num' /tmp/augmented_jobstatus.json` - oldest_commit_time=`jq 'sort_by(.workflows.created_at)| .[0].workflows.created_at' /tmp/augmented_jobstatus.json` + oldest_running_build_num=`jq 'sort_by(.committer_date)| .[0].build_num' /tmp/augmented_jobstatus.json` + oldest_commit_time=`jq 'sort_by(.committer_date)| .[0].committer_date' /tmp/augmented_jobstatus.json` else echo "Orb parameter only-on-workflow is true." echo "This job will block until no previous occurrences of workflow <> have *any* jobs running." - oldest_running_build_num=`jq ". | map(select(.workflows.workflow_name| test(\"<>\";\"sx\"))) | sort_by(.workflows.created_at)| .[0].build_num" /tmp/augmented_jobstatus.json` - oldest_commit_time=`jq ". | map(select(.workflows.workflow_name| test(\"<>\";\"sx\"))) | sort_by(.workflows.created_at)| .[0].workflows.created_at" /tmp/augmented_jobstatus.json` + oldest_running_build_num=`jq ". | map(select(.workflows.workflow_name| test(\"<>\";\"sx\"))) | sort_by(.committer_date)| .[0].build_num" /tmp/augmented_jobstatus.json` + oldest_commit_time=`jq ". | map(select(.workflows.workflow_name| test(\"<>\";\"sx\"))) | sort_by(.committer_date)| .[0].committer_date" /tmp/augmented_jobstatus.json` fi else echo "Orb parameter block-workflow is false."