Skip to content

Thomasht86/set access rule before deployment#1228

Merged
thomasht86 merged 6 commits intomasterfrom
thomasht86/set-access-rule-before-deployment
Feb 12, 2026
Merged

Thomasht86/set access rule before deployment#1228
thomasht86 merged 6 commits intomasterfrom
thomasht86/set-access-rule-before-deployment

Conversation

@thomasht86
Copy link
Collaborator

When services.xml references secrets from vaults, automatically ensure the application has SANDBOX access before deploying to dev, saving users from manual console configuration.

Changes:

  • Add vault access rule logic to VespaCloud (uses csrf token if auth token, not if ap-key for auth)
  • Add secrets tag to services.py configuration DSL
  • Add skipped integration test for manual cloud verification (must be run with interactive login to work).

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

To test:

  1. uv sync --extra dev
  2. Comment out the unittest.skip annotation of TestDeployAddsVaultAccessCloud in test_integration_vespa_cloud.py
  3. uv run python -m pytest tests/integration/test_integration_vespa_cloud.py::TestDeployAddsVaultAccessCloud -v -s

thomasht86 and others added 6 commits February 12, 2026 09:04
When services.xml references secrets from vaults, automatically ensure
the application has SANDBOX access before deploying to dev, saving users
from manual console configuration.

Changes:
- Add vault access rule logic to VespaCloud (CSRF-aware, with verification)
- Add `secrets` tag to services.py configuration DSL
- Replace debug print() with logging.info() for vault diagnostics
- Narrow exception handling to specific types for better error surfacing
- Clean up unit tests: remove low-value tests, simplify assertions
- Add skipped integration test for manual cloud verification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add auth method check in _ensure_vault_access_rule: raise ValueError
  with actionable message when API key auth is used and rule is missing,
  since API keys lack the administrator role needed for vault modifications
- Remove ValueError from except clause in _ensure_vault_access_for_dev
  so the auth error propagates up and stops the deployment
- Refactor _get_csrf_token to try/except instead of auth method check
- Replace debug print() calls with logging.info()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- test_ensure_vault_access_rule_api_key_raises: verify ValueError is
  raised with instructional message when auth is api_key and rule is
  missing, and no PUT is attempted
- test_ensure_vault_access_for_dev_api_key_raises: verify ValueError
  propagates up (not caught as warning)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
API key auth cannot set vault access rules (lacks administrator role).
This test requires interactive (Auth0) login. Skip by default with
instructions to comment out @unittest.skip to run manually.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@thomasht86 thomasht86 requested a review from bjorncs February 12, 2026 10:47
@thomasht86 thomasht86 merged commit e6dd40f into master Feb 12, 2026
35 checks passed
@thomasht86 thomasht86 deleted the thomasht86/set-access-rule-before-deployment branch February 12, 2026 11:37
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.

2 participants