Repository navigation
♻️ The Rulekeeper - Index from one workflow that starts the Azure job - #2800
Conversation
Index Rules for The Rulekeeper now starts the Container Apps index job, and passes --reembed and --allow-removals to it when they are ticked. Re-index Rules for The Rulekeeper did the same without the options, and the old Index Rules ran the indexer on a GitHub runner as the SQL administrator. Both are gone.
Only the GitHub runner index workflow used the pipeline's Cognitive Services OpenAI User role on Foundry, and that workflow is gone.
The workflow returned as soon as Azure accepted the run, so a failed re-embed still showed green. It now waits for the execution and fails on Failed, Stopped or Degraded. A wait can outlast the Azure CLI's login, so it logs in again with a new GitHub token when reading the status fails.
One failed status read after logging in again ended the step, even while the Azure run went on. The wait now logs in again and tries on the next tick, and fails only after three failed reads in a row. The workflow job is named Index Rules, since it now waits for the run too.
bradystroud
left a comment
There was a problem hiding this comment.
The single workflow is a good simplification. Two things need attention before merge.
Blocking
1. The retry logic does not match the description.
The description says the wait step "fails only after three failed reads in a row" and that a counter was tested. No pushed commit (a6cbeb4, 7132d62, f47e32b) has a counter. The step runs as bash -eo pipefail (because of shell: bash). After one failed read it logs in again and reads once more with STATUS=$(status) at line 113. If that read also fails, set -e stops the step. One short ARM error after the new login fails the workflow while the job keeps running. Please push the counter, or correct the description if one retry is the intent.
2. The staging test runs have not happened.
The description asks for two staging runs before merge, and no rules-chat-index.yml run exists on ap/rulekeeper-one-index-workflow. The az rest .../start call sends the job's full containers object back, possibly with fields such as probes or volumeMounts. That is the part most likely to fail, and only these runs will show it. Please link the two green runs here.
Non-blocking
- A run that gives up on the lock still ends Succeeded, so the workflow shows green with nothing indexed. This is most likely during a re-embed, when someone is watching the result. A follow-up could make the script exit with a non-zero code in that case.
- This PR deletes the runner workflow, which was the fallback when the job image itself is broken. That is probably OK, but the team should agree to it.
- After merge, remember to delete the pipeline's old OpenAI User role assignment on
aif-sswrules-chat-stagingandaif-sswrules-chat-prod.
Checked and OK
REEMBEDandALLOW_REMOVALSgo throughenv:, not${{ }}inrun:.run.shforwards"$@", so the containerargsreachindex-rules.mjs.- The new login uses the
ACTIONS_ID_TOKEN_REQUEST_*variables thatid-token: writemakes available. - Nothing else uses the pipeline's Foundry role, and
servicePrincipalObjectIdis still used for AcrPush.
The start request copied the job's whole container. The job carries fields newer than the request's API version, such as imageType, which Azure may reject. The request now sends the container's name, image, settings and resources, plus the arguments.
|
Thanks, Brady.
|
bradystroud
left a comment
There was a problem hiding this comment.
Thanks, Anton. Both blocking points are resolved.
- Retry counter:
6846fafadds it, and it works underbash -eo pipefail. The$((…))increment does not tripset -e, and each command inlogin_againhas its own|| return 1, becauseset -edoes not apply inside theif. - Staging runs after merge: OK. If this workflow is broken, the hourly job is not affected, and Run now in the portal still works. Sending only
name,image,env,resourcesandargs(6d452c6) also removes the main risk I saw.
After merge, please:
- Post the links to the two staging runs (
allow_removals=trueandreembed=true) here. - Delete the pipeline's old OpenAI User role assignment on
aif-sswrules-chat-stagingandaif-sswrules-chat-prod.
#2809 tracks the lock-timeout case.
Description
✏️
We had two workflows for indexing. "Re-index Rules for The Rulekeeper" started the Azure index job. "Index Rules for The Rulekeeper" ran the indexer on a GitHub runner, signed in as the SQL administrator, and had the re-embed and removal options. The job can take those options itself, so one workflow is enough.
--reembedor--allow-removalsto the job.rules-chat-reindex-trigger.yml.az containerapp job start --argssends a container with only the arguments. So the workflow copies the job's own container and adds the arguments. It copies only the name, image, settings and resources, because the job also carries fields newer than the request's API version, such asimageType.infra/README.mdand the lock comments.A run that waits 30 minutes for the index lock and gives up still ends Succeeded, so the workflow shows green even though nothing was indexed. I left the index script as it is in this PR and opened #2809 for it.
After merging, someone needs to delete the pipeline's existing role assignment on
aif-sswrules-chat-stagingandaif-sswrules-chat-prod. The deploy leaves role assignments it no longer declares in place.Screenshot (optional)
✏️
Not applicable. This change has no UI.
Validation
actionlintandaz bicep buildpassed, including on the wait step.pnpm lintpassed.gh workflow run rules-chat-index.yml -f environment=staging -f allow_removals=truetakes a few minutes and covers starting the run with arguments.gh workflow run rules-chat-index.yml -f environment=staging -f reembed=truere-embeds every rule, so it runs long enough to need the second login. It also pays to embed every rule again.