diff --git a/src/index.js b/src/index.js index 5341600..9d893cc 100644 --- a/src/index.js +++ b/src/index.js @@ -151,26 +151,12 @@ const check = async ({ projectSourcePath, codePath, projectMember }) => { // NOTE: The verdict is the exit code of the test service. up would report the // exit code of whichever container stopped first, so app and db shut down // after successful tests turned a green run red. - // - // The service is not in every project image yet, so the step falls back to up. - // Without the fallback the merge would be a flag day: run --rm test on a - // project without the service exits 1, and "no such service" is - // indistinguishable from failing tests. The up branch goes away once every - // published image carries test. Mirrors hexlet-project-source-ci's template. - const { stdout: serviceList } = await exec.getExecOutput( - 'docker compose', - [...composeFile, 'config', '--services'], - options, - ); - const hasTestService = serviceList - .split('\n') - .map((name) => name.trim()) - .includes('test'); - const verdictArgs = hasTestService - ? [...composeFile, 'run', '--rm', 'test'] - : [...composeFile, 'up', '--abort-on-container-exit']; try { - await exec.exec('docker compose', verdictArgs, options); + await exec.exec( + 'docker compose', + [...composeFile, 'run', '--rm', 'test'], + options, + ); } catch (err) { // NOTE: run attaches to the test container only, so logs of the services it // waited for are the only clue left for a failing server project.