-
Notifications
You must be signed in to change notification settings - Fork 3.4k
chore: Add a CircleCI parameter for target publish-binary branch #32665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cacieprins
wants to merge
12
commits into
develop
Choose a base branch
from
ci/parameterize-binary-branch
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+88
−68
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8d8f718
chore: migrate trigger publish binary script to bash, use parameteriz…
cacieprins f944cd3
Merge branch 'develop' into ci/parameterize-binary-branch
cacieprins 284b03d
Update trigger-publish-binary-pipeline.yml
cacieprins b3cd415
fix continuation json
cacieprins 51883ff
Merge branch 'develop' into ci/parameterize-binary-branch
cacieprins 045c26b
conflicting parameters?
cacieprins 5d50a15
just need to have them named different
cacieprins 728b683
maybe without the params json?
cacieprins 02a220b
Merge branch 'develop' into ci/parameterize-binary-branch
cacieprins c4f35d2
Merge branch 'develop' into ci/parameterize-binary-branch
cacieprins c3037e4
Merge branch 'develop' into ci/parameterize-binary-branch
cacieprins 2b684c4
Merge branch 'develop' into ci/parameterize-binary-branch
cacieprins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,11 @@ base-internal-minimum-node: &base-internal-minimum-node cypress/base-internal:20 | |
| ubuntu-2004-current: &ubuntu-2004-current ubuntu-2004:2024.11.1 | ||
| ubuntu-2004-older: &ubuntu-2004-older ubuntu-2004:2024.05.1 | ||
|
|
||
| parameters: | ||
| publish-binary-branch: | ||
| type: string | ||
| default: main | ||
|
|
||
| orbs: | ||
| browser-tools: circleci/[email protected] | ||
|
|
||
|
|
@@ -1366,19 +1371,6 @@ commands: | |
| paths: | ||
| - cypress/cypress.zip | ||
|
|
||
| trigger-publish-binary-pipeline: | ||
| steps: | ||
| - run: | ||
| name: "Trigger publish-binary pipeline" | ||
| command: | | ||
| source ./scripts/ensure-node.sh | ||
| echo $SHOULD_PERSIST_ARTIFACTS | ||
| node ./scripts/binary/trigger-publish-binary-pipeline.js | ||
| - persist_to_workspace: | ||
| root: ~/ | ||
| paths: | ||
| - triggered_pipeline.json | ||
|
|
||
| build-cypress-npm-package: | ||
| parameters: | ||
| executor: | ||
|
|
@@ -2471,7 +2463,8 @@ jobs: | |
| - restore_cached_workspace | ||
| - check-if-binary-exists | ||
| - setup_should_persist_artifacts | ||
| - trigger-publish-binary-pipeline | ||
| - trigger-publish-binary-pipeline: | ||
| target-repo-branch: << pipeline.parameters.publish-binary-branch >> | ||
|
|
||
| get-published-artifacts: | ||
| <<: *defaults | ||
|
|
||
74 changes: 74 additions & 0 deletions
74
.circleci/src/pipeline/commands/trigger-publish-binary-pipeline.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| parameters: | ||
| target-repo-branch: | ||
| type: string | ||
| default: main | ||
|
|
||
| steps: | ||
| - run: | ||
| name: Trigger publish-binary pipeline | ||
| command: | | ||
| if [[ -z "$CIRCLE_TOKEN" ]] || \ | ||
| [[ -z "$CIRCLE_SHA1" ]] || \ | ||
| [[ -z "$CIRCLE_JOB" ]] || \ | ||
| [[ -z "$CIRCLE_WORKFLOW_ID" ]] || \ | ||
| [[ -z "$CIRCLE_BUILD_URL" ]] || \ | ||
| [[ -z "$CIRCLE_BRANCH" ]]; then | ||
| echo "Missing required environment variables. Skipping pipeline trigger." | ||
| exit 1 | ||
| fi | ||
| if [[ -n "$SHOULD_PERSIST_ARTIFACTS" && "$SHOULD_PERSIST_ARTIFACTS" != "true" && "$SHOULD_PERSIST_ARTIFACTS" != "false" ]]; then | ||
| echo "SHOULD_PERSIST_ARTIFACTS must be true, false, or undefined. Skipping pipeline trigger." | ||
| exit 1 | ||
| fi | ||
| if [[ -z $(which node) ]] || [[ -z $(which curl) ]] || [[ -z $(which jq) ]]; then | ||
| echo "Missing required commands. Skipping pipeline trigger. Ensure jq, curl, and node are installed." | ||
| exit 1 | ||
cacieprins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fi | ||
| echo "Determining next binary version..." | ||
| export NEXT_VERSION=$(node ./scripts/get-next-version.js) | ||
cacieprins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if [[ $? != 0 ]]; then | ||
| echo "Failed to determine next binary version. Skipping pipeline trigger." | ||
| exit 1 | ||
| fi | ||
| echo "Next binary version: $NEXT_VERSION" | ||
| export BODY=$(cat \<<JSON_BODY_EOF | ||
| { | ||
| "branch": "<< parameters.target-repo-branch >>", | ||
| "parameters": { | ||
| "temp_dir": "${TMPDIR:-/tmp}", | ||
| "sha": "$CIRCLE_SHA1", | ||
| "job_name": "$CIRCLE_JOB", | ||
| "triggered_workflow_id": "$CIRCLE_WORKFLOW_ID", | ||
| "triggered_job_url": "$CIRCLE_BUILD_URL", | ||
| "branch": "$CIRCLE_BRANCH", | ||
| "should_persist_artifacts": ${SHOULD_PERSIST_ARTIFACTS:-false}, | ||
| "binary_version": "$NEXT_VERSION" | ||
| } | ||
| } | ||
| JSON_BODY_EOF | ||
| ) | ||
| if [[ $? != 0 ]]; then | ||
| echo "Failed to compose the request body. Skipping pipeline trigger." | ||
| exit 1 | ||
| fi | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| echo "Triggering new pipeline in cypress-publish-binary project on branch << parameters.target-repo-branch >>..." | ||
| curl -X POST \ | ||
| -o ~/triggered_pipeline.json \ | ||
| -H "Circle-Token: $CIRCLE_TOKEN" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "$BODY" \ | ||
| https://circleci.com/api/v2/project/github/cypress-io/cypress-publish-binary/pipeline | ||
| if [[ $? != 0 ]]; then | ||
| echo "Failed to trigger new pipeline. Skipping pipeline trigger." | ||
| exit 1 | ||
| 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)" | ||
cacieprins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - persist_to_workspace: | ||
| root: ~/ | ||
| paths: | ||
| - triggered_pipeline.json | ||
jennifer-shehane marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,9 +176,8 @@ Upgrading `electron` involves more than just bumping this package's `package.jso | |
| - [ ] Update `electron` version in `package.json` | ||
| - [ ] Update the target `electron` version in the circle configuration | ||
| - [ ] Update the docker image to the new browsers-internal image made in the previous step | ||
| - [ ] Temporarily update the circle configuration to allow `cypress` to run against the branch | ||
| - [ ] Temporarily set target `cypress-publish-binary` branch as a `branch` property on the request body in [../../scripts/binary/trigger-publish-binary-pipeline.js](../../scripts/binary/trigger-publish-binary-pipeline.js) script, so that you can test against this branch from the electron upgrade branch. This property must be set both at the root of the body object, and on the `parameters` key. If it is not set at the root, the binary pipeline will continue to use the primary branch. | ||
|
|
||
| - [ ] Add your branch name to the `&full-workflow-filters` anchor in [`@pipeline.yml`](../../.circleci/src/pipeline/@pipeline.yml) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this can be parameterized as well (separately, to reduce delta surface) |
||
| - [ ] Trigger the pipeline in CircleCI's UI, and set the `publish-binary-branch` parameter to the branch you created in the `cypress-publish-binary` repository. | ||
|
|
||
| - [ ] **Manually smoke test `cypress open`.** Upgrading Electron can break the `desktop-gui` in unexpected ways. Since testing in this area is weak, double-check that things like launching `cypress open`, signing into Cypress Cloud, and launching Electron tests still work. | ||
| - [ ] **Manually smoke test `cypress run` in record mode** Upgrading Electron can cause `better-sqlite3` to SIGSEGV the Electron process. | ||
|
|
||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.