summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--model/job/index.ts15
-rw-r--r--worker/secret.ts2
2 files changed, 14 insertions, 3 deletions
diff --git a/model/job/index.ts b/model/job/index.ts
index b7fb3b0..473b61a 100644
--- a/model/job/index.ts
+++ b/model/job/index.ts
@@ -1,11 +1,22 @@
import { isObject } from '@emprespresso/pengueno';
export type JobArgT = Record<string, string>;
+export type JobType = 'fetch_code' | 'ci_pipeline' | 'build_docker_image.js' | 'ansible_playbook.js' | 'checkout_ci.js';
+export const JobTypes: Array<JobType> = [
+ 'fetch_code',
+ 'ci_pipeline',
+ 'build_docker_image.js',
+ 'ansible_playbook.js',
+ 'checkout_ci.js',
+];
export interface Job {
- readonly type: string;
+ readonly type: JobType;
readonly arguments: JobArgT;
}
+
+export const isJobType = (j: unknown): j is JobType => typeof j === 'string' && JobTypes.includes(<JobType>j);
+
export const isJob = (j: unknown): j is Job =>
- !!(isObject(j) && 'arguments' in j && isObject(j.arguments) && 'type' in j && typeof j.type === 'string' && j);
+ !!(isObject(j) && 'arguments' in j && isObject(j.arguments) && 'type' in j && isJobType(j.type) && j);
export * from './jobs.js';
diff --git a/worker/secret.ts b/worker/secret.ts
index e533b16..241823d 100644
--- a/worker/secret.ts
+++ b/worker/secret.ts
@@ -104,7 +104,7 @@ export class Bitwarden implements IVault<TClient, TKey, TItemId> {
.flatMap(TraceUtil.withMetricTrace(Bitwarden.lockVaultMetric))
.peek((tSession) => tSession.trace.trace(`taking care of locking the vault :3`))
.flatMap((tSession) =>
- tSession.move('bw lock').map((lockCmd) =>
+ tSession.move('bw lock && bw logout').map((lockCmd) =>
getStdout(lockCmd, {
env: { BW_SESSION: tSession.get() },
}),