운영버킷 배포
Deploy EG-BIM QA Gateway / deploy (push) Failing after 12s

This commit is contained in:
root committed 2026-11-11 11:03:51 +09:00
1 parent 0d9b1fd703
commit 7c09c89da5
9 files changed
+202 -31

No files matched your search

+33 -5
View File
@@ -5,7 +5,12 @@ export const productionTarget = Object.freeze({
worker: 'baron-qa-gateway-prod',
config: 'wrangler.production.toml',
bucket: 'baron-qa-write',
origin: 'https://qa.baroncs.co.kr'
origin: 'https://qa.baroncs.co.kr',
apiOrigin: 'https://qa.brsw.kr',
projectId: '01a1c543-ab4f-744f-8eff-ab85f2644271',
channelId: '01a1c544-35ac-7674-9bf0-2469bfbe3e52',
authIssuer: 'https://app.brsw.kr/oidc',
orgContextApiUrl: 'https://app.brsw.kr/api/v1/integrations/org-context'
});
function required(env, name) {
@@ -23,6 +28,15 @@ function httpsBase(value, name) {
return url.origin;
}
function httpsIssuer(value) {
let url;
try { url = new URL(value); } catch { throw new Error('AUTH_ISSUER must be an HTTPS issuer URL'); }
if (url.protocol !== 'https:' || url.username || url.password || url.search || url.hash) {
throw new Error('AUTH_ISSUER must be an HTTPS issuer URL');
}
return url.origin + url.pathname.replace(/\/+$/, '');
}
export function productionSettings(env) {
// These names are mapped exclusively from PROD_* settings in the production workflow.
required(env, 'CLOUDFLARE_API_TOKEN');
@@ -34,20 +48,34 @@ export function productionSettings(env) {
};
if (secrets.SESSION_SECRET.length < 32) throw new Error('SESSION_SECRET must contain at least 32 characters');
if (required(env, 'ORG_CONTEXT_ENABLED') !== 'true') throw new Error('ORG_CONTEXT_ENABLED must be true for production');
const organization = deploymentOrgSettings(env);
const organization = deploymentOrgSettings({
...env, ORG_CONTEXT_API_URL: env.ORG_CONTEXT_API_URL || productionTarget.orgContextApiUrl
});
orgContextConfig({ ...organization.vars, ...secrets });
const issuer = httpsIssuer(env.AUTH_ISSUER || productionTarget.authIssuer);
const vars = {
...organization.vars,
AUTH_CLIENT_ID: required(env, 'AUTH_CLIENT_ID'),
ABC_API_BASE_URL: httpsBase(required(env, 'ABC_API_BASE_URL'), 'ABC_API_BASE_URL'),
ABC_PROJECT_ID: required(env, 'ABC_PROJECT_ID'),
ABC_CHANNEL_ID: required(env, 'ABC_CHANNEL_ID')
AUTH_AUTHORIZE_URL: issuer + '/oauth2/auth',
AUTH_TOKEN_URL: issuer + '/oauth2/token',
AUTH_USERINFO_URL: issuer + '/userinfo',
ABC_API_BASE_URL: httpsBase(env.ABC_API_BASE_URL || productionTarget.apiOrigin, 'ABC_API_BASE_URL'),
ABC_PROJECT_ID: String(env.ABC_PROJECT_ID || productionTarget.projectId).trim(),
ABC_CHANNEL_ID: String(env.ABC_CHANNEL_ID || productionTarget.channelId).trim()
};
const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
for (const name of ['ABC_PROJECT_ID', 'ABC_CHANNEL_ID']) {
if (!uuid.test(vars[name])) throw new Error(name + ' must be a UUID');
}
// Fail before uploads if a PROD_* variable points at staging or another channel.
for (const [name, expected] of Object.entries({
ABC_API_BASE_URL: productionTarget.apiOrigin,
ABC_PROJECT_ID: productionTarget.projectId,
ABC_CHANNEL_ID: productionTarget.channelId
})) {
if (vars[name] !== expected) throw new Error(name + ' must match the production EGBIM Q&A target: ' + expected);
}
const revision = required(env, 'DEPLOY_COMMIT_SHA');
if (!/^[0-9a-f]{40}$/.test(revision)) throw new Error('DEPLOY_COMMIT_SHA must be a full lowercase Git commit SHA');
vars.QA_ASSET_PREFIX = 'releases/' + revision;