mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 18:13:40 -05:00
0346ba2698
* [web] CE script to verify TexLive versions on startup --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> GitOrigin-RevId: b99001d38468a775991a7284611aa333e956b919
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
const minimist = require('minimist')
|
|
const { batchedUpdateWithResultHandling } = require('./helpers/batchedUpdate')
|
|
|
|
const argv = minimist(process.argv.slice(2))
|
|
const commit = argv.commit !== undefined
|
|
let imageName = argv._[0]
|
|
|
|
function usage() {
|
|
console.log(
|
|
'Usage: node backfill_project_image_name.js --commit <texlive_docker_image>'
|
|
)
|
|
console.log(
|
|
'Argument <texlive_docker_image> is not required when TEX_LIVE_DOCKER_IMAGE is set.'
|
|
)
|
|
console.log(
|
|
'Environment variable ALL_TEX_LIVE_DOCKER_IMAGES must contain <texlive_docker_image>.'
|
|
)
|
|
}
|
|
|
|
if (!imageName && process.env.TEX_LIVE_DOCKER_IMAGE) {
|
|
imageName = process.env.TEX_LIVE_DOCKER_IMAGE
|
|
}
|
|
|
|
if (!imageName) {
|
|
usage()
|
|
process.exit(1)
|
|
}
|
|
|
|
if (!process.env.ALL_TEX_LIVE_DOCKER_IMAGES) {
|
|
console.error(
|
|
'Error: environment variable ALL_TEX_LIVE_DOCKER_IMAGES is not defined.'
|
|
)
|
|
usage()
|
|
process.exit(1)
|
|
}
|
|
|
|
if (!process.env.ALL_TEX_LIVE_DOCKER_IMAGES.split(',').includes(imageName)) {
|
|
console.error(
|
|
`Error: ALL_TEX_LIVE_DOCKER_IMAGES doesn't contain ${imageName}`
|
|
)
|
|
usage()
|
|
process.exit(1)
|
|
}
|
|
|
|
if (!commit) {
|
|
console.error('DOING DRY RUN. TO SAVE CHANGES PASS --commit')
|
|
process.exit(1)
|
|
}
|
|
|
|
batchedUpdateWithResultHandling(
|
|
'projects',
|
|
{ imageName: null },
|
|
{ $set: { imageName } }
|
|
)
|