Skip to content

Commit

Permalink
feat: send CI variables for CloudFresh (#15117)
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Feb 17, 2021
1 parent 181f8ac commit f6233af
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/server/__snapshots__/cypress_spec.js
Expand Up @@ -68,6 +68,7 @@ The ciBuildId is automatically detected if you are running Cypress in any of the
- codeshipBasic
- codeshipPro
- concourse
- codeFresh
- drone
- githubActions
- gitlab
Expand Down Expand Up @@ -104,6 +105,7 @@ The ciBuildId is automatically detected if you are running Cypress in any of the
- codeshipBasic
- codeshipPro
- concourse
- codeFresh
- drone
- githubActions
- gitlab
Expand Down Expand Up @@ -141,6 +143,7 @@ The ciBuildId is automatically detected if you are running Cypress in any of the
- codeshipBasic
- codeshipPro
- concourse
- codeFresh
- drone
- githubActions
- gitlab
Expand Down
21 changes: 21 additions & 0 deletions packages/server/lib/util/ci_provider.js
Expand Up @@ -96,6 +96,7 @@ const CI_PROVIDERS = {
'codeshipBasic': isCodeshipBasic,
'codeshipPro': isCodeshipPro,
'concourse': isConcourse,
codeFresh: 'CF_BUILD_ID',
'drone': 'DRONE',
githubActions: 'GITHUB_ACTIONS',
'gitlab': isGitlab,
Expand Down Expand Up @@ -218,6 +219,20 @@ const _providerCiParams = () => {
'BUILD_TEAM_NAME',
'ATC_EXTERNAL_URL',
]),
// https://codefresh.io/docs/docs/codefresh-yaml/variables/
codeFresh: extract([
'CF_BUILD_ID',
'CF_BUILD_URL',
'CF_CURRENT_ATTEMPT',
'CF_STEP_NAME',
'CF_PIPELINE_NAME',
'CF_PIPELINE_TRIGGER_ID',
// variables added for pull requests
'CF_PULL_REQUEST_ID',
'CF_PULL_REQUEST_IS_FORK',
'CF_PULL_REQUEST_NUMBER',
'CF_PULL_REQUEST_TARGET',
]),
drone: extract([
'DRONE_JOB_NUMBER',
'DRONE_BUILD_LINK',
Expand Down Expand Up @@ -465,6 +480,12 @@ const _providerCommitParams = () => {
// remoteOrigin: ???
// defaultBranch: ???
},
codeFresh: {
sha: env.CF_REVISION,
branch: env.CF_BRANCH,
message: env.CF_COMMIT_MESSAGE,
authorName: env.CF_COMMIT_AUTHOR,
},
drone: {
sha: env.DRONE_COMMIT_SHA,
branch: env.DRONE_COMMIT_BRANCH,
Expand Down
46 changes: 46 additions & 0 deletions packages/server/test/unit/ci_provider_spec.js
Expand Up @@ -458,6 +458,52 @@ describe('lib/util/ci_provider', () => {
return expectsCommitParams(null)
})

it('codeFresh', () => {
resetEnv = mockedEnv({
// build information
'CF_BUILD_ID': 'cfBuildId',
'CF_BUILD_URL': 'cfBuildUrl',
'CF_CURRENT_ATTEMPT': 'cfCurrentAttempt',
'CF_STEP_NAME': 'cfStepName',
'CF_PIPELINE_NAME': 'cfPipelineName',
'CF_PIPELINE_TRIGGER_ID': 'cfPipelineTriggerId',

// variables added for pull requests
'CF_PULL_REQUEST_ID': 'cfPullRequestId',
'CF_PULL_REQUEST_IS_FORK': 'cfPullRequestIsFork',
'CF_PULL_REQUEST_NUMBER': 'cfPullRequestNumber',
'CF_PULL_REQUEST_TARGET': 'cfPullRequestTarget',

// git information
CF_REVISION: 'cfRevision',
CF_BRANCH: 'cfBranch',
CF_COMMIT_MESSAGE: 'cfCommitMessage',
CF_COMMIT_AUTHOR: 'cfCommitAuthor',
}, { clear: true })

expectsName('codeFresh')
expectsCiParams({
cfBuildId: 'cfBuildId',
cfBuildUrl: 'cfBuildUrl',
cfCurrentAttempt: 'cfCurrentAttempt',
cfStepName: 'cfStepName',
cfPipelineName: 'cfPipelineName',
cfPipelineTriggerId: 'cfPipelineTriggerId',
// pull request variables
cfPullRequestId: 'cfPullRequestId',
cfPullRequestIsFork: 'cfPullRequestIsFork',
cfPullRequestNumber: 'cfPullRequestNumber',
cfPullRequestTarget: 'cfPullRequestTarget',
})

expectsCommitParams({
sha: 'cfRevision',
branch: 'cfBranch',
message: 'cfCommitMessage',
authorName: 'cfCommitAuthor',
})
})

it('drone', () => {
resetEnv = mockedEnv({
DRONE: 'true',
Expand Down

4 comments on commit f6233af

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f6233af Feb 17, 2021

Choose a reason for hiding this comment

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

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/6.6.0/circle-develop-f6233af8a768b44e0e754c8af51417d4dd9ec842/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f6233af Feb 17, 2021

Choose a reason for hiding this comment

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

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/6.6.0/circle-develop-f6233af8a768b44e0e754c8af51417d4dd9ec842/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f6233af Feb 17, 2021

Choose a reason for hiding this comment

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

AppVeyor has built the win32 ia32 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/6.6.0/appveyor-develop-f6233af8a768b44e0e754c8af51417d4dd9ec842/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f6233af Feb 17, 2021

Choose a reason for hiding this comment

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

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/6.6.0/appveyor-develop-f6233af8a768b44e0e754c8af51417d4dd9ec842/cypress.tgz

Please sign in to comment.