Kill GnuPG agent at POST step

This commit is contained in:
CrazyMax 2020-05-06 00:23:29 +02:00
parent 7f1aa5edc1
commit 3ff0e7f81d
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
5 changed files with 19 additions and 1 deletions

View file

@ -18,7 +18,7 @@ If you are interested, [check out](https://git.io/Je09Y) my other :octocat: GitH
* Allow to seed the internal cache of `gpg-agent` with provided passphrase
* Enable signing for Git commits and tags
* Configure and check committer info against GPG key
* Purge imported GPG key and cache information from runner
* Purge imported GPG key, cache information and kill agent from runner
## Usage

View file

@ -180,4 +180,10 @@ describe('gpg', () => {
await gpg.deleteKey(userInfo.fingerprint);
});
});
describe('killAgent', () => {
it('kills GnuPG agent', async () => {
await gpg.killAgent();
});
});
});

5
dist/index.js generated vendored
View file

@ -1092,6 +1092,8 @@ function cleanup() {
core.info('🚿 Removing keys');
const privateKey = yield openpgp.readPrivateKey(process.env.SIGNING_KEY);
yield gpg.deleteKey(privateKey.fingerprint);
core.info('💀 Killing GnuPG agent');
yield gpg.killAgent();
}
catch (error) {
core.warning(error.message);
@ -1274,6 +1276,9 @@ exports.deleteKey = (fingerprint) => __awaiter(void 0, void 0, void 0, function*
}
});
});
exports.killAgent = () => __awaiter(void 0, void 0, void 0, function* () {
yield gpgConnectAgent('KILLAGENT');
});
/***/ }),

View file

@ -163,3 +163,7 @@ export const deleteKey = async (fingerprint: string): Promise<void> => {
}
});
};
export const killAgent = async (): Promise<void> => {
await gpgConnectAgent('KILLAGENT');
};

View file

@ -87,6 +87,9 @@ async function cleanup(): Promise<void> {
core.info('🚿 Removing keys');
const privateKey = await openpgp.readPrivateKey(process.env.SIGNING_KEY);
await gpg.deleteKey(privateKey.fingerprint);
core.info('💀 Killing GnuPG agent');
await gpg.killAgent();
} catch (error) {
core.warning(error.message);
}