Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
A separate console host and image, tacticus-planner-jobs, that runs one named batch job per execution and exits. The only job is `smoke`, which proves the image, the jobs connection string and the private network path. The runner refuses to run while migrations are pending and reports the outcome as its exit code. CD Stage and CD Prod publish the image beside the API image and point the Container Apps Job at it once the API revision is healthy; until the infra has created the job and granted access, that step is skipped with a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RikpRHXQe5CFoQVZgczdDm
5bc36dd to
ba54846
Compare
…d-lm5368-jobs # Conflicts: # openspec/changes/add-background-jobs/proposal.md
| catch (Exception exception) | ||
| { | ||
| LogFailed(logger, exception, name); | ||
| return Failed; | ||
| } |
There was a problem hiding this comment.
Intentional. This is the process boundary of the batch host. Any exception a job throws must be logged, with the job name, to Application Insights and turned into exit code 1, which is what marks the Container Apps Job execution as failed. Letting it escape would crash the host without the structured log. Nothing is swallowed here: the job's own code still handles the specific exceptions it expects. Leaving it as is.
Generated by Claude Code
…d-lm5368-jobs # Conflicts: # openspec/changes/add-background-jobs/proposal.md
Code coverage overviewLanguages: C# C# / coverage/api
View coverage of the 6 most impacted files.
C# / coverage/game-catalog
C# / coverage/api-integration
View coverage of the 8 most impacted files.
C# / coverage/persistence
View coverage of the 4 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
Requested by Severyn · project thread
Part 3 of 3 of the background-jobs MVP. Stacked on #273: the diff here is only the jobs container. After #273 merges, this gets rebased onto
main. Infra: TacticusPlanner/tacticus-planner-infra#37.What
src/TacticusPlanner.Jobs: a generic-host console app (AddServiceDefaultsfor telemetry) built into its own image,tacticus-planner-jobs. It runs the job named by its first argument and exits.IBatchJobregistrations (JobRegistration.AddBatchJobs).0succeeded,1failed,2unknown job,3migrations pending.planner-db-jobs-connection-stringsecret (pool of 2). It has no column-encryption key, so a job that touches an encrypted column fails fast.smoke: logs the applied-migration and profile counts. It proves the image, the connection string and the private network path work.CMD ["smoke"]._publish-api.ymltakesrepositoryanddockerfileinputs (defaults stay the API), with a gha cache scope per image._deploy-api.ymltakes an optionaljobs-imageinput, checks it is an immutabletacticus-planner-jobs@sha256reference, and runsaz containerapp job update --imageonce the API revision is healthy. IfCONTAINER_APP_JOB_NAMEis unset, or the job is missing or not readable yet (ResourceNotFound/AuthorizationFailed), the step is skipped with a warning and a summary note, so CD stays green before the infra steps below._build-api.ymlalso builds the jobs image whenarea:dockeris set; plus a labelerarea:jobslabel and a Dependabot docker entry in thedotnet-sdkgroup.tests/TacticusPlanner.Jobs.Tests: 5 runner cases with fakes, plus a Testcontainers test for unmigrated (exit 3) and migrated (exit 0) databases.Validation
TacticusPlanner.Jobs.Tests: 7/7 passed locally. Full suite left to CI.dotnet format --verify-no-changesclean;dotnet restore --locked-modeclean; Releasedotnet publishof the Jobs project OK.smokeagainst an unmigrated database exits 3.bash -n. I could not run actionlint ordocker buildhere: the sandbox proxy's CA isn't trusted inside Docker, and the API image fails the same way. CI's image build covers it.Rollout (after this merges and CD publishes the first jobs image)
deploy workload --env stg --action apply --image <api digest> --jobs-image <jobs digest>. This createscaj-tp-jobs-stg.access post --env stggrants the deploy identity access to the job. From then on, CD updates the job's image.az containerapp job start --name caj-tp-jobs-stg --resource-group rg-tp-stg, and check that the execution succeeded.--confirm prod.🤖 Generated with Claude Code
https://claude.ai/code/session_01RikpRHXQe5CFoQVZgczdDm