@fabrika/provider-zerops 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/control.ts +13 -0
- package/src/index.ts +1 -1
- package/src/namespace.ts +3 -3
- package/src/provider.ts +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/provider-zerops",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"gen:schema": "bun scripts/generate-zerops-types.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@fabrika/auth": "^0.0.
|
|
36
|
-
"@fabrika/auth-core": "^0.0.
|
|
37
|
-
"@fabrika/provider-contract": "^0.0.
|
|
38
|
-
"@fabrika/proxy-contract": "^0.0.
|
|
35
|
+
"@fabrika/auth": "^0.0.15",
|
|
36
|
+
"@fabrika/auth-core": "^0.0.15",
|
|
37
|
+
"@fabrika/provider-contract": "^0.0.15",
|
|
38
|
+
"@fabrika/proxy-contract": "^0.0.15"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/src/control.ts
CHANGED
|
@@ -440,6 +440,19 @@ export const createZeropsControlProvider = (options: ZeropsControlProviderOption
|
|
|
440
440
|
const controlProvider: ZeropsControlProvider = {
|
|
441
441
|
id: 'zerops',
|
|
442
442
|
normalizeRegistration,
|
|
443
|
+
/**
|
|
444
|
+
* A Zerops artifact IS the compiled manifest, so the declaration is right here and core can refuse
|
|
445
|
+
* a variable this app would never read. An artifact that will not decode answers `undefined`
|
|
446
|
+
* rather than an empty set: a broken envelope is a registration problem, and reporting it as an
|
|
447
|
+
* undeclared variable would point the operator at the wrong thing.
|
|
448
|
+
*/
|
|
449
|
+
declaredVariables: ({ artifact }) => {
|
|
450
|
+
try {
|
|
451
|
+
return parseFabrikaManifest(decodeEnvelope('artifact', artifact, zeropsArtifactCodec)).app.pipeline.vars
|
|
452
|
+
} catch {
|
|
453
|
+
return undefined
|
|
454
|
+
}
|
|
455
|
+
},
|
|
443
456
|
resolveSource: (input) => resolveSource(input),
|
|
444
457
|
resolveSourceWithBinding: (input) => resolveSource(input, input.sourceBinding),
|
|
445
458
|
deploy: async (input: ProviderDeployInput): Promise<ProviderTerminalOutcome> => {
|
package/src/index.ts
CHANGED
|
@@ -69,8 +69,8 @@ export {
|
|
|
69
69
|
compileZeropsNamespaceTopology,
|
|
70
70
|
createZeropsNamespaceCapabilities,
|
|
71
71
|
createZeropsNamespaceOperator,
|
|
72
|
+
ZEROPS_NAMESPACE_IAM_ISSUER_VARIABLE,
|
|
72
73
|
ZEROPS_NAMESPACE_IAM_KEY_VARIABLE,
|
|
73
|
-
ZEROPS_NAMESPACE_IAM_URL_VARIABLE,
|
|
74
74
|
ZEROPS_NAMESPACE_POSTGRES_HOSTNAME,
|
|
75
75
|
ZEROPS_NAMESPACE_PROXY_HOSTNAME,
|
|
76
76
|
ZEROPS_SHARED_POSTGRES_CONNECTION_STRING,
|
package/src/namespace.ts
CHANGED
|
@@ -31,7 +31,7 @@ import type { ZeropsServiceSpec, ZeropsSourceTarget } from './types'
|
|
|
31
31
|
|
|
32
32
|
export const ZEROPS_NAMESPACE_PROXY_HOSTNAME = 'proxy'
|
|
33
33
|
export const ZEROPS_NAMESPACE_POSTGRES_HOSTNAME = 'postgres'
|
|
34
|
-
export const
|
|
34
|
+
export const ZEROPS_NAMESPACE_IAM_ISSUER_VARIABLE = 'FABRIKA_IAM_ISSUER'
|
|
35
35
|
export const ZEROPS_NAMESPACE_IAM_KEY_VARIABLE = 'FABRIKA_IAM_KEY'
|
|
36
36
|
/**
|
|
37
37
|
* How an app reaches the namespace-owned PostgreSQL service — port, database and TLS mode NAMED, not
|
|
@@ -759,11 +759,11 @@ const ensureProxyConfiguration = async (
|
|
|
759
759
|
})
|
|
760
760
|
deployRequired = true
|
|
761
761
|
}
|
|
762
|
-
const iamUrl = byKey.get(
|
|
762
|
+
const iamUrl = byKey.get(ZEROPS_NAMESPACE_IAM_ISSUER_VARIABLE)
|
|
763
763
|
if (iamUrl?.content !== options.iamUrl) {
|
|
764
764
|
await options.api.putServiceEnv({
|
|
765
765
|
serviceId: proxyServiceId,
|
|
766
|
-
key:
|
|
766
|
+
key: ZEROPS_NAMESPACE_IAM_ISSUER_VARIABLE,
|
|
767
767
|
value: options.iamUrl,
|
|
768
768
|
signal,
|
|
769
769
|
})
|
package/src/provider.ts
CHANGED
|
@@ -152,9 +152,21 @@ const cancelSourceBestEffort = async (env: StepEnv, source: ZeropsRuntimeSource,
|
|
|
152
152
|
sourceController.abort()
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Drop a version that was created and never handed to the platform.
|
|
157
|
+
*
|
|
158
|
+
* BEST EFFORT ON PURPOSE. Every caller runs this while already failing, so a cleanup that throws would
|
|
159
|
+
* replace the reason the deploy failed with the reason the cleanup did — which is what happened live,
|
|
160
|
+
* where a real `trigger-deploy` failure surfaced as `delete app-version failed (400)` and the cause was
|
|
161
|
+
* gone. The leftover version is visible on the platform; the lost diagnosis was not.
|
|
162
|
+
*/
|
|
155
163
|
const cleanupPreTriggerVersion = async (env: StepEnv, source: ZeropsRuntimeSource, appVersionId: string): Promise<void> => {
|
|
156
164
|
await cancelSourceBestEffort(env, source, appVersionId)
|
|
157
|
-
|
|
165
|
+
try {
|
|
166
|
+
await env.zerops.api.deleteAppVersion({ appVersionId, signal: AbortSignal.timeout(5000) })
|
|
167
|
+
} catch (error) {
|
|
168
|
+
env.log(` [warn] app-version ${appVersionId} was left behind: ${error instanceof Error ? error.message : 'unknown error'}`)
|
|
169
|
+
}
|
|
158
170
|
}
|
|
159
171
|
|
|
160
172
|
/**
|