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

feat: Add Buddy to supported Cloud CI Providers #26848

Closed
wants to merge 8 commits into from
Closed
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
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ _Released 06/06/2023 (PENDING)_
**Features:**

- A new testing type switcher has been added to the Spec Explorer to make it easier to move between E2E and Component Testing. An informational overview of each type is displayed if it isn't configured in your project to help newcomers to each testing type. Addresses [#26448](https://github.com/cypress-io/cypress/issues/26448), [#26836](https://github.com/cypress-io/cypress/issues/26836) and [#26837](https://github.com/cypress-io/cypress/issues/26837).
- Added Buddy to the list of supported CI providers that maps to the Cloud. Addressed in [#26848](https://github.com/cypress-io/cypress/pull/26848).

**Bugfixes:**

Expand Down
3 changes: 3 additions & 0 deletions packages/server/__snapshots__/cypress_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ The ciBuildId is automatically detected if you are running Cypress in any of the
- bamboo
- bitbucket
- buildkite
- buddy
- circle
- codeshipBasic
- codeshipPro
Expand Down Expand Up @@ -102,6 +103,7 @@ The ciBuildId is automatically detected if you are running Cypress in any of the
- bamboo
- bitbucket
- buildkite
- buddy
- circle
- codeshipBasic
- codeshipPro
Expand Down Expand Up @@ -141,6 +143,7 @@ The ciBuildId is automatically detected if you are running Cypress in any of the
- bamboo
- bitbucket
- buildkite
- buddy
- circle
- codeshipBasic
- codeshipPro
Expand Down
20 changes: 20 additions & 0 deletions packages/server/lib/util/ci_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const CI_PROVIDERS = {
'bamboo': isBamboo,
'bitbucket': 'BITBUCKET_BUILD_NUMBER',
'buildkite': 'BUILDKITE',
'buddy': 'BUDDY',
'circle': 'CIRCLECI',
'codeshipBasic': isCodeshipBasic,
'codeshipPro': isCodeshipPro,
Expand Down Expand Up @@ -197,6 +198,17 @@ const _providerCiParams = () => {
'BUILDKITE_PULL_REQUEST_BASE_BRANCH',
'BUILDKITE_RETRY_COUNT',
]),
// All available vars
Copy link
Member

Choose a reason for hiding this comment

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

@trojano31 @estrada9166 on our Cloud team pointed this out:

we need to still send the customCiBuildId in case record jobs that run it in parallel or with groups

This change would be made here: https://github.com/cypress-io/cypress-services/blob/develop/packages/util/src/ciProvider.ts#L25-L45

Looking at the Buddy envs, it looks like BUDDY_PIPELINE_ID and BUDDY_EXECUTION_ID would satisfy this.

Copy link
Author

Choose a reason for hiding this comment

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

@emilyrohrbough I assume the change has to be done by the Cloud team as I don't have permissions to view this repository? However, I've added BUDDY_PIPELINE_ID to the list of extracted variables

// https://buddy.works/docs/pipelines/environment-variables#default-environment-variables
buddy: extract([
'BUDDY_EXECUTION_ID',
'BUDDY_PIPELINE_ID',
'BUDDY_PROJECT_URL',
'BUDDY_EXECUTION_URL',
'BUDDY_EXECUTION_REVISION',
'BUDDY_EXECUTION_REF',
'BUDDY_INVOKER_NAME',
]),
circle: extract([
'CIRCLE_JOB',
'CIRCLE_BUILD_NUM',
Expand Down Expand Up @@ -491,6 +503,14 @@ const _providerCommitParams = () => {
remoteOrigin: env.BUILDKITE_REPO,
defaultBranch: env.BUILDKITE_PIPELINE_DEFAULT_BRANCH,
},
buddy: {
sha: env.BUDDY_EXECUTION_REVISION,
branch: env.BUDDY_EXECUTION_BRANCH,
authorName: env.BUDDY_EXECUTION_REVISION_COMMITTER_NAME,
authorEmail: env.BUDDY_EXECUTION_REVISION_COMMITTER_EMAIL,
remoteOrigin: env.BUDDY_SCM_URL,
message: env.BUDDY_EXECUTION_REVISION_MESSAGE,
},
circle: {
sha: env.CIRCLE_SHA1,
branch: env.CIRCLE_BRANCH,
Expand Down
40 changes: 40 additions & 0 deletions packages/server/test/unit/util/ci_provider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,46 @@ describe('lib/util/ci_provider', () => {
})
})

it('buddy', () => {
resetEnv = mockedEnv({
BUDDY: 'true',

BUDDY_PROJECT_URL: 'buddyProjectUrl',
BUDDY_EXECUTION_URL: 'buddyExecutionUrl',
BUDDY_EXECUTION_REVISION: 'buddyExecutionRevision',
BUDDY_EXECUTION_REF: 'buddyExecutionRef',
BUDDY_EXECUTION_ID: 'buddyExecutionId',
BUDDY_PIPELINE_ID: 'buddyPipelineId',
BUDDY_INVOKER_NAME: 'buddyInvokerName',

BUDDY_EXECUTION_BRANCH: 'buddyExecutionBranch',
BUDDY_EXECUTION_REVISION_COMMITTER_NAME: 'buddyExecutionRevisionCommitterName',
BUDDY_EXECUTION_REVISION_COMMITTER_EMAIL: 'buddyExecutionRevisionCommitterEmail',
BUDDY_SCM_URL: 'buddyScmUrl',
BUDDY_EXECUTION_REVISION_MESSAGE: 'buddyExecutionRevisionMessage',
}, { clear: true })

expectsName('buddy')
expectsCiParams({
buddyProjectUrl: 'buddyProjectUrl',
buddyExecutionUrl: 'buddyExecutionUrl',
buddyExecutionRevision: 'buddyExecutionRevision',
buddyExecutionRef: 'buddyExecutionRef',
buddyExecutionId: 'buddyExecutionId',
buddyPipelineId: 'buddyPipelineId',
buddyInvokerName: 'buddyInvokerName',
})

expectsCommitParams({
sha: 'buddyExecutionRevision',
branch: 'buddyExecutionBranch',
message: 'buddyExecutionRevisionMessage',
authorName: 'buddyExecutionRevisionCommitterName',
authorEmail: 'buddyExecutionRevisionCommitterEmail',
remoteOrigin: 'buddyScmUrl',
})
})

it('circle', () => {
resetEnv = mockedEnv({
CIRCLECI: 'true',
Expand Down