Skip to content
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

chore: skip binary jobs if we don't have a circle token #27876

Merged
merged 3 commits into from
Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 34 additions & 6 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ commands:
circleci-agent step halt
fi
maybe_skip_binary_jobs:
steps:
- run:
name: Skip binary job if external PR
command: |
if [[ -z "$CIRCLE_TOKEN" ]]; then
echo "There is no CIRCLE_TOKEN set for this job. Cannot trigger binary build. Skipping job."
circleci-agent step halt
fi
restore_workspace_binaries:
steps:
- attach_workspace:
Expand Down Expand Up @@ -593,7 +603,7 @@ commands:
if [[ <<parameters.type>> == 'ct' ]]; then
# component tests are located side by side with the source codes.
# for the app component tests, ignore specs that are known to cause failures on contributor PRs (see https://discuss.circleci.com/t/how-to-exclude-certain-files-from-circleci-test-globbing/41028)
TESTFILES=$(find src -regextype posix-extended -name '*.cy.*' -not -regex '.*(FileMatch|PromoAction|SelectorPlayground|useDurationFormat|useTestingType|SpecPatterns|DebugPendingRunCounts).cy.*' | circleci tests split --total=$CIRCLE_NODE_TOTAL)
TESTFILES=$(find src -regextype posix-extended -name '*.cy.*' -not -regex '.*(FileMatch|PromoAction|SelectorPlayground|useDurationFormat|useTestingType|SpecPatterns|DebugPendingRunCounts|DebugRunStates|DebugPageHeader|DebugPendingRunSplash|DebugRunNavigation|DebugRunNavigationLimitMessage).cy.*' | circleci tests split --total=$CIRCLE_NODE_TOTAL)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also ignoring some extra CT tests that fail on contributor PRs for some reason

else
GLOB="cypress/e2e/**/*cy.*"
TESTFILES=$(circleci tests glob "$GLOB" | circleci tests split --total=$CIRCLE_NODE_TOTAL)
Expand Down Expand Up @@ -1648,6 +1658,7 @@ jobs:
docker_layer_caching: true
resource_class: medium
steps:
- maybe_skip_binary_jobs
- run-binary-system-tests

system-tests-chrome:
Expand Down Expand Up @@ -2091,6 +2102,7 @@ jobs:
default: xlarge
resource_class: << parameters.resource_class >>
steps:
- maybe_skip_binary_jobs
- restore_cached_workspace
- check-if-binary-exists
- setup_should_persist_artifacts
Expand All @@ -2106,6 +2118,7 @@ jobs:
default: large
resource_class: << parameters.resource_class >>
steps:
- maybe_skip_binary_jobs
- restore_cached_workspace
- run:
name: Check pipeline info
Expand Down Expand Up @@ -2247,6 +2260,7 @@ jobs:
docker:
- image: cypress/base-internal:18.15.0
steps:
- maybe_skip_binary_jobs
- restore_workspace_binaries
- run: mkdir test-binary
- run:
Expand Down Expand Up @@ -2283,6 +2297,7 @@ jobs:
<<: *defaults
resource_class: small
steps:
- maybe_skip_binary_jobs
- restore_workspace_binaries
- run: mkdir <<parameters.wd>>
- run:
Expand Down Expand Up @@ -2322,6 +2337,7 @@ jobs:
<<: *defaults
resource_class: small
steps:
- maybe_skip_binary_jobs
- restore_workspace_binaries
- run: mkdir <<parameters.wd>>
- run:
Expand Down Expand Up @@ -2414,6 +2430,7 @@ jobs:
test-binary-against-kitchensink:
<<: *defaults
steps:
- maybe_skip_binary_jobs
- test-binary-against-repo:
repo: cypress-example-kitchensink
browser: electron
Expand Down Expand Up @@ -2476,6 +2493,7 @@ jobs:
test-binary-as-specific-user:
<<: *defaults
steps:
- maybe_skip_binary_jobs
- restore_workspace_binaries
# the user should be "node"
- run: whoami
Expand Down Expand Up @@ -2829,15 +2847,19 @@ linux-x64-workflow: &linux-x64-workflow
requires:
- build
- test-npm-module-on-minimum-node-version:
context: publish-binary
requires:
- get-published-artifacts
- test-types-cypress-and-jest:
context: publish-binary
requires:
- get-published-artifacts
- test-full-typescript-project:
context: publish-binary
requires:
- get-published-artifacts
- test-binary-against-kitchensink:
context: publish-binary
requires:
- get-published-artifacts
- test-npm-module-and-verify-binary:
Expand Down Expand Up @@ -2881,13 +2903,16 @@ linux-x64-workflow: &linux-x64-workflow
- test-binary-as-specific-user:
name: "test binary as a non-root user"
executor: non-root-docker-user
context: publish-binary
requires:
- get-published-artifacts
- test-binary-as-specific-user:
name: "test binary as a root user"
context: publish-binary
requires:
- get-published-artifacts
- binary-system-tests:
context: publish-binary
requires:
- get-published-artifacts
- system-tests-node-modules-install
Expand Down Expand Up @@ -3179,14 +3204,10 @@ linux-x64-contributor-workflow: &linux-x64-contributor-workflow
context: [test-runner:upload, test-runner:build-binary, publish-binary]
requires:
- contributor-pr
- wait-for-binary-publish:
type: approval
requires:
- create-and-trigger-packaging-artifacts
- get-published-artifacts:
context: [publish-binary, test-runner:commit-status-checks]
requires:
- wait-for-binary-publish
- create-and-trigger-packaging-artifacts
# various testing scenarios, like building full binary
# and testing it on a real project
- test-against-staging:
Expand All @@ -3203,15 +3224,19 @@ linux-x64-contributor-workflow: &linux-x64-contributor-workflow
requires:
- build
- test-npm-module-on-minimum-node-version:
context: publish-binary
requires:
- get-published-artifacts
- test-types-cypress-and-jest:
context: publish-binary
requires:
- get-published-artifacts
- test-full-typescript-project:
context: publish-binary
requires:
- get-published-artifacts
- test-binary-against-kitchensink:
context: publish-binary
requires:
- get-published-artifacts
- test-npm-module-and-verify-binary:
Expand Down Expand Up @@ -3255,13 +3280,16 @@ linux-x64-contributor-workflow: &linux-x64-contributor-workflow
- test-binary-as-specific-user:
name: "test binary as a non-root user"
executor: non-root-docker-user
context: publish-binary
requires:
- get-published-artifacts
- test-binary-as-specific-user:
name: "test binary as a root user"
context: publish-binary
requires:
- get-published-artifacts
- binary-system-tests:
context: publish-binary
requires:
- get-published-artifacts
- system-tests-node-modules-install
Expand Down