Skip to content

Commit

Permalink
[dev/build_ts_refs] enable caching by default (#92513)
Browse files Browse the repository at this point in the history
Co-authored-by: spalger <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
3 people committed Feb 24, 2021
1 parent 84b5b68 commit 40cfa1d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/dev/ci_setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ cp "src/dev/ci_setup/.bazelrc-ci" "$HOME/.bazelrc";
echo "# Appended by src/dev/ci_setup/setup.sh" >> "$HOME/.bazelrc"
echo "build --remote_header=x-buildbuddy-api-key=$KIBANA_BUILDBUDDY_CI_API_KEY" >> "$HOME/.bazelrc"

if [[ "$BUILD_TS_REFS_CACHE_ENABLE" != "true" ]]; then
export BUILD_TS_REFS_CACHE_ENABLE=false
fi

###
### install dependencies
###
Expand Down
5 changes: 4 additions & 1 deletion src/dev/typescript/build_ts_refs_cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function runBuildRefsCli() {
async ({ log, flags }) => {
const outDirs = getOutputsDeep(REF_CONFIG_PATHS);

const cacheEnabled = process.env.BUILD_TS_REFS_CACHE_ENABLE === 'true' || !!flags.cache;
const cacheEnabled = process.env.BUILD_TS_REFS_CACHE_ENABLE !== 'false' && !!flags.cache;
const doCapture = process.env.BUILD_TS_REFS_CACHE_CAPTURE === 'true';
const doClean = !!flags.clean || doCapture;
const doInitCache = cacheEnabled && !doClean;
Expand Down Expand Up @@ -62,6 +62,9 @@ export async function runBuildRefsCli() {
description: 'Build TypeScript projects',
flags: {
boolean: ['clean', 'cache'],
default: {
cache: true,
},
},
log: {
defaultLevel: 'debug',
Expand Down
2 changes: 1 addition & 1 deletion src/dev/typescript/ref_output_cache/ref_output_cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class RefOutputCache {
this.log.debug(`[${relative}] clearing outDir and replacing with cache`);
await del(outDir);
await unzip(Path.resolve(tmpDir, cacheName), outDir);
await Fs.writeFile(Path.resolve(outDir, OUTDIR_MERGE_BASE_FILENAME), archive.sha);
await Fs.writeFile(Path.resolve(outDir, OUTDIR_MERGE_BASE_FILENAME), this.mergeBase);
});
}

Expand Down

0 comments on commit 40cfa1d

Please sign in to comment.