mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-23 15:39:28 -05:00
form upload hash from CI environment vars if not set
This commit is contained in:
@@ -73,6 +73,9 @@ uploadNpmPackage = (args = []) ->
|
||||
la(isNpmPackageFile(options.file),
|
||||
"invalid file to upload extension", options.file)
|
||||
|
||||
if not options.hash
|
||||
options.hash = uploadUtils.formHashFromEnvironment()
|
||||
|
||||
la(check.unemptyString(options.hash), "missing hash to give", options)
|
||||
la(check.unemptyString(options.version), "missing version", options)
|
||||
|
||||
|
||||
@@ -76,6 +76,9 @@ uploadUniqueBinary = (args = []) ->
|
||||
la(isBinaryFile(options.file),
|
||||
"invalid file to upload extension", options.file)
|
||||
|
||||
if not options.hash
|
||||
options.hash = uploadUtils.formHashFromEnvironment()
|
||||
|
||||
la(check.unemptyString(options.hash), "missing hash to give", options)
|
||||
la(check.unemptyString(options.version), "missing version", options)
|
||||
|
||||
|
||||
@@ -10,6 +10,16 @@ Promise = require("bluebird")
|
||||
{configFromEnvOrJsonFile, filenameToShellVariable} = require('@cypress/env-or-json-file')
|
||||
konfig = require("../../../packages/server/lib/konfig")
|
||||
|
||||
formHashFromEnvironment = () ->
|
||||
env = process.env
|
||||
if env.BUILDKITE
|
||||
return "#{env.BUILDKITE_BRANCH}-#{env.BUILDKITE_COMMIT}-#{env.BUILDKITE_BUILD_NUMBER}"
|
||||
if env.CIRCLE
|
||||
return "#{env.CIRCLE_BRANCH}-#{env.CIRCLE_SHA1}-#{env.CIRCLE_BUILD_NUM}"
|
||||
if env.APPVEYOR
|
||||
return "#{env.APPVEYOR_REPO_BRANCH}-#{env.APPVEYOR_REPO_COMMIT}-#{env.APPVEYOR_BUILD_ID}"
|
||||
throw new Error("Do not know how to form unique build hash on this CI")
|
||||
|
||||
getS3Credentials = () ->
|
||||
## gleb: fix this plzzzzzz
|
||||
old = process.cwd()
|
||||
@@ -133,5 +143,6 @@ module.exports = {
|
||||
purgeDesktopAppFromCache,
|
||||
purgeDesktopAppAllPlatforms,
|
||||
getUploadNameByOs,
|
||||
saveUrl
|
||||
saveUrl,
|
||||
formHashFromEnvironment
|
||||
}
|
||||
|
||||
@@ -29,21 +29,19 @@ if (!shouldBuildBinary()) {
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
console.log('building binary')
|
||||
console.log('building Windows binary')
|
||||
|
||||
const hash = `${process.env.APPVEYOR_REPO_BRANCH}-${process.env.APPVEYOR_REPO_COMMIT}-${process.env.APPVEYOR_BUILD_ID}`
|
||||
const filename = `cypress-${process.env.NEXT_DEV_VERSION}.tgz`
|
||||
const version = process.env.NEXT_DEV_VERSION
|
||||
la(is.unemptyString(version), 'missing NEXT_DEV_VERSION')
|
||||
|
||||
console.log('building version', version)
|
||||
console.log('upload hash', hash)
|
||||
|
||||
shell.exec(`node scripts/binary.js upload-npm-package --file cli/build/${filename} --version ${version} --hash ${hash}`)
|
||||
shell.exec(`node scripts/binary.js upload-npm-package --file cli/build/${filename} --version ${version}`)
|
||||
shell.cat('npm-package-url.json')
|
||||
shell.exec(`npm run binary-build -- --platform windows --version ${version}`)
|
||||
shell.exec('npm run binary-zip')
|
||||
shell.ls('-l', '*.zip')
|
||||
shell.exec(`node scripts/binary.js upload-unique-binary --file cypress.zip --version ${version} --hash ${hash}`)
|
||||
shell.exec(`node scripts/binary.js upload-unique-binary --file cypress.zip --version ${version}`)
|
||||
shell.cat('binary-url.json')
|
||||
shell.exec('node scripts/test-other-projects.js --npm npm-package-url.json --binary binary-url.json --provider appVeyor')
|
||||
|
||||
Reference in New Issue
Block a user