Merge pull request #20698 from overleaf/jpa-texlive-check-pro

[web] exit early from check-texlive-images when running in CE

GitOrigin-RevId: 7266203715b24ea957662647a90638e9198bc6c1
This commit is contained in:
Jakob Ackermann 2024-09-30 10:18:46 +02:00 committed by Copybot
parent 35728d7681
commit 1c30f17042
2 changed files with 24 additions and 0 deletions

View file

@ -21,6 +21,13 @@ async function readImagesInUse() {
return images return images
} }
function checkIsServerPro() {
if (process.env.OVERLEAF_IS_SERVER_PRO !== 'true') {
console.log('Running Overleaf Community Edition, skipping TexLive checks')
process.exit(0)
}
}
function checkSandboxedCompilesAreEnabled() { function checkSandboxedCompilesAreEnabled() {
if (process.env.SANDBOXED_COMPILES !== 'true') { if (process.env.SANDBOXED_COMPILES !== 'true') {
console.log('Sandboxed compiles disabled, skipping TexLive checks') console.log('Sandboxed compiles disabled, skipping TexLive checks')
@ -46,6 +53,7 @@ async function main() {
process.exit(0) process.exit(0)
} }
checkIsServerPro()
checkSandboxedCompilesAreEnabled() checkSandboxedCompilesAreEnabled()
checkTexLiveEnvVariablesAreProvided() checkTexLiveEnvVariablesAreProvided()

View file

@ -524,6 +524,7 @@ describe('ServerCEScripts', function () {
SANDBOXED_COMPILES, SANDBOXED_COMPILES,
TEX_LIVE_DOCKER_IMAGE, TEX_LIVE_DOCKER_IMAGE,
ALL_TEX_LIVE_DOCKER_IMAGES, ALL_TEX_LIVE_DOCKER_IMAGES,
OVERLEAF_IS_SERVER_PRO = true,
}) { }) {
let cmd = `SANDBOXED_COMPILES=${SANDBOXED_COMPILES ? 'true' : 'false'}` let cmd = `SANDBOXED_COMPILES=${SANDBOXED_COMPILES ? 'true' : 'false'}`
if (TEX_LIVE_DOCKER_IMAGE) { if (TEX_LIVE_DOCKER_IMAGE) {
@ -532,6 +533,9 @@ describe('ServerCEScripts', function () {
if (ALL_TEX_LIVE_DOCKER_IMAGES) { if (ALL_TEX_LIVE_DOCKER_IMAGES) {
cmd += ` ALL_TEX_LIVE_DOCKER_IMAGES='${ALL_TEX_LIVE_DOCKER_IMAGES}'` cmd += ` ALL_TEX_LIVE_DOCKER_IMAGES='${ALL_TEX_LIVE_DOCKER_IMAGES}'`
} }
if (OVERLEAF_IS_SERVER_PRO === true) {
cmd += ` OVERLEAF_IS_SERVER_PRO=${OVERLEAF_IS_SERVER_PRO}`
}
return ( return (
cmd + ' node modules/server-ce-scripts/scripts/check-texlive-images' cmd + ' node modules/server-ce-scripts/scripts/check-texlive-images'
) )
@ -544,6 +548,18 @@ describe('ServerCEScripts', function () {
await user.createProject('test-project') await user.createProject('test-project')
}) })
describe('when running in CE', function () {
beforeEach('run script', function () {
output = run(buildCheckTexLiveCmd({ OVERLEAF_IS_SERVER_PRO: false }))
})
it('should skip checks', function () {
expect(output).to.include(
'Running Overleaf Community Edition, skipping TexLive checks'
)
})
})
describe('when sandboxed compiles are disabled', function () { describe('when sandboxed compiles are disabled', function () {
beforeEach('run script', function () { beforeEach('run script', function () {
output = run(buildCheckTexLiveCmd({ SANDBOXED_COMPILES: false })) output = run(buildCheckTexLiveCmd({ SANDBOXED_COMPILES: false }))