Skip to content

Commit

Permalink
reorient app caching around compose cache
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Jul 18, 2024
1 parent fb73f80 commit ecebe21
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions bin/lando
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,21 @@ if (runtime === 4) {
// Summon the implementation of @lando/cli@3 that works with @lando/core@3
const Cli = require('../lib/cli');
const cli = new Cli(ENVPREFIX, LOGLEVELCONSOLE, USERCONFROOT, COREBASE, debug);
const bsLevel = (_.has(appConfig, 'recipe')) ? 'APP' : 'TASKS';
const bsLevel = !fs.existsSync(appConfig.composeCache) ? 'APP' : 'TASKS';
const getTasks = require(`${COREBASE}/utils/get-tasks`);
debug('starting lando with %o runtime using cli %o', `v${runtime}`, {ENVPREFIX, LOGLEVELCONSOLE, USERCONFROOT, COREBASE});

// Lando cache stuffs
process.lando = 'node';
process.landoTaskCacheName = '_.tasks.cache';
process.landoTaskCacheFile = path.join(cli.defaultConfig().userConfRoot, 'cache', process.landoTaskCacheName);
process.landoAppTaskCacheFile = !_.isEmpty(appConfig) ? appConfig.toolingCache : undefined;
process.landoAppCacheFile = !_.isEmpty(appConfig) ? appConfig.composeCache : undefined;

// Check for sudo usage
cli.checkPerms();

// Check to see if we have a recipe and if it doesn't have a tooling cache lets enforce a manual cache clear
if (bsLevel === 'APP' && !fs.existsSync(appConfig.toolingCache)) {
if (bsLevel === 'APP' && !fs.existsSync(appConfig.composeCache)) {
if (fs.existsSync(process.landoTaskCacheFile)) fs.unlinkSync(process.landoTaskCacheFile);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module.exports = class Cli {
*/
clearTaskCaches() {
if (fs.existsSync(process.landoTaskCacheFile)) fs.unlinkSync(process.landoTaskCacheFile);
if (fs.existsSync(process.landoAppTaskCacheFile)) fs.unlinkSync(process.landoAppTaskCacheFile);
if (fs.existsSync(process.landoAppCacheFile)) fs.unlinkSync(process.landoAppCacheFile);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions utils/get-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ module.exports = (files, userConfRoot) => {
// merge and return
return require('lodash/merge')({}, config, {
configFiles: files,
composeCache: path.join(userConfRoot, 'cache', `${config.project}.compose.cache`),
metaCache: `${config.project}.meta.cache`,
recipeCache: path.join(userConfRoot, 'cache', `${config.project}.recipe.cache`),
root: path.dirname(files[0]),
composeCache: path.join(userConfRoot, 'cache', `${config.project}.compose.cache`),
toolingCache: path.join(userConfRoot, 'cache', `${config.project}.tooling.cache`),
toolingRouter: path.join(userConfRoot, 'cache', `${config.project}.tooling.router`),
});
};

0 comments on commit ecebe21

Please sign in to comment.