Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ orbs:
setup: true
version: 2.1

parameters:
persist-artifacts:
type: boolean
default: false

_should_persist_artifacts: &should-persist-artifacts
or:
- equal: [<< pipeline.git.branch >>, "develop"]
- matches:
pattern: /^release\/.*/
value: << pipeline.git.branch >>
- << pipeline.parameters.persist-artifacts >>

workflows:
setup-workflow:
jobs:
Expand Down Expand Up @@ -151,8 +164,18 @@ jobs:
echo "❌ Primary workflow definition not found in .circleci/packed/pipeline.yml!"
exit 1
fi
- continuation/continue:
configuration_path: .circleci/packed/pipeline.yml
- when:
condition: *should-persist-artifacts
steps:
- continuation/continue:
configuration_path: .circleci/packed/pipeline.yml
parameters: '{ "persist-artifacts": true }'
- unless:
condition: *should-persist-artifacts
steps:
- continuation/continue:
configuration_path: .circleci/packed/pipeline.yml
parameters: '{ "persist-artifacts": false }'



Expand Down
60 changes: 22 additions & 38 deletions .circleci/src/pipeline/@pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ ubuntu-2004-older: &ubuntu-2004-older ubuntu-2004:2024.05.1
orbs:
browser-tools: circleci/[email protected]

parameters:
persist-artifacts:
type: boolean
default: false

defaults: &defaults
parallelism: 1
working_directory: ~/cypress
Expand Down Expand Up @@ -108,28 +113,6 @@ executors:
PLATFORM: linux

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:
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" != "fix/dbus-messages" ]]; then
export SHOULD_PERSIST_ARTIFACTS=true
fi' >> "$BASH_ENV"
# You must run `setup_should_persist_artifacts` command and be using bash before running this command
verify_should_persist_artifacts:
steps:
- run:
name: Check current branch to persist artifacts
command: |
if [[ -z "$SHOULD_PERSIST_ARTIFACTS" ]]; then
echo "Not uploading artifacts or posting install comment for this branch."
circleci-agent step halt
fi

maybe_skip_binary_jobs:
steps:
- run:
Expand Down Expand Up @@ -1369,7 +1352,7 @@ commands:
name: "Trigger publish-binary pipeline"
command: |
source ./scripts/ensure-node.sh
echo $SHOULD_PERSIST_ARTIFACTS
[[ "<< pipeline.parameters.persist-artifacts >>" == "true" ]] && export SHOULD_PERSIST_ARTIFACTS=true
node ./scripts/binary/trigger-publish-binary-pipeline.js
- persist_to_workspace:
root: ~/
Expand Down Expand Up @@ -2453,10 +2436,11 @@ jobs:
- build-and-package-binary
- build-cypress-npm-package:
executor: << parameters.executor >>
- setup_should_persist_artifacts
- verify_should_persist_artifacts
- upload-build-artifacts
- post-install-comment
- when:
condition: << pipeline.parameters.persist-artifacts >>
steps:
- upload-build-artifacts
- post-install-comment

create-and-trigger-packaging-artifacts:
<<: *defaults
Expand All @@ -2470,7 +2454,6 @@ jobs:
- maybe_skip_binary_jobs
- restore_cached_workspace
- check-if-binary-exists
- setup_should_persist_artifacts
- trigger-publish-binary-pipeline

get-published-artifacts:
Expand All @@ -2487,7 +2470,6 @@ jobs:
- run:
name: Check pipeline info
command: cat ~/triggered_pipeline.json
- setup_should_persist_artifacts
- run:
name: Download binary artifacts
command: |
Expand All @@ -2498,15 +2480,17 @@ jobs:
paths:
- cypress/cypress.zip
- cypress/cypress.tgz
- verify_should_persist_artifacts
- persist_to_workspace:
root: ~/
paths:
- cypress/binary-url.json
- cypress/npm-package-url.json
- post-install-comment:
package_url_path: ~/cypress/npm-package-url.json
binary_url_path: ~/cypress/binary-url.json
- when:
condition: << pipeline.parameters.persist-artifacts >>
steps:
- persist_to_workspace:
root: ~/
paths:
- cypress/binary-url.json
- cypress/npm-package-url.json
- post-install-comment:
package_url_path: ~/cypress/npm-package-url.json
binary_url_path: ~/cypress/binary-url.json

test-kitchensink:
<<: *defaults
Expand Down
Loading