chore: Ensure binaries are downloadable after release (#16735)

This commit is contained in:
Chris Breiding
2021-06-02 10:08:11 -04:00
committed by GitHub
parent 445e57dc1d
commit 97e7a524d4
6 changed files with 100 additions and 3 deletions
+3 -3
View File
@@ -92,7 +92,7 @@ In the following instructions, "X.Y.Z" is used to denote the version of Cypress
2. If there is a new [`cypress-example-kitchensink`](https://github.com/cypress-io/cypress-example-kitchensink/releases) version, update the corresponding dependency in [`packages/example`](./packages/example) to that new version.
3. Use the `move-binaries` script to move the binaries for `<commit sha>` from `beta` to the `desktop` folder for `<new target version>`
3. Use the `move-binaries` script to move the binaries for `<commit sha>` from `beta` to the `desktop` folder for `<new target version>`. This also purges the cloudflare cache for this version.
```shell
yarn move-binaries --sha <commit sha> --version <new target version>
```
@@ -145,9 +145,9 @@ In the following instructions, "X.Y.Z" is used to denote the version of Cypress
npm dist-tag add cypress@X.Y.Z
```
10. Run `binary-release` to update the [download server's manifest](https://download.cypress.io/desktop.json):
10. Run `binary-release` to update the [download server's manifest](https://download.cypress.io/desktop.json). This will also ensure the binary for the version is downloadable for each system.
```shell
yarn run binary-release --version X.Y.Z
yarn binary-release --version X.Y.Z
```
11. If needed, push out any updated changes to the links manifest to [`on.cypress.io`](https://github.com/cypress-io/cypress-services/tree/develop/packages/on).
+1
View File
@@ -7,6 +7,7 @@
"binary-build": "node ./scripts/binary.js build",
"binary-deploy": "node ./scripts/binary.js deploy",
"binary-deploy-linux": "./scripts/build-linux-binary.sh",
"binary-ensure": "node ./scripts/binary.js ensure",
"binary-purge": "node ./scripts/binary.js purge-version",
"binary-release": "node ./scripts/binary.js release",
"binary-upload": "node ./scripts/binary.js upload",
+9
View File
@@ -84,6 +84,14 @@ const getReleases = (releases) => {
}]
}
const getEnsureVersion = () => {
return prompt([{
name: 'version',
type: 'input',
message: 'Which version do you want to ensure?',
}])
}
const getVersions = (releases) => {
return [{
name: 'version',
@@ -197,6 +205,7 @@ module.exports = {
getPlatformQuestion,
getQuestions,
getReleases,
getEnsureVersion,
getVersions,
getBumpTasks,
deployNewVersion,
+77
View File
@@ -13,6 +13,7 @@ const check = require('check-more-types')
const debug = require('debug')('cypress:binary')
const questionsRemain = require('@cypress/questions-remain')
const R = require('ramda')
const rp = require('@cypress/request-promise')
const zip = require('./zip')
const ask = require('./ask')
@@ -143,12 +144,88 @@ const deploy = {
fail('Release Failed')
throw err
})
.then(() => {
return this.checkDownloads({ version })
})
}
return askMissingOptions(['version'])(options)
.then(release)
},
checkDownloads ({ version }) {
const systems = [
{ platform: 'linux', arch: 'x64' },
{ platform: 'darwin', arch: 'x64' },
{ platform: 'win32', arch: 'ia32' },
{ platform: 'win32', arch: 'x64' },
]
const urlExists = (url) => {
return rp.head(url)
.then(() => true)
.catch(() => false)
}
const checkSystem = ({ platform, arch }) => {
const url = `https://download.cypress.io/desktop/${version}?platform=${platform}&arch=${arch}`
const system = `${platform}-${arch}`
process.stdout.write(`Checking for ${chalk.yellow(system)} at ${chalk.cyan(url)} ... `)
return urlExists(url)
.then((exists) => {
const result = exists ? '✅' : '❌'
process.stdout.write(`${result}\n`)
return { exists, platform, arch, url }
})
}
const allEnsured = (results) => {
return !results.filter(({ exists }) => !exists).length
}
return Promise.mapSeries(systems, checkSystem)
.then((results) => {
if (allEnsured(results)) return results
console.log(chalk.red(`\nCould not ensure v${version} of the Cypress binary is available for the following systems:`))
return results
})
.map((result) => {
const { exists, platform, arch, url } = result
if (exists) return result
console.log(`
${chalk.yellow('Platform')}: ${platform}
${chalk.yellow('Arch')}: ${arch}
${chalk.yellow('URL')}: ${url}`)
return result
})
.then((results) => {
if (allEnsured(results)) return
const purgeCommand = `yarn binary-purge --version ${version}`
const ensureCommand = `yarn binary-ensure --version ${version}`
console.log(`\nPurge the cloudflare cache with ${chalk.yellow(purgeCommand)} and check again with ${chalk.yellow(ensureCommand)}\n`)
process.exit(1)
})
},
ensure () {
const options = this.parseOptions(process.argv)
return questionsRemain({ version: ask.getEnsureVersion })(options)
.then(this.checkDownloads)
},
build (options) {
console.log('#build')
if (options == null) {
+2
View File
@@ -228,6 +228,8 @@ export const moveBinaries = async (args = []) => {
})
}
await uploadUtils.purgeDesktopAppAllPlatforms(releaseOptions.version, zipName)
// return all available information
return { lastBuilds, testRunners }
}
@@ -1,6 +1,8 @@
const snapshot = require('snap-shot-it')
const la = require('lazy-ass')
const is = require('check-more-types')
const { expect } = require('chai')
const uploadUtils = require('../../binary/util/upload')
const s3helpers = require('../../binary/s3-api').s3helpers
@@ -77,6 +79,10 @@ describe('move-binaries', () => {
context('moveBinaries', () => {
const move = moveBinaries.moveBinaries
beforeEach(() => {
sinon.stub(uploadUtils, 'purgeDesktopAppAllPlatforms').resolves()
})
it('is a function', () => {
la(is.fn(move))
})
@@ -152,6 +158,8 @@ describe('move-binaries', () => {
return move(args).then((result) => {
la(is.object(result), 'expected a result', result)
expect(uploadUtils.purgeDesktopAppAllPlatforms).to.be.calledWith(version, 'cypress.zip')
snapshot('collected builds and copied desktop', result)
})
})