From 8e7c24f4000de4426d24629b736067c9f78326b4 Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Mon, 17 Nov 2025 16:15:50 -0500 Subject: [PATCH 1/4] use pipeline param in pull requests to override artifact persistence --- .circleci/config.yml | 5 +++- .circleci/src/pipeline/@pipeline.yml | 23 +++++++++++++++---- .../src/pipeline/workflows/pull-request.yml | 1 + 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 72390b6ffd2..ae2a12e8816 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,10 @@ workflows: parameters: publish-binary-branch: type: string - default: main + default: main + force-persist-artifacts: + type: boolean + default: false commands: persist: diff --git a/.circleci/src/pipeline/@pipeline.yml b/.circleci/src/pipeline/@pipeline.yml index 479adab5796..b1df7132cee 100644 --- a/.circleci/src/pipeline/@pipeline.yml +++ b/.circleci/src/pipeline/@pipeline.yml @@ -18,6 +18,9 @@ parameters: publish-binary-branch: type: string default: main + force-persist-artifacts: + type: boolean + default: false orbs: browser-tools: circleci/browser-tools@2.3.1 @@ -116,14 +119,22 @@ commands: # This command inserts SHOULD_PERSIST_ARTIFACTS into BASH_ENV. This way, we can define the variable in one place and use it in multiple steps. # Run this command in a job before you want to use the SHOULD_PERSIST_ARTIFACTS variable. setup_should_persist_artifacts: + parameters: + force-persist-artifacts: + type: boolean + default: false steps: - run: name: Set environment variable to determine whether or not to persist artifacts command: | echo "Setting SHOULD_PERSIST_ARTIFACTS variable" - echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "chore/remove_unused_anchors" ]]; then - export SHOULD_PERSIST_ARTIFACTS=true - fi' >> "$BASH_ENV" + if [[ "<< parameters.force-persist-artifacts >>" == "true" ]]; then + echo 'export SHOULD_PERSIST_ARTIFACTS=true' >> "$BASH_ENV" + else + echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* ]]; then + export SHOULD_PERSIST_ARTIFACTS=true + fi' >> "$BASH_ENV" + fi # You must run `setup_should_persist_artifacts` command and be using bash before running this command verify_should_persist_artifacts: steps: @@ -2472,6 +2483,9 @@ jobs: resource_class: type: string default: medium + force-persist-artifacts: + type: boolean + default: false resource_class: << parameters.resource_class >> steps: - maybe_skip_binary_jobs @@ -2479,7 +2493,8 @@ jobs: - run: name: Check pipeline info command: cat ~/triggered_pipeline.json - - setup_should_persist_artifacts + - setup_should_persist_artifacts: + force-persist-artifacts: << parameters.force-persist-artifacts >> - run: name: Download binary artifacts command: | diff --git a/.circleci/src/pipeline/workflows/pull-request.yml b/.circleci/src/pipeline/workflows/pull-request.yml index 5d42aacbeaf..8bb42f49ba6 100644 --- a/.circleci/src/pipeline/workflows/pull-request.yml +++ b/.circleci/src/pipeline/workflows/pull-request.yml @@ -326,6 +326,7 @@ jobs: requires: - create-and-trigger-packaging-artifacts - get-published-artifacts: + force-persist-artifacts: << pipeline.parameters.force-persist-artifacts >> context: - publish-binary - test-runner:commit-status-checks From 05bafcd489e4a2f64a0ae0a07041405961c6454a Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Tue, 18 Nov 2025 11:29:11 -0500 Subject: [PATCH 2/4] fix jq err when triggering pipeline --- .../src/pipeline/commands/trigger-publish-binary-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/src/pipeline/commands/trigger-publish-binary-pipeline.yml b/.circleci/src/pipeline/commands/trigger-publish-binary-pipeline.yml index d0ffffd91a5..ac7b4c5b5b1 100644 --- a/.circleci/src/pipeline/commands/trigger-publish-binary-pipeline.yml +++ b/.circleci/src/pipeline/commands/trigger-publish-binary-pipeline.yml @@ -67,7 +67,7 @@ steps: fi echo "Pipeline saved to triggered_pipeline.json" - echo "Triggered pipeline: https://app.circleci.com/pipelines/github/cypress-io/cypress-publish-binary/$(jq -r '.number' triggered_pipeline.json)" + echo "Triggered pipeline: https://app.circleci.com/pipelines/github/cypress-io/cypress-publish-binary/$(jq -r '.number' ~/triggered_pipeline.json)" - persist_to_workspace: root: ~/ paths: From de9daa86fab29d0f1fe150354fa32d3794be0496 Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Tue, 18 Nov 2025 11:32:21 -0500 Subject: [PATCH 3/4] simplify parameter usage --- .circleci/src/pipeline/@pipeline.yml | 12 ++---------- .circleci/src/pipeline/workflows/pull-request.yml | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.circleci/src/pipeline/@pipeline.yml b/.circleci/src/pipeline/@pipeline.yml index b1df7132cee..3338d0943be 100644 --- a/.circleci/src/pipeline/@pipeline.yml +++ b/.circleci/src/pipeline/@pipeline.yml @@ -119,16 +119,12 @@ commands: # This command inserts SHOULD_PERSIST_ARTIFACTS into BASH_ENV. This way, we can define the variable in one place and use it in multiple steps. # Run this command in a job before you want to use the SHOULD_PERSIST_ARTIFACTS variable. setup_should_persist_artifacts: - parameters: - force-persist-artifacts: - type: boolean - default: false steps: - run: name: Set environment variable to determine whether or not to persist artifacts command: | echo "Setting SHOULD_PERSIST_ARTIFACTS variable" - if [[ "<< parameters.force-persist-artifacts >>" == "true" ]]; then + if [[ "<< pipeline.parameters.force-persist-artifacts >>" == "true" ]]; then echo 'export SHOULD_PERSIST_ARTIFACTS=true' >> "$BASH_ENV" else echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* ]]; then @@ -2483,9 +2479,6 @@ jobs: resource_class: type: string default: medium - force-persist-artifacts: - type: boolean - default: false resource_class: << parameters.resource_class >> steps: - maybe_skip_binary_jobs @@ -2493,8 +2486,7 @@ jobs: - run: name: Check pipeline info command: cat ~/triggered_pipeline.json - - setup_should_persist_artifacts: - force-persist-artifacts: << parameters.force-persist-artifacts >> + - setup_should_persist_artifacts - run: name: Download binary artifacts command: | diff --git a/.circleci/src/pipeline/workflows/pull-request.yml b/.circleci/src/pipeline/workflows/pull-request.yml index 8bb42f49ba6..5d42aacbeaf 100644 --- a/.circleci/src/pipeline/workflows/pull-request.yml +++ b/.circleci/src/pipeline/workflows/pull-request.yml @@ -326,7 +326,6 @@ jobs: requires: - create-and-trigger-packaging-artifacts - get-published-artifacts: - force-persist-artifacts: << pipeline.parameters.force-persist-artifacts >> context: - publish-binary - test-runner:commit-status-checks From 1f793689d256be75dc3f9c0257d9cf63628d7a17 Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Mon, 24 Nov 2025 15:20:55 -0500 Subject: [PATCH 4/4] Update config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ae2a12e8816..e2c2bac023d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ workflows: parameters: publish-binary-branch: type: string - default: main + default: main force-persist-artifacts: type: boolean default: false