Skip to content

Commit

Permalink
fix: Capture env vars from AWS Code Build (#8159)
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-shehane authored Aug 3, 2020
1 parent e0f587e commit 9d19a9f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/server/__snapshots__/cypress_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The ciBuildId is automatically detected if you are running Cypress in any of the
- appveyor
- azure
- awsCodeBuild
- bamboo
- bitbucket
- buildkite
Expand Down Expand Up @@ -95,6 +96,7 @@ The ciBuildId is automatically detected if you are running Cypress in any of the
- appveyor
- azure
- awsCodeBuild
- bamboo
- bitbucket
- buildkite
Expand Down Expand Up @@ -131,6 +133,7 @@ The ciBuildId is automatically detected if you are running Cypress in any of the
- appveyor
- azure
- awsCodeBuild
- bamboo
- bitbucket
- buildkite
Expand Down
23 changes: 23 additions & 0 deletions packages/server/lib/util/ci_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ const isAzureCi = () => {
return process.env.TF_BUILD && process.env.AZURE_HTTP_USER_AGENT
}

const isAWSCodeBuild = () => {
return _.some(process.env, (val, key) => {
return /^CODEBUILD_/.test(key)
})
}

const isBamboo = () => {
return process.env.bamboo_buildNumber
}
Expand Down Expand Up @@ -82,6 +88,7 @@ const isWercker = () => {
const CI_PROVIDERS = {
'appveyor': 'APPVEYOR',
'azure': isAzureCi,
'awsCodeBuild': isAWSCodeBuild,
'bamboo': isBamboo,
'bitbucket': 'BITBUCKET_BUILD_NUMBER',
'buildkite': 'BUILDKITE',
Expand Down Expand Up @@ -139,6 +146,13 @@ const _providerCiParams = () => {
'BUILD_CONTAINERID',
'BUILD_REPOSITORY_URI',
]),
awsCodeBuild: extract([
'CODEBUILD_BUILD_ID',
'CODEBUILD_BUILD_NUMBER',
'CODEBUILD_RESOLVED_SOURCE_VERSION',
'CODEBUILD_SOURCE_REPO_URL',
'CODEBUILD_SOURCE_VERSION',
]),
bamboo: extract([
'bamboo_buildNumber',
'bamboo_buildResultsUrl',
Expand Down Expand Up @@ -375,6 +389,15 @@ const _providerCommitParams = () => {
// remoteOrigin: ???
// defaultBranch: ???
},
awsCodeBuild: {
sha: env.CODEBUILD_RESOLVED_SOURCE_VERSION,
// branch: ???,
// message: ???
// authorName: ???
// authorEmail: ???
remoteOrigin: env.CODEBUILD_SOURCE_REPO_URL,
// defaultBranch: ???
},
azure: {
sha: env.BUILD_SOURCEVERSION,
branch: env.BUILD_SOURCEBRANCHNAME,
Expand Down
24 changes: 24 additions & 0 deletions packages/server/test/unit/ci_provider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,30 @@ describe('lib/util/ci_provider', () => {
})
})

it('awsCodeBuild', () => {
resetEnv = mockedEnv({
CODEBUILD_BUILD_ID: 'codebuild-demo-project:b1e6661e-e4f2-4156-9ab9-82a19EXAMPLE',
CODEBUILD_BUILD_NUMBER: '123',
CODEBUILD_RESOLVED_SOURCE_VERSION: 'commit',
CODEBUILD_SOURCE_REPO_URL: 'repositoryUrl',
CODEBUILD_SOURCE_VERSION: 'commitOrBranchOrTag',
}, { clear: true })

expectsName('awsCodeBuild')
expectsCiParams({
codebuildBuildId: 'codebuild-demo-project:b1e6661e-e4f2-4156-9ab9-82a19EXAMPLE',
codebuildBuildNumber: '123',
codebuildResolvedSourceVersion: 'commit',
codebuildSourceRepoUrl: 'repositoryUrl',
codebuildSourceVersion: 'commitOrBranchOrTag',
})

return expectsCommitParams({
sha: 'commit',
remoteOrigin: 'repositoryUrl',
})
})

it('bamboo', () => {
resetEnv = mockedEnv({
'bamboo_buildNumber': 'bambooBuildNumber',
Expand Down

8 comments on commit 9d19a9f

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9d19a9f Aug 3, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/linux-x64/circle-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-412079/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/circle-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-412070/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9d19a9f Aug 3, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9d19a9f Aug 3, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34452803/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9d19a9f Aug 3, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/darwin-x64/circle-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-412098/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/circle-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-412076/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9d19a9f Aug 3, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.12.0/linux-x64/circle-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-412166/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.12.0/circle-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-412154/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9d19a9f Aug 3, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.12.0/win32-ia32/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.12.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/4.12.0/win32-ia32/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.12.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.12.0/win32-ia32/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.12.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.12.0/win32-ia32/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.zip npm install https://cdn.cypress.io/beta/npm/4.12.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9d19a9f Aug 3, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.12.0/win32-x64/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.12.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/4.12.0/win32-x64/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.12.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.12.0/win32-x64/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.12.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.12.0/win32-x64/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.zip npm install https://cdn.cypress.io/beta/npm/4.12.0/appveyor-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-34453969/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9d19a9f Aug 3, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.12.0/darwin-x64/circle-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-412183/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.12.0/circle-develop-9d19a9f0efba3dd69eb8f93b6bd0d8dfeda7f637-412160/cypress.tgz

Please sign in to comment.