@firestartr/cli 1.51.1-snapshot-06 → 1.51.2
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/build/index.js +1224 -500
- package/build/packages/cdk8s_renderer/imports/firestartr.dev.d.ts +439 -139
- package/build/packages/cdk8s_renderer/src/charts/github/RepoSecretsSectionChart.d.ts +12 -0
- package/build/packages/cdk8s_renderer/src/charts/github/orgWebhookChart.d.ts +2 -1
- package/build/packages/cdk8s_renderer/src/charts/github/repositoryChart.d.ts +2 -8
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/index.d.ts +7 -0
- package/build/packages/cdk8s_renderer/src/claims/github/index.d.ts +3 -0
- package/build/packages/cdk8s_renderer/src/claims/github/orgWebhook.d.ts +1 -4
- package/build/packages/cdk8s_renderer/src/claims/github/orgwebhook.schema.d.ts +3 -0
- package/build/packages/cdk8s_renderer/src/claims/tfworkspaces/index.d.ts +4 -0
- package/build/packages/cdk8s_renderer/src/claims/tfworkspaces/terraform.schema.d.ts +4 -0
- package/build/packages/github/index.d.ts +2 -0
- package/build/packages/github/src/encrypt.d.ts +3 -6
- package/build/packages/operator/src/informer.d.ts +1 -0
- package/build/packages/operator/src/processItem.debug.d.ts +2 -0
- package/build/packages/operator/src/status.d.ts +2 -0
- package/build/packages/operator/src/syncCtl.d.ts +31 -0
- package/build/packages/operator/src/syncer.d.ts +6 -2
- package/build/packages/operator/src/syncer.debug.d.ts +2 -0
- package/build/packages/provisioner/src/entities/firestartrgithubrepositorysecretssection/FirestartrGithubRepositorySecretsSection.d.ts +9 -0
- package/build/packages/provisioner/src/entities/firestartrgithubrepositorysecretssection/helpers/RepositorySecret.d.ts +3 -0
- package/build/packages/provisioner/src/resources/github_repository_secrets_section/index.d.ts +5 -0
- package/build/packages/provisioner/src/resources/index.d.ts +2 -0
- package/package.json +1 -1
- package/build/packages/provisioner/src/entities/firestartrgithubrepository/helpers/RepositorySecret.d.ts +0 -4
package/build/index.js
CHANGED
|
@@ -346931,6 +346931,7 @@ const DEFAULT_TIME_ZONE = 'Europe/Madrid';
|
|
|
346931
346931
|
function validateCron(cronLine, tz = DEFAULT_TIME_ZONE) {
|
|
346932
346932
|
try {
|
|
346933
346933
|
const interval = cron_parser_dist.CronExpressionParser.parse(cronLine, {
|
|
346934
|
+
// to enable the only minutes cron
|
|
346934
346935
|
strict: false,
|
|
346935
346936
|
tz,
|
|
346936
346937
|
});
|
|
@@ -354780,24 +354781,24 @@ var libsodium_wrappers_default = /*#__PURE__*/__nccwpck_require__.n(libsodium_wr
|
|
|
354780
354781
|
|
|
354781
354782
|
|
|
354782
354783
|
|
|
354783
|
-
async function getRepoPublicKey(owner, repo) {
|
|
354784
|
+
async function getRepoPublicKey(owner, repo, section) {
|
|
354784
354785
|
github_src_logger.info(`Retrieving public key for ${owner}/${repo}`);
|
|
354785
354786
|
try {
|
|
354786
354787
|
const octokit = await getOctokitForOrg(owner);
|
|
354787
|
-
const { data } = await octokit.
|
|
354788
|
+
const { data } = await octokit[section].getRepoPublicKey({
|
|
354788
354789
|
owner,
|
|
354789
354790
|
repo,
|
|
354790
354791
|
});
|
|
354791
354792
|
return data;
|
|
354792
354793
|
}
|
|
354793
354794
|
catch (error) {
|
|
354794
|
-
github_src_logger.error(`Error retrieving public key for ${owner}/${repo}: ${error}`);
|
|
354795
|
+
github_src_logger.error(`Error retrieving public key (${section}) for ${owner}/${repo}: ${error}`);
|
|
354795
354796
|
throw error;
|
|
354796
354797
|
}
|
|
354797
354798
|
}
|
|
354798
|
-
async function encryptRepoSecret(owner, repo, plaintextValue) {
|
|
354799
|
+
async function encryptRepoSecret(owner, repo, section, plaintextValue) {
|
|
354799
354800
|
try {
|
|
354800
|
-
const { key_id, key } = await getRepoPublicKey(owner, repo);
|
|
354801
|
+
const { key_id, key } = await getRepoPublicKey(owner, repo, section);
|
|
354801
354802
|
await (libsodium_wrappers_default()).ready;
|
|
354802
354803
|
const publicKey = libsodium_wrappers_default().from_base64(key, (libsodium_wrappers_default()).base64_variants.ORIGINAL);
|
|
354803
354804
|
const secretBytes = libsodium_wrappers_default().from_string(plaintextValue);
|
|
@@ -355661,6 +355662,10 @@ InitializerClaimRef.applicableKinds = [
|
|
|
355661
355662
|
];
|
|
355662
355663
|
|
|
355663
355664
|
|
|
355665
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/logger.ts
|
|
355666
|
+
|
|
355667
|
+
/* harmony default export */ const cdk8s_renderer_src_logger = (catalog_common.logger);
|
|
355668
|
+
|
|
355664
355669
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refresolver/index.ts
|
|
355665
355670
|
/**
|
|
355666
355671
|
* renderedClaims is a map of rendered claims
|
|
@@ -355669,8 +355674,10 @@ InitializerClaimRef.applicableKinds = [
|
|
|
355669
355674
|
* and the value is the rendered CR
|
|
355670
355675
|
*/
|
|
355671
355676
|
let renderedClaims = {};
|
|
355677
|
+
|
|
355672
355678
|
function setRenderedClaim(claim, cr) {
|
|
355673
355679
|
const claimKey = `${claim.kind}-${claim.name}`;
|
|
355680
|
+
cdk8s_renderer_src_logger.silly(`Set rendered claim with key ${claimKey}`);
|
|
355674
355681
|
if (renderedClaims[claimKey]) {
|
|
355675
355682
|
throw new Error(`Claim ${claimKey} already rendered`);
|
|
355676
355683
|
}
|
|
@@ -357181,10 +357188,6 @@ const NORMALIZERS = [
|
|
|
357181
357188
|
RevisionNormalizer,
|
|
357182
357189
|
];
|
|
357183
357190
|
|
|
357184
|
-
;// CONCATENATED MODULE: ../cdk8s_renderer/src/logger.ts
|
|
357185
|
-
|
|
357186
|
-
/* harmony default export */ const cdk8s_renderer_src_logger = (catalog_common.logger);
|
|
357187
|
-
|
|
357188
357191
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsExtractor.ts
|
|
357189
357192
|
|
|
357190
357193
|
|
|
@@ -357972,6 +357975,9 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
357972
357975
|
type: 'boolean',
|
|
357973
357976
|
description: 'If the webhook is active',
|
|
357974
357977
|
},
|
|
357978
|
+
secretRef: {
|
|
357979
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimSecretRef',
|
|
357980
|
+
},
|
|
357975
357981
|
events: {
|
|
357976
357982
|
type: 'array',
|
|
357977
357983
|
description: 'List of events that trigger the webhook (e.g., push, pull_request, issues)',
|
|
@@ -357980,7 +357986,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
357980
357986
|
},
|
|
357981
357987
|
},
|
|
357982
357988
|
},
|
|
357983
|
-
required: ['url', 'contentType', 'events'],
|
|
357989
|
+
required: ['url', 'contentType', 'events', 'secretRef'],
|
|
357984
357990
|
},
|
|
357985
357991
|
},
|
|
357986
357992
|
required: ['orgName', 'webhook'],
|
|
@@ -358186,7 +358192,11 @@ const GithubSchemas = [
|
|
|
358186
358192
|
schedule_timezone: {
|
|
358187
358193
|
type: 'string',
|
|
358188
358194
|
},
|
|
358195
|
+
policy: {
|
|
358196
|
+
type: 'string',
|
|
358197
|
+
},
|
|
358189
358198
|
},
|
|
358199
|
+
additionalProperties: false,
|
|
358190
358200
|
required: ['enabled'],
|
|
358191
358201
|
oneOf: [
|
|
358192
358202
|
{
|
|
@@ -360904,6 +360914,7 @@ const KINDS_CR_MAP = {
|
|
|
360904
360914
|
user: 'FirestartrGithubMembership',
|
|
360905
360915
|
repo: 'FirestartrGithubRepository',
|
|
360906
360916
|
feat: 'FirestartrGithubRepositoryFeature',
|
|
360917
|
+
secretsSection: 'FirestartrGithubRepositorySecretsSection',
|
|
360907
360918
|
};
|
|
360908
360919
|
|
|
360909
360920
|
|
|
@@ -361724,6 +361735,7 @@ function toJson_FirestartrGithubOrgWebhookSpecWebhookSecretRef(obj) {
|
|
|
361724
361735
|
return undefined;
|
|
361725
361736
|
}
|
|
361726
361737
|
const result = {
|
|
361738
|
+
'kind': obj.kind,
|
|
361727
361739
|
'name': obj.name,
|
|
361728
361740
|
'key': obj.key,
|
|
361729
361741
|
};
|
|
@@ -361772,6 +361784,17 @@ function toJson_FirestartrGithubOrgWebhookSpecWriteConnectionSecretToRefOutputs(
|
|
|
361772
361784
|
// filter undefined values
|
|
361773
361785
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
361774
361786
|
}
|
|
361787
|
+
/* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
361788
|
+
/**
|
|
361789
|
+
* The type of Kubernetes resource to reference.
|
|
361790
|
+
*
|
|
361791
|
+
* @schema FirestartrGithubOrgWebhookSpecWebhookSecretRefKind
|
|
361792
|
+
*/
|
|
361793
|
+
var FirestartrGithubOrgWebhookSpecWebhookSecretRefKind;
|
|
361794
|
+
(function (FirestartrGithubOrgWebhookSpecWebhookSecretRefKind) {
|
|
361795
|
+
/** Secret */
|
|
361796
|
+
FirestartrGithubOrgWebhookSpecWebhookSecretRefKind["SECRET"] = "Secret";
|
|
361797
|
+
})(FirestartrGithubOrgWebhookSpecWebhookSecretRefKind || (FirestartrGithubOrgWebhookSpecWebhookSecretRefKind = {}));
|
|
361775
361798
|
/**
|
|
361776
361799
|
* Converts an object of type 'FirestartrGithubOrgWebhookSpecContextBackendRef' to JSON representation.
|
|
361777
361800
|
*/
|
|
@@ -361900,7 +361923,6 @@ function toJson_FirestartrGithubRepositorySpec(obj) {
|
|
|
361900
361923
|
'actions': toJson_FirestartrGithubRepositorySpecActions(obj.actions),
|
|
361901
361924
|
'pages': toJson_FirestartrGithubRepositorySpecPages(obj.pages),
|
|
361902
361925
|
'permissions': obj.permissions?.map(y => toJson_FirestartrGithubRepositorySpecPermissions(y)),
|
|
361903
|
-
'secrets': toJson_FirestartrGithubRepositorySpecSecrets(obj.secrets),
|
|
361904
361926
|
'vars': toJson_FirestartrGithubRepositorySpecVars(obj.vars),
|
|
361905
361927
|
'branchProtections': obj.branchProtections?.map(y => toJson_FirestartrGithubRepositorySpecBranchProtections(y)),
|
|
361906
361928
|
'writeConnectionSecretToRef': toJson_FirestartrGithubRepositorySpecWriteConnectionSecretToRef(obj.writeConnectionSecretToRef),
|
|
@@ -362012,22 +362034,6 @@ function toJson_FirestartrGithubRepositorySpecPermissions(obj) {
|
|
|
362012
362034
|
// filter undefined values
|
|
362013
362035
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362014
362036
|
}
|
|
362015
|
-
/**
|
|
362016
|
-
* Converts an object of type 'FirestartrGithubRepositorySpecSecrets' to JSON representation.
|
|
362017
|
-
*/
|
|
362018
|
-
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362019
|
-
function toJson_FirestartrGithubRepositorySpecSecrets(obj) {
|
|
362020
|
-
if (obj === undefined) {
|
|
362021
|
-
return undefined;
|
|
362022
|
-
}
|
|
362023
|
-
const result = {
|
|
362024
|
-
'actions': obj.actions?.map(y => toJson_FirestartrGithubRepositorySpecSecretsActions(y)),
|
|
362025
|
-
'codespaces': obj.codespaces?.map(y => toJson_FirestartrGithubRepositorySpecSecretsCodespaces(y)),
|
|
362026
|
-
'dependabot': obj.dependabot?.map(y => toJson_FirestartrGithubRepositorySpecSecretsDependabot(y)),
|
|
362027
|
-
};
|
|
362028
|
-
// filter undefined values
|
|
362029
|
-
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362030
|
-
}
|
|
362031
362037
|
/**
|
|
362032
362038
|
* Converts an object of type 'FirestartrGithubRepositorySpecVars' to JSON representation.
|
|
362033
362039
|
*/
|
|
@@ -362195,51 +362201,6 @@ function toJson_FirestartrGithubRepositorySpecPermissionsRef(obj) {
|
|
|
362195
362201
|
// filter undefined values
|
|
362196
362202
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362197
362203
|
}
|
|
362198
|
-
/**
|
|
362199
|
-
* Converts an object of type 'FirestartrGithubRepositorySpecSecretsActions' to JSON representation.
|
|
362200
|
-
*/
|
|
362201
|
-
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362202
|
-
function toJson_FirestartrGithubRepositorySpecSecretsActions(obj) {
|
|
362203
|
-
if (obj === undefined) {
|
|
362204
|
-
return undefined;
|
|
362205
|
-
}
|
|
362206
|
-
const result = {
|
|
362207
|
-
'name': obj.name,
|
|
362208
|
-
'ref': toJson_FirestartrGithubRepositorySpecSecretsActionsRef(obj.ref),
|
|
362209
|
-
};
|
|
362210
|
-
// filter undefined values
|
|
362211
|
-
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362212
|
-
}
|
|
362213
|
-
/**
|
|
362214
|
-
* Converts an object of type 'FirestartrGithubRepositorySpecSecretsCodespaces' to JSON representation.
|
|
362215
|
-
*/
|
|
362216
|
-
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362217
|
-
function toJson_FirestartrGithubRepositorySpecSecretsCodespaces(obj) {
|
|
362218
|
-
if (obj === undefined) {
|
|
362219
|
-
return undefined;
|
|
362220
|
-
}
|
|
362221
|
-
const result = {
|
|
362222
|
-
'name': obj.name,
|
|
362223
|
-
'ref': toJson_FirestartrGithubRepositorySpecSecretsCodespacesRef(obj.ref),
|
|
362224
|
-
};
|
|
362225
|
-
// filter undefined values
|
|
362226
|
-
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362227
|
-
}
|
|
362228
|
-
/**
|
|
362229
|
-
* Converts an object of type 'FirestartrGithubRepositorySpecSecretsDependabot' to JSON representation.
|
|
362230
|
-
*/
|
|
362231
|
-
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362232
|
-
function toJson_FirestartrGithubRepositorySpecSecretsDependabot(obj) {
|
|
362233
|
-
if (obj === undefined) {
|
|
362234
|
-
return undefined;
|
|
362235
|
-
}
|
|
362236
|
-
const result = {
|
|
362237
|
-
'name': obj.name,
|
|
362238
|
-
'ref': toJson_FirestartrGithubRepositorySpecSecretsDependabotRef(obj.ref),
|
|
362239
|
-
};
|
|
362240
|
-
// filter undefined values
|
|
362241
|
-
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362242
|
-
}
|
|
362243
362204
|
/**
|
|
362244
362205
|
* Converts an object of type 'FirestartrGithubRepositorySpecVarsVariableItemSchema' to JSON representation.
|
|
362245
362206
|
*/
|
|
@@ -362316,54 +362277,6 @@ function toJson_FirestartrGithubRepositorySpecContextProviderRef(obj) {
|
|
|
362316
362277
|
// filter undefined values
|
|
362317
362278
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362318
362279
|
}
|
|
362319
|
-
/**
|
|
362320
|
-
* Converts an object of type 'FirestartrGithubRepositorySpecSecretsActionsRef' to JSON representation.
|
|
362321
|
-
*/
|
|
362322
|
-
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362323
|
-
function toJson_FirestartrGithubRepositorySpecSecretsActionsRef(obj) {
|
|
362324
|
-
if (obj === undefined) {
|
|
362325
|
-
return undefined;
|
|
362326
|
-
}
|
|
362327
|
-
const result = {
|
|
362328
|
-
'kind': obj.kind,
|
|
362329
|
-
'name': obj.name,
|
|
362330
|
-
'key': obj.key,
|
|
362331
|
-
};
|
|
362332
|
-
// filter undefined values
|
|
362333
|
-
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362334
|
-
}
|
|
362335
|
-
/**
|
|
362336
|
-
* Converts an object of type 'FirestartrGithubRepositorySpecSecretsCodespacesRef' to JSON representation.
|
|
362337
|
-
*/
|
|
362338
|
-
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362339
|
-
function toJson_FirestartrGithubRepositorySpecSecretsCodespacesRef(obj) {
|
|
362340
|
-
if (obj === undefined) {
|
|
362341
|
-
return undefined;
|
|
362342
|
-
}
|
|
362343
|
-
const result = {
|
|
362344
|
-
'kind': obj.kind,
|
|
362345
|
-
'name': obj.name,
|
|
362346
|
-
'key': obj.key,
|
|
362347
|
-
};
|
|
362348
|
-
// filter undefined values
|
|
362349
|
-
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362350
|
-
}
|
|
362351
|
-
/**
|
|
362352
|
-
* Converts an object of type 'FirestartrGithubRepositorySpecSecretsDependabotRef' to JSON representation.
|
|
362353
|
-
*/
|
|
362354
|
-
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362355
|
-
function toJson_FirestartrGithubRepositorySpecSecretsDependabotRef(obj) {
|
|
362356
|
-
if (obj === undefined) {
|
|
362357
|
-
return undefined;
|
|
362358
|
-
}
|
|
362359
|
-
const result = {
|
|
362360
|
-
'kind': obj.kind,
|
|
362361
|
-
'name': obj.name,
|
|
362362
|
-
'key': obj.key,
|
|
362363
|
-
};
|
|
362364
|
-
// filter undefined values
|
|
362365
|
-
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362366
|
-
}
|
|
362367
362280
|
/**
|
|
362368
362281
|
* Converts an object of type 'FirestartrGithubRepositorySpecVarsVariableItemSchemaRef' to JSON representation.
|
|
362369
362282
|
*/
|
|
@@ -362650,33 +362563,33 @@ var FirestartrGithubRepositoryFeatureSpecContextProviderRefKind;
|
|
|
362650
362563
|
FirestartrGithubRepositoryFeatureSpecContextProviderRefKind["FIRESTARTR_PROVIDER_CONFIG"] = "FirestartrProviderConfig";
|
|
362651
362564
|
})(FirestartrGithubRepositoryFeatureSpecContextProviderRefKind || (FirestartrGithubRepositoryFeatureSpecContextProviderRefKind = {}));
|
|
362652
362565
|
/**
|
|
362653
|
-
* A resource to handle backend and provider configuration.
|
|
362654
362566
|
*
|
|
362655
|
-
*
|
|
362567
|
+
*
|
|
362568
|
+
* @schema FirestartrGithubRepositorySecretsSection
|
|
362656
362569
|
*/
|
|
362657
|
-
class
|
|
362570
|
+
class FirestartrGithubRepositorySecretsSection extends lib.ApiObject {
|
|
362658
362571
|
/**
|
|
362659
|
-
* Renders a Kubernetes manifest for "
|
|
362572
|
+
* Renders a Kubernetes manifest for "FirestartrGithubRepositorySecretsSection".
|
|
362660
362573
|
*
|
|
362661
362574
|
* This can be used to inline resource manifests inside other objects (e.g. as templates).
|
|
362662
362575
|
*
|
|
362663
362576
|
* @param props initialization props
|
|
362664
362577
|
*/
|
|
362665
|
-
static manifest(props) {
|
|
362578
|
+
static manifest(props = {}) {
|
|
362666
362579
|
return {
|
|
362667
|
-
...
|
|
362668
|
-
...
|
|
362580
|
+
...FirestartrGithubRepositorySecretsSection.GVK,
|
|
362581
|
+
...toJson_FirestartrGithubRepositorySecretsSectionProps(props),
|
|
362669
362582
|
};
|
|
362670
362583
|
}
|
|
362671
362584
|
/**
|
|
362672
|
-
* Defines a "
|
|
362585
|
+
* Defines a "FirestartrGithubRepositorySecretsSection" API object
|
|
362673
362586
|
* @param scope the scope in which to define this object
|
|
362674
362587
|
* @param id a scope-local name for the object
|
|
362675
362588
|
* @param props initialization props
|
|
362676
362589
|
*/
|
|
362677
|
-
constructor(scope, id, props) {
|
|
362590
|
+
constructor(scope, id, props = {}) {
|
|
362678
362591
|
super(scope, id, {
|
|
362679
|
-
...
|
|
362592
|
+
...FirestartrGithubRepositorySecretsSection.GVK,
|
|
362680
362593
|
...props,
|
|
362681
362594
|
});
|
|
362682
362595
|
}
|
|
@@ -362686,273 +362599,204 @@ class FirestartrProviderConfig extends lib.ApiObject {
|
|
|
362686
362599
|
toJson() {
|
|
362687
362600
|
const resolved = super.toJson();
|
|
362688
362601
|
return {
|
|
362689
|
-
...
|
|
362690
|
-
...
|
|
362602
|
+
...FirestartrGithubRepositorySecretsSection.GVK,
|
|
362603
|
+
...toJson_FirestartrGithubRepositorySecretsSectionProps(resolved),
|
|
362691
362604
|
};
|
|
362692
362605
|
}
|
|
362693
362606
|
}
|
|
362694
362607
|
/**
|
|
362695
|
-
* Returns the apiVersion and kind for "
|
|
362608
|
+
* Returns the apiVersion and kind for "FirestartrGithubRepositorySecretsSection"
|
|
362696
362609
|
*/
|
|
362697
|
-
|
|
362610
|
+
FirestartrGithubRepositorySecretsSection.GVK = {
|
|
362698
362611
|
apiVersion: 'firestartr.dev/v1',
|
|
362699
|
-
kind: '
|
|
362612
|
+
kind: 'FirestartrGithubRepositorySecretsSection',
|
|
362700
362613
|
};
|
|
362701
362614
|
|
|
362702
362615
|
/**
|
|
362703
|
-
* Converts an object of type '
|
|
362616
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionProps' to JSON representation.
|
|
362704
362617
|
*/
|
|
362705
362618
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362706
|
-
function
|
|
362619
|
+
function toJson_FirestartrGithubRepositorySecretsSectionProps(obj) {
|
|
362707
362620
|
if (obj === undefined) {
|
|
362708
362621
|
return undefined;
|
|
362709
362622
|
}
|
|
362710
362623
|
const result = {
|
|
362711
362624
|
'metadata': obj.metadata,
|
|
362712
|
-
'spec':
|
|
362625
|
+
'spec': toJson_FirestartrGithubRepositorySecretsSectionSpec(obj.spec),
|
|
362713
362626
|
};
|
|
362714
362627
|
// filter undefined values
|
|
362715
362628
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362716
362629
|
}
|
|
362717
362630
|
/**
|
|
362718
|
-
* Converts an object of type '
|
|
362631
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpec' to JSON representation.
|
|
362719
362632
|
*/
|
|
362720
362633
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362721
|
-
function
|
|
362634
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpec(obj) {
|
|
362722
362635
|
if (obj === undefined) {
|
|
362723
362636
|
return undefined;
|
|
362724
362637
|
}
|
|
362725
362638
|
const result = {
|
|
362726
|
-
'
|
|
362727
|
-
'
|
|
362728
|
-
'
|
|
362729
|
-
'
|
|
362730
|
-
'inline': obj.inline,
|
|
362731
|
-
'env': obj.env,
|
|
362732
|
-
'secrets': ((obj.secrets) === undefined) ? undefined : (Object.entries(obj.secrets).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: toJson_FirestartrProviderConfigSpecSecrets(i[1]) }), {})),
|
|
362639
|
+
'firestartr': toJson_FirestartrGithubRepositorySecretsSectionSpecFirestartr(obj.firestartr),
|
|
362640
|
+
'repositoryTarget': toJson_FirestartrGithubRepositorySecretsSectionSpecRepositoryTarget(obj.repositoryTarget),
|
|
362641
|
+
'secrets': toJson_FirestartrGithubRepositorySecretsSectionSpecSecrets(obj.secrets),
|
|
362642
|
+
'context': toJson_FirestartrGithubRepositorySecretsSectionSpecContext(obj.context),
|
|
362733
362643
|
};
|
|
362734
362644
|
// filter undefined values
|
|
362735
362645
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362736
362646
|
}
|
|
362737
362647
|
/**
|
|
362738
|
-
* Converts an object of type '
|
|
362648
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecFirestartr' to JSON representation.
|
|
362739
362649
|
*/
|
|
362740
362650
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362741
|
-
function
|
|
362651
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecFirestartr(obj) {
|
|
362742
362652
|
if (obj === undefined) {
|
|
362743
362653
|
return undefined;
|
|
362744
362654
|
}
|
|
362745
362655
|
const result = {
|
|
362746
|
-
'
|
|
362656
|
+
'tfStateKey': obj.tfStateKey,
|
|
362747
362657
|
};
|
|
362748
362658
|
// filter undefined values
|
|
362749
362659
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362750
362660
|
}
|
|
362751
362661
|
/**
|
|
362752
|
-
* Converts an object of type '
|
|
362662
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecRepositoryTarget' to JSON representation.
|
|
362753
362663
|
*/
|
|
362754
362664
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362755
|
-
function
|
|
362665
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecRepositoryTarget(obj) {
|
|
362756
362666
|
if (obj === undefined) {
|
|
362757
362667
|
return undefined;
|
|
362758
362668
|
}
|
|
362759
362669
|
const result = {
|
|
362760
|
-
'
|
|
362761
|
-
'namespace': obj.namespace,
|
|
362762
|
-
'key': obj.key,
|
|
362670
|
+
'ref': toJson_FirestartrGithubRepositorySecretsSectionSpecRepositoryTargetRef(obj.ref),
|
|
362763
362671
|
};
|
|
362764
362672
|
// filter undefined values
|
|
362765
362673
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362766
362674
|
}
|
|
362767
|
-
/* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362768
|
-
/**
|
|
362769
|
-
* A workspace to handle Terraform code
|
|
362770
|
-
*
|
|
362771
|
-
* @schema FirestartrTerraformWorkspace
|
|
362772
|
-
*/
|
|
362773
|
-
class FirestartrTerraformWorkspace extends lib.ApiObject {
|
|
362774
|
-
/**
|
|
362775
|
-
* Renders a Kubernetes manifest for "FirestartrTerraformWorkspace".
|
|
362776
|
-
*
|
|
362777
|
-
* This can be used to inline resource manifests inside other objects (e.g. as templates).
|
|
362778
|
-
*
|
|
362779
|
-
* @param props initialization props
|
|
362780
|
-
*/
|
|
362781
|
-
static manifest(props) {
|
|
362782
|
-
return {
|
|
362783
|
-
...FirestartrTerraformWorkspace.GVK,
|
|
362784
|
-
...toJson_FirestartrTerraformWorkspaceProps(props),
|
|
362785
|
-
};
|
|
362786
|
-
}
|
|
362787
|
-
/**
|
|
362788
|
-
* Defines a "FirestartrTerraformWorkspace" API object
|
|
362789
|
-
* @param scope the scope in which to define this object
|
|
362790
|
-
* @param id a scope-local name for the object
|
|
362791
|
-
* @param props initialization props
|
|
362792
|
-
*/
|
|
362793
|
-
constructor(scope, id, props) {
|
|
362794
|
-
super(scope, id, {
|
|
362795
|
-
...FirestartrTerraformWorkspace.GVK,
|
|
362796
|
-
...props,
|
|
362797
|
-
});
|
|
362798
|
-
}
|
|
362799
|
-
/**
|
|
362800
|
-
* Renders the object to Kubernetes JSON.
|
|
362801
|
-
*/
|
|
362802
|
-
toJson() {
|
|
362803
|
-
const resolved = super.toJson();
|
|
362804
|
-
return {
|
|
362805
|
-
...FirestartrTerraformWorkspace.GVK,
|
|
362806
|
-
...toJson_FirestartrTerraformWorkspaceProps(resolved),
|
|
362807
|
-
};
|
|
362808
|
-
}
|
|
362809
|
-
}
|
|
362810
|
-
/**
|
|
362811
|
-
* Returns the apiVersion and kind for "FirestartrTerraformWorkspace"
|
|
362812
|
-
*/
|
|
362813
|
-
FirestartrTerraformWorkspace.GVK = {
|
|
362814
|
-
apiVersion: 'firestartr.dev/v1',
|
|
362815
|
-
kind: 'FirestartrTerraformWorkspace',
|
|
362816
|
-
};
|
|
362817
|
-
|
|
362818
362675
|
/**
|
|
362819
|
-
* Converts an object of type '
|
|
362676
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecSecrets' to JSON representation.
|
|
362820
362677
|
*/
|
|
362821
362678
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362822
|
-
function
|
|
362679
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecSecrets(obj) {
|
|
362823
362680
|
if (obj === undefined) {
|
|
362824
362681
|
return undefined;
|
|
362825
362682
|
}
|
|
362826
362683
|
const result = {
|
|
362827
|
-
'
|
|
362828
|
-
'
|
|
362684
|
+
'actions': obj.actions?.map(y => toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsActions(y)),
|
|
362685
|
+
'codespaces': obj.codespaces?.map(y => toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsCodespaces(y)),
|
|
362686
|
+
'dependabot': obj.dependabot?.map(y => toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsDependabot(y)),
|
|
362829
362687
|
};
|
|
362830
362688
|
// filter undefined values
|
|
362831
362689
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362832
362690
|
}
|
|
362833
362691
|
/**
|
|
362834
|
-
* Converts an object of type '
|
|
362692
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecContext' to JSON representation.
|
|
362835
362693
|
*/
|
|
362836
362694
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362837
|
-
function
|
|
362695
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecContext(obj) {
|
|
362838
362696
|
if (obj === undefined) {
|
|
362839
362697
|
return undefined;
|
|
362840
362698
|
}
|
|
362841
362699
|
const result = {
|
|
362842
|
-
'
|
|
362843
|
-
'
|
|
362844
|
-
'module': obj.module,
|
|
362845
|
-
'source': obj.source,
|
|
362846
|
-
'values': obj.values,
|
|
362847
|
-
'references': obj.references?.map(y => toJson_FirestartrTerraformWorkspaceSpecReferences(y)),
|
|
362848
|
-
'writeConnectionSecretToRef': toJson_FirestartrTerraformWorkspaceSpecWriteConnectionSecretToRef(obj.writeConnectionSecretToRef),
|
|
362700
|
+
'provider': toJson_FirestartrGithubRepositorySecretsSectionSpecContextProvider(obj.provider),
|
|
362701
|
+
'backend': toJson_FirestartrGithubRepositorySecretsSectionSpecContextBackend(obj.backend),
|
|
362849
362702
|
};
|
|
362850
362703
|
// filter undefined values
|
|
362851
362704
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362852
362705
|
}
|
|
362853
362706
|
/**
|
|
362854
|
-
* Converts an object of type '
|
|
362707
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecRepositoryTargetRef' to JSON representation.
|
|
362855
362708
|
*/
|
|
362856
362709
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362857
|
-
function
|
|
362710
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecRepositoryTargetRef(obj) {
|
|
362858
362711
|
if (obj === undefined) {
|
|
362859
362712
|
return undefined;
|
|
362860
362713
|
}
|
|
362861
362714
|
const result = {
|
|
362862
|
-
'
|
|
362863
|
-
'
|
|
362715
|
+
'kind': obj.kind,
|
|
362716
|
+
'name': obj.name,
|
|
362717
|
+
'needsSecret': obj.needsSecret,
|
|
362864
362718
|
};
|
|
362865
362719
|
// filter undefined values
|
|
362866
362720
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362867
362721
|
}
|
|
362868
362722
|
/**
|
|
362869
|
-
* Converts an object of type '
|
|
362723
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecSecretsActions' to JSON representation.
|
|
362870
362724
|
*/
|
|
362871
362725
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362872
|
-
function
|
|
362726
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsActions(obj) {
|
|
362873
362727
|
if (obj === undefined) {
|
|
362874
362728
|
return undefined;
|
|
362875
362729
|
}
|
|
362876
362730
|
const result = {
|
|
362877
|
-
'
|
|
362731
|
+
'name': obj.name,
|
|
362732
|
+
'ref': toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsActionsRef(obj.ref),
|
|
362878
362733
|
};
|
|
362879
362734
|
// filter undefined values
|
|
362880
362735
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362881
362736
|
}
|
|
362882
|
-
/* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362883
|
-
/**
|
|
362884
|
-
* @schema FirestartrTerraformWorkspaceSpecSource
|
|
362885
|
-
*/
|
|
362886
|
-
var FirestartrTerraformWorkspaceSpecSource;
|
|
362887
|
-
(function (FirestartrTerraformWorkspaceSpecSource) {
|
|
362888
|
-
/** Remote */
|
|
362889
|
-
FirestartrTerraformWorkspaceSpecSource["REMOTE"] = "Remote";
|
|
362890
|
-
/** Inline */
|
|
362891
|
-
FirestartrTerraformWorkspaceSpecSource["INLINE"] = "Inline";
|
|
362892
|
-
})(FirestartrTerraformWorkspaceSpecSource || (FirestartrTerraformWorkspaceSpecSource = {}));
|
|
362893
362737
|
/**
|
|
362894
|
-
* Converts an object of type '
|
|
362738
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecSecretsCodespaces' to JSON representation.
|
|
362895
362739
|
*/
|
|
362896
362740
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362897
|
-
function
|
|
362741
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsCodespaces(obj) {
|
|
362898
362742
|
if (obj === undefined) {
|
|
362899
362743
|
return undefined;
|
|
362900
362744
|
}
|
|
362901
362745
|
const result = {
|
|
362902
362746
|
'name': obj.name,
|
|
362903
|
-
'ref':
|
|
362747
|
+
'ref': toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsCodespacesRef(obj.ref),
|
|
362904
362748
|
};
|
|
362905
362749
|
// filter undefined values
|
|
362906
362750
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362907
362751
|
}
|
|
362908
362752
|
/**
|
|
362909
|
-
* Converts an object of type '
|
|
362753
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecSecretsDependabot' to JSON representation.
|
|
362910
362754
|
*/
|
|
362911
362755
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362912
|
-
function
|
|
362756
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsDependabot(obj) {
|
|
362913
362757
|
if (obj === undefined) {
|
|
362914
362758
|
return undefined;
|
|
362915
362759
|
}
|
|
362916
362760
|
const result = {
|
|
362917
362761
|
'name': obj.name,
|
|
362918
|
-
'
|
|
362762
|
+
'ref': toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsDependabotRef(obj.ref),
|
|
362919
362763
|
};
|
|
362920
362764
|
// filter undefined values
|
|
362921
362765
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362922
362766
|
}
|
|
362923
362767
|
/**
|
|
362924
|
-
* Converts an object of type '
|
|
362768
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecContextProvider' to JSON representation.
|
|
362925
362769
|
*/
|
|
362926
362770
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362927
|
-
function
|
|
362771
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecContextProvider(obj) {
|
|
362928
362772
|
if (obj === undefined) {
|
|
362929
362773
|
return undefined;
|
|
362930
362774
|
}
|
|
362931
362775
|
const result = {
|
|
362932
|
-
'ref':
|
|
362776
|
+
'ref': toJson_FirestartrGithubRepositorySecretsSectionSpecContextProviderRef(obj.ref),
|
|
362933
362777
|
};
|
|
362934
362778
|
// filter undefined values
|
|
362935
362779
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362936
362780
|
}
|
|
362937
362781
|
/**
|
|
362938
|
-
* Converts an object of type '
|
|
362782
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecContextBackend' to JSON representation.
|
|
362939
362783
|
*/
|
|
362940
362784
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362941
|
-
function
|
|
362785
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecContextBackend(obj) {
|
|
362942
362786
|
if (obj === undefined) {
|
|
362943
362787
|
return undefined;
|
|
362944
362788
|
}
|
|
362945
362789
|
const result = {
|
|
362946
|
-
'ref':
|
|
362790
|
+
'ref': toJson_FirestartrGithubRepositorySecretsSectionSpecContextBackendRef(obj.ref),
|
|
362947
362791
|
};
|
|
362948
362792
|
// filter undefined values
|
|
362949
362793
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362950
362794
|
}
|
|
362951
362795
|
/**
|
|
362952
|
-
* Converts an object of type '
|
|
362796
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecSecretsActionsRef' to JSON representation.
|
|
362953
362797
|
*/
|
|
362954
362798
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362955
|
-
function
|
|
362799
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsActionsRef(obj) {
|
|
362956
362800
|
if (obj === undefined) {
|
|
362957
362801
|
return undefined;
|
|
362958
362802
|
}
|
|
@@ -362965,39 +362809,42 @@ function toJson_FirestartrTerraformWorkspaceSpecReferencesRef(obj) {
|
|
|
362965
362809
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362966
362810
|
}
|
|
362967
362811
|
/**
|
|
362968
|
-
* Converts an object of type '
|
|
362812
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecSecretsCodespacesRef' to JSON representation.
|
|
362969
362813
|
*/
|
|
362970
362814
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362971
|
-
function
|
|
362815
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsCodespacesRef(obj) {
|
|
362972
362816
|
if (obj === undefined) {
|
|
362973
362817
|
return undefined;
|
|
362974
362818
|
}
|
|
362975
362819
|
const result = {
|
|
362820
|
+
'kind': obj.kind,
|
|
362821
|
+
'name': obj.name,
|
|
362976
362822
|
'key': obj.key,
|
|
362977
362823
|
};
|
|
362978
362824
|
// filter undefined values
|
|
362979
362825
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362980
362826
|
}
|
|
362981
362827
|
/**
|
|
362982
|
-
* Converts an object of type '
|
|
362828
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecSecretsDependabotRef' to JSON representation.
|
|
362983
362829
|
*/
|
|
362984
362830
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362985
|
-
function
|
|
362831
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecSecretsDependabotRef(obj) {
|
|
362986
362832
|
if (obj === undefined) {
|
|
362987
362833
|
return undefined;
|
|
362988
362834
|
}
|
|
362989
362835
|
const result = {
|
|
362990
362836
|
'kind': obj.kind,
|
|
362991
362837
|
'name': obj.name,
|
|
362838
|
+
'key': obj.key,
|
|
362992
362839
|
};
|
|
362993
362840
|
// filter undefined values
|
|
362994
362841
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362995
362842
|
}
|
|
362996
362843
|
/**
|
|
362997
|
-
* Converts an object of type '
|
|
362844
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecContextProviderRef' to JSON representation.
|
|
362998
362845
|
*/
|
|
362999
362846
|
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363000
|
-
function
|
|
362847
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecContextProviderRef(obj) {
|
|
363001
362848
|
if (obj === undefined) {
|
|
363002
362849
|
return undefined;
|
|
363003
362850
|
}
|
|
@@ -363008,7 +362855,428 @@ function toJson_FirestartrTerraformWorkspaceSpecContextProvidersRef(obj) {
|
|
|
363008
362855
|
// filter undefined values
|
|
363009
362856
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363010
362857
|
}
|
|
363011
|
-
|
|
362858
|
+
/**
|
|
362859
|
+
* Converts an object of type 'FirestartrGithubRepositorySecretsSectionSpecContextBackendRef' to JSON representation.
|
|
362860
|
+
*/
|
|
362861
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362862
|
+
function toJson_FirestartrGithubRepositorySecretsSectionSpecContextBackendRef(obj) {
|
|
362863
|
+
if (obj === undefined) {
|
|
362864
|
+
return undefined;
|
|
362865
|
+
}
|
|
362866
|
+
const result = {
|
|
362867
|
+
'kind': obj.kind,
|
|
362868
|
+
'name': obj.name,
|
|
362869
|
+
};
|
|
362870
|
+
// filter undefined values
|
|
362871
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362872
|
+
}
|
|
362873
|
+
/* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362874
|
+
/**
|
|
362875
|
+
* The type of Kubernetes resource to reference.
|
|
362876
|
+
*
|
|
362877
|
+
* @schema FirestartrGithubRepositorySecretsSectionSpecSecretsActionsRefKind
|
|
362878
|
+
*/
|
|
362879
|
+
var FirestartrGithubRepositorySecretsSectionSpecSecretsActionsRefKind;
|
|
362880
|
+
(function (FirestartrGithubRepositorySecretsSectionSpecSecretsActionsRefKind) {
|
|
362881
|
+
/** Secret */
|
|
362882
|
+
FirestartrGithubRepositorySecretsSectionSpecSecretsActionsRefKind["SECRET"] = "Secret";
|
|
362883
|
+
})(FirestartrGithubRepositorySecretsSectionSpecSecretsActionsRefKind || (FirestartrGithubRepositorySecretsSectionSpecSecretsActionsRefKind = {}));
|
|
362884
|
+
/**
|
|
362885
|
+
* The type of Kubernetes resource to reference.
|
|
362886
|
+
*
|
|
362887
|
+
* @schema FirestartrGithubRepositorySecretsSectionSpecSecretsCodespacesRefKind
|
|
362888
|
+
*/
|
|
362889
|
+
var FirestartrGithubRepositorySecretsSectionSpecSecretsCodespacesRefKind;
|
|
362890
|
+
(function (FirestartrGithubRepositorySecretsSectionSpecSecretsCodespacesRefKind) {
|
|
362891
|
+
/** Secret */
|
|
362892
|
+
FirestartrGithubRepositorySecretsSectionSpecSecretsCodespacesRefKind["SECRET"] = "Secret";
|
|
362893
|
+
})(FirestartrGithubRepositorySecretsSectionSpecSecretsCodespacesRefKind || (FirestartrGithubRepositorySecretsSectionSpecSecretsCodespacesRefKind = {}));
|
|
362894
|
+
/**
|
|
362895
|
+
* The type of Kubernetes resource to reference.
|
|
362896
|
+
*
|
|
362897
|
+
* @schema FirestartrGithubRepositorySecretsSectionSpecSecretsDependabotRefKind
|
|
362898
|
+
*/
|
|
362899
|
+
var FirestartrGithubRepositorySecretsSectionSpecSecretsDependabotRefKind;
|
|
362900
|
+
(function (FirestartrGithubRepositorySecretsSectionSpecSecretsDependabotRefKind) {
|
|
362901
|
+
/** Secret */
|
|
362902
|
+
FirestartrGithubRepositorySecretsSectionSpecSecretsDependabotRefKind["SECRET"] = "Secret";
|
|
362903
|
+
})(FirestartrGithubRepositorySecretsSectionSpecSecretsDependabotRefKind || (FirestartrGithubRepositorySecretsSectionSpecSecretsDependabotRefKind = {}));
|
|
362904
|
+
/**
|
|
362905
|
+
* @schema FirestartrGithubRepositorySecretsSectionSpecContextProviderRefKind
|
|
362906
|
+
*/
|
|
362907
|
+
var FirestartrGithubRepositorySecretsSectionSpecContextProviderRefKind;
|
|
362908
|
+
(function (FirestartrGithubRepositorySecretsSectionSpecContextProviderRefKind) {
|
|
362909
|
+
/** FirestartrProviderConfig */
|
|
362910
|
+
FirestartrGithubRepositorySecretsSectionSpecContextProviderRefKind["FIRESTARTR_PROVIDER_CONFIG"] = "FirestartrProviderConfig";
|
|
362911
|
+
})(FirestartrGithubRepositorySecretsSectionSpecContextProviderRefKind || (FirestartrGithubRepositorySecretsSectionSpecContextProviderRefKind = {}));
|
|
362912
|
+
/**
|
|
362913
|
+
* @schema FirestartrGithubRepositorySecretsSectionSpecContextBackendRefKind
|
|
362914
|
+
*/
|
|
362915
|
+
var FirestartrGithubRepositorySecretsSectionSpecContextBackendRefKind;
|
|
362916
|
+
(function (FirestartrGithubRepositorySecretsSectionSpecContextBackendRefKind) {
|
|
362917
|
+
/** FirestartrProviderConfig */
|
|
362918
|
+
FirestartrGithubRepositorySecretsSectionSpecContextBackendRefKind["FIRESTARTR_PROVIDER_CONFIG"] = "FirestartrProviderConfig";
|
|
362919
|
+
})(FirestartrGithubRepositorySecretsSectionSpecContextBackendRefKind || (FirestartrGithubRepositorySecretsSectionSpecContextBackendRefKind = {}));
|
|
362920
|
+
/**
|
|
362921
|
+
* A resource to handle backend and provider configuration.
|
|
362922
|
+
*
|
|
362923
|
+
* @schema FirestartrProviderConfig
|
|
362924
|
+
*/
|
|
362925
|
+
class FirestartrProviderConfig extends lib.ApiObject {
|
|
362926
|
+
/**
|
|
362927
|
+
* Renders a Kubernetes manifest for "FirestartrProviderConfig".
|
|
362928
|
+
*
|
|
362929
|
+
* This can be used to inline resource manifests inside other objects (e.g. as templates).
|
|
362930
|
+
*
|
|
362931
|
+
* @param props initialization props
|
|
362932
|
+
*/
|
|
362933
|
+
static manifest(props) {
|
|
362934
|
+
return {
|
|
362935
|
+
...FirestartrProviderConfig.GVK,
|
|
362936
|
+
...toJson_FirestartrProviderConfigProps(props),
|
|
362937
|
+
};
|
|
362938
|
+
}
|
|
362939
|
+
/**
|
|
362940
|
+
* Defines a "FirestartrProviderConfig" API object
|
|
362941
|
+
* @param scope the scope in which to define this object
|
|
362942
|
+
* @param id a scope-local name for the object
|
|
362943
|
+
* @param props initialization props
|
|
362944
|
+
*/
|
|
362945
|
+
constructor(scope, id, props) {
|
|
362946
|
+
super(scope, id, {
|
|
362947
|
+
...FirestartrProviderConfig.GVK,
|
|
362948
|
+
...props,
|
|
362949
|
+
});
|
|
362950
|
+
}
|
|
362951
|
+
/**
|
|
362952
|
+
* Renders the object to Kubernetes JSON.
|
|
362953
|
+
*/
|
|
362954
|
+
toJson() {
|
|
362955
|
+
const resolved = super.toJson();
|
|
362956
|
+
return {
|
|
362957
|
+
...FirestartrProviderConfig.GVK,
|
|
362958
|
+
...toJson_FirestartrProviderConfigProps(resolved),
|
|
362959
|
+
};
|
|
362960
|
+
}
|
|
362961
|
+
}
|
|
362962
|
+
/**
|
|
362963
|
+
* Returns the apiVersion and kind for "FirestartrProviderConfig"
|
|
362964
|
+
*/
|
|
362965
|
+
FirestartrProviderConfig.GVK = {
|
|
362966
|
+
apiVersion: 'firestartr.dev/v1',
|
|
362967
|
+
kind: 'FirestartrProviderConfig',
|
|
362968
|
+
};
|
|
362969
|
+
|
|
362970
|
+
/**
|
|
362971
|
+
* Converts an object of type 'FirestartrProviderConfigProps' to JSON representation.
|
|
362972
|
+
*/
|
|
362973
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362974
|
+
function toJson_FirestartrProviderConfigProps(obj) {
|
|
362975
|
+
if (obj === undefined) {
|
|
362976
|
+
return undefined;
|
|
362977
|
+
}
|
|
362978
|
+
const result = {
|
|
362979
|
+
'metadata': obj.metadata,
|
|
362980
|
+
'spec': toJson_FirestartrProviderConfigSpec(obj.spec),
|
|
362981
|
+
};
|
|
362982
|
+
// filter undefined values
|
|
362983
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
362984
|
+
}
|
|
362985
|
+
/**
|
|
362986
|
+
* Converts an object of type 'FirestartrProviderConfigSpec' to JSON representation.
|
|
362987
|
+
*/
|
|
362988
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
362989
|
+
function toJson_FirestartrProviderConfigSpec(obj) {
|
|
362990
|
+
if (obj === undefined) {
|
|
362991
|
+
return undefined;
|
|
362992
|
+
}
|
|
362993
|
+
const result = {
|
|
362994
|
+
'type': obj.type,
|
|
362995
|
+
'source': obj.source,
|
|
362996
|
+
'version': obj.version,
|
|
362997
|
+
'config': obj.config,
|
|
362998
|
+
'inline': obj.inline,
|
|
362999
|
+
'env': obj.env,
|
|
363000
|
+
'secrets': ((obj.secrets) === undefined) ? undefined : (Object.entries(obj.secrets).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: toJson_FirestartrProviderConfigSpecSecrets(i[1]) }), {})),
|
|
363001
|
+
};
|
|
363002
|
+
// filter undefined values
|
|
363003
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363004
|
+
}
|
|
363005
|
+
/**
|
|
363006
|
+
* Converts an object of type 'FirestartrProviderConfigSpecSecrets' to JSON representation.
|
|
363007
|
+
*/
|
|
363008
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363009
|
+
function toJson_FirestartrProviderConfigSpecSecrets(obj) {
|
|
363010
|
+
if (obj === undefined) {
|
|
363011
|
+
return undefined;
|
|
363012
|
+
}
|
|
363013
|
+
const result = {
|
|
363014
|
+
'secretRef': toJson_FirestartrProviderConfigSpecSecretsSecretRef(obj.secretRef),
|
|
363015
|
+
};
|
|
363016
|
+
// filter undefined values
|
|
363017
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363018
|
+
}
|
|
363019
|
+
/**
|
|
363020
|
+
* Converts an object of type 'FirestartrProviderConfigSpecSecretsSecretRef' to JSON representation.
|
|
363021
|
+
*/
|
|
363022
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363023
|
+
function toJson_FirestartrProviderConfigSpecSecretsSecretRef(obj) {
|
|
363024
|
+
if (obj === undefined) {
|
|
363025
|
+
return undefined;
|
|
363026
|
+
}
|
|
363027
|
+
const result = {
|
|
363028
|
+
'name': obj.name,
|
|
363029
|
+
'namespace': obj.namespace,
|
|
363030
|
+
'key': obj.key,
|
|
363031
|
+
};
|
|
363032
|
+
// filter undefined values
|
|
363033
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363034
|
+
}
|
|
363035
|
+
/* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363036
|
+
/**
|
|
363037
|
+
* A workspace to handle Terraform code
|
|
363038
|
+
*
|
|
363039
|
+
* @schema FirestartrTerraformWorkspace
|
|
363040
|
+
*/
|
|
363041
|
+
class FirestartrTerraformWorkspace extends lib.ApiObject {
|
|
363042
|
+
/**
|
|
363043
|
+
* Renders a Kubernetes manifest for "FirestartrTerraformWorkspace".
|
|
363044
|
+
*
|
|
363045
|
+
* This can be used to inline resource manifests inside other objects (e.g. as templates).
|
|
363046
|
+
*
|
|
363047
|
+
* @param props initialization props
|
|
363048
|
+
*/
|
|
363049
|
+
static manifest(props) {
|
|
363050
|
+
return {
|
|
363051
|
+
...FirestartrTerraformWorkspace.GVK,
|
|
363052
|
+
...toJson_FirestartrTerraformWorkspaceProps(props),
|
|
363053
|
+
};
|
|
363054
|
+
}
|
|
363055
|
+
/**
|
|
363056
|
+
* Defines a "FirestartrTerraformWorkspace" API object
|
|
363057
|
+
* @param scope the scope in which to define this object
|
|
363058
|
+
* @param id a scope-local name for the object
|
|
363059
|
+
* @param props initialization props
|
|
363060
|
+
*/
|
|
363061
|
+
constructor(scope, id, props) {
|
|
363062
|
+
super(scope, id, {
|
|
363063
|
+
...FirestartrTerraformWorkspace.GVK,
|
|
363064
|
+
...props,
|
|
363065
|
+
});
|
|
363066
|
+
}
|
|
363067
|
+
/**
|
|
363068
|
+
* Renders the object to Kubernetes JSON.
|
|
363069
|
+
*/
|
|
363070
|
+
toJson() {
|
|
363071
|
+
const resolved = super.toJson();
|
|
363072
|
+
return {
|
|
363073
|
+
...FirestartrTerraformWorkspace.GVK,
|
|
363074
|
+
...toJson_FirestartrTerraformWorkspaceProps(resolved),
|
|
363075
|
+
};
|
|
363076
|
+
}
|
|
363077
|
+
}
|
|
363078
|
+
/**
|
|
363079
|
+
* Returns the apiVersion and kind for "FirestartrTerraformWorkspace"
|
|
363080
|
+
*/
|
|
363081
|
+
FirestartrTerraformWorkspace.GVK = {
|
|
363082
|
+
apiVersion: 'firestartr.dev/v1',
|
|
363083
|
+
kind: 'FirestartrTerraformWorkspace',
|
|
363084
|
+
};
|
|
363085
|
+
|
|
363086
|
+
/**
|
|
363087
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceProps' to JSON representation.
|
|
363088
|
+
*/
|
|
363089
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363090
|
+
function toJson_FirestartrTerraformWorkspaceProps(obj) {
|
|
363091
|
+
if (obj === undefined) {
|
|
363092
|
+
return undefined;
|
|
363093
|
+
}
|
|
363094
|
+
const result = {
|
|
363095
|
+
'metadata': obj.metadata,
|
|
363096
|
+
'spec': toJson_FirestartrTerraformWorkspaceSpec(obj.spec),
|
|
363097
|
+
};
|
|
363098
|
+
// filter undefined values
|
|
363099
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363100
|
+
}
|
|
363101
|
+
/**
|
|
363102
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpec' to JSON representation.
|
|
363103
|
+
*/
|
|
363104
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363105
|
+
function toJson_FirestartrTerraformWorkspaceSpec(obj) {
|
|
363106
|
+
if (obj === undefined) {
|
|
363107
|
+
return undefined;
|
|
363108
|
+
}
|
|
363109
|
+
const result = {
|
|
363110
|
+
'context': toJson_FirestartrTerraformWorkspaceSpecContext(obj.context),
|
|
363111
|
+
'firestartr': toJson_FirestartrTerraformWorkspaceSpecFirestartr(obj.firestartr),
|
|
363112
|
+
'module': obj.module,
|
|
363113
|
+
'source': obj.source,
|
|
363114
|
+
'values': obj.values,
|
|
363115
|
+
'references': obj.references?.map(y => toJson_FirestartrTerraformWorkspaceSpecReferences(y)),
|
|
363116
|
+
'writeConnectionSecretToRef': toJson_FirestartrTerraformWorkspaceSpecWriteConnectionSecretToRef(obj.writeConnectionSecretToRef),
|
|
363117
|
+
};
|
|
363118
|
+
// filter undefined values
|
|
363119
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363120
|
+
}
|
|
363121
|
+
/**
|
|
363122
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpecContext' to JSON representation.
|
|
363123
|
+
*/
|
|
363124
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363125
|
+
function toJson_FirestartrTerraformWorkspaceSpecContext(obj) {
|
|
363126
|
+
if (obj === undefined) {
|
|
363127
|
+
return undefined;
|
|
363128
|
+
}
|
|
363129
|
+
const result = {
|
|
363130
|
+
'backend': toJson_FirestartrTerraformWorkspaceSpecContextBackend(obj.backend),
|
|
363131
|
+
'providers': obj.providers?.map(y => toJson_FirestartrTerraformWorkspaceSpecContextProviders(y)),
|
|
363132
|
+
};
|
|
363133
|
+
// filter undefined values
|
|
363134
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363135
|
+
}
|
|
363136
|
+
/**
|
|
363137
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpecFirestartr' to JSON representation.
|
|
363138
|
+
*/
|
|
363139
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363140
|
+
function toJson_FirestartrTerraformWorkspaceSpecFirestartr(obj) {
|
|
363141
|
+
if (obj === undefined) {
|
|
363142
|
+
return undefined;
|
|
363143
|
+
}
|
|
363144
|
+
const result = {
|
|
363145
|
+
'tfStateKey': obj.tfStateKey,
|
|
363146
|
+
};
|
|
363147
|
+
// filter undefined values
|
|
363148
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363149
|
+
}
|
|
363150
|
+
/* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363151
|
+
/**
|
|
363152
|
+
* @schema FirestartrTerraformWorkspaceSpecSource
|
|
363153
|
+
*/
|
|
363154
|
+
var FirestartrTerraformWorkspaceSpecSource;
|
|
363155
|
+
(function (FirestartrTerraformWorkspaceSpecSource) {
|
|
363156
|
+
/** Remote */
|
|
363157
|
+
FirestartrTerraformWorkspaceSpecSource["REMOTE"] = "Remote";
|
|
363158
|
+
/** Inline */
|
|
363159
|
+
FirestartrTerraformWorkspaceSpecSource["INLINE"] = "Inline";
|
|
363160
|
+
})(FirestartrTerraformWorkspaceSpecSource || (FirestartrTerraformWorkspaceSpecSource = {}));
|
|
363161
|
+
/**
|
|
363162
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpecReferences' to JSON representation.
|
|
363163
|
+
*/
|
|
363164
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363165
|
+
function toJson_FirestartrTerraformWorkspaceSpecReferences(obj) {
|
|
363166
|
+
if (obj === undefined) {
|
|
363167
|
+
return undefined;
|
|
363168
|
+
}
|
|
363169
|
+
const result = {
|
|
363170
|
+
'name': obj.name,
|
|
363171
|
+
'ref': toJson_FirestartrTerraformWorkspaceSpecReferencesRef(obj.ref),
|
|
363172
|
+
};
|
|
363173
|
+
// filter undefined values
|
|
363174
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363175
|
+
}
|
|
363176
|
+
/**
|
|
363177
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpecWriteConnectionSecretToRef' to JSON representation.
|
|
363178
|
+
*/
|
|
363179
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363180
|
+
function toJson_FirestartrTerraformWorkspaceSpecWriteConnectionSecretToRef(obj) {
|
|
363181
|
+
if (obj === undefined) {
|
|
363182
|
+
return undefined;
|
|
363183
|
+
}
|
|
363184
|
+
const result = {
|
|
363185
|
+
'name': obj.name,
|
|
363186
|
+
'outputs': obj.outputs?.map(y => toJson_FirestartrTerraformWorkspaceSpecWriteConnectionSecretToRefOutputs(y)),
|
|
363187
|
+
};
|
|
363188
|
+
// filter undefined values
|
|
363189
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363190
|
+
}
|
|
363191
|
+
/**
|
|
363192
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpecContextBackend' to JSON representation.
|
|
363193
|
+
*/
|
|
363194
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363195
|
+
function toJson_FirestartrTerraformWorkspaceSpecContextBackend(obj) {
|
|
363196
|
+
if (obj === undefined) {
|
|
363197
|
+
return undefined;
|
|
363198
|
+
}
|
|
363199
|
+
const result = {
|
|
363200
|
+
'ref': toJson_FirestartrTerraformWorkspaceSpecContextBackendRef(obj.ref),
|
|
363201
|
+
};
|
|
363202
|
+
// filter undefined values
|
|
363203
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363204
|
+
}
|
|
363205
|
+
/**
|
|
363206
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpecContextProviders' to JSON representation.
|
|
363207
|
+
*/
|
|
363208
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363209
|
+
function toJson_FirestartrTerraformWorkspaceSpecContextProviders(obj) {
|
|
363210
|
+
if (obj === undefined) {
|
|
363211
|
+
return undefined;
|
|
363212
|
+
}
|
|
363213
|
+
const result = {
|
|
363214
|
+
'ref': toJson_FirestartrTerraformWorkspaceSpecContextProvidersRef(obj.ref),
|
|
363215
|
+
};
|
|
363216
|
+
// filter undefined values
|
|
363217
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363218
|
+
}
|
|
363219
|
+
/**
|
|
363220
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpecReferencesRef' to JSON representation.
|
|
363221
|
+
*/
|
|
363222
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363223
|
+
function toJson_FirestartrTerraformWorkspaceSpecReferencesRef(obj) {
|
|
363224
|
+
if (obj === undefined) {
|
|
363225
|
+
return undefined;
|
|
363226
|
+
}
|
|
363227
|
+
const result = {
|
|
363228
|
+
'kind': obj.kind,
|
|
363229
|
+
'name': obj.name,
|
|
363230
|
+
'key': obj.key,
|
|
363231
|
+
};
|
|
363232
|
+
// filter undefined values
|
|
363233
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363234
|
+
}
|
|
363235
|
+
/**
|
|
363236
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpecWriteConnectionSecretToRefOutputs' to JSON representation.
|
|
363237
|
+
*/
|
|
363238
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363239
|
+
function toJson_FirestartrTerraformWorkspaceSpecWriteConnectionSecretToRefOutputs(obj) {
|
|
363240
|
+
if (obj === undefined) {
|
|
363241
|
+
return undefined;
|
|
363242
|
+
}
|
|
363243
|
+
const result = {
|
|
363244
|
+
'key': obj.key,
|
|
363245
|
+
};
|
|
363246
|
+
// filter undefined values
|
|
363247
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363248
|
+
}
|
|
363249
|
+
/**
|
|
363250
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpecContextBackendRef' to JSON representation.
|
|
363251
|
+
*/
|
|
363252
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363253
|
+
function toJson_FirestartrTerraformWorkspaceSpecContextBackendRef(obj) {
|
|
363254
|
+
if (obj === undefined) {
|
|
363255
|
+
return undefined;
|
|
363256
|
+
}
|
|
363257
|
+
const result = {
|
|
363258
|
+
'kind': obj.kind,
|
|
363259
|
+
'name': obj.name,
|
|
363260
|
+
};
|
|
363261
|
+
// filter undefined values
|
|
363262
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363263
|
+
}
|
|
363264
|
+
/**
|
|
363265
|
+
* Converts an object of type 'FirestartrTerraformWorkspaceSpecContextProvidersRef' to JSON representation.
|
|
363266
|
+
*/
|
|
363267
|
+
/* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363268
|
+
function toJson_FirestartrTerraformWorkspaceSpecContextProvidersRef(obj) {
|
|
363269
|
+
if (obj === undefined) {
|
|
363270
|
+
return undefined;
|
|
363271
|
+
}
|
|
363272
|
+
const result = {
|
|
363273
|
+
'kind': obj.kind,
|
|
363274
|
+
'name': obj.name,
|
|
363275
|
+
};
|
|
363276
|
+
// filter undefined values
|
|
363277
|
+
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
363278
|
+
}
|
|
363279
|
+
/* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
363012
363280
|
/**
|
|
363013
363281
|
* @schema FirestartrTerraformWorkspaceSpecReferencesRefKind
|
|
363014
363282
|
*/
|
|
@@ -363691,12 +363959,104 @@ class FeatureRepoChart extends BaseGithubChart {
|
|
|
363691
363959
|
}
|
|
363692
363960
|
}
|
|
363693
363961
|
|
|
363962
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/github/RepoSecretsSectionChart.ts
|
|
363963
|
+
|
|
363964
|
+
|
|
363965
|
+
class RepoSecretsSectionChart extends BaseGithubChart {
|
|
363966
|
+
constructor(scope, chartId, firestartrId, claim, patches = [], cr = null) {
|
|
363967
|
+
super(scope, chartId, firestartrId, claim, patches);
|
|
363968
|
+
this.set('repoCr', cr);
|
|
363969
|
+
}
|
|
363970
|
+
template() {
|
|
363971
|
+
const claim = this.get('claim');
|
|
363972
|
+
const repositoryTarget = this.resolveRepositoryTarget();
|
|
363973
|
+
const github = claim.providers?.github ?? {};
|
|
363974
|
+
const cr = {
|
|
363975
|
+
metadata: {
|
|
363976
|
+
name: this.get('repoCr').metadata.name,
|
|
363977
|
+
annotations: {
|
|
363978
|
+
'firestartr.dev/external-name': claim.name,
|
|
363979
|
+
},
|
|
363980
|
+
},
|
|
363981
|
+
spec: {
|
|
363982
|
+
context: this.get('repoCr').spec?.context,
|
|
363983
|
+
org: claim.org,
|
|
363984
|
+
repositoryTarget,
|
|
363985
|
+
secrets: {
|
|
363986
|
+
actions: this.renderSecrets('actions', github),
|
|
363987
|
+
codespaces: this.renderSecrets('codespaces', github),
|
|
363988
|
+
dependabot: this.renderSecrets('dependabot', github),
|
|
363989
|
+
},
|
|
363990
|
+
firestartr: {
|
|
363991
|
+
tfStateKey: this.get('repoCr').spec.firestartr.tfStateKey,
|
|
363992
|
+
},
|
|
363993
|
+
},
|
|
363994
|
+
};
|
|
363995
|
+
const annotations = this.getAnnotationsFromRepo(this.get('repoCr'), [
|
|
363996
|
+
'claim-ref',
|
|
363997
|
+
'revision',
|
|
363998
|
+
'sync-enabled',
|
|
363999
|
+
'sync-period',
|
|
364000
|
+
]);
|
|
364001
|
+
cr.metadata.annotations = {
|
|
364002
|
+
...cr.metadata.annotations,
|
|
364003
|
+
...annotations,
|
|
364004
|
+
};
|
|
364005
|
+
return cr;
|
|
364006
|
+
}
|
|
364007
|
+
getAnnotationsFromRepo(repoCr, inheritedAnnotations) {
|
|
364008
|
+
const annotations = {};
|
|
364009
|
+
for (const annotation of inheritedAnnotations) {
|
|
364010
|
+
const fsAnnotation = `firestartr.dev/${annotation}`;
|
|
364011
|
+
if (fsAnnotation in repoCr.metadata.annotations) {
|
|
364012
|
+
annotations[fsAnnotation] = repoCr.metadata.annotations[fsAnnotation];
|
|
364013
|
+
}
|
|
364014
|
+
}
|
|
364015
|
+
return annotations;
|
|
364016
|
+
}
|
|
364017
|
+
renderSecrets(section, githubProvider) {
|
|
364018
|
+
const secrets = [];
|
|
364019
|
+
if (githubProvider?.secrets?.[section]) {
|
|
364020
|
+
const secretsSection = githubProvider.secrets[section];
|
|
364021
|
+
for (const secret of secretsSection) {
|
|
364022
|
+
const parts = secret.value.split(':');
|
|
364023
|
+
secrets.push({
|
|
364024
|
+
name: secret.name,
|
|
364025
|
+
ref: {
|
|
364026
|
+
kind: 'Secret',
|
|
364027
|
+
name: parts[2],
|
|
364028
|
+
key: parts[3],
|
|
364029
|
+
},
|
|
364030
|
+
});
|
|
364031
|
+
}
|
|
364032
|
+
}
|
|
364033
|
+
return secrets;
|
|
364034
|
+
}
|
|
364035
|
+
gvk() {
|
|
364036
|
+
return FirestartrGithubRepositorySecretsSection.GVK;
|
|
364037
|
+
}
|
|
364038
|
+
instanceApiObject(template) {
|
|
364039
|
+
return new FirestartrGithubRepositorySecretsSection(this, `${template.metadata.name}-${template.spec.firestartr.tfStateKey}-secrets-section`, template);
|
|
364040
|
+
}
|
|
364041
|
+
resolveRepositoryTarget() {
|
|
364042
|
+
const repositoryTarget = {
|
|
364043
|
+
ref: {
|
|
364044
|
+
kind: 'FirestartrGithubRepository',
|
|
364045
|
+
name: this.get('repoCr').metadata.name,
|
|
364046
|
+
needsSecret: false,
|
|
364047
|
+
},
|
|
364048
|
+
};
|
|
364049
|
+
return repositoryTarget;
|
|
364050
|
+
}
|
|
364051
|
+
}
|
|
364052
|
+
|
|
363694
364053
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/github/repositoryChart.ts
|
|
363695
364054
|
|
|
363696
364055
|
|
|
363697
364056
|
|
|
363698
364057
|
|
|
363699
364058
|
|
|
364059
|
+
|
|
363700
364060
|
class GithubRepositoryChart extends BaseGithubChart {
|
|
363701
364061
|
template() {
|
|
363702
364062
|
const claim = this.get('claim');
|
|
@@ -363739,7 +364099,6 @@ class GithubRepositoryChart extends BaseGithubChart {
|
|
|
363739
364099
|
actions,
|
|
363740
364100
|
permissions: this.createPermissions(claim),
|
|
363741
364101
|
vars: this.createVars(claim),
|
|
363742
|
-
secrets: this.createRepoSecrets(claim),
|
|
363743
364102
|
pages: claim.providers.github.pages,
|
|
363744
364103
|
branchProtections: [],
|
|
363745
364104
|
writeConnectionSecretToRef: {
|
|
@@ -363762,6 +364121,7 @@ class GithubRepositoryChart extends BaseGithubChart {
|
|
|
363762
364121
|
async render() {
|
|
363763
364122
|
await super.render();
|
|
363764
364123
|
await this.postRenderFeatures(this.get('rendered-cr'));
|
|
364124
|
+
await this.postRenderSecretsSection(this.get('rendered-cr'));
|
|
363765
364125
|
return this;
|
|
363766
364126
|
}
|
|
363767
364127
|
gvk() {
|
|
@@ -363783,6 +364143,20 @@ class GithubRepositoryChart extends BaseGithubChart {
|
|
|
363783
364143
|
}
|
|
363784
364144
|
this.set('features', features);
|
|
363785
364145
|
}
|
|
364146
|
+
async postRenderSecretsSection(cr) {
|
|
364147
|
+
const areThereSecrets = this.get('claim').providers?.github?.secrets ?? false;
|
|
364148
|
+
if (!areThereSecrets) {
|
|
364149
|
+
return;
|
|
364150
|
+
}
|
|
364151
|
+
const secretsSectionChart = await (await new RepoSecretsSectionChart(this, 'secrets-section', cr.spec.firestartr.tfStateKey, this.get('claim'), [], cr).render()).postRenderer([]);
|
|
364152
|
+
this.set('secrets_section', {
|
|
364153
|
+
claim: {
|
|
364154
|
+
kind: secretsSectionChart.kind,
|
|
364155
|
+
name: secretsSectionChart.name,
|
|
364156
|
+
},
|
|
364157
|
+
chart: secretsSectionChart,
|
|
364158
|
+
});
|
|
364159
|
+
}
|
|
363786
364160
|
instanceApiObject(template) {
|
|
363787
364161
|
return new FirestartrGithubRepository(this, template.metadata.name, template);
|
|
363788
364162
|
}
|
|
@@ -363826,27 +364200,6 @@ class GithubRepositoryChart extends BaseGithubChart {
|
|
|
363826
364200
|
}
|
|
363827
364201
|
return vars;
|
|
363828
364202
|
}
|
|
363829
|
-
/**
|
|
363830
|
-
* @description This method creates the secrets data for the repository
|
|
363831
|
-
* @param claim
|
|
363832
|
-
* @returns RepoSecretsConfiguration
|
|
363833
|
-
*/
|
|
363834
|
-
createRepoSecrets(claim) {
|
|
363835
|
-
const repoSecrets = {};
|
|
363836
|
-
const repoSecretsDefinitions = claim.providers?.github?.secrets;
|
|
363837
|
-
if (repoSecretsDefinitions) {
|
|
363838
|
-
if (repoSecretsDefinitions.actions) {
|
|
363839
|
-
repoSecrets.actions = this.formatRepoSecrets(repoSecretsDefinitions.actions);
|
|
363840
|
-
}
|
|
363841
|
-
if (repoSecretsDefinitions.codespaces) {
|
|
363842
|
-
repoSecrets.codespaces = this.formatRepoSecrets(repoSecretsDefinitions.codespaces);
|
|
363843
|
-
}
|
|
363844
|
-
if (repoSecretsDefinitions.dependabot) {
|
|
363845
|
-
repoSecrets.dependabot = this.formatRepoSecrets(repoSecretsDefinitions.dependabot);
|
|
363846
|
-
}
|
|
363847
|
-
}
|
|
363848
|
-
return repoSecrets;
|
|
363849
|
-
}
|
|
363850
364203
|
formatVars(blockDefinition) {
|
|
363851
364204
|
return blockDefinition.map((varDef) => {
|
|
363852
364205
|
if (isRepoSecretRef(varDef.value)) {
|
|
@@ -363868,26 +364221,11 @@ class GithubRepositoryChart extends BaseGithubChart {
|
|
|
363868
364221
|
}
|
|
363869
364222
|
});
|
|
363870
364223
|
}
|
|
363871
|
-
formatRepoSecrets(blockDefinition) {
|
|
363872
|
-
return blockDefinition.map((secretDef) => {
|
|
363873
|
-
if (isRepoSecretRef(secretDef.value)) {
|
|
363874
|
-
const parts = secretDef.value.split(':');
|
|
363875
|
-
return {
|
|
363876
|
-
name: secretDef.name,
|
|
363877
|
-
ref: {
|
|
363878
|
-
kind: 'Secret',
|
|
363879
|
-
name: parts[2],
|
|
363880
|
-
key: parts[3],
|
|
363881
|
-
},
|
|
363882
|
-
};
|
|
363883
|
-
}
|
|
363884
|
-
else {
|
|
363885
|
-
throw new Error(`RepoSecret value is not correct: ${secretDef.value}`);
|
|
363886
|
-
}
|
|
363887
|
-
});
|
|
363888
|
-
}
|
|
363889
364224
|
extraCharts() {
|
|
363890
|
-
|
|
364225
|
+
const charts = [this.get('secrets_section') ?? undefined];
|
|
364226
|
+
return charts
|
|
364227
|
+
.concat(this.get('features') ?? [])
|
|
364228
|
+
.filter((chart) => chart);
|
|
363891
364229
|
}
|
|
363892
364230
|
}
|
|
363893
364231
|
|
|
@@ -363910,10 +364248,7 @@ class GithubOrgWebhookChart extends BaseGithubChart {
|
|
|
363910
364248
|
webhook: {
|
|
363911
364249
|
url: claim.providers.github.webhook.url,
|
|
363912
364250
|
contentType: claim.providers.github.webhook.contentType,
|
|
363913
|
-
secretRef:
|
|
363914
|
-
name: claim.providers.github.webhook.secretRef.name,
|
|
363915
|
-
key: claim.providers.github.webhook.secretRef.key,
|
|
363916
|
-
},
|
|
364251
|
+
secretRef: this.renderSecret(claim.providers.github.webhook.secretRef),
|
|
363917
364252
|
active: claim.providers.github.webhook.active,
|
|
363918
364253
|
events: claim.providers.github.webhook.events,
|
|
363919
364254
|
},
|
|
@@ -363924,6 +364259,17 @@ class GithubOrgWebhookChart extends BaseGithubChart {
|
|
|
363924
364259
|
},
|
|
363925
364260
|
};
|
|
363926
364261
|
}
|
|
364262
|
+
renderSecret(secret) {
|
|
364263
|
+
const parts = secret.split(':');
|
|
364264
|
+
if (parts.length < 4) {
|
|
364265
|
+
throw `GithubOrgWebhookChart: invalid secretRef: ${secret}. Expected format: <provider>:<namespace>:<name>:<key>`;
|
|
364266
|
+
}
|
|
364267
|
+
return {
|
|
364268
|
+
kind: 'Secret',
|
|
364269
|
+
name: parts[2],
|
|
364270
|
+
key: parts[3],
|
|
364271
|
+
};
|
|
364272
|
+
}
|
|
363927
364273
|
gvk() {
|
|
363928
364274
|
return FirestartrGithubOrgWebhook.GVK;
|
|
363929
364275
|
}
|
|
@@ -364470,7 +364816,7 @@ class SecretsChart extends BaseSecretsChart {
|
|
|
364470
364816
|
gvk() {
|
|
364471
364817
|
return {
|
|
364472
364818
|
kind: 'ExternalSecret/PushSecret',
|
|
364473
|
-
apiVersion: 'external-secrets.io/
|
|
364819
|
+
apiVersion: 'external-secrets.io/v1alpha1',
|
|
364474
364820
|
};
|
|
364475
364821
|
}
|
|
364476
364822
|
extraCharts() {
|
|
@@ -364478,7 +364824,8 @@ class SecretsChart extends BaseSecretsChart {
|
|
|
364478
364824
|
const pushSecrets = this.get('pushSecrets');
|
|
364479
364825
|
const kind = this.get('claim').kind;
|
|
364480
364826
|
const name = this.get('claim').name;
|
|
364481
|
-
const concatenated =
|
|
364827
|
+
const concatenated = []
|
|
364828
|
+
.concat(externalSecrets)
|
|
364482
364829
|
.concat(pushSecrets)
|
|
364483
364830
|
.filter((el) => el !== undefined);
|
|
364484
364831
|
return concatenated.map((chart) => {
|
|
@@ -364553,7 +364900,7 @@ class SecretsChart extends BaseSecretsChart {
|
|
|
364553
364900
|
}
|
|
364554
364901
|
for (const pushSecret of pushSecretsFromClaim) {
|
|
364555
364902
|
const k8sResource = {
|
|
364556
|
-
apiVersion: 'external-secrets.io/
|
|
364903
|
+
apiVersion: 'external-secrets.io/v1alpha1',
|
|
364557
364904
|
kind: 'PushSecret',
|
|
364558
364905
|
metadata: {
|
|
364559
364906
|
name: catalog_common.generic.normalizeName(`${pushSecret.secretName}-${claim.name}`),
|
|
@@ -364832,7 +365179,7 @@ function validateClaimsSecretsRefs(ref, renderClaims) {
|
|
|
364832
365179
|
if (!secrets) {
|
|
364833
365180
|
return;
|
|
364834
365181
|
}
|
|
364835
|
-
for (const section of ['actions', 'codespaces', '
|
|
365182
|
+
for (const section of ['actions', 'codespaces', 'dependabot']) {
|
|
364836
365183
|
const secretsSection = secrets[section];
|
|
364837
365184
|
if (!secretsSection) {
|
|
364838
365185
|
continue;
|
|
@@ -366046,12 +366393,7 @@ async function moveCRsAndClaims(crs, org, claimsPath, resourcesPath) {
|
|
|
366046
366393
|
const importedResources = [];
|
|
366047
366394
|
const failedImportedResources = [];
|
|
366048
366395
|
for (const k of Object.keys(crs)) {
|
|
366049
|
-
if (crs[k]
|
|
366050
|
-
crs[k].metadata.name === `${org}-all`) {
|
|
366051
|
-
importer_src_logger.info(`⚡ SKIP IMPORT: CR is the all group, skipping import with kind: ${crs[k].kind} and name: ${crs[k].metadata.name}`);
|
|
366052
|
-
continue;
|
|
366053
|
-
}
|
|
366054
|
-
else if (cdk8s_renderer.isCatalogEntity(crs[k])) {
|
|
366396
|
+
if (cdk8s_renderer.isCatalogEntity(crs[k])) {
|
|
366055
366397
|
importer_src_logger.info(`⚡ SKIP IMPORT: CR is a catalog entity, skipping import with kind: ${crs[k].kind} and name: ${crs[k].metadata.name}`);
|
|
366056
366398
|
continue;
|
|
366057
366399
|
}
|
|
@@ -366508,6 +366850,7 @@ const kindPluralMap = {
|
|
|
366508
366850
|
githubmemberships: 'FirestartrGithubMembership',
|
|
366509
366851
|
githubrepositories: 'FirestartrGithubRepository',
|
|
366510
366852
|
githubrepositoryfeatures: 'FirestartrGithubRepositoryFeature',
|
|
366853
|
+
githubrepositorysecretssections: 'FirestartrGithubRepositorySecretsSection',
|
|
366511
366854
|
terraformmodules: 'FirestartrTerraformModule',
|
|
366512
366855
|
githuborgwebhooks: 'FirestartrGithubOrgWebhook',
|
|
366513
366856
|
terraformworkspaces: 'FirestartrTerraformWorkspace',
|
|
@@ -367122,6 +367465,28 @@ async function needsProvisioningOnCreate(cr) {
|
|
|
367122
367465
|
operator_src_logger.debug(`Skipping the provisioning process for custom resource '${cr.kind}/${cr.metadata.name}' because its current state is not handled.`);
|
|
367123
367466
|
return false;
|
|
367124
367467
|
}
|
|
367468
|
+
async function updateSyncTransition(itemPath, reason, lastSyncTime, nextSyncTime, message, status) {
|
|
367469
|
+
operator_src_logger.info(`The item at '${itemPath}' transitioned to a new SYNCHRONIZED condition of '${status}'. The reason for the change is '${reason}' with the message: '${message}'.`);
|
|
367470
|
+
const k8sItem = await getItemByItemPath(itemPath);
|
|
367471
|
+
if (!('status' in k8sItem))
|
|
367472
|
+
k8sItem.status = {};
|
|
367473
|
+
if (!('conditions' in k8sItem.status))
|
|
367474
|
+
k8sItem.status.conditions = [];
|
|
367475
|
+
let conditionObject = getRelevantCondition(k8sItem.status.conditions, 'SYNCHRONIZED');
|
|
367476
|
+
conditionObject = {
|
|
367477
|
+
...conditionObject,
|
|
367478
|
+
reason,
|
|
367479
|
+
status,
|
|
367480
|
+
message,
|
|
367481
|
+
observedGeneration: k8sItem.metadata.generation,
|
|
367482
|
+
lastSyncTime,
|
|
367483
|
+
lastUpdateTime: new Date().toJSON(),
|
|
367484
|
+
nextSyncTime,
|
|
367485
|
+
};
|
|
367486
|
+
k8sItem.status.conditions = updateConditionByType(k8sItem.status.conditions, 'SYNCHRONIZED', conditionObject);
|
|
367487
|
+
const itemParameters = itemPath.split('/');
|
|
367488
|
+
await writeStatus(itemParameters[1], itemParameters[0], k8sItem);
|
|
367489
|
+
}
|
|
367125
367490
|
async function updateTransition(itemPath, reason, type, statusValue, message = '', updateStatusOnly = false) {
|
|
367126
367491
|
operator_src_logger.info(`The item at '${itemPath}' transitioned to a new status of '${statusValue}' (type: '${type}'). The reason for the change is '${reason}' with the message: '${message}'. This was a status-only update: '${updateStatusOnly}'.`);
|
|
367127
367492
|
const k8sItem = await getItemByItemPath(itemPath);
|
|
@@ -367182,12 +367547,144 @@ function updateConditionByType(conditionList, type, newCondition) {
|
|
|
367182
367547
|
return conditionList;
|
|
367183
367548
|
}
|
|
367184
367549
|
|
|
367185
|
-
;// CONCATENATED MODULE: ../operator/src/
|
|
367550
|
+
;// CONCATENATED MODULE: ../operator/src/syncCtl.ts
|
|
367551
|
+
// Machinery for syncing
|
|
367552
|
+
|
|
367553
|
+
|
|
367186
367554
|
|
|
367187
367555
|
|
|
367188
|
-
const syncWatchers = {};
|
|
367189
|
-
const FORCE_REVISION_TIME = 60 * 1000;
|
|
367190
367556
|
const DEFAULT_REVISION_TIME = '1m';
|
|
367557
|
+
async function createWatcherForItem(itemPath, itemCR) {
|
|
367558
|
+
const item = itemCR ?? (await getItemByItemPath(itemPath));
|
|
367559
|
+
const syncStatus = await getSyncStatus(itemPath, item);
|
|
367560
|
+
let nextTimeoutInMS = syncStatus.nextTimeoutInMS;
|
|
367561
|
+
// we have lapsed last interval
|
|
367562
|
+
// we calculate from the lastSyncTime
|
|
367563
|
+
if (syncStatus.intervalLapsed) {
|
|
367564
|
+
operator_src_logger.debug(`Next sync interval have been lapsed for ${itemPath}`);
|
|
367565
|
+
if (syncStatus.syncMode === 'Period') {
|
|
367566
|
+
operator_src_logger.debug(`Next sync interval have been lapsed for ${itemPath} the sync will start now`);
|
|
367567
|
+
nextTimeoutInMS = -1;
|
|
367568
|
+
}
|
|
367569
|
+
}
|
|
367570
|
+
const syncInfo = syncStatus.conditions?.[0] ?? null;
|
|
367571
|
+
const watcher = {
|
|
367572
|
+
itemPath,
|
|
367573
|
+
lastRevision: setTimeout(() => {
|
|
367574
|
+
operator_src_logger.debug(`Item ${itemPath} needs revision`);
|
|
367575
|
+
watcher.needsRevision = true;
|
|
367576
|
+
watcher.alreadyFired = true;
|
|
367577
|
+
}, nextTimeoutInMS),
|
|
367578
|
+
needsRevision: false,
|
|
367579
|
+
nextSync: syncInfo ? syncInfo?.nextSyncTime : undefined,
|
|
367580
|
+
syncMode: syncStatus.syncMode,
|
|
367581
|
+
alreadyFired: false,
|
|
367582
|
+
};
|
|
367583
|
+
return watcher;
|
|
367584
|
+
}
|
|
367585
|
+
async function destroyWatcherForItem(watcher) {
|
|
367586
|
+
clearTimeout(watcher.lastRevision);
|
|
367587
|
+
operator_src_logger.debug(`Disabled SyncWatcher for ${watcher.itemPath}`);
|
|
367588
|
+
}
|
|
367589
|
+
async function getSyncSpecs(itemPath, itemCR) {
|
|
367590
|
+
const item = itemCR ?? (await getItemByItemPath(itemPath));
|
|
367591
|
+
return {
|
|
367592
|
+
item,
|
|
367593
|
+
syncable: helperIsSyncable(item),
|
|
367594
|
+
period: item.metadata.annotations['firestartr.dev/sync-period'] ||
|
|
367595
|
+
DEFAULT_REVISION_TIME,
|
|
367596
|
+
schedule: item.metadata.annotations['firestartr.dev/sync-schedule'] || false,
|
|
367597
|
+
scheduleTZ: item.metadata.annotations['firestartr.dev/sync-schedule-timezone'] ||
|
|
367598
|
+
'Europe/Madrid',
|
|
367599
|
+
};
|
|
367600
|
+
}
|
|
367601
|
+
async function getSyncStatus(itemPath, itemCR) {
|
|
367602
|
+
const item = itemCR ?? (await getItemByItemPath(itemPath));
|
|
367603
|
+
const syncCondition = getConditionByType(item.status?.conditions ?? [], 'SYNCHRONIZED');
|
|
367604
|
+
// no sync condition present
|
|
367605
|
+
if (!syncCondition) {
|
|
367606
|
+
return {
|
|
367607
|
+
syncStatusPresent: false,
|
|
367608
|
+
};
|
|
367609
|
+
}
|
|
367610
|
+
else {
|
|
367611
|
+
const nextSyncDate = new Date(syncCondition.nextSyncTime);
|
|
367612
|
+
const isLapsed = Date.now() >= nextSyncDate.getTime();
|
|
367613
|
+
const mode = !helperIsSyncable(item)
|
|
367614
|
+
? 'NotSyncable'
|
|
367615
|
+
: (await getSyncSpecs(itemPath, item)).schedule
|
|
367616
|
+
? 'Scheduled'
|
|
367617
|
+
: 'Period';
|
|
367618
|
+
return {
|
|
367619
|
+
itemPath,
|
|
367620
|
+
syncMode: mode,
|
|
367621
|
+
conditions: [syncCondition],
|
|
367622
|
+
syncStatusPresent: true,
|
|
367623
|
+
nextTimeoutInMS: isLapsed ? -1 : nextSyncDate.getTime() - Date.now(),
|
|
367624
|
+
intervalLapsed: isLapsed,
|
|
367625
|
+
};
|
|
367626
|
+
}
|
|
367627
|
+
}
|
|
367628
|
+
async function setSyncStatus(itemPath, reason, status, message) {
|
|
367629
|
+
const item = await getItemByItemPath(itemPath);
|
|
367630
|
+
const machinery = assessSyncCalculationMachinery(item);
|
|
367631
|
+
const syncStatus = await machinery(item, reason, status, message);
|
|
367632
|
+
syncStatus.itemPath = itemPath;
|
|
367633
|
+
syncStatus.syncStatusPresent = true;
|
|
367634
|
+
operator_src_logger.info(`Setting sync status for ${itemPath}: ${JSON.stringify(syncStatus)}`);
|
|
367635
|
+
const syncTransition = syncStatus.conditions[0];
|
|
367636
|
+
await updateSyncTransition(itemPath, syncTransition.reason, syncTransition.lastSyncTime, syncTransition.nextSyncTime, syncTransition.message, syncTransition.status);
|
|
367637
|
+
return syncStatus;
|
|
367638
|
+
}
|
|
367639
|
+
function assessSyncCalculationMachinery(item) {
|
|
367640
|
+
if (!helperIsSyncable(item)) {
|
|
367641
|
+
return processNotSyncable;
|
|
367642
|
+
}
|
|
367643
|
+
else if (item.metadata.annotations['firestartr.dev/sync-schedule'] ??
|
|
367644
|
+
false) {
|
|
367645
|
+
return processScheduledSync;
|
|
367646
|
+
}
|
|
367647
|
+
else {
|
|
367648
|
+
return processPeriodSync;
|
|
367649
|
+
}
|
|
367650
|
+
}
|
|
367651
|
+
function helperIsSyncable(item) {
|
|
367652
|
+
return (item.metadata.annotations &&
|
|
367653
|
+
item.metadata.annotations['firestartr.dev/sync-enabled'] &&
|
|
367654
|
+
item.metadata.annotations['firestartr.dev/sync-enabled'] === 'true');
|
|
367655
|
+
}
|
|
367656
|
+
async function processNotSyncable(item, reason, status, message) {
|
|
367657
|
+
return {
|
|
367658
|
+
syncMode: 'NotSyncable',
|
|
367659
|
+
conditions: [
|
|
367660
|
+
{
|
|
367661
|
+
reason,
|
|
367662
|
+
type: 'SYNCHRONIZED',
|
|
367663
|
+
message,
|
|
367664
|
+
status,
|
|
367665
|
+
lastSyncTime: new Date().toISOString(),
|
|
367666
|
+
nextSyncTime: new Date().toISOString(),
|
|
367667
|
+
},
|
|
367668
|
+
],
|
|
367669
|
+
};
|
|
367670
|
+
}
|
|
367671
|
+
async function processPeriodSync(item, reason, status, message) {
|
|
367672
|
+
const period = item.metadata.annotations['firestartr.dev/sync-period'];
|
|
367673
|
+
const periodMS = helperCalculateRevisionTime(period);
|
|
367674
|
+
return {
|
|
367675
|
+
syncMode: 'Period',
|
|
367676
|
+
conditions: [
|
|
367677
|
+
{
|
|
367678
|
+
reason,
|
|
367679
|
+
type: 'SYNCHRONIZED',
|
|
367680
|
+
message,
|
|
367681
|
+
status,
|
|
367682
|
+
lastSyncTime: new Date().toISOString(),
|
|
367683
|
+
nextSyncTime: new Date(Date.now() + periodMS).toISOString(),
|
|
367684
|
+
},
|
|
367685
|
+
],
|
|
367686
|
+
};
|
|
367687
|
+
}
|
|
367191
367688
|
function helperCalculateRevisionTime(period) {
|
|
367192
367689
|
const [_, scalar, dimension] = period.split(/(\d+)/);
|
|
367193
367690
|
const multiplier = dimension === 's'
|
|
@@ -367201,24 +367698,97 @@ function helperCalculateRevisionTime(period) {
|
|
|
367201
367698
|
: 1;
|
|
367202
367699
|
return Number(scalar) * multiplier * 1000;
|
|
367203
367700
|
}
|
|
367701
|
+
async function processScheduledSync(item, reason, status, message) {
|
|
367702
|
+
const nextPeriod = catalog_common.cron.getCronNextInterval(item.metadata.annotations['firestartr.dev/sync-schedule'], item.metadata.annotations['firestartr.dev/sync-schedule-timezone'] ||
|
|
367703
|
+
undefined);
|
|
367704
|
+
const nextPeriodDate = new Date(nextPeriod);
|
|
367705
|
+
return {
|
|
367706
|
+
syncMode: 'Scheduled',
|
|
367707
|
+
conditions: [
|
|
367708
|
+
{
|
|
367709
|
+
reason,
|
|
367710
|
+
type: 'SYNCHRONIZED',
|
|
367711
|
+
message,
|
|
367712
|
+
status,
|
|
367713
|
+
lastSyncTime: new Date().toISOString(),
|
|
367714
|
+
nextSyncTime: nextPeriodDate.toISOString(),
|
|
367715
|
+
},
|
|
367716
|
+
],
|
|
367717
|
+
};
|
|
367718
|
+
}
|
|
367719
|
+
|
|
367720
|
+
;// CONCATENATED MODULE: ../operator/src/syncer.debug.ts
|
|
367721
|
+
|
|
367722
|
+
|
|
367723
|
+
let running = false;
|
|
367724
|
+
let waitingF = null;
|
|
367725
|
+
async function syncerDebug(syncWatchers) {
|
|
367726
|
+
if (running)
|
|
367727
|
+
return waitUntilDone(syncWatchers);
|
|
367728
|
+
running = true;
|
|
367729
|
+
try {
|
|
367730
|
+
await writeDownSyncer(syncWatchers);
|
|
367731
|
+
running = false;
|
|
367732
|
+
}
|
|
367733
|
+
catch (err) {
|
|
367734
|
+
operator_src_logger.error(`PANIC!!! sync debug could not be written ${err}`);
|
|
367735
|
+
running = false;
|
|
367736
|
+
}
|
|
367737
|
+
}
|
|
367738
|
+
async function waitUntilDone(syncWatchers) {
|
|
367739
|
+
if (waitingF)
|
|
367740
|
+
return;
|
|
367741
|
+
waitingF = setTimeout(() => {
|
|
367742
|
+
syncerDebug(syncWatchers).catch((err) => {
|
|
367743
|
+
operator_src_logger.error(`Caught error: ${err}`);
|
|
367744
|
+
throw `Caught error: ${err}`;
|
|
367745
|
+
});
|
|
367746
|
+
clearTimeout(waitingF);
|
|
367747
|
+
waitingF = null;
|
|
367748
|
+
}, 300);
|
|
367749
|
+
}
|
|
367750
|
+
async function writeDownSyncer(syncWatchers) {
|
|
367751
|
+
let output = '';
|
|
367752
|
+
for (const watcher of Object.values(syncWatchers)) {
|
|
367753
|
+
output += `${watcher.itemPath} - (${watcher.syncMode}) - next: ${watcher.nextSync} \n`;
|
|
367754
|
+
}
|
|
367755
|
+
return new Promise((ok, ko) => {
|
|
367756
|
+
external_fs_.writeFile('/tmp/syncs', output, (err) => {
|
|
367757
|
+
if (err)
|
|
367758
|
+
return ko(`Error writing the /tmp/syncs: ${err}`);
|
|
367759
|
+
else
|
|
367760
|
+
return ok();
|
|
367761
|
+
});
|
|
367762
|
+
});
|
|
367763
|
+
}
|
|
367764
|
+
|
|
367765
|
+
;// CONCATENATED MODULE: ../operator/src/syncer.ts
|
|
367766
|
+
|
|
367767
|
+
|
|
367768
|
+
|
|
367769
|
+
|
|
367770
|
+
const syncWatchers = {};
|
|
367771
|
+
const FORCE_REVISION_TIME = (/* unused pure expression or super */ null && (60 * 1000));
|
|
367204
367772
|
async function syncer(enqueue) {
|
|
367205
|
-
|
|
367206
|
-
void loop(enqueue);
|
|
367207
|
-
return {
|
|
367773
|
+
const api = {
|
|
367208
367774
|
addItem(itemPath) {
|
|
367209
367775
|
operator_src_logger.info(`Added item of path '${itemPath}' for synchronization`);
|
|
367210
|
-
|
|
367776
|
+
getSyncSpecs(itemPath)
|
|
367777
|
+
.then(async (itemSyncInfo) => {
|
|
367211
367778
|
if (!itemSyncInfo.syncable) {
|
|
367212
367779
|
return;
|
|
367213
367780
|
}
|
|
367214
|
-
|
|
367215
|
-
|
|
367216
|
-
lastRevision: setInterval(() => {
|
|
367217
|
-
syncWatchers[itemPath].needsRevision = true;
|
|
367218
|
-
}, helperCalculateRevisionTime(itemSyncInfo.period)),
|
|
367219
|
-
needsRevision: false,
|
|
367220
|
-
};
|
|
367781
|
+
const syncCtl = await getSyncStatus(itemPath, itemSyncInfo.item);
|
|
367782
|
+
syncWatchers[itemPath] = await createWatcherForItem(itemPath, itemSyncInfo.item);
|
|
367221
367783
|
operator_src_logger.info(`Configured synchronization for item at path '${itemPath}'`);
|
|
367784
|
+
operator_src_logger.debug(`Sync information for '${itemPath}': ${JSON.stringify({ ...itemSyncInfo, item: null }, null)}`);
|
|
367785
|
+
syncerDebug(syncWatchers).catch((err) => {
|
|
367786
|
+
throw `Error syncer debug: ${err}`;
|
|
367787
|
+
});
|
|
367788
|
+
})
|
|
367789
|
+
.catch((err) => {
|
|
367790
|
+
operator_src_logger.error(`Error on sync [add item]: ${err}`);
|
|
367791
|
+
throw `Error on sync [add item]: ${err}`;
|
|
367222
367792
|
});
|
|
367223
367793
|
},
|
|
367224
367794
|
updateItem(itemPath) {
|
|
@@ -367227,27 +367797,27 @@ async function syncer(enqueue) {
|
|
|
367227
367797
|
// return
|
|
367228
367798
|
//}
|
|
367229
367799
|
operator_src_logger.debug(`Updated item of path '${itemPath}' during synchronization`);
|
|
367230
|
-
|
|
367231
|
-
|
|
367232
|
-
|
|
367233
|
-
|
|
367234
|
-
|
|
367235
|
-
operator_src_logger.info(`Removed item of path '${itemPath}' from synchronization`);
|
|
367236
|
-
}
|
|
367800
|
+
return getSyncSpecs(itemPath)
|
|
367801
|
+
.then(async (itemSyncInfo) => {
|
|
367802
|
+
if (syncWatchers[itemPath]) {
|
|
367803
|
+
await destroyWatcherForItem(syncWatchers[itemPath]);
|
|
367804
|
+
delete syncWatchers[itemPath];
|
|
367237
367805
|
}
|
|
367238
|
-
|
|
367239
|
-
|
|
367240
|
-
|
|
367241
|
-
|
|
367242
|
-
syncWatchers[itemPath] = {
|
|
367243
|
-
itemPath,
|
|
367244
|
-
lastRevision: setInterval(() => {
|
|
367245
|
-
syncWatchers[itemPath].needsRevision = true;
|
|
367246
|
-
}, helperCalculateRevisionTime(itemSyncInfo.period)),
|
|
367247
|
-
needsRevision: false,
|
|
367248
|
-
};
|
|
367249
|
-
operator_src_logger.debug(`Configured synchronization for item at path '${itemPath}' with watcher '${syncWatchers[itemPath]}'`);
|
|
367806
|
+
// we need to check if the item is not syncable anymore
|
|
367807
|
+
if (!itemSyncInfo.syncable) {
|
|
367808
|
+
operator_src_logger.info(`Removed item of path '${itemPath}' from synchronization`);
|
|
367809
|
+
return;
|
|
367250
367810
|
}
|
|
367811
|
+
// if it is syncable we need to recalculate everything
|
|
367812
|
+
syncWatchers[itemPath] = await createWatcherForItem(itemPath);
|
|
367813
|
+
operator_src_logger.info(`Configured synchronization for item at path '${itemPath}' with watcher`);
|
|
367814
|
+
syncerDebug(syncWatchers).catch((err) => {
|
|
367815
|
+
throw `Error syncer debug: ${err}`;
|
|
367816
|
+
});
|
|
367817
|
+
})
|
|
367818
|
+
.catch((err) => {
|
|
367819
|
+
operator_src_logger.error(`Error on sync [updateItem]: ${err}`);
|
|
367820
|
+
throw `Error on sync [updateItem]: ${err}`;
|
|
367251
367821
|
});
|
|
367252
367822
|
},
|
|
367253
367823
|
deleteItem(itemPath) {
|
|
@@ -367255,35 +367825,54 @@ async function syncer(enqueue) {
|
|
|
367255
367825
|
operator_src_logger.debug(`Ignored deletion attempt for item at path '${itemPath}' as it was not found during synchronization`);
|
|
367256
367826
|
return;
|
|
367257
367827
|
}
|
|
367258
|
-
|
|
367259
|
-
|
|
367260
|
-
|
|
367261
|
-
|
|
367828
|
+
destroyWatcherForItem(syncWatchers[itemPath])
|
|
367829
|
+
.then(() => {
|
|
367830
|
+
operator_src_logger.debug(`Deleted item of path '${itemPath}' during synchronization`);
|
|
367831
|
+
delete syncWatchers[itemPath];
|
|
367832
|
+
syncerDebug(syncWatchers).catch((err) => {
|
|
367833
|
+
throw `Error syncer debug: ${err}`;
|
|
367834
|
+
});
|
|
367835
|
+
})
|
|
367836
|
+
.catch((err) => {
|
|
367837
|
+
operator_src_logger.error(`Error deleting item of path ${itemPath} for synchronization: ${err}`);
|
|
367838
|
+
throw `Error deleting item of path ${itemPath} for synchronization: ${err}`;
|
|
367839
|
+
});
|
|
367262
367840
|
},
|
|
367263
367841
|
};
|
|
367842
|
+
// fork
|
|
367843
|
+
void loop(enqueue, api);
|
|
367844
|
+
return api;
|
|
367264
367845
|
}
|
|
367265
|
-
async function loop(enqueueIfNeeded) {
|
|
367846
|
+
async function loop(enqueueIfNeeded, api) {
|
|
367847
|
+
void loopKeeper(api);
|
|
367266
367848
|
while (1) {
|
|
367267
367849
|
await fWait();
|
|
367268
367850
|
const needRevisionItems = Object.values(syncWatchers).filter((watcher) => watcher.needsRevision);
|
|
367269
367851
|
for (const watcher of needRevisionItems) {
|
|
367270
367852
|
const item = await getItemIfNeededSync(watcher);
|
|
367853
|
+
operator_src_logger.debug(`Item needs revision ${watcher.itemPath}`);
|
|
367271
367854
|
if (item !== null) {
|
|
367272
367855
|
enqueueIfNeeded(item);
|
|
367273
|
-
watcher.needsRevision = false;
|
|
367274
367856
|
}
|
|
367857
|
+
watcher.needsRevision = false;
|
|
367275
367858
|
}
|
|
367276
367859
|
}
|
|
367277
367860
|
}
|
|
367278
|
-
async function
|
|
367279
|
-
|
|
367280
|
-
|
|
367281
|
-
|
|
367282
|
-
|
|
367283
|
-
|
|
367284
|
-
|
|
367285
|
-
|
|
367286
|
-
|
|
367861
|
+
async function loopKeeper(api) {
|
|
367862
|
+
try {
|
|
367863
|
+
while (1) {
|
|
367864
|
+
await fWait(5);
|
|
367865
|
+
for (const watcher of Object.values(syncWatchers)) {
|
|
367866
|
+
if (watcher.alreadyFired) {
|
|
367867
|
+
await api.updateItem(watcher.itemPath);
|
|
367868
|
+
}
|
|
367869
|
+
}
|
|
367870
|
+
}
|
|
367871
|
+
}
|
|
367872
|
+
catch (err) {
|
|
367873
|
+
operator_src_logger.error(`PANIC!: loopKeeper has failed: ${err}`);
|
|
367874
|
+
process.exit(1);
|
|
367875
|
+
}
|
|
367287
367876
|
}
|
|
367288
367877
|
async function getItemIfNeededSync(watcher) {
|
|
367289
367878
|
const item = await getItemByItemPath(watcher.itemPath);
|
|
@@ -367293,13 +367882,7 @@ async function getItemIfNeededSync(watcher) {
|
|
|
367293
367882
|
const isDeleting = item.status?.conditions?.find((condition) => condition.type === 'DELETING' && condition.status === 'True');
|
|
367294
367883
|
if (isDeleting)
|
|
367295
367884
|
return null;
|
|
367296
|
-
|
|
367297
|
-
if (!synchronizedCondition)
|
|
367298
|
-
return item;
|
|
367299
|
-
const lastSync = new Date(synchronizedCondition.lastUpdateTime).getTime();
|
|
367300
|
-
if (lastSync <= Date.now() - FORCE_REVISION_TIME)
|
|
367301
|
-
return item;
|
|
367302
|
-
return null;
|
|
367885
|
+
return item;
|
|
367303
367886
|
}
|
|
367304
367887
|
function fWait(segs = 1) {
|
|
367305
367888
|
return new Promise((ok) => {
|
|
@@ -367555,6 +368138,7 @@ var WorkStatus;
|
|
|
367555
368138
|
|
|
367556
368139
|
|
|
367557
368140
|
|
|
368141
|
+
|
|
367558
368142
|
const kindsWithFinalizer = [
|
|
367559
368143
|
'FirestartrTerraformWorkspace',
|
|
367560
368144
|
'FirestartrGithubGroup',
|
|
@@ -367562,6 +368146,7 @@ const kindsWithFinalizer = [
|
|
|
367562
368146
|
'FirestartrGithubRepository',
|
|
367563
368147
|
'FirestartrGithubRepositoryFeature',
|
|
367564
368148
|
'FirestartrGithubOrgWebhook',
|
|
368149
|
+
'FirestartrGithubRepositorySecretsSection',
|
|
367565
368150
|
];
|
|
367566
368151
|
/**
|
|
367567
368152
|
* Observe whenever a new item is added, modified or deleted in a given kind
|
|
@@ -367674,15 +368259,18 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
|
|
|
367674
368259
|
success: () => retryCtl.successReconciling(informer_itemPath(pluralKind, workItem.item)),
|
|
367675
368260
|
};
|
|
367676
368261
|
workItem.process = async function* (item, operation, handler) {
|
|
367677
|
-
|
|
367678
|
-
yield transition;
|
|
367679
|
-
}
|
|
367680
|
-
if (operation === OperationType.RENAMED ||
|
|
368262
|
+
const needsUpdateSyncConditions = operation === OperationType.RENAMED ||
|
|
367681
368263
|
operation === OperationType.UPDATED ||
|
|
367682
368264
|
operation === OperationType.SYNC ||
|
|
367683
368265
|
operation === OperationType.CREATED ||
|
|
367684
|
-
operation === OperationType.RETRY
|
|
367685
|
-
|
|
368266
|
+
operation === OperationType.RETRY;
|
|
368267
|
+
await setSyncStatus(workItem.handler.itemPath(), operation, 'False', 'Sync process started');
|
|
368268
|
+
for await (const transition of compute(item, operation, handler)) {
|
|
368269
|
+
yield transition;
|
|
368270
|
+
}
|
|
368271
|
+
if (needsUpdateSyncConditions) {
|
|
368272
|
+
await setSyncStatus(workItem.handler.itemPath(), operation, operation === OperationType.SYNC ? 'True' : 'False', 'Sync process finished');
|
|
368273
|
+
void syncCtl.updateItem(informer_itemPath(pluralKind, item));
|
|
367686
368274
|
}
|
|
367687
368275
|
else {
|
|
367688
368276
|
operator_src_logger.debug(`The informer received an item with an operation type of '${operation}', which is not a specific operation.`);
|
|
@@ -367724,6 +368312,7 @@ async function inform(pluralKind, item, op, lastWorkItem = null) {
|
|
|
367724
368312
|
item,
|
|
367725
368313
|
workStatus: WorkStatus.PENDING,
|
|
367726
368314
|
onDelete: function () { },
|
|
368315
|
+
upsertTime: Date.now(),
|
|
367727
368316
|
};
|
|
367728
368317
|
return workItem;
|
|
367729
368318
|
case 'onRename':
|
|
@@ -367734,6 +368323,7 @@ async function inform(pluralKind, item, op, lastWorkItem = null) {
|
|
|
367734
368323
|
item,
|
|
367735
368324
|
workStatus: WorkStatus.PENDING,
|
|
367736
368325
|
onDelete: function () { },
|
|
368326
|
+
upsertTime: Date.now(),
|
|
367737
368327
|
};
|
|
367738
368328
|
return workItem;
|
|
367739
368329
|
}
|
|
@@ -367747,6 +368337,7 @@ async function inform(pluralKind, item, op, lastWorkItem = null) {
|
|
|
367747
368337
|
item,
|
|
367748
368338
|
workStatus: WorkStatus.PENDING,
|
|
367749
368339
|
onDelete: function () { },
|
|
368340
|
+
upsertTime: Date.now(),
|
|
367750
368341
|
};
|
|
367751
368342
|
return workItem;
|
|
367752
368343
|
case 'onAdd':
|
|
@@ -367756,6 +368347,7 @@ async function inform(pluralKind, item, op, lastWorkItem = null) {
|
|
|
367756
368347
|
item,
|
|
367757
368348
|
workStatus: WorkStatus.PENDING,
|
|
367758
368349
|
onDelete: function () { },
|
|
368350
|
+
upsertTime: Date.now(),
|
|
367759
368351
|
};
|
|
367760
368352
|
return workItem;
|
|
367761
368353
|
}
|
|
@@ -367763,6 +368355,7 @@ async function inform(pluralKind, item, op, lastWorkItem = null) {
|
|
|
367763
368355
|
case 'onMarkedToDeletion':
|
|
367764
368356
|
if (workItem !== null && workItem.workStatus === WorkStatus.PENDING) {
|
|
367765
368357
|
workItem.operation = OperationType.MARKED_TO_DELETION;
|
|
368358
|
+
workItem.upsertTime = Date.now();
|
|
367766
368359
|
return null;
|
|
367767
368360
|
}
|
|
367768
368361
|
else {
|
|
@@ -367771,6 +368364,7 @@ async function inform(pluralKind, item, op, lastWorkItem = null) {
|
|
|
367771
368364
|
item,
|
|
367772
368365
|
workStatus: WorkStatus.PENDING,
|
|
367773
368366
|
onDelete: function () { },
|
|
368367
|
+
upsertTime: Date.now(),
|
|
367774
368368
|
};
|
|
367775
368369
|
return workItem;
|
|
367776
368370
|
}
|
|
@@ -367785,6 +368379,7 @@ async function inform(pluralKind, item, op, lastWorkItem = null) {
|
|
|
367785
368379
|
item,
|
|
367786
368380
|
workStatus: WorkStatus.PENDING,
|
|
367787
368381
|
onDelete: function () { },
|
|
368382
|
+
upsertTime: Date.now(),
|
|
367788
368383
|
};
|
|
367789
368384
|
return workItem;
|
|
367790
368385
|
}
|
|
@@ -367904,11 +368499,89 @@ function dummy_fWait(ms) {
|
|
|
367904
368499
|
});
|
|
367905
368500
|
}
|
|
367906
368501
|
|
|
368502
|
+
;// CONCATENATED MODULE: ../operator/src/processItem.debug.ts
|
|
368503
|
+
|
|
368504
|
+
|
|
368505
|
+
function loopWorkItemDebug(queue) {
|
|
368506
|
+
let running = false;
|
|
368507
|
+
setInterval(() => {
|
|
368508
|
+
if (running)
|
|
368509
|
+
return;
|
|
368510
|
+
running = true;
|
|
368511
|
+
writeDownQueueStatus(queue)
|
|
368512
|
+
.then(() => {
|
|
368513
|
+
running = false;
|
|
368514
|
+
})
|
|
368515
|
+
.catch((err) => {
|
|
368516
|
+
operator_src_logger.error(`PANIC cannot evaluate the queue for debug!!!: ${err}`);
|
|
368517
|
+
});
|
|
368518
|
+
}, 5 * 1000);
|
|
368519
|
+
}
|
|
368520
|
+
async function writeDownQueueStatus(queue) {
|
|
368521
|
+
let output = '';
|
|
368522
|
+
for (const workItem of queue) {
|
|
368523
|
+
const item = workItem.item;
|
|
368524
|
+
output += `${item.kind}/${item.metadata.name} - ${workItem.workStatus} - ${workItem.operation} - (upsert ${formatElapsedTimeWithDate(workItem.upsertTime)})\n`;
|
|
368525
|
+
}
|
|
368526
|
+
return new Promise((ok, ko) => {
|
|
368527
|
+
external_fs_.writeFile('/tmp/queue', output, (err) => {
|
|
368528
|
+
if (err)
|
|
368529
|
+
ko(`Writing /tmp/queue: ${err}`);
|
|
368530
|
+
else
|
|
368531
|
+
ok();
|
|
368532
|
+
});
|
|
368533
|
+
});
|
|
368534
|
+
}
|
|
368535
|
+
function formatElapsedTimeWithDate(upsertTime) {
|
|
368536
|
+
const now = new Date();
|
|
368537
|
+
const diffMs = now.getTime() - upsertTime;
|
|
368538
|
+
if (diffMs < 0) {
|
|
368539
|
+
return 'Future time (Error)';
|
|
368540
|
+
}
|
|
368541
|
+
if (diffMs < 1000) {
|
|
368542
|
+
return 'Just now';
|
|
368543
|
+
}
|
|
368544
|
+
const MS_PER_SECOND = 1000;
|
|
368545
|
+
const MS_PER_MINUTE = 60 * MS_PER_SECOND;
|
|
368546
|
+
const MS_PER_HOUR = 60 * MS_PER_MINUTE;
|
|
368547
|
+
const MS_PER_DAY = 24 * MS_PER_HOUR;
|
|
368548
|
+
const parts = [];
|
|
368549
|
+
let remainingMs = diffMs;
|
|
368550
|
+
// 1. Calculate Days
|
|
368551
|
+
const days = Math.floor(remainingMs / MS_PER_DAY);
|
|
368552
|
+
if (days > 0) {
|
|
368553
|
+
parts.push(`${days} day${days !== 1 ? 's' : ''}`);
|
|
368554
|
+
remainingMs %= MS_PER_DAY;
|
|
368555
|
+
}
|
|
368556
|
+
// 2. Calculate Hours
|
|
368557
|
+
const hours = Math.floor(remainingMs / MS_PER_HOUR);
|
|
368558
|
+
if (hours > 0) {
|
|
368559
|
+
parts.push(`${hours} hour${hours !== 1 ? 's' : ''}`);
|
|
368560
|
+
remainingMs %= MS_PER_HOUR;
|
|
368561
|
+
}
|
|
368562
|
+
// 3. Calculate Minutes
|
|
368563
|
+
const minutes = Math.floor(remainingMs / MS_PER_MINUTE);
|
|
368564
|
+
if (minutes > 0) {
|
|
368565
|
+
parts.push(`${minutes} minute${minutes !== 1 ? 's' : ''}`);
|
|
368566
|
+
remainingMs %= MS_PER_MINUTE;
|
|
368567
|
+
}
|
|
368568
|
+
// 4. Calculate Seconds (added logic for seconds)
|
|
368569
|
+
const seconds = Math.floor(remainingMs / MS_PER_SECOND);
|
|
368570
|
+
if (seconds > 0 && parts.length < 2) {
|
|
368571
|
+
parts.push(`${seconds} second${seconds !== 1 ? 's' : ''}`);
|
|
368572
|
+
}
|
|
368573
|
+
if (parts.length === 0 && seconds > 0) {
|
|
368574
|
+
return `${seconds} second${seconds !== 1 ? 's' : ''} ago`;
|
|
368575
|
+
}
|
|
368576
|
+
return `${parts.slice(0, 2).join(', ')} ago`;
|
|
368577
|
+
}
|
|
368578
|
+
|
|
367907
368579
|
;// CONCATENATED MODULE: ../operator/src/processItem.ts
|
|
367908
368580
|
|
|
367909
368581
|
|
|
367910
368582
|
|
|
367911
368583
|
|
|
368584
|
+
|
|
367912
368585
|
const queue = [];
|
|
367913
368586
|
const WEIGHTS = {
|
|
367914
368587
|
RENAMED: 15,
|
|
@@ -368014,6 +368687,7 @@ async function processItem(workItem) {
|
|
|
368014
368687
|
*/
|
|
368015
368688
|
async function processItem_loop() {
|
|
368016
368689
|
const nextWorkItem = () => sortQueue(queue).find((w) => w.workStatus === WorkStatus.PENDING);
|
|
368690
|
+
loopWorkItemDebug(queue);
|
|
368017
368691
|
while (1) {
|
|
368018
368692
|
const w = nextWorkItem();
|
|
368019
368693
|
if (w) {
|
|
@@ -368047,9 +368721,18 @@ function createTimeout(w) {
|
|
|
368047
368721
|
*/
|
|
368048
368722
|
function sortQueue(queue) {
|
|
368049
368723
|
const sortedQueue = queue.sort((wa, wb) => {
|
|
368050
|
-
|
|
368051
|
-
const
|
|
368052
|
-
|
|
368724
|
+
// --- PRIMARY SORT: By Weight (Descending) ---
|
|
368725
|
+
const weightA = WEIGHTS[wa.operation];
|
|
368726
|
+
const weightB = WEIGHTS[wb.operation];
|
|
368727
|
+
// Check if weights are different
|
|
368728
|
+
if (weightA !== weightB) {
|
|
368729
|
+
// Sort in descending order (higher weight first)
|
|
368730
|
+
// If weightA is larger, return -1 (a comes before b)
|
|
368731
|
+
return weightB - weightA;
|
|
368732
|
+
}
|
|
368733
|
+
// --- SECONDARY SORT: By upsertTime (Ascending) ---
|
|
368734
|
+
// If weights are equal, sort by the oldest upsertTime (ascending)
|
|
368735
|
+
return wa.upsertTime - wb.upsertTime;
|
|
368053
368736
|
});
|
|
368054
368737
|
return sortedQueue;
|
|
368055
368738
|
}
|
|
@@ -368180,28 +368863,21 @@ class Entity {
|
|
|
368180
368863
|
throw new Error(ErrorMessage);
|
|
368181
368864
|
}
|
|
368182
368865
|
const { kind, name, needsSecret } = ref;
|
|
368183
|
-
|
|
368184
|
-
|
|
368185
|
-
|
|
368186
|
-
|
|
368187
|
-
|
|
368188
|
-
|
|
368189
|
-
|
|
368190
|
-
if (!propertyRef) {
|
|
368191
|
-
const ErrorMessage = `resolveRef:
|
|
368866
|
+
if (!needsSecret) {
|
|
368867
|
+
const cr = this.deps[`${kind}-${name}`].cr;
|
|
368868
|
+
return (cr.metadata?.annotations?.[EXTERNAL_NAME_ANNOTATION] || cr.metadata.name);
|
|
368869
|
+
}
|
|
368870
|
+
else {
|
|
368871
|
+
if (!propertyRef) {
|
|
368872
|
+
const ErrorMessage = `resolveRef:
|
|
368192
368873
|
|
|
368193
|
-
|
|
368874
|
+
Entity with kind ${this.kind} ${this.metadata.name}
|
|
368194
368875
|
|
|
368195
|
-
|
|
368196
|
-
|
|
368197
|
-
|
|
368198
|
-
}
|
|
368199
|
-
return Buffer.from(this.deps[`${kind}-${name}`].secret.data[propertyRef], 'base64').toString('utf8');
|
|
368876
|
+
needs a propertyRef to resolve the secret`;
|
|
368877
|
+
provisioner_src_logger.error(ErrorMessage);
|
|
368878
|
+
throw new Error(ErrorMessage);
|
|
368200
368879
|
}
|
|
368201
|
-
|
|
368202
|
-
catch (error) {
|
|
368203
|
-
const errorMsg = `Error resolving ref for ${kind}-${name}: ${error}`;
|
|
368204
|
-
throw new Error(errorMsg);
|
|
368880
|
+
return Buffer.from(this.deps[`${kind}-${name}`].secret.data[propertyRef], 'base64').toString('utf8');
|
|
368205
368881
|
}
|
|
368206
368882
|
}
|
|
368207
368883
|
resolveSecretRef(ref) {
|
|
@@ -368492,100 +369168,6 @@ function provisionDefaultBranch(scope, fsGithubRepository, repo) {
|
|
|
368492
369168
|
return branchDefault;
|
|
368493
369169
|
}
|
|
368494
369170
|
|
|
368495
|
-
// EXTERNAL MODULE: ../provisioner/node_modules/@cdktf/provider-github/lib/actions-secret/index.js
|
|
368496
|
-
var actions_secret = __nccwpck_require__(89039);
|
|
368497
|
-
// EXTERNAL MODULE: ../provisioner/node_modules/@cdktf/provider-github/lib/codespaces-secret/index.js
|
|
368498
|
-
var codespaces_secret = __nccwpck_require__(80659);
|
|
368499
|
-
// EXTERNAL MODULE: ../provisioner/node_modules/@cdktf/provider-github/lib/dependabot-secret/index.js
|
|
368500
|
-
var dependabot_secret = __nccwpck_require__(16281);
|
|
368501
|
-
;// CONCATENATED MODULE: ../provisioner/src/entities/firestartrgithubrepository/helpers/RepositorySecret.ts
|
|
368502
|
-
|
|
368503
|
-
|
|
368504
|
-
|
|
368505
|
-
|
|
368506
|
-
|
|
368507
|
-
|
|
368508
|
-
async function provisionRepositorySecrets(scope, repo, fsGithubRepository) {
|
|
368509
|
-
const sections = ['actions', 'codespaces', 'dependabot'];
|
|
368510
|
-
if ('secrets' in fsGithubRepository.spec) {
|
|
368511
|
-
const secrets = fsGithubRepository.spec.secrets;
|
|
368512
|
-
for (const section of sections) {
|
|
368513
|
-
if (section in secrets) {
|
|
368514
|
-
for (const secret of secrets[section]) {
|
|
368515
|
-
await provisionRepositorySecret(scope, fsGithubRepository, section, secret.name, secret.ref, repo);
|
|
368516
|
-
}
|
|
368517
|
-
}
|
|
368518
|
-
}
|
|
368519
|
-
}
|
|
368520
|
-
else {
|
|
368521
|
-
provisioner_src_logger.info(`FirestartrGithubRepository ${fsGithubRepository.metadata.name} does not have a secrets section`);
|
|
368522
|
-
}
|
|
368523
|
-
}
|
|
368524
|
-
async function provisionRepositorySecret(scope, repo, section, repoSecretName, secretRef, repoResource) {
|
|
368525
|
-
provisioner_src_logger.info(`Provisioning repo secret ${repo.metadata.name}/${section}/${repoSecretName}`);
|
|
368526
|
-
const secretClass = section === 'actions'
|
|
368527
|
-
? actions_secret/* ActionsSecret */.N
|
|
368528
|
-
: section === 'codespaces'
|
|
368529
|
-
? codespaces_secret/* CodespacesSecret */.k
|
|
368530
|
-
: section === 'dependabot'
|
|
368531
|
-
? dependabot_secret/* DependabotSecret */.c
|
|
368532
|
-
: null;
|
|
368533
|
-
if (secretClass) {
|
|
368534
|
-
const fSecretCreation = process.env['AVOID_PROVIDER_SECRET_ENCRYPTION']
|
|
368535
|
-
? createUnencryptedSecret
|
|
368536
|
-
: createEncryptedSecrect;
|
|
368537
|
-
await fSecretCreation(scope, repo, secretRef, secretClass, section, repoSecretName, repoResource);
|
|
368538
|
-
provisioner_src_logger.info(`RepoSecret provisioned ${section}-${repoSecretName.toLowerCase()}-secret`);
|
|
368539
|
-
}
|
|
368540
|
-
}
|
|
368541
|
-
async function createEncryptedSecrect(scope, repo, secretRef, secretClass, section, repoSecretName, repoResource) {
|
|
368542
|
-
const { key_id, encrypted_value } = await encryptSecret(repo, secretRef);
|
|
368543
|
-
const resourceKey = `${section}-${repoSecretName.toLowerCase()}-secret`;
|
|
368544
|
-
const plainTextSecret = repo.resolveSecretRef({
|
|
368545
|
-
name: secretRef.name,
|
|
368546
|
-
key: secretRef.key,
|
|
368547
|
-
});
|
|
368548
|
-
const sha256 = external_crypto_default().createHash('sha256')
|
|
368549
|
-
.update(plainTextSecret)
|
|
368550
|
-
.digest('hex');
|
|
368551
|
-
const secretResourceName = `_${repoSecretName}-${sha256.slice(0, 12)}`;
|
|
368552
|
-
const instanceLifecycle = {
|
|
368553
|
-
ignoreChanges: ['encrypted_value'],
|
|
368554
|
-
};
|
|
368555
|
-
const sc = new secretClass(scope, secretResourceName, {
|
|
368556
|
-
secretName: repoSecretName,
|
|
368557
|
-
repository: repo.metadata.name,
|
|
368558
|
-
encryptedValue: encrypted_value,
|
|
368559
|
-
dependsOn: [repoResource],
|
|
368560
|
-
lifecycle: instanceLifecycle,
|
|
368561
|
-
});
|
|
368562
|
-
repo.addResourceToStack(resourceKey, sc);
|
|
368563
|
-
}
|
|
368564
|
-
async function createUnencryptedSecret(scope, repo, secretRef, secretClass, section, repoSecretName, repoResource) {
|
|
368565
|
-
const plainTextSecret = repo.resolveSecretRef({
|
|
368566
|
-
name: secretRef.name,
|
|
368567
|
-
key: secretRef.key,
|
|
368568
|
-
});
|
|
368569
|
-
const resourceKey = `${section}-${repoSecretName.toLowerCase()}-secret`;
|
|
368570
|
-
const tfStateKey = `_${repo.getTfStateKey()}-${resourceKey}`;
|
|
368571
|
-
const sc = new secretClass(scope, tfStateKey, {
|
|
368572
|
-
secretName: repoSecretName,
|
|
368573
|
-
plaintextValue: plainTextSecret,
|
|
368574
|
-
repository: repo.metadata.name,
|
|
368575
|
-
dependsOn: [repoResource],
|
|
368576
|
-
});
|
|
368577
|
-
provisioner_src_logger.info(tfStateKey);
|
|
368578
|
-
repo.addResourceToStack(resourceKey, sc);
|
|
368579
|
-
}
|
|
368580
|
-
async function encryptSecret(repo, secretRef) {
|
|
368581
|
-
const plainTextSecret = repo.resolveSecretRef({
|
|
368582
|
-
name: secretRef.name,
|
|
368583
|
-
key: secretRef.key,
|
|
368584
|
-
});
|
|
368585
|
-
const v = await github_0.encryption.encryptRepoSecret(process.env.ORG, repo.metadata.name, plainTextSecret);
|
|
368586
|
-
return v;
|
|
368587
|
-
}
|
|
368588
|
-
|
|
368589
369171
|
// EXTERNAL MODULE: ../provisioner/node_modules/@cdktf/provider-github/lib/actions-variable/index.js
|
|
368590
369172
|
var actions_variable = __nccwpck_require__(81133);
|
|
368591
369173
|
;// CONCATENATED MODULE: ../provisioner/src/entities/firestartrgithubrepository/helpers/RepositoryVariable.ts
|
|
@@ -368642,7 +369224,6 @@ async function provisionRepositoryVar(scope, repo, section, repoVarName, value,
|
|
|
368642
369224
|
|
|
368643
369225
|
|
|
368644
369226
|
|
|
368645
|
-
|
|
368646
369227
|
class FirestartrGithubRepository_FirestartrGithubRepository extends Entity {
|
|
368647
369228
|
constructor(artifact, deps) {
|
|
368648
369229
|
super(artifact, deps);
|
|
@@ -368657,7 +369238,6 @@ class FirestartrGithubRepository_FirestartrGithubRepository extends Entity {
|
|
|
368657
369238
|
}
|
|
368658
369239
|
provisionCodeowners(scope, this.mainResource, branchDefault, this);
|
|
368659
369240
|
provisionPermissions(scope, this.mainResource, this);
|
|
368660
|
-
await provisionRepositorySecrets(scope, this.mainResource, this);
|
|
368661
369241
|
await provisionRepositoryVariables(scope, this.mainResource, this);
|
|
368662
369242
|
}
|
|
368663
369243
|
async orgHasOneOfThesePlans(org, plans) {
|
|
@@ -368889,6 +369469,121 @@ class FirestartrTerraformModuleEntity extends Entity {
|
|
|
368889
369469
|
}
|
|
368890
369470
|
}
|
|
368891
369471
|
|
|
369472
|
+
// EXTERNAL MODULE: ../provisioner/node_modules/@cdktf/provider-github/lib/actions-secret/index.js
|
|
369473
|
+
var actions_secret = __nccwpck_require__(89039);
|
|
369474
|
+
// EXTERNAL MODULE: ../provisioner/node_modules/@cdktf/provider-github/lib/codespaces-secret/index.js
|
|
369475
|
+
var codespaces_secret = __nccwpck_require__(80659);
|
|
369476
|
+
// EXTERNAL MODULE: ../provisioner/node_modules/@cdktf/provider-github/lib/dependabot-secret/index.js
|
|
369477
|
+
var dependabot_secret = __nccwpck_require__(16281);
|
|
369478
|
+
;// CONCATENATED MODULE: ../provisioner/src/entities/firestartrgithubrepositorysecretssection/helpers/RepositorySecret.ts
|
|
369479
|
+
|
|
369480
|
+
|
|
369481
|
+
|
|
369482
|
+
|
|
369483
|
+
|
|
369484
|
+
|
|
369485
|
+
async function provisionRepositorySecrets(scope, fsGithubRepositorySecretsSection, repo) {
|
|
369486
|
+
const sections = [
|
|
369487
|
+
'actions',
|
|
369488
|
+
'codespaces',
|
|
369489
|
+
'dependabot',
|
|
369490
|
+
];
|
|
369491
|
+
if ('secrets' in fsGithubRepositorySecretsSection.spec) {
|
|
369492
|
+
const secrets = fsGithubRepositorySecretsSection.spec.secrets;
|
|
369493
|
+
for (const section of sections) {
|
|
369494
|
+
if (section in secrets) {
|
|
369495
|
+
for (const secret of secrets[section]) {
|
|
369496
|
+
await provisionRepositorySecret(scope, fsGithubRepositorySecretsSection, section, secret.name, secret.ref, repo);
|
|
369497
|
+
}
|
|
369498
|
+
}
|
|
369499
|
+
}
|
|
369500
|
+
}
|
|
369501
|
+
else {
|
|
369502
|
+
provisioner_src_logger.info(`FirestartrGithubRepository ${fsGithubRepositorySecretsSection.metadata.name} does not have a secrets section`);
|
|
369503
|
+
}
|
|
369504
|
+
}
|
|
369505
|
+
async function provisionRepositorySecret(scope, rss, section, repoSecretName, secretRef, repoResource) {
|
|
369506
|
+
provisioner_src_logger.info(`Provisioning repo secret ${rss.metadata.name}/${section}/${repoSecretName}`);
|
|
369507
|
+
const secretClass = section === 'actions'
|
|
369508
|
+
? actions_secret/* ActionsSecret */.N
|
|
369509
|
+
: section === 'codespaces'
|
|
369510
|
+
? codespaces_secret/* CodespacesSecret */.k
|
|
369511
|
+
: section === 'dependabot'
|
|
369512
|
+
? dependabot_secret/* DependabotSecret */.c
|
|
369513
|
+
: null;
|
|
369514
|
+
if (secretClass) {
|
|
369515
|
+
const fSecretCreation = process.env['AVOID_PROVIDER_SECRET_ENCRYPTION']
|
|
369516
|
+
? createUnencryptedSecret
|
|
369517
|
+
: createEncryptedSecret;
|
|
369518
|
+
await fSecretCreation(scope, rss, secretRef, secretClass, section, repoSecretName, repoResource);
|
|
369519
|
+
provisioner_src_logger.info(`RepoSecret provisioned ${section}-${repoSecretName.toLowerCase()}-secret`);
|
|
369520
|
+
}
|
|
369521
|
+
}
|
|
369522
|
+
async function createEncryptedSecret(scope, rss, secretRef, secretClass, section, repoSecretName, repo) {
|
|
369523
|
+
const { key_id, encrypted_value } = await encryptSecret(rss, secretRef, section);
|
|
369524
|
+
const resourceKey = `${section}-${repoSecretName.toLowerCase()}-secret`;
|
|
369525
|
+
const plainTextSecret = rss.resolveSecretRef({
|
|
369526
|
+
name: secretRef.name,
|
|
369527
|
+
key: secretRef.key,
|
|
369528
|
+
});
|
|
369529
|
+
const sha256 = external_crypto_default().createHash('sha256')
|
|
369530
|
+
.update(plainTextSecret)
|
|
369531
|
+
.digest('hex');
|
|
369532
|
+
const secretResourceName = `_${section}-${repoSecretName.toLowerCase()}-${sha256.slice(0, 12)}`;
|
|
369533
|
+
const instanceLifecycle = {
|
|
369534
|
+
ignoreChanges: ['encrypted_value'],
|
|
369535
|
+
};
|
|
369536
|
+
const sc = new secretClass(scope, secretResourceName, {
|
|
369537
|
+
secretName: repoSecretName,
|
|
369538
|
+
repository: repo,
|
|
369539
|
+
encryptedValue: encrypted_value,
|
|
369540
|
+
lifecycle: instanceLifecycle,
|
|
369541
|
+
});
|
|
369542
|
+
rss.addResourceToStack(resourceKey, sc);
|
|
369543
|
+
}
|
|
369544
|
+
async function createUnencryptedSecret(scope, rss, secretRef, secretClass, section, repoSecretName, repo) {
|
|
369545
|
+
const plainTextSecret = rss.resolveSecretRef({
|
|
369546
|
+
name: secretRef.name,
|
|
369547
|
+
key: secretRef.key,
|
|
369548
|
+
});
|
|
369549
|
+
const resourceKey = `${section}-${repoSecretName.toLowerCase()}-secret`;
|
|
369550
|
+
const tfStateKey = `_${rss.getTfStateKey()}-${resourceKey}`;
|
|
369551
|
+
const sc = new secretClass(scope, tfStateKey, {
|
|
369552
|
+
secretName: repoSecretName,
|
|
369553
|
+
plaintextValue: plainTextSecret,
|
|
369554
|
+
repository: repo,
|
|
369555
|
+
});
|
|
369556
|
+
provisioner_src_logger.info(tfStateKey);
|
|
369557
|
+
rss.addResourceToStack(resourceKey, sc);
|
|
369558
|
+
}
|
|
369559
|
+
async function encryptSecret(rss, secretRef, section) {
|
|
369560
|
+
const plainTextSecret = rss.resolveSecretRef({
|
|
369561
|
+
name: secretRef.name,
|
|
369562
|
+
key: secretRef.key,
|
|
369563
|
+
});
|
|
369564
|
+
const v = await github_0.encryption.encryptRepoSecret(process.env.ORG, rss.resolveRepoExternalName(), section, plainTextSecret);
|
|
369565
|
+
return v;
|
|
369566
|
+
}
|
|
369567
|
+
|
|
369568
|
+
;// CONCATENATED MODULE: ../provisioner/src/entities/firestartrgithubrepositorysecretssection/FirestartrGithubRepositorySecretsSection.ts
|
|
369569
|
+
|
|
369570
|
+
|
|
369571
|
+
class FirestartrGithubRepositorySecretsSection_FirestartrGithubRepositorySecretsSection extends Entity {
|
|
369572
|
+
constructor(artifact, deps) {
|
|
369573
|
+
super(artifact, deps);
|
|
369574
|
+
}
|
|
369575
|
+
async loadResources(data) {
|
|
369576
|
+
const { scope } = data;
|
|
369577
|
+
const repo = this.resolveRef(this.spec.repositoryTarget.ref);
|
|
369578
|
+
await provisionRepositorySecrets(scope, this, repo);
|
|
369579
|
+
}
|
|
369580
|
+
resolveRepoExternalName() {
|
|
369581
|
+
const cr = this.deps[`${this.spec.repositoryTarget.ref.kind}-${this.spec.repositoryTarget.ref.name}`].cr;
|
|
369582
|
+
const repoName = cr.metadata.annotations['firestartr.dev/external-name'];
|
|
369583
|
+
return repoName;
|
|
369584
|
+
}
|
|
369585
|
+
}
|
|
369586
|
+
|
|
368892
369587
|
;// CONCATENATED MODULE: ../provisioner/src/entities/index.ts
|
|
368893
369588
|
|
|
368894
369589
|
|
|
@@ -368896,6 +369591,7 @@ class FirestartrTerraformModuleEntity extends Entity {
|
|
|
368896
369591
|
|
|
368897
369592
|
|
|
368898
369593
|
|
|
369594
|
+
|
|
368899
369595
|
function getEntityInstance(entity, deps) {
|
|
368900
369596
|
let instance = null;
|
|
368901
369597
|
switch (entity.kind) {
|
|
@@ -368917,6 +369613,9 @@ function getEntityInstance(entity, deps) {
|
|
|
368917
369613
|
case 'FirestartrGithubOrgWebhook':
|
|
368918
369614
|
instance = new FirestartrGithubOrgWebhook_FirestartrGithubOrgWebhook(entity, deps);
|
|
368919
369615
|
break;
|
|
369616
|
+
case 'FirestartrGithubRepositorySecretsSection':
|
|
369617
|
+
instance = new FirestartrGithubRepositorySecretsSection_FirestartrGithubRepositorySecretsSection(entity, deps);
|
|
369618
|
+
break;
|
|
368920
369619
|
default:
|
|
368921
369620
|
break;
|
|
368922
369621
|
}
|
|
@@ -369156,6 +369855,7 @@ function getStackByEntity(entity) {
|
|
|
369156
369855
|
case 'FirestartrGithubMembership':
|
|
369157
369856
|
case 'FirestartrGithubRepositoryFeature':
|
|
369158
369857
|
case 'FirestartrGithubOrgWebhook':
|
|
369858
|
+
case 'FirestartrGithubRepositorySecretsSection':
|
|
369159
369859
|
return GithubStack;
|
|
369160
369860
|
case 'FirestartrTerraformModule':
|
|
369161
369861
|
return TerraformModuleStack;
|
|
@@ -369183,8 +369883,12 @@ function __calculateTFStatePath(entity) {
|
|
|
369183
369883
|
|
|
369184
369884
|
|
|
369185
369885
|
async function runCDKTF(entityPath, action, depsPath, stream) {
|
|
369886
|
+
const args = [action, '--log-level', 'DEBUG', '--auto-approve'];
|
|
369887
|
+
if (process.env.IS_DEV_LOCAL_ENVIRONMENT) {
|
|
369888
|
+
args.push('--app', 'node --loader ts-node/esm --experimental-specifier-resolution=node index.ts');
|
|
369889
|
+
}
|
|
369186
369890
|
return new Promise((ok, ko) => {
|
|
369187
|
-
const cdktfProcess = (0,external_child_process_.spawn)('cdktf',
|
|
369891
|
+
const cdktfProcess = (0,external_child_process_.spawn)('cdktf', args, {
|
|
369188
369892
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
369189
369893
|
cwd: process.env.IS_DEV_LOCAL_ENVIRONMENT
|
|
369190
369894
|
? '/library/packages/provisioner'
|
|
@@ -369907,6 +370611,30 @@ class github_orgWebhook_FirestartrGithubOrgWebhook extends Resource {
|
|
|
369907
370611
|
}
|
|
369908
370612
|
}
|
|
369909
370613
|
|
|
370614
|
+
;// CONCATENATED MODULE: ../provisioner/src/resources/github_repository_secrets_section/index.ts
|
|
370615
|
+
|
|
370616
|
+
|
|
370617
|
+
class github_repository_secrets_section_FirestartrGithubRepositorySecretsSection extends Resource {
|
|
370618
|
+
static kind() {
|
|
370619
|
+
return 'FirestartrGithubRepositorySecretsSection';
|
|
370620
|
+
}
|
|
370621
|
+
async preprocess() {
|
|
370622
|
+
switch (this.get('operation')) {
|
|
370623
|
+
case 'CREATE':
|
|
370624
|
+
provisioner_src_logger.debug('Creating FirestartrGithubRepositorySecretsSection');
|
|
370625
|
+
break;
|
|
370626
|
+
case 'UPDATE':
|
|
370627
|
+
provisioner_src_logger.debug('Updating FirestartrGithubRepositorySecretsSection');
|
|
370628
|
+
break;
|
|
370629
|
+
case 'DELETE':
|
|
370630
|
+
provisioner_src_logger.debug('Deleting FirestartrGithubRepositorySecretsSection');
|
|
370631
|
+
break;
|
|
370632
|
+
default:
|
|
370633
|
+
provisioner_src_logger.debug(`Unknown operation '${this.get('operation')}' for FirestartrGithubRepositorySecretsSection`);
|
|
370634
|
+
}
|
|
370635
|
+
}
|
|
370636
|
+
}
|
|
370637
|
+
|
|
369910
370638
|
;// CONCATENATED MODULE: ../provisioner/src/resources/index.ts
|
|
369911
370639
|
|
|
369912
370640
|
|
|
@@ -369914,6 +370642,7 @@ class github_orgWebhook_FirestartrGithubOrgWebhook extends Resource {
|
|
|
369914
370642
|
|
|
369915
370643
|
|
|
369916
370644
|
|
|
370645
|
+
|
|
369917
370646
|
/* harmony default export */ const resources = ({
|
|
369918
370647
|
FirestartrGithubRepositoryFeature: github_feature_FirestartrGithubRepositoryFeature,
|
|
369919
370648
|
FirestartrGithubRepository: github_repository_FirestartrGithubRepository,
|
|
@@ -369921,6 +370650,7 @@ class github_orgWebhook_FirestartrGithubOrgWebhook extends Resource {
|
|
|
369921
370650
|
FirestartrGithubGroup: github_group_FirestartrGithubGroup,
|
|
369922
370651
|
FirestartrTerraformModule: FirestartrTerraformModule,
|
|
369923
370652
|
FirestartrGithubOrgWebhook: github_orgWebhook_FirestartrGithubOrgWebhook,
|
|
370653
|
+
FirestartrGithubRepositorySecretsSection: github_repository_secrets_section_FirestartrGithubRepositorySecretsSection,
|
|
369924
370654
|
});
|
|
369925
370655
|
|
|
369926
370656
|
;// CONCATENATED MODULE: ../provisioner/init.ts
|
|
@@ -371814,13 +372544,6 @@ function isDestroyRetry(item) {
|
|
|
371814
372544
|
return false;
|
|
371815
372545
|
}
|
|
371816
372546
|
async function* process_operation_sync(item, op, handler, syncPolicy, generalPolicy) {
|
|
371817
|
-
yield {
|
|
371818
|
-
item,
|
|
371819
|
-
reason: op,
|
|
371820
|
-
type: 'SYNCHRONIZED',
|
|
371821
|
-
status: 'False',
|
|
371822
|
-
message: 'Sync process started',
|
|
371823
|
-
};
|
|
371824
372547
|
if (!syncPolicy) {
|
|
371825
372548
|
operator_src_logger.debug(`The Terraform processor is only observing item '${item.kind}/${item.metadata.name}' because no sync policy was found for operation '${op}'.`);
|
|
371826
372549
|
yield* doPlanJSONFormat(item, op, handler);
|
|
@@ -373643,6 +374366,7 @@ function getProvisionImplementation(plural) {
|
|
|
373643
374366
|
case 'githubrepositoryfeatures':
|
|
373644
374367
|
case 'githubgroups':
|
|
373645
374368
|
case 'githuborgwebhooks':
|
|
374369
|
+
case 'githubrepositorysecretssections':
|
|
373646
374370
|
implementation = processOperation;
|
|
373647
374371
|
break;
|
|
373648
374372
|
}
|