Skip to content

Commit 6a1111a

Browse files
authored
Add flex oidc support (#20324)
1 parent 1c2d64c commit 6a1111a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,5 +341,5 @@ ENV PRE_COMMIT_HOME=/workspace/.pre-commit
341341

342342
# Setting the environment variable here so that it will be accessible to all tasks and
343343
# terminal sessions in Gitpod workspaces.
344-
ENV PREVIEW_ENV_DEV_SA_KEY_PATH=
344+
ENV PREVIEW_ENV_DEV_SA_KEY_PATH=/root/.config/gcloud/sa.json
345345
ENV GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES=1

dev/next-oidc/oidc.js dev/flex-oidc/oidc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ const getIDToken = async () => {
88
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
99

1010
const controlPlaneApiEndpoint = config.controlPlaneApiEndpoint;
11-
const workspaceToken = config.workspaceToken;
11+
const environmentToken = config.environmentToken;
1212

1313
const url = new URL(controlPlaneApiEndpoint);
1414
const client = http2.connect(url.origin);
1515

1616
const req = client.request({
1717
":method": "POST",
1818
"content-type": "application/json",
19-
authorization: `Bearer ${workspaceToken}`,
19+
authorization: `Bearer ${environmentToken}`,
2020
":path": `${url.pathname}/gitpod.v1.IdentityService/GetIDToken`,
2121
});
2222

dev/preview/workflow/preview/configure-workspace.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ fi
2020

2121
if [ -f "/usr/local/gitpod/config/initial-spec.json" ]; then
2222
gcloud iam workload-identity-pools create-cred-config \
23-
projects/184212049955/locations/global/workloadIdentityPools/gitpod-next/providers/gitpod-next-provider \
23+
projects/184212049955/locations/global/workloadIdentityPools/gitpod-flex/providers/gitpod-flex-provider \
2424
--service-account=preview-environmnet-dev@gitpod-dev-preview.iam.gserviceaccount.com \
2525
--service-account-token-lifetime-seconds=1h \
2626
--output-file="${PREVIEW_ENV_DEV_SA_KEY_PATH}" \
27-
--executable-command='node /workspace/gitpod/dev/next-oidc/oidc.js' \
27+
--executable-command='node /workspace/gitpod/dev/flex-oidc/oidc.js' \
2828
--executable-timeout-millis=5000
2929
elif [[ -n "${PREVIEW_ENV_DEV_CRED:-}" ]]; then
3030
echo "${PREVIEW_ENV_DEV_CRED}" >"${PREVIEW_ENV_DEV_SA_KEY_PATH}"

0 commit comments

Comments
 (0)