Skip to content

Commit

Permalink
Merge pull request reproducible-containers#37 from enam-co/main
Browse files Browse the repository at this point in the history
Use sudo to clear cache source during extraction
  • Loading branch information
AkihiroSuda authored Jun 30, 2024
2 parents 1e9b89a + 87d545d commit 5b6db76
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.ts]
indent_style = space
indent_size = 4
9 changes: 5 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/extract-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { run, runPiped } from './run.js';
async function extractCache(cacheSource: string, cacheOptions: CacheOptions, scratchDir: string) {
// Prepare Timestamp for Layer Cache Busting
const date = new Date().toISOString();

await fs.mkdir(scratchDir, { recursive: true });
await fs.writeFile(path.join(scratchDir, 'buildstamp'), date);

Expand Down Expand Up @@ -42,7 +42,7 @@ RUN --mount=${mountArgs} \
);

// Move Cache into Its Place
await fs.rm(cacheSource, { recursive: true, force: true });
await run('sudo', ['rm', '-rf', cacheSource]);
await fs.rename(path.join(scratchDir, 'dance-cache'), cacheSource);
}

Expand Down

0 comments on commit 5b6db76

Please sign in to comment.