Skip to content

Commit 62ffa2d

Browse files
committed
Fix vault auth
1 parent 22951f7 commit 62ffa2d

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

config/ci/montagu.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ vault:
1212
## a list, which is currently
1313
##
1414
## azure, github, gcp, kubernetes, ldap, mfa, okta
15-
method: github
15+
method: token
1616

1717
## Prefix for container names; we'll use {container_prefix}-(container_name)
1818
container_prefix: montagu

tests/test_integration.py

+9-22
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,20 @@ def test_task_queue():
5555
cfg = MontaguConfig(path)
5656
try:
5757
youtrack_token = os.environ["YOUTRACK_TOKEN"]
58-
os.environ["VAULT_AUTH_GITHUB_TOKEN"] = os.environ["VAULT_TOKEN"]
59-
with vault_dev.server() as s:
58+
with vault_dev.Server(export_token=True) as s:
6059
cl = s.client()
61-
enable_github_login(cl)
6260
cl.write("secret/youtrack/token", value=youtrack_token)
6361
vault_addr = f"http://localhost:{s.port}"
6462

6563
orderly_web.start(orderly_config_path)
66-
cli.main(["start", path, f"--option=vault.addr={vault_addr}"])
64+
cli.main(
65+
[
66+
"start",
67+
path,
68+
f"--option=vault.addr={vault_addr}",
69+
f"--option=vault.auth.args.token={s.token}",
70+
]
71+
)
6772

6873
# wait for API to be ready
6974
http_get("https://localhost/api/v1")
@@ -101,21 +106,3 @@ def add_task_queue_user(cfg, orderly_config_path):
101106
orderly_web.admin.grant(
102107
orderly_config_path, "[email protected]", ["*/reports.run", "*/reports.review", "*/reports.read"]
103108
)
104-
105-
106-
def enable_github_login(cl, path="github"):
107-
cl.sys.enable_auth_method(method_type="github", path=path)
108-
policy = """
109-
path "secret/*" {
110-
capabilities = ["read", "list"]
111-
}
112-
"""
113-
114-
cl.sys.create_or_update_policy(
115-
name="secret-reader",
116-
policy=policy,
117-
)
118-
119-
cl.auth.github.map_team(team_name="robots", policies=["secret-reader"], mount_point=path)
120-
121-
cl.auth.github.configure(organization="vimc", mount_point=path)

0 commit comments

Comments
 (0)