Skip to content

Commit b42c680

Browse files
authored
chore: purge binary manifest file (#32363)
1 parent ab2004b commit b42c680

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

guides/release-process.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The `@cypress/`-namespaced NPM packages that live inside the [`/npm`](../npm) di
3737
GITHUB_PRIVATE_KEY=
3838
```
3939
40-
- For purging the Cloudflare cache (needed for the `prepare-release-artifacts` script in step 6), you'll need `CF_ZONEID` and `CF_TOKEN` set. These can be found in 1Password.
40+
- For purging the Cloudflare cache (needed for the `prepare-release-artifacts` script in step 6 and `binary-release` in step 14), you'll need `CF_ZONEID` and `CF_TOKEN` set. These can be found in 1Password.
4141
```text
4242
CF_ZONEID="..."
4343
CF_TOKEN="..."

scripts/binary/index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ const deploy = {
135135
fail('Release Failed')
136136
throw err
137137
})
138+
.then(() => {
139+
return this.checkManifest({ version })
140+
})
138141
.then(() => {
139142
return this.checkDownloads({ version })
140143
})
@@ -144,6 +147,33 @@ const deploy = {
144147
.then(release)
145148
},
146149

150+
checkManifest ({ version }) {
151+
const checkManifest = () => {
152+
const url = `https://download.cypress.io/desktop.json`
153+
154+
process.stdout.write(`Checking for ${chalk.yellow(version)} in the manifest at ${chalk.cyan(url)} ... `)
155+
156+
return rp.get(url)
157+
.then((res) => {
158+
const manifest = JSON.parse(res)
159+
160+
return manifest
161+
})
162+
}
163+
164+
return checkManifest().then((manifest) => {
165+
const versionMatches = manifest.version === version
166+
167+
process.stdout.write(`${versionMatches ? '✅' : '❌'}\n`)
168+
169+
if (!versionMatches) {
170+
console.log(chalk.red(`\nFound ${manifest.version} in the manifest, but ${version} was requested.`))
171+
172+
process.exit(1)
173+
}
174+
})
175+
},
176+
147177
checkDownloads ({ version }) {
148178
const systems = [
149179
{ platform: 'linux', arch: 'x64' },

scripts/binary/upload.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ module.exports = {
131131
return fs.removeAsync(manifest)
132132
})
133133
})
134+
.then(() => {
135+
return uploadUtils.purgeDesktopManifest()
136+
})
134137
},
135138

136139
toS3 ({ file, uploadPath }) {

scripts/binary/util/upload.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ const getDesktopUrl = function (version, osName, zipName) {
8484
return [url, 'desktop', version, osName, zipName].join('/')
8585
}
8686

87+
const purgeDesktopManifest = function () {
88+
const url = getUploadUrl()
89+
90+
return purgeCloudflareCache([url, 'desktop', 'manifest.json'].join('/'))
91+
}
92+
8793
// purges desktop application url from Cloudflare cache
8894
const purgeDesktopAppFromCache = function ({ version, platformArch, zipName }) {
8995
la(check.unemptyString(version), 'missing desktop version', version)
@@ -162,6 +168,7 @@ module.exports = {
162168
getPublisher,
163169
purgeDesktopAppFromCache,
164170
purgeDesktopAppAllPlatforms,
171+
purgeDesktopManifest,
165172
getUploadNameByOsAndArch,
166173
validPlatformArchs,
167174
getValidPlatformArchs,

0 commit comments

Comments
 (0)