Don't try to push store paths that were GCed

Previously we'd only push unique paths before/after the job,
but that's not good enough because someone might run garbage
collection.

Now we only push unique store paths that are in the list of
when the job finished.
This commit is contained in:
Domen Kožar 2020-05-12 10:13:15 +02:00
commit 13e2cf25a1
No known key found for this signature in database
GPG key ID: C2FFBCAFD2C24246
3 changed files with 8 additions and 2 deletions

3
dist/main/index.js vendored
View file

@ -971,6 +971,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const child_process_1 = __webpack_require__(129);
const coreCommand = __importStar(__webpack_require__(431));
const exec = __importStar(__webpack_require__(986));
exports.IsPost = !!process.env['STATE_isPost'];
@ -1010,7 +1011,7 @@ function upload() {
try {
if (signingKey !== "" && skipPush !== 'true') {
core.startGroup('Cachix: pushing paths');
yield exec.exec("sh", ["-c", `nix path-info --all | grep -v '\.drv$' | cat - /tmp/store-path-pre-build | sort | uniq -u | ${cachixExecutable} push ${name}`]);
child_process_1.execFileSync(`${__dirname}/push-paths.sh`, { stdio: 'inherit' });
core.endGroup();
}
}

4
dist/main/push-paths.sh vendored Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
comm -13 <(sort /tmp/store-path-pre-build) <(nix path-info --all | grep -v '\.drv$') | $1 push $2