Skip to content

Align CI's dummy env var names with what the collectors actually read - #37

Merged
OkiriGabriel merged 2 commits into
open-devops-agent:mainfrom
Nitjsefnie-OSC:fix/13-align-ci-env-var-names
Aug 2, 2026
Merged

OkiriGabriel merged 2 commits into
open-devops-agent:mainfrom
Nitjsefnie-OSC:fix/13-align-ci-env-var-names

Conversation

@Nitjsefnie

Copy link
Copy Markdown
Contributor

Bug Description / Summary

CI's throwaway .env sets variable names the collectors do not read, so the collector smoke steps
were passing while exercising nothing.

Fixes #13.

Your rename table was right on all four pairs, and there were two more it did not list:

CI set code reads source
JENKINS_USER JENKINS_USERNAME collectors/jenkins.py:17
ARGOCD_SERVER ARGOCD_SERVER_URL collectors/argocd.py:22
ARGOCD_TOKEN ARGOCD_AUTH_TOKEN collectors/argocd.py:23
AZURE_DEVOPS_TOKEN AZURE_DEVOPS_PAT collectors/azure_devops.py:17
JENKINS_TOKEN JENKINS_API_TOKEN collectors/jenkins.py:18
BAMBOO_TOKEN BAMBOO_USERNAME + BAMBOO_PASSWORD collectors/bamboo.py:17-18

BAMBOO_TOKEN is not a rename — that name exists nowhere in the codebase, so it becomes the two keys
Bamboo actually reads. The ArgoCD pair also recurs as os.environ assignments in the
test-collectors job, which the issue does not mention.

Also worth flagging: the issue asks to compare against CREDENTIAL_KEYS, which does not exist. The
constant is ORG_CREDENTIAL_KEYS (services/org_config.py:20).

What changed

  • .github/workflows/ci.yml — six renames (the .env heredoc plus the test-collectors
    os.environ pair), 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 in
    all three requirements files and only present transitively, so adding it for a test felt wrong.
  • .env.example — one line documenting SLACK_BOT_TOKEN.

Testing

pytest tests/ -q: 1 failed, 147 passed, 2 skipped, against a 1 failed, 145 passed, 2 skipped
baseline — 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 of
main: requirements.txt:15 pins mcp[cli]>=1.9.0 unbounded, and mcp 2.0.0 (PyPI, 2026-07-28)
removed mcp.server.fastmcp which devops_mcp/registry.py:10 imports. Your last green run on main
predates that release. Filed separately as #34. I did not fix, skip or pin around it.

Bite, with the workflow and .env.example reverted to main:

AssertionError: ... ['ARGOCD_SERVER', 'ARGOCD_TOKEN', 'AZURE_DEVOPS_TOKEN', 'BAMBOO_TOKEN', 'JENKINS_TOKEN', 'JENKINS_USER']
AssertionError: .env.example does not mention these ORG_CREDENTIAL_KEYS: ['SLACK_BOT_TOKEN']

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, and main's two step bodies pass
unmodified — which is the proof they were vacuous before.

black --check . was not run repo-wide (it would rewrite 67 unrelated files); the new test file
passes 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

  • The test is deliberately narrow, and here is exactly how. It scrapes KEY= lines from the
    .env heredoc and os.environ[...] = assignments. It will not catch a stale name introduced via a
    GitHub Actions env: mapping, os.environ.setdefault, an echo >> .env, or an export inside the
    heredoc. Widening it means either a YAML dependency or a much bigger parser, so I stopped where the
    issue's own acceptance criteria stop.
  • TESTING is whitelisted and nothing reads it. It is set at ci.yml:92 and :303 and consumed
    by 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_TOKEN is documented as optional, not required, because nothing usefully consumes it:
    SlackNotifier._bot_token (tools/notify.py:29-30) has zero callers and send_message posts via
    SLACK_WEBHOOK_URL. It is an ORG_CREDENTIAL_KEYS entry that OrgConfig.save will persist, which
    is why it needs documenting at all.
  • Criterion 3 is met in spirit rather than to the letter: both smoke steps set their own variables
    inline, so the variables can never actually be missing — what the assertions catch is name drift,
    which is the useful property.
  • Out of scope, noticed while working: docs/GETTING_STARTED.md:381-382 still documents
    JENKINS_USER/JENKINS_TOKEN.

Generated by Claude Opus 5 (1M context) (brief, implementation, review), Kimi K3 (implementation, verification)

@OkiriGabriel

Copy link
Copy Markdown
Collaborator

CI failure summary

CI is failing on Test Agent with Dummy Data (Python 3.10, 3.11, 3.12). All other checks pass ✅

Failing test:

tests/test_mcp.py::test_register_agent_tools_registers_all_tools
AttributeError: module 'devops_mcp' has no attribute 'registry'

Likely cause: This looks like a pre-existing issue on main, not caused by this PR's CI env var changes. The same failure appears on #35 and #36.

Suggested fix (for maintainers / follow-up PR):

  • Import the registry submodule before patching, e.g. import devops_mcp.registry # noqa: F401 at the top of tests/test_mcp.py, or
  • Patch via patch("devops_mcp.registry.register_agent_tools") after a direct import

This PR's scope: The CI env alignment changes themselves look unrelated to the MCP test failure. Once the MCP test is fixed on main, rebasing this branch should go green.

Run link: https://github.com/open-devops-agent/open-devops-agent/actions/runs/30650521541

@OkiriGabriel

Copy link
Copy Markdown
Collaborator

CI fix merged to main in #38 (pinned MCP SDK to <2.0.0 and fixed tests/test_mcp.py). Please rebase onto latest main — your PR checks should go green now.

@OkiriGabriel

Copy link
Copy Markdown
Collaborator

Rebase needed — no code fixes required

The CI failure on this PR was caused by a pre-existing issue on main, not your changes. That is now fixed and merged (#38).

Your PR code looks good. To get CI green, update your branch with latest main:

git fetch origin
git checkout {"headRefName":"fix/13-align-ci-env-var-names"}
git rebase origin/main
git push --force-with-lease

Or 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!

Nitjsefnie and others added 2 commits August 2, 2026 10:38
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]>
@Nitjsefnie
Nitjsefnie force-pushed the fix/13-align-ci-env-var-names branch from 5c1b59f to 8e99f07 Compare August 2, 2026 08:42
@Nitjsefnie

Copy link
Copy Markdown
Contributor Author

Rebased onto main with #38 in — new head 8e99f07, no conflicts (#38 did not touch ci.yml).

148 passed, 2 skipped locally on 3.12 — the 146 baseline plus this PR's two test_ci_env_alignment.py tests, run against the .env this branch's own ci.yml writes, i.e. with the renamed collector variables.

@OkiriGabriel
OkiriGabriel merged commit ace3dc2 into open-devops-agent:main Aug 2, 2026
10 checks passed
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.

Fix CI environment variable name mismatches with application code

2 participants