mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
When kbn-es downloads a snapshot, it writes the in progress download to `/tmp` rather than the destination path in case the download fails part way through, then renames the file from `/tmp` to the final location. This is a good practice, but in CI the `/tmp` directory isn't stored on the same disk as the project, which causes a rename error to occur because we're attempting to rename across devices. This updates the download logic to write to `${destPath}.tmp` instead, and do the same renaming, so that we can avoid cross-device errors.
This commit is contained in:
parent
ffd2fe83e3
commit
ccdf59e319
2 changed files with 3 additions and 4 deletions
|
@ -3,7 +3,7 @@ const fs = require('fs');
|
|||
const mkdirp = require('mkdirp');
|
||||
const chalk = require('chalk');
|
||||
const path = require('path');
|
||||
const { BASE_PATH, DL_PATH } = require('../paths');
|
||||
const { BASE_PATH } = require('../paths');
|
||||
const { installArchive } = require('./archive');
|
||||
const { log: defaultLog, cache } = require('../utils');
|
||||
|
||||
|
@ -40,10 +40,10 @@ exports.installSnapshot = async function installSnapshot({
|
|||
* @returns {Promose}
|
||||
*/
|
||||
function downloadFile(url, dest, log) {
|
||||
const downloadPath = path.resolve(DL_PATH, path.basename(dest));
|
||||
const downloadPath = `${dest}.tmp`;
|
||||
const cacheMeta = cache.readMeta(dest);
|
||||
|
||||
mkdirp.sync(DL_PATH);
|
||||
mkdirp.sync(path.dirname(dest));
|
||||
|
||||
log.info('downloading from %s', chalk.bold(url));
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ function useBat(bin) {
|
|||
const tempDir = os.tmpdir();
|
||||
|
||||
exports.BASE_PATH = path.resolve(tempDir, 'kbn-es');
|
||||
exports.DL_PATH = tempDir;
|
||||
|
||||
exports.GRADLE_BIN = useBat('./gradlew');
|
||||
exports.ES_BIN = useBat('bin/elasticsearch');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue