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

Detect and capture env vars from AWS CodeBuild including ciBuildId #8101

Closed
danbroooks opened this issue Jul 28, 2020 · 11 comments · Fixed by #8159
Closed

Detect and capture env vars from AWS CodeBuild including ciBuildId #8101

danbroooks opened this issue Jul 28, 2020 · 11 comments · Fixed by #8159
Labels
pkg/server This is due to an issue in the packages/server directory type: enhancement Requested enhancement of existing feature

Comments

@danbroooks
Copy link

danbroooks commented Jul 28, 2020

The documentation lists CodeBuild under "CI environment variables" in this list here:

https://github.com/cypress-io/cypress-documentation/blame/develop/source/guides/guides/parallelization.md#L246

Which was recently changed in the last month. However, when running cypress with the --parallel flag in this environment cypress (4.11) puts out this error:

962 | You passed the --group or --parallel flag but we could not automatically determine or generate a ciBuildId.
963 |  
964 | The --group flag you passed was: admin
965 | The --parallel flag you passed was: true
966 |  
967 | In order to use either of these features a ciBuildId must be determined.
968 |  
969 | The ciBuildId is automatically detected if you are running Cypress in any of the these CI providers:
970 |  
971 | - appveyor
972 | - azure
973 | - bamboo
974 | - bitbucket
975 | - buildkite
976 | - circle
977 | - codeshipBasic
978 | - codeshipPro
979 | - concourse
980 | - drone
981 | - githubActions
982 | - gitlab
983 | - goCD
984 | - googleCloud
985 | - jenkins
986 | - semaphore
987 | - shippable
988 | - teamfoundation
989 | - travis
990 | - netlify
991 |  
992 | Because the ciBuildId could not be auto-detected you must pass the --ci-build-id flag manually.

And in the cypress code it does not list CodeBuild:

const CI_PROVIDERS = {
'appveyor': 'APPVEYOR',
'azure': isAzureCi,
'bamboo': isBamboo,
'bitbucket': 'BITBUCKET_BUILD_NUMBER',
'buildkite': 'BUILDKITE',
'circle': 'CIRCLECI',
'codeshipBasic': isCodeshipBasic,
'codeshipPro': isCodeshipPro,
'concourse': isConcourse,
'drone': 'DRONE',
githubActions: 'GITHUB_ACTIONS',
'gitlab': isGitlab,
'goCD': 'GO_JOB_NAME',
'googleCloud': isGoogleCloud,
'jenkins': isJenkins,
'semaphore': 'SEMAPHORE',
'shippable': 'SHIPPABLE',
'teamcity': 'TEAMCITY_VERSION',
'teamfoundation': isTeamFoundation,
'travis': 'TRAVIS',
'wercker': isWercker,
netlify: 'NETLIFY',
}

I am confused why this documentation has been changed like this when it does not appear to be a supported CI provider?

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Jul 28, 2020

Yeah, this should not have been added to that portion of the docs since this is not built into Cypress to automatically detect this build ID.

@jennifer-shehane jennifer-shehane changed the title Documentation lists CodeBuild under "CI Build ID environment variables" but not listed in error when running parallel flag Detect and capture env vars from AWS CodeBuild including ciBuildId Jul 28, 2020
@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Jul 28, 2020
@jennifer-shehane jennifer-shehane added type: enhancement Requested enhancement of existing feature pkg/server This is due to an issue in the packages/server directory stage: ready for work The issue is reproducible and in scope and removed stage: ready for work The issue is reproducible and in scope labels Jul 28, 2020
@danbroooks
Copy link
Author

danbroooks commented Jul 28, 2020

Would implementing a PR for this simply be mirroring something like this change 3c37b8b only for CodeBuild and the code build env value mentioned in those erroneous docs? I guess whoever updated that documentation assumed codebuild was simply missing and listed codebuilds build is env var in that list or something?

If the change is as straightforward as that I would be happy to make this PR

@jennifer-shehane
Copy link
Member

@danbroooks Pretty much, except you'd do a check to ensure it's codebuild similar to the check for isConcourse - that there's an env var present that starts with CODEBUILD_. A PR would be great!

@estefafdez
Copy link

One question about this one, if I'm using AWS CodeBuild with a Docker container, should the --parallel flag works even when I'm not running the tests against the Cypress Dashboard? thanks!

@jennifer-shehane
Copy link
Member

Using the --parallel flag allows Cypress to parallelize tests during cypress run. It requires recording to the Dashboard (passing the --record key).

If you're talking about running parallel builds in AWS CodeBuild, that would be outside of Cypress.

@estefafdez
Copy link

Yes, it's outside Cypress (considering Cypress the Cypress Dashboard and not having record key).

Any plan to release the parallelization of tests outside Cypress to be able to run the test in parallel locally (in a Docker container) for example or in Jenkins/AWS? Thanks.

@danbroooks
Copy link
Author

@jennifer-shehane ah I see, so this --parallel flag is related to use with the cypress dashboard, I was thinking this flag was required in order to get the tests to run in parallel for these CI providers, but I see how it explains this in the documentation. This is my bad for skim reading thfsae docs 😂

I have thrown together this suggested PR now, so happy to submit it still. However, do you think it may also be worth making this more obvious on the parallelisation page of the documentation? Something like a warning box like on this page? https://docs.cypress.io/guides/guides/cross-browser-testing.html#Continuous-Integration-Strategies

I'd be happy to do a PR for this also, but also fine if it just serves me right skim reading documentation 😂

@jennifer-shehane
Copy link
Member

@estefafdez Not currently without recording. There's a discussion on parallelizing outside of recording to the Dashboard here if you'd like to add your thoughts there - we check those comments. #2520

@danbroooks There is a callout section, but maybe there's a better place this could be added. Feel free to create a new issue/PR in our docs, they're open source.
Screen Shot 2020-07-29 at 3 36 25 PM

@estefafdez
Copy link

thanks @jennifer-shehane , I will have a look :)

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 3, 2020

The code for this is done in cypress-io/cypress#8159, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Aug 3, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 3, 2020

Released in 4.12.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.12.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/server This is due to an issue in the packages/server directory type: enhancement Requested enhancement of existing feature
Projects
None yet
3 participants