diff --git a/src/lib/assets/pods.ts b/src/lib/assets/pods.ts index 83628228a..2f3927bab 100644 --- a/src/lib/assets/pods.ts +++ b/src/lib/assets/pods.ts @@ -17,18 +17,23 @@ export const namespace: kind.Namespace = { export function watcher(assets: Assets, hash: string) { const { name, image, capabilities, config } = assets; + let hasSchedule = false; + // Append the watcher suffix const app = `${name}-watcher`; const bindings: Binding[] = []; // Loop through the capabilities and find any Watch Actions for (const capability of capabilities) { + if (capability.hasSchedule) { + hasSchedule = true; + } const watchers = capability.bindings.filter(binding => binding.isWatch); bindings.push(...watchers); } // If there are no watchers, don't deploy the watcher - if (bindings.length < 1) { + if (bindings.length < 1 && !hasSchedule) { return null; } diff --git a/src/lib/capability.ts b/src/lib/capability.ts index 9d8a80324..6011ad5e0 100644 --- a/src/lib/capability.ts +++ b/src/lib/capability.ts @@ -48,10 +48,10 @@ export class Capability implements CapabilityExport { */ OnSchedule: (schedule: Schedule) => void = (schedule: Schedule) => { const { name, every, unit, run, startTime, completions } = schedule; + this.hasSchedule = true; if (process.env.PEPR_WATCH_MODE === "true") { // Only create/watch schedule store if necessary - this.hasSchedule = true; // Create a new schedule const newSchedule: Schedule = {