Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] [dev/build_ts_refs] enable caching by default (#92513) #92696

Merged
merged 1 commit into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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