Repository navigation
Align CI's dummy env var names with what the collectors actually read - #37
Conversation
CI failure summaryCI is failing on Test Agent with Dummy Data (Python 3.10, 3.11, 3.12). All other checks pass ✅ Failing test: Likely cause: This looks like a pre-existing issue on Suggested fix (for maintainers / follow-up PR):
This PR's scope: The CI env alignment changes themselves look unrelated to the MCP test failure. Once the MCP test is fixed on |
|
CI fix merged to |
Rebase needed — no code fixes requiredThe CI failure on this PR was caused by a pre-existing issue on Your PR code looks good. To get CI green, update your branch with latest git fetch origin
git checkout {"headRefName":"fix/13-align-ci-env-var-names"}
git rebase origin/main
git push --force-with-leaseOr use the Update branch button on this PR if GitHub offers it. After rebase, CI should pass and this will be ready to merge. Thanks for contributing! |
One of the CI workflow's throwaway .env heredocs and the ArgoCD smoke step set JENKINS_USER, JENKINS_TOKEN, BAMBOO_TOKEN, AZURE_DEVOPS_TOKEN, ARGOCD_SERVER and ARGOCD_TOKEN, but the collectors read JENKINS_USERNAME, JENKINS_API_TOKEN, BAMBOO_USERNAME/BAMBOO_PASSWORD, AZURE_DEVOPS_PAT, ARGOCD_SERVER_URL and ARGOCD_AUTH_TOKEN. Every collector falls back to os.getenv(..., ""), so the smoke jobs passed while validating nothing. Rename the five one-for-one keys to the names the code and .env.example already use, replace BAMBOO_TOKEN with the BAMBOO_USERNAME and BAMBOO_PASSWORD pair the Bamboo collector reads, and make the ArgoCD and GitLab smoke steps assert the collector actually picked the values up so a future rename fails CI instead of passing it. Also document SLACK_BOT_TOKEN in .env.example: it is an ORG_CREDENTIAL_KEYS entry (services/org_config.py) that OrgConfig.save will persist, but it appeared nowhere in the example file. Its only reader, SlackNotifier._bot_token in tools/notify.py, is currently unused — notifications post via SLACK_WEBHOOK_URL only — so it is listed as optional and left empty. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Co-Authored-By: Kimi K3 <[email protected]>
Adds tests/test_ci_env_alignment.py. One test scrapes every KEY= line in ci.yml's `cat > .env << EOF` blocks plus every os.environ[...] = ... assignment (reads and == comparisons are excluded, so a harmless os.environ['GITHUB_WORKSPACE'] read does not trip it) and asserts each assigned name is known — either an ORG_CREDENTIAL_KEYS entry, a key declared in .env.example, or the TESTING harness flag — so a drifting name is named in the failure instead of silently smoke-testing nothing. The other asserts every ORG_CREDENTIAL_KEYS entry is mentioned somewhere in .env.example, matched on a word boundary so keys documented in prose comments (AWS_ACCESS_KEY_ID, GOOGLE_APPLICATION_CREDENTIALS) count while ARGOCD_SERVER still does not match inside ARGOCD_SERVER_URL. Standard library only — no YAML dependency is added, since the shell heredoc inside the block scalar has to be text-scanned either way. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Co-Authored-By: Kimi K3 <[email protected]>
5c1b59f to
8e99f07
Compare
Bug Description / Summary
CI's throwaway
.envsets variable names the collectors do not read, so the collector smoke stepswere passing while exercising nothing.
Fixes #13.
Your rename table was right on all four pairs, and there were two more it did not list:
JENKINS_USERJENKINS_USERNAMEcollectors/jenkins.py:17ARGOCD_SERVERARGOCD_SERVER_URLcollectors/argocd.py:22ARGOCD_TOKENARGOCD_AUTH_TOKENcollectors/argocd.py:23AZURE_DEVOPS_TOKENAZURE_DEVOPS_PATcollectors/azure_devops.py:17JENKINS_TOKENJENKINS_API_TOKENcollectors/jenkins.py:18BAMBOO_TOKENBAMBOO_USERNAME+BAMBOO_PASSWORDcollectors/bamboo.py:17-18BAMBOO_TOKENis not a rename — that name exists nowhere in the codebase, so it becomes the two keysBamboo actually reads. The ArgoCD pair also recurs as
os.environassignments in thetest-collectorsjob, which the issue does not mention.Also worth flagging: the issue asks to compare against
CREDENTIAL_KEYS, which does not exist. Theconstant is
ORG_CREDENTIAL_KEYS(services/org_config.py:20).What changed
.github/workflows/ci.yml— six renames (the.envheredoc plus thetest-collectorsos.environpair), and real assertions in the ArgoCD and GitLab smoke steps.tests/test_ci_env_alignment.py— new, stdlib-only. No YAML dependency: PyYAML is undeclared inall three requirements files and only present transitively, so adding it for a test felt wrong.
.env.example— one line documentingSLACK_BOT_TOKEN.Testing
pytest tests/ -q:1 failed, 147 passed, 2 skipped, against a1 failed, 145 passed, 2 skippedbaseline — exactly +2, skips unchanged.
Please expect this PR's CI to be red, and not because of this change. That one failure is
tests/test_mcp.py::test_register_agent_tools_registers_all_tools, which fails on a clean checkout ofmain:requirements.txt:15pinsmcp[cli]>=1.9.0unbounded, and mcp 2.0.0 (PyPI, 2026-07-28)removed
mcp.server.fastmcpwhichdevops_mcp/registry.py:10imports. Your last green run onmainpredates that release. Filed separately as #34. I did not fix, skip or pin around it.
Bite, with the workflow and
.env.examplereverted tomain:Reverting a rename in either site alone still fails, so both are independently guarded. The smoke
assertions bite too: the ArgoCD step body run with the old names raises
AssertionError: ArgoCD collector did not read ARGOCD_SERVER_URL, andmain's two step bodies passunmodified — which is the proof they were vacuous before.
black --check .was not run repo-wide (it would rewrite 67 unrelated files); the new test filepasses it. flake8's CI selection is clean on project files.
Environment
Debian 13 (x86_64), Python 3.13.14. CI matrix is 3.10–3.12.
Follow-ups / Known Limitations
KEY=lines from the.envheredoc andos.environ[...] =assignments. It will not catch a stale name introduced via aGitHub Actions
env:mapping,os.environ.setdefault, anecho >> .env, or anexportinside theheredoc. Widening it means either a YAML dependency or a much bigger parser, so I stopped where the
issue's own acceptance criteria stop.
TESTINGis whitelisted and nothing reads it. It is set atci.yml:92and:303and consumedby no repo code. Whitelisting it is the honest minimum to make the test pass, but it is arguably the
same bug class this issue is about — say the word and I will chase it instead.
SLACK_BOT_TOKENis documented as optional, not required, because nothing usefully consumes it:SlackNotifier._bot_token(tools/notify.py:29-30) has zero callers andsend_messageposts viaSLACK_WEBHOOK_URL. It is anORG_CREDENTIAL_KEYSentry thatOrgConfig.savewill persist, whichis why it needs documenting at all.
inline, so the variables can never actually be missing — what the assertions catch is name drift,
which is the useful property.
docs/GETTING_STARTED.md:381-382still documentsJENKINS_USER/JENKINS_TOKEN.Generated by Claude Opus 5 (1M context) (brief, implementation, review), Kimi K3 (implementation, verification)