Sync Cloud Scheduler from runtime target#104
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc1b7af3d7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| current_schedule="$(gcloud scheduler jobs describe "${candidate_job}" \ | ||
| --project="${GCP_PROJECT_ID}" \ | ||
| --location="${scheduler_location}" \ | ||
| --format='value(schedule)' 2>/dev/null || true)" |
There was a problem hiding this comment.
Don't hide scheduler describe failures
In contexts where gcloud scheduler jobs describe fails for something other than an absent candidate job, such as missing cloudscheduler.jobs.get permission or a disabled Scheduler API, the 2>/dev/null || true here turns that failure into an empty current_schedule; the workflow then logs that the job was not found and succeeds without syncing any schedules. Since the gcloud docs define this command as showing job details, preserve the status/stderr and only continue on a confirmed NOT_FOUND.
Useful? React with 👍 / 👎.
|
|
||
| current_fields = os.environ["CURRENT_SCHEDULE"].split() | ||
| time_fields = os.environ["SCHEDULE_TIME"].split() | ||
| if len(current_fields) != 5: |
There was a problem hiding this comment.
Allow full cron overrides without parsing current schedule
When an existing job uses Cloud Scheduler's supported human-readable groc schedule format, current_fields is not five tokens; this check runs before the code handles a full five-field SCHEDULE_TIME, so a runtime target that supplies a complete cron expression still fails instead of replacing the old schedule. Only validate current_fields in the two-field merge branch.
Useful? React with 👍 / 👎.
Summary
Tests