Fix bootstrap auth

This commit is contained in:
Fang-Pen Lin
2025-11-07 17:09:29 -08:00
parent 3b5046eadd
commit c4b759b6a8
2 changed files with 12 additions and 2 deletions

1
.gitignore vendored
View File

@@ -71,5 +71,6 @@ frontend-build
cli/infisical-merge cli/infisical-merge
cli/test/infisical-merge cli/test/infisical-merge
/backend/binary /backend/binary
backend/bdd/.bdd-infisical-bootstrap-result.json
/npm/bin /npm/bin

View File

@@ -21,7 +21,7 @@ BOOTSTRAP_INFISICAL = int(os.environ.get("BOOTSTRAP_INFISICAL", 0))
# Called mostly from a CI to setup the new Infisical instance to get it ready for BDD tests # Called mostly from a CI to setup the new Infisical instance to get it ready for BDD tests
def bootstrap_infisical(context: Context): def bootstrap_infisical(context: Context):
bootstrap_result_file = pathlib.Path.cwd() / ".bootstrap-result.json" bootstrap_result_file = pathlib.Path.cwd() / ".bdd-infisical-bootstrap-result.json"
if bootstrap_result_file.exists(): if bootstrap_result_file.exists():
logger.info( logger.info(
"Bootstrap result file exists at %s, loading it now", bootstrap_result_file "Bootstrap result file exists at %s, loading it now", bootstrap_result_file
@@ -45,6 +45,15 @@ def bootstrap_infisical(context: Context):
user = body["user"] user = body["user"]
temp_token = body["token"] temp_token = body["token"]
resp = client.post(
"/api/v3/auth/select-organization",
headers={"Authorization": f"Bearer {temp_token}"},
json={"organizationId": org["id"]},
)
resp.raise_for_status()
body = resp.json()
temp_token = body["token"]
resp = client.post( resp = client.post(
"/api/v1/auth/token", "/api/v1/auth/token",
headers={"Authorization": f"Bearer {temp_token}"}, headers={"Authorization": f"Bearer {temp_token}"},
@@ -96,7 +105,7 @@ def bootstrap_infisical(context: Context):
) )
resp.raise_for_status() resp.raise_for_status()
body = resp.json() body = resp.json()
ca = body["certificateAuthorities"] ca = body
cert_template_slug = faker.slug() cert_template_slug = faker.slug()
resp = client.post( resp = client.post(