Skip to content

fix: clear error when triggering job on undeployed scheduled task#203

Merged
fedemaleh merged 4 commits into
betafrom
fix/scheduled-task-trigger-not-deployed
Jul 17, 2026
Merged

fix: clear error when triggering job on undeployed scheduled task#203
fedemaleh merged 4 commits into
betafrom
fix/scheduled-task-trigger-not-deployed

Conversation

@fedemaleh

Copy link
Copy Markdown
Collaborator

Summary

Dedicated PR for the scheduled-task trigger fix, split out from #202 (which also carries the unrelated kill-job-execution work). No overlap with that work — this touches only trigger files.

Triggering the Trigger job action on a scope with no active deployment previously produced an opaque error: with no deployment there is no CronJob, so the script ran kubectl create job --from="cronjob/" (no name) and surfaced a cryptic kubectl failure.

Changes

  • Guard on .scope.current_active_deployment — if empty/null, fail early (before any kubectl call) with a clear "deploy the scope first" message. Also guards the empty-CronJob case with its own actionable message.
  • set -euo pipefail added (was missing), aligning with the repo's scope-script conventions.
  • log function via workflow steptrigger-job.yaml now has a load logging step importing $OVERRIDES_PATH/logging (a scheduled-task copy of k8s/logging); the script assumes log exists rather than sourcing it, matching restart-pods.yaml.
  • include: $SERVICE_PATH/values.yaml in trigger-job.yaml so K8S_NAMESPACE (and LOG_LEVEL) are provided, plus a script-level ${K8S_NAMESPACE:-nullplatform} guard as defense-in-depth (the missing include caused an unbound variable crash under set -u).

Test plan

New scheduled_task/scope/tests/trigger.bats — 10/10 passing:

  • Happy path; no active deployment (key absent + null); no CronJob found
  • Namespace resolution (provider namespace / default / K8S_NAMESPACE unset / nullplatform fallback)
  • Workflow-wiring checks: values.yaml include present, load logging step present
bats scheduled_task/scope/tests/trigger.bats
1..10  ok 1..10

@fedemaleh
fedemaleh merged commit 01b32d6 into beta Jul 17, 2026
3 checks passed
@fedemaleh
fedemaleh deleted the fix/scheduled-task-trigger-not-deployed branch July 17, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants