Skip to content

Commit f3ab76d

Browse files
authored
feat: support both github and gitlab logins to internal futo auth service (#1676)
1 parent 398857f commit f3ab76d

21 files changed

Lines changed: 992 additions & 194 deletions

File tree

.mise/config.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[tools]
2+
deno = "2.8.3"
23
flux2 = "2.8.7"
34
go = "1.26.3"
45
"go:github.com/cloudnative-pg/cloudnative-pg/cmd/kubectl-cnpg" = "1.29.1"
@@ -14,9 +15,14 @@ yamlfmt = "0.21.0"
1415

1516
[env]
1617
KUBECONFIG = "{{config_root}}/.mise/kube.config"
18+
# Pin op CLI resolution to the immich account so `op run`/`op inject` aren't
19+
# ambiguous when other 1Password accounts are also signed in. All op:// refs in
20+
# this repo live in the immich account; the FUTO account is reached via service
21+
# tokens at the provider level, not the op CLI.
22+
OP_ACCOUNT = "immich.1password.com"
1723

1824
[tasks.tg]
19-
run = "op run '--env-file={{config_root}}/tf/deployment/.env' -- env -u OP_CONNECT_HOST -u OP_CONNECT_TOKEN -u OP_SERVICE_ACCOUNT_TOKEN -- terragrunt"
25+
run = "op run '--env-file={{config_root}}/tf/deployment/.env' -- env -u OP_CONNECT_HOST -u OP_CONNECT_TOKEN -u OP_SERVICE_ACCOUNT_TOKEN -u OP_ACCOUNT -- terragrunt"
2026
description = "Wrapper for terragrunt, op run resolves secrets then env -u strips op auth vars so they don't conflict with terraform providers"
2127
dir = "{{cwd}}"
2228

services/outline-role-sync/src/zitadel.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,24 @@ export class ZitadelClient {
5454
}
5555

5656
async getUserGrants(userId: string, projectId: string): Promise<string[]> {
57+
// The per-user path (/users/{userId}/grants/_search) 405s; the grants search
58+
// lives at /users/grants/_search filtered by user, then narrowed to the
59+
// project client-side.
5760
const result = await this.request<{ result?: ZitadelUserGrant[] }>(
5861
"POST",
59-
`/management/v1/users/${userId}/grants/_search`,
62+
`/management/v1/users/grants/_search`,
6063
{
6164
queries: [
6265
{
63-
projectIdQuery: {
64-
projectId,
66+
userIdQuery: {
67+
userId,
6568
},
6669
},
6770
],
6871
},
6972
);
7073

71-
const grants = result.result ?? [];
74+
const grants = (result.result ?? []).filter((grant) => grant.projectId === projectId);
7275
return grants.flatMap((grant) => grant.roleKeys);
7376
}
7477
}

services/zitadel-actions/deno.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"tasks": {
3+
"test": "deno test",
4+
"check": "deno check src/index.ts test/index.test.ts",
5+
"build": "deno run --allow-read --allow-net --allow-env scripts/build.ts"
6+
},
7+
"compilerOptions": {
8+
"strict": true
9+
}
10+
}

services/zitadel-actions/deno.lock

Lines changed: 67 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Transpiles the TypeScript worker (src/index.ts) to JavaScript for terraform's
2+
// content_base64 — Cloudflare runs JS, the source is TS. Invoked by the
3+
// data.external in actions-v2.tf, so it must print ONLY a JSON object with the
4+
// JS string on stdout (deno's own download/progress noise goes to stderr).
5+
import { transpile } from "jsr:@deno/emit";
6+
7+
const entry = new URL("../src/index.ts", import.meta.url);
8+
const result = await transpile(entry);
9+
const js = result.get(entry.href);
10+
11+
if (!js) {
12+
console.error(`transpile produced no output for ${entry.href}`);
13+
Deno.exit(1);
14+
}
15+
16+
console.log(JSON.stringify({ js }));

0 commit comments

Comments
 (0)