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 forked pull request on AppVeyor CI #4063

Closed
bahmutov opened this issue Apr 29, 2019 · 4 comments · Fixed by #4078
Closed

Detect forked pull request on AppVeyor CI #4063

bahmutov opened this issue Apr 29, 2019 · 4 comments · Fixed by #4078
Assignees
Labels
CI General issues involving running in a CI provider process: tests Related to our internal tests type: chore Work is required w/ no deliverable to end user

Comments

@bahmutov
Copy link
Contributor

We have special logic to detect forked pull requests on CircleCI and run tests without recording even when the CI file says cypress run --record. (we do show a warning in the terminal)

I have noticed that we don't detect this situation on AppVeyor, see https://ci.appveyor.com/project/cypress-io/cypress-example-kitchensink/builds/24174895 for example

run-if npm run test:ci:record
Platform win32 is allowed
Arch ia32 is allowed
> [email protected] test:ci:record C:\projects\cypress-example-kitchensink
> run-p --race start:ci e2e:record
> [email protected] start:ci C:\projects\cypress-example-kitchensink
> http-server app -c-1 --silent
> [email protected] e2e:record C:\projects\cypress-example-kitchensink
> cypress run --record
You passed the --record flag but did not provide us your Record Key.
You can pass us your Record Key like this:
  cypress run --record --key <record_key>
You can also set the key as an environment variable with the name CYPRESS_RECORD_KEY.
https://on.cypress.io/how-do-i-record-runs
npm ERR! code ELIFECYCLE
npm ERR! errno 1

Environment variables to use to detect this situation

print-env APPVEYOR
APPVEYOR=True
APPVEYOR_ACCOUNT_NAME=cypress-io
APPVEYOR_API_URL=http://localhost:1031/
APPVEYOR_BUILD_AGENT_HYPERV_NIC_CONFIGURED=true
APPVEYOR_BUILD_FOLDER=C:\projects\cypress-example-kitchensink
APPVEYOR_BUILD_ID=24174895
APPVEYOR_BUILD_NUMBER=1125
APPVEYOR_BUILD_VERSION=1.0.1125
APPVEYOR_BUILD_WORKER_IMAGE=Visual Studio 2015
APPVEYOR_JOB_ID=vq2vocqjxhwwik0r
APPVEYOR_JOB_NUMBER=1
APPVEYOR_PROJECT_ID=369103
APPVEYOR_PROJECT_NAME=cypress-example-kitchensink
APPVEYOR_PROJECT_SLUG=cypress-example-kitchensink
APPVEYOR_PULL_REQUEST_HEAD_COMMIT=0f79966c703a3864cb74a993a4e25ded91fbed61
APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH=patch-2
APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME=mguery/cypress-example-kitchensink
APPVEYOR_PULL_REQUEST_NUMBER=241
APPVEYOR_PULL_REQUEST_TITLE=Update index.html
APPVEYOR_REPO_BRANCH=master
APPVEYOR_REPO_COMMIT=1fed0b1223afaa50c5df2a4586e1c9e67dcca90b
APPVEYOR_REPO_COMMIT_AUTHOR=Marjy Guery
[email protected]
APPVEYOR_REPO_COMMIT_MESSAGE=Update index.html
APPVEYOR_REPO_COMMIT_TIMESTAMP=2019-04-29T13:21:01.0000000Z
APPVEYOR_REPO_NAME=cypress-io/cypress-example-kitchensink
APPVEYOR_REPO_PROVIDER=gitHub
APPVEYOR_REPO_SCM=git
APPVEYOR_REPO_TAG=false
APPVEYOR_URL=https://ci.appveyor.com
commit-message-install --else "npm ci"
@bahmutov bahmutov self-assigned this Apr 29, 2019
@bahmutov
Copy link
Contributor Author

for comparison, internal pull request here https://ci.appveyor.com/project/cypress-io/cypress-example-kitchensink/builds/24164123 with the following env variables

APPVEYOR=True
APPVEYOR_ACCOUNT_NAME=cypress-io
APPVEYOR_API_URL=http://localhost:1031/
APPVEYOR_BUILD_AGENT_HYPERV_NIC_CONFIGURED=true
APPVEYOR_BUILD_FOLDER=C:\projects\cypress-example-kitchensink
APPVEYOR_BUILD_ID=24164123
APPVEYOR_BUILD_NUMBER=1123
APPVEYOR_BUILD_VERSION=1.0.1123
APPVEYOR_BUILD_WORKER_IMAGE=Visual Studio 2015
APPVEYOR_JOB_ID=8g5140lxdy6grrc0
APPVEYOR_JOB_NUMBER=1
APPVEYOR_PROJECT_ID=369103
APPVEYOR_PROJECT_NAME=cypress-example-kitchensink
APPVEYOR_PROJECT_SLUG=cypress-example-kitchensink
APPVEYOR_PULL_REQUEST_HEAD_COMMIT=33c8ec36ba97f1eaa3148515e5f6f3028fbb611d
APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH=renovate/lock-file-maintenance
APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME=cypress-io/cypress-example-kitchensink
APPVEYOR_PULL_REQUEST_NUMBER=234
APPVEYOR_PULL_REQUEST_TITLE=chore(deps): update dependency to version ??
APPVEYOR_REPO_BRANCH=master
APPVEYOR_REPO_COMMIT=cde7daf8edb42b10562df3d7ba5d78e07876ff47
APPVEYOR_REPO_COMMIT_AUTHOR=Renovate Bot
[email protected]
APPVEYOR_REPO_COMMIT_MESSAGE=chore(deps): update to ??
APPVEYOR_REPO_COMMIT_TIMESTAMP=2019-04-29T04:09:39.0000000Z
APPVEYOR_REPO_NAME=cypress-io/cypress-example-kitchensink
APPVEYOR_REPO_PROVIDER=gitHub
APPVEYOR_REPO_SCM=git
APPVEYOR_REPO_TAG=false
APPVEYOR_URL=https://ci.appveyor.com
commit-message-install --else "npm ci"

@bahmutov
Copy link
Contributor Author

we can check values of APPVEYOR_REPO_NAME and APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME - if they are the same, this is internal PR. If they are different, then this is a forked pull request

@cypress-bot cypress-bot bot added the stage: investigating Someone from Cypress is looking into this label Apr 30, 2019
@jennifer-shehane jennifer-shehane added process: tests Related to our internal tests type: chore Work is required w/ no deliverable to end user labels Apr 30, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress and removed stage: investigating Someone from Cypress is looking into this stage: needs review The PR code is done & tested, needs review labels Apr 30, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 1, 2019

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

bahmutov added a commit that referenced this issue May 1, 2019
* detect forked PR on AppVeyor CI, close #4063

* match what CircleCI has for env variables
@jennifer-shehane
Copy link
Member

Released in 3.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI General issues involving running in a CI provider process: tests Related to our internal tests type: chore Work is required w/ no deliverable to end user
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants