@firestartr/cli 2.7.0-snapshot-13 → 2.7.0-snapshot-15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/build/index.js +1179 -274
  2. package/build/packages/cdk8s_renderer/index.d.ts +5 -3
  3. package/build/packages/cdk8s_renderer/src/charts/github/index.d.ts +1 -0
  4. package/build/packages/cdk8s_renderer/src/charts/github/orgSettingsChart.d.ts +8 -0
  5. package/build/packages/cdk8s_renderer/src/charts/index.d.ts +2 -1
  6. package/build/packages/cdk8s_renderer/src/claims/base/index.d.ts +1 -0
  7. package/build/packages/cdk8s_renderer/src/claims/base/orgSettings.d.ts +5 -0
  8. package/build/packages/cdk8s_renderer/src/claims/base/schemas/index.d.ts +139 -0
  9. package/build/packages/cdk8s_renderer/src/claims/base/schemas/orgsettings.schema.d.ts +32 -0
  10. package/build/packages/cdk8s_renderer/src/claims/github/index.d.ts +109 -0
  11. package/build/packages/cdk8s_renderer/src/claims/github/orgSettings.d.ts +34 -0
  12. package/build/packages/cdk8s_renderer/src/claims/github/orgsettings.schema.d.ts +111 -0
  13. package/build/packages/cdk8s_renderer/src/config.d.ts +4 -0
  14. package/build/packages/cdk8s_renderer/src/loader/lazy_loader.d.ts +1 -1
  15. package/build/packages/cdk8s_renderer/src/loader/loader.d.ts +7 -1
  16. package/build/packages/cdk8s_renderer/src/overriders/featureOverride.d.ts +3 -0
  17. package/build/packages/cdk8s_renderer/src/renderer/claims-render.d.ts +1 -1
  18. package/build/packages/cdk8s_renderer/src/validations/githubOrgSettings.d.ts +2 -0
  19. package/build/packages/gh_provisioner/src/entities/ghorgsettings/index.d.ts +7 -0
  20. package/build/packages/importer/src/decanter/gh/github_org_settings.d.ts +10 -0
  21. package/build/packages/importer/src/decanter/gh/github_org_settings_collection.d.ts +10 -0
  22. package/build/packages/importer/src/decanter/index.d.ts +2 -0
  23. package/build/packages/operator/src/ctl.d.ts +7 -0
  24. package/build/packages/operator/src/parentDependency.d.ts +30 -0
  25. package/build/packages/operator/src/processItem.d.ts +3 -0
  26. package/build/packages/operator/src/queueSort.d.ts +2 -0
  27. package/package.json +1 -1
package/build/index.js CHANGED
@@ -239466,7 +239466,7 @@ class SimpleTokenizer {
239466
239466
  ;// CONCATENATED MODULE: ../catalog_common/src/codeowners/index.ts
239467
239467
  // Common CODEOWNERS machinery (pure TypeScript/data; NO IO, NO classes)
239468
239468
  // Strictly follows GitHub CODEOWNERS syntax.
239469
- // Spec: see specs/common/001-common-codeowners-machinery/spec.md
239469
+ // Design: see packages/catalog_common/docs/adr/0001-codeowners-machinery-is-pure-data.md
239470
239470
 
239471
239471
  const OWNER_RE = /^@[\w.-]+(\/[\w.-]+)?$/;
239472
239472
  function parse(raw) {
@@ -278569,6 +278569,9 @@ class InitializerPatches extends BasePatches {
278569
278569
  if (data?.defaultValues) {
278570
278570
  this.data['values'] = data.defaultValues;
278571
278571
  }
278572
+ if (data?.path) {
278573
+ this.data['path'] = data.path;
278574
+ }
278572
278575
  }
278573
278576
  static FILE_NAME() {
278574
278577
  if (!this.fileName) {
@@ -278738,6 +278741,7 @@ UUIDInitializer.applicableKinds = [
278738
278741
  'ComponentClaim',
278739
278742
  'TFWorkspaceClaim',
278740
278743
  'OrgWebhookClaim',
278744
+ 'OrgSettingsClaim',
278741
278745
  ];
278742
278746
 
278743
278747
 
@@ -279392,6 +279396,7 @@ InitializerClaimRef.applicableKinds = [
279392
279396
  'ComponentClaim',
279393
279397
  'TFWorkspaceClaim',
279394
279398
  'OrgWebhookClaim',
279399
+ 'OrgSettingsClaim',
279395
279400
  ];
279396
279401
 
279397
279402
 
@@ -279722,6 +279727,20 @@ var external_fs_default = /*#__PURE__*/__nccwpck_require__.n(external_fs_);
279722
279727
  // List of currently set path variables for each entity type
279723
279728
  const __PATH_VARIABLES = {};
279724
279729
  const __EXCLUDED_PATHS = [];
279730
+ let repositoryUrl;
279731
+ let defaultBranch = 'main';
279732
+ function setRepositoryUrl(url) {
279733
+ repositoryUrl = url;
279734
+ }
279735
+ function getRepositoryUrl() {
279736
+ return repositoryUrl;
279737
+ }
279738
+ function setDefaultBranch(branch) {
279739
+ defaultBranch = branch;
279740
+ }
279741
+ function getDefaultBranch() {
279742
+ return defaultBranch;
279743
+ }
279725
279744
  function setExcludedPaths(excludedPaths) {
279726
279745
  __EXCLUDED_PATHS.length = 0;
279727
279746
  for (const path of excludedPaths) {
@@ -280379,6 +280398,8 @@ TechnologyInitializer.applicableKinds = ['ComponentClaim'];
280379
280398
 
280380
280399
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/initializers/backstage.ts
280381
280400
 
280401
+
280402
+
280382
280403
  class BackstageInitializer extends InitializerPatches {
280383
280404
  constructor() {
280384
280405
  super(...arguments);
@@ -280388,6 +280409,16 @@ class BackstageInitializer extends InitializerPatches {
280388
280409
  return true;
280389
280410
  }
280390
280411
  async __patches(claim, _) {
280412
+ const claimPath = this.data?.path;
280413
+ const repoUrl = getRepositoryUrl();
280414
+ let relativePath;
280415
+ if (repoUrl && claimPath) {
280416
+ const claimsRoot = getPath('claims');
280417
+ relativePath = external_path_.relative(claimsRoot, claimPath)
280418
+ .split(external_path_.sep)
280419
+ .map((segment) => encodeURIComponent(segment))
280420
+ .join('/');
280421
+ }
280391
280422
  return [
280392
280423
  {
280393
280424
  validate() {
@@ -280433,10 +280464,41 @@ class BackstageInitializer extends InitializerPatches {
280433
280464
  };
280434
280465
  },
280435
280466
  },
280467
+ {
280468
+ validate() {
280469
+ return true;
280470
+ },
280471
+ apply(cr) {
280472
+ if (!repoUrl || !relativePath)
280473
+ return cr;
280474
+ cr.metadata.annotations = cr.metadata.annotations ?? {};
280475
+ cr.metadata.annotations['backstage.io/edit-url'] =
280476
+ `${repoUrl}/blob/${getDefaultBranch()}/${relativePath}`;
280477
+ return cr;
280478
+ },
280479
+ identify() {
280480
+ return 'initializers/BackstageInitializer';
280481
+ },
280482
+ applicable() {
280483
+ return {
280484
+ applicableProviders: ['catalog'],
280485
+ };
280486
+ },
280487
+ },
280436
280488
  ];
280437
280489
  }
280438
280490
  }
280439
- BackstageInitializer.applicableKinds = ['ComponentClaim'];
280491
+ BackstageInitializer.applicableKinds = [
280492
+ 'ComponentClaim',
280493
+ 'SystemClaim',
280494
+ 'DomainClaim',
280495
+ 'GroupClaim',
280496
+ 'UserClaim',
280497
+ 'TFWorkspaceClaim',
280498
+ 'SecretsClaim',
280499
+ 'ArgoDeployClaim',
280500
+ 'OrgWebhookClaim',
280501
+ ];
280440
280502
 
280441
280503
 
280442
280504
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/initializers/syncer.ts
@@ -280688,6 +280750,7 @@ const INITIALIZERS_BY_FILE_NAME = {
280688
280750
  defaults_github_membership: InitializerDefault,
280689
280751
  defaults_github_group: InitializerDefault,
280690
280752
  defaults_github_orgwebhook: InitializerDefault,
280753
+ defaults_github_orgsettings: InitializerDefault,
280691
280754
  };
280692
280755
  const SCHEMAS_BY_INITIALIZER_NAME = {
280693
280756
  [TechnologyInitializer.FILE_NAME()]: technologies,
@@ -281838,6 +281901,38 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
281838
281901
  },
281839
281902
  });
281840
281903
 
281904
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/base/schemas/orgsettings.schema.ts
281905
+
281906
+ /* harmony default export */ const orgsettings_schema = ({
281907
+ $schema: SCHEMA,
281908
+ $id: 'OrgSettingsClaim',
281909
+ definitions: {
281910
+ OrgSettingsClaim: {
281911
+ $id: 'firestartr.dev://common/OrgSettingsClaim',
281912
+ type: 'object',
281913
+ description: 'A GitHub organization settings claim',
281914
+ unevaluatedProperties: false,
281915
+ allOf: [
281916
+ { $ref: 'firestartr.dev://common/ClaimEnvelope' },
281917
+ {
281918
+ type: 'object',
281919
+ properties: {
281920
+ providers: {
281921
+ type: 'object',
281922
+ properties: {
281923
+ github: {
281924
+ $ref: 'firestartr.dev://github/GithubOrgSettingsClaim',
281925
+ },
281926
+ },
281927
+ additionalProperties: false,
281928
+ },
281929
+ },
281930
+ },
281931
+ ],
281932
+ },
281933
+ },
281934
+ });
281935
+
281841
281936
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/group.schema.ts
281842
281937
 
281843
281938
  /* harmony default export */ const github_group_schema = ({
@@ -282180,6 +282275,116 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
282180
282275
  },
282181
282276
  });
282182
282277
 
282278
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/orgsettings.schema.ts
282279
+
282280
+ const organizationSettingsProperties = {
282281
+ name: {
282282
+ type: 'string',
282283
+ },
282284
+ tfStateKey: {
282285
+ $ref: 'firestartr.dev://common/TerraformStateKey',
282286
+ },
282287
+ org: {
282288
+ $ref: 'firestartr.dev://common/ClaimName',
282289
+ },
282290
+ billing_email: {
282291
+ type: 'string',
282292
+ },
282293
+ twitter_username: {
282294
+ type: 'string',
282295
+ },
282296
+ company: {
282297
+ type: 'string',
282298
+ },
282299
+ blog: {
282300
+ type: 'string',
282301
+ },
282302
+ email: {
282303
+ type: 'string',
282304
+ },
282305
+ location: {
282306
+ type: 'string',
282307
+ },
282308
+ description: {
282309
+ type: 'string',
282310
+ },
282311
+ has_organization_projects: {
282312
+ type: 'boolean',
282313
+ },
282314
+ has_repository_projects: {
282315
+ type: 'boolean',
282316
+ },
282317
+ default_repository_permission: {
282318
+ type: 'string',
282319
+ enum: ['read', 'write', 'admin', 'none'],
282320
+ },
282321
+ members_can_create_repositories: {
282322
+ type: 'boolean',
282323
+ },
282324
+ members_can_create_public_repositories: {
282325
+ type: 'boolean',
282326
+ },
282327
+ members_can_create_private_repositories: {
282328
+ type: 'boolean',
282329
+ },
282330
+ members_can_create_internal_repositories: {
282331
+ type: 'boolean',
282332
+ },
282333
+ members_can_create_pages: {
282334
+ type: 'boolean',
282335
+ },
282336
+ members_can_create_public_pages: {
282337
+ type: 'boolean',
282338
+ },
282339
+ members_can_create_private_pages: {
282340
+ type: 'boolean',
282341
+ },
282342
+ members_can_fork_private_repositories: {
282343
+ type: 'boolean',
282344
+ },
282345
+ web_commit_signoff_required: {
282346
+ type: 'boolean',
282347
+ },
282348
+ advanced_security_enabled_for_new_repositories: {
282349
+ type: 'boolean',
282350
+ },
282351
+ dependabot_alerts_enabled_for_new_repositories: {
282352
+ type: 'boolean',
282353
+ },
282354
+ dependabot_security_updates_enabled_for_new_repositories: {
282355
+ type: 'boolean',
282356
+ },
282357
+ dependency_graph_enabled_for_new_repositories: {
282358
+ type: 'boolean',
282359
+ },
282360
+ secret_scanning_enabled_for_new_repositories: {
282361
+ type: 'boolean',
282362
+ },
282363
+ secret_scanning_push_protection_enabled_for_new_repositories: {
282364
+ type: 'boolean',
282365
+ },
282366
+ };
282367
+ /* harmony default export */ const github_orgsettings_schema = ({
282368
+ $schema: SCHEMA,
282369
+ $id: 'GithubOrgSettingsClaim',
282370
+ definitions: {
282371
+ GithubOrgSettingsClaim: {
282372
+ $id: 'firestartr.dev://github/GithubOrgSettingsClaim',
282373
+ type: 'object',
282374
+ description: 'A Github Organization Settings claim',
282375
+ allOf: [
282376
+ { $ref: 'firestartr.dev://common/ClaimProviderEnvelope' },
282377
+ {
282378
+ type: 'object',
282379
+ properties: organizationSettingsProperties,
282380
+ additionalProperties: false,
282381
+ required: ['org', 'billing_email'],
282382
+ },
282383
+ ],
282384
+ },
282385
+ },
282386
+ });
282387
+
282183
282388
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/feature.schema.ts
282184
282389
 
282185
282390
  /* harmony default export */ const feature_schema = ({
@@ -282326,7 +282531,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
282326
282531
  type: 'string',
282327
282532
  minLength: 1,
282328
282533
  maxLength: 50,
282329
- pattern: '^(?!\\s+$)[^"\\\\]+$',
282534
+ pattern: '^[^"\\\\\\s]+(?: +[^"\\\\\\s]+)*$',
282330
282535
  description: 'Label name (1-50 chars, no " or \\ characters)',
282331
282536
  },
282332
282537
  color: {
@@ -282353,12 +282558,14 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
282353
282558
 
282354
282559
 
282355
282560
 
282561
+
282356
282562
  const GithubSchemas = [
282357
282563
  github_group_schema,
282358
282564
  github_user_schema,
282359
282565
  feature_schema,
282360
282566
  github_component_schema,
282361
282567
  github_orgwebhook_schema,
282568
+ github_orgsettings_schema,
282362
282569
  component_secrets_vars_schema,
282363
282570
  component_labels_schema,
282364
282571
  ];
@@ -282764,6 +282971,7 @@ const SecretsSchemas = [external_secrets_schema];
282764
282971
 
282765
282972
 
282766
282973
 
282974
+
282767
282975
  const schemas = {
282768
282976
  root: root_schema,
282769
282977
  schemas: [
@@ -282781,6 +282989,7 @@ const schemas = {
282781
282989
  SecretsSchemas,
282782
282990
  secrets_schema,
282783
282991
  orgwebhook_schema,
282992
+ orgsettings_schema,
282784
282993
  ],
282785
282994
  };
282786
282995
  /* harmony default export */ const base_schemas = (schemas);
@@ -282887,6 +283096,9 @@ const deploy_schema = 'firestartr.dev://common/ArgoDeployClaim';
282887
283096
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/base/orgWebhook.ts
282888
283097
  const orgWebhook_schema = 'firestartr.dev://common/OrgWebhookClaim';
282889
283098
 
283099
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/base/orgSettings.ts
283100
+ const orgSettings_schema = 'firestartr.dev://common/OrgSettingsClaim';
283101
+
282890
283102
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/base/secrets.ts
282891
283103
  const base_secrets_schema = 'firestartr.dev://common/SecretsClaim';
282892
283104
 
@@ -282900,6 +283112,7 @@ const base_secrets_schema = 'firestartr.dev://common/SecretsClaim';
282900
283112
 
282901
283113
 
282902
283114
 
283115
+
282903
283116
  /* harmony default export */ const base = ({
282904
283117
  UserClaimSchema: schema,
282905
283118
  GroupClaimSchema: base_group_schema,
@@ -282909,6 +283122,7 @@ const base_secrets_schema = 'firestartr.dev://common/SecretsClaim';
282909
283122
  TFWorkspaceClaimSchema: workspace_schema,
282910
283123
  ArgoDeployClaimSchema: deploy_schema,
282911
283124
  OrgWebhookClaimSchema: orgWebhook_schema,
283125
+ OrgSettingsClaimSchema: orgSettings_schema,
282912
283126
  SecretsClaimSchema: base_secrets_schema,
282913
283127
  });
282914
283128
 
@@ -283116,7 +283330,7 @@ async function setVirtualClaimAdditionalData(renderedData, claim, claimRef) {
283116
283330
  return renderedData;
283117
283331
  }
283118
283332
  async function setNonVirtualClaimAdditionalData(renderedData, claim, claimRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers) {
283119
- renderedData[claimRef]['initializers'] = await loadInitializers(claim);
283333
+ renderedData[claimRef]['initializers'] = await loadInitializers(claim, renderedData[claimRef]['claimPath']);
283120
283334
  renderedData[claimRef]['globals'] = await loadGlobals(claim);
283121
283335
  renderedData[claimRef]['overrides'] = loadOverrides(claim);
283122
283336
  renderedData[claimRef]['normalizers'] = await loadNormalizers(claim, renderedData[claimRef]['claimPath']);
@@ -283278,7 +283492,7 @@ async function loadNormalizers(_claim, path) {
283278
283492
  *
283279
283493
  */
283280
283494
  let loadedInitializers = false;
283281
- async function loadInitializers(claim, initializersPath = getPath('initializers')) {
283495
+ async function loadInitializers(claim, claimPath, initializersPath = getPath('initializers')) {
283282
283496
  const result = [];
283283
283497
  await crawl(initializersPath, (entry) => {
283284
283498
  return isYamlFile.test(entry);
@@ -283301,7 +283515,7 @@ async function loadInitializers(claim, initializersPath = getPath('initializers'
283301
283515
  });
283302
283516
  for (const initializer of INITIALIZERS) {
283303
283517
  if (initializer.applicableKinds.includes(claim.kind)) {
283304
- result.push(new initializer());
283518
+ result.push(new initializer({ path: claimPath }));
283305
283519
  }
283306
283520
  }
283307
283521
  logger.info(`Loaded initializers ${JSON.stringify(result)}`);
@@ -283336,35 +283550,41 @@ function loader_patchClaim(claim, defaultsClaims) {
283336
283550
  }
283337
283551
  return claim;
283338
283552
  }
283339
- /*
283340
- * Loads all CRs and stores them into a object.
283341
- *
283342
- * This function receives no input.
283343
- *
283344
- * Returns:
283345
- * - An object promise which contains each loaded CR
283346
- *
283347
- */
283348
- async function loadCRs(crsPath = getPath('crs'), excludedPaths = [getPath('globals'), getPath('initializers')], allowedClaimReferences = []) {
283553
+ async function loadCRsWithFullSet(crsPath = getPath('crs'), excludedPaths = [getPath('globals'), getPath('initializers')], allowedClaimReferences = []) {
283349
283554
  const result = {};
283555
+ const fullResult = {};
283350
283556
  await crawlWithExclusions(crsPath, (entry) => {
283351
283557
  return isYamlFile.test(entry);
283352
283558
  }, async (entry, data) => {
283353
283559
  const yamlData = stripKnownRelations(catalog_common/* default.io.fromYaml */.Z.io.fromYaml(data));
283354
- if (!('kind' in yamlData && 'name' in yamlData.metadata)) {
283355
- logger.warn(`Invalid claim file ${entry}`);
283356
- }
283357
- else {
283358
- if (result[`${yamlData.kind}-${yamlData.metadata.name}`]) {
283359
- logger.error(`Duplicate CR ${yamlData.kind}-${yamlData.metadata.name}`);
283360
- }
283560
+ const metadata = yamlData?.metadata;
283561
+ if (!(yamlData &&
283562
+ typeof yamlData === 'object' &&
283563
+ 'kind' in yamlData &&
283564
+ metadata &&
283565
+ typeof metadata === 'object' &&
283566
+ 'name' in metadata)) {
283567
+ logger.warn(`Invalid CR file ${entry}`);
283568
+ }
283569
+ else {
283570
+ const crKey = `${yamlData.kind}-${metadata.name}`;
283571
+ if (fullResult[crKey]) {
283572
+ logger.error(`Duplicate CR ${crKey}`);
283573
+ }
283574
+ // Keep the complete CR set for validations that need repository-wide context.
283575
+ fullResult[crKey] = yamlData;
283576
+ // Keep the filtered CR set for previous-CR lookup during claim rendering.
283361
283577
  if (allowedClaimReferences.length === 0 ||
283362
283578
  allowedClaimReferences.includes(yamlData.metadata?.annotations?.[catalog_common/* default.generic.getFirestartrAnnotation */.Z.generic.getFirestartrAnnotation('claim-ref')])) {
283363
- result[`${yamlData.kind}-${yamlData.metadata.name}`] = yamlData;
283579
+ result[crKey] = yamlData;
283364
283580
  }
283365
283581
  }
283366
283582
  }, excludedPaths.concat(getAdditionalPaths()));
283367
- return result;
283583
+ return { crs: result, fullCrs: fullResult };
283584
+ }
283585
+ async function loadCRs(crsPath = getPath('crs'), excludedPaths = [getPath('globals'), getPath('initializers')], allowedClaimReferences = []) {
283586
+ const { crs } = await loadCRsWithFullSet(crsPath, excludedPaths, allowedClaimReferences);
283587
+ return crs;
283368
283588
  }
283369
283589
  /*
283370
283590
  * Description: Get the renamed using claimRef annotation
@@ -283414,6 +283634,7 @@ async function loadClaimsList(claimRefList, claimsPath = getPath('claims')) {
283414
283634
  const data = {
283415
283635
  renderClaims: {},
283416
283636
  crs: {},
283637
+ fullCrs: {},
283417
283638
  };
283418
283639
  const defaults = loadClaimDefaults();
283419
283640
  for await (const claimRef of claimRefList) {
@@ -283425,7 +283646,9 @@ async function loadClaimsList(claimRefList, claimsPath = getPath('claims')) {
283425
283646
  // Replaces only the first instance of '-'
283426
283647
  crClaimReferences.push(ref.replace('-', '/'));
283427
283648
  }
283428
- data['crs'] = await loadCRs(getPath('crs'), [getPath('globals'), getPath('initializers')], crClaimReferences);
283649
+ const loadedCrs = await loadCRsWithFullSet(getPath('crs'), [getPath('globals'), getPath('initializers')], crClaimReferences);
283650
+ data['crs'] = loadedCrs.crs;
283651
+ data['fullCrs'] = loadedCrs.fullCrs;
283429
283652
  return data;
283430
283653
  }
283431
283654
  function getOrg() {
@@ -285198,6 +285421,9 @@ class FeaturesOverrider extends OverriderPatches {
285198
285421
  identify() {
285199
285422
  return `feature/${featureName}`;
285200
285423
  },
285424
+ applicable() {
285425
+ return { applicableProviders: ['catalog', 'github'] };
285426
+ },
285201
285427
  async post(cr) {
285202
285428
  return utils_renderFeature(featureName, featureVersion, renderedFeatureConfig, cr, claim.name);
285203
285429
  },
@@ -285208,8 +285434,12 @@ class FeaturesOverrider extends OverriderPatches {
285208
285434
  return true;
285209
285435
  },
285210
285436
  async apply(cr) {
285437
+ if (!renderedFeatureConfig) {
285438
+ logger.warn(`Feature ${featureName}: renderedFeatureConfig is null, skipping post-patch`);
285439
+ return cr;
285440
+ }
285211
285441
  const provider = helperCTX(this).provider;
285212
- const jsonPatches = renderedFeatureConfig.patches[provider] || [];
285442
+ const jsonPatches = renderedFeatureConfig.patches?.[provider] || [];
285213
285443
  fast_json_patch_default().applyPatch(cr, jsonPatches);
285214
285444
  return cr;
285215
285445
  },
@@ -288975,12 +289205,71 @@ class GithubOrgWebhookChart extends BaseGithubChart {
288975
289205
  }
288976
289206
  }
288977
289207
 
289208
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/github/orgSettingsChart.ts
289209
+
289210
+
289211
+ class GithubOrgSettingsChart extends BaseGithubChart {
289212
+ template() {
289213
+ const claim = this.get('claim');
289214
+ const firestartrId = this.get('firestartrId');
289215
+ const githubProvider = claim.providers.github;
289216
+ const template = {
289217
+ metadata: {
289218
+ name: githubProvider.name,
289219
+ },
289220
+ spec: {
289221
+ org: githubProvider.org,
289222
+ billingEmail: githubProvider.billing_email,
289223
+ company: githubProvider.company,
289224
+ blog: githubProvider.blog,
289225
+ email: githubProvider.email,
289226
+ twitterUsername: githubProvider.twitter_username,
289227
+ location: githubProvider.location,
289228
+ description: githubProvider.description,
289229
+ hasOrganizationProjects: githubProvider.has_organization_projects,
289230
+ hasRepositoryProjects: githubProvider.has_repository_projects,
289231
+ defaultRepositoryPermission: githubProvider.default_repository_permission,
289232
+ membersCanCreateRepositories: githubProvider.members_can_create_repositories,
289233
+ membersCanCreatePublicRepositories: githubProvider.members_can_create_public_repositories,
289234
+ membersCanCreatePrivateRepositories: githubProvider.members_can_create_private_repositories,
289235
+ membersCanCreateInternalRepositories: githubProvider.members_can_create_internal_repositories,
289236
+ membersCanCreatePages: githubProvider.members_can_create_pages,
289237
+ membersCanCreatePublicPages: githubProvider.members_can_create_public_pages,
289238
+ membersCanCreatePrivatePages: githubProvider.members_can_create_private_pages,
289239
+ membersCanForkPrivateRepositories: githubProvider.members_can_fork_private_repositories,
289240
+ webCommitSignoffRequired: githubProvider.web_commit_signoff_required,
289241
+ advancedSecurityEnabledForNewRepositories: githubProvider.advanced_security_enabled_for_new_repositories,
289242
+ dependabotAlertsEnabledForNewRepositories: githubProvider.dependabot_alerts_enabled_for_new_repositories,
289243
+ dependabotSecurityUpdatesEnabledForNewRepositories: githubProvider.dependabot_security_updates_enabled_for_new_repositories,
289244
+ dependencyGraphEnabledForNewRepositories: githubProvider.dependency_graph_enabled_for_new_repositories,
289245
+ secretScanningEnabledForNewRepositories: githubProvider.secret_scanning_enabled_for_new_repositories,
289246
+ secretScanningPushProtectionEnabledForNewRepositories: githubProvider.secret_scanning_push_protection_enabled_for_new_repositories,
289247
+ firestartr: {
289248
+ tfStateKey: firestartrId,
289249
+ },
289250
+ writeConnectionSecretToRef: {
289251
+ name: `firestartrgithuborganizationsettings-${githubProvider.name}-outputs`.toLowerCase(),
289252
+ outputs: [],
289253
+ },
289254
+ },
289255
+ };
289256
+ return JSON.parse(JSON.stringify(template));
289257
+ }
289258
+ gvk() {
289259
+ return FirestartrGithubOrganizationSettings.GVK;
289260
+ }
289261
+ instanceApiObject(template) {
289262
+ return new FirestartrGithubOrganizationSettings(this, template.metadata.name, template);
289263
+ }
289264
+ }
289265
+
288978
289266
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/github/index.ts
288979
289267
 
288980
289268
 
288981
289269
 
288982
289270
 
288983
289271
 
289272
+
288984
289273
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/catalog/base.ts
288985
289274
 
288986
289275
  class BaseCatalogChart extends BaseChart {
@@ -289724,6 +290013,7 @@ class SecretsChart extends BaseSecretsChart {
289724
290013
  ArgoDeployChart: ArgoDeployChart,
289725
290014
  SecretsChart: SecretsChart,
289726
290015
  GithubOrgWebhookChart: GithubOrgWebhookChart,
290016
+ GithubOrgSettingsChart: GithubOrgSettingsChart,
289727
290017
  });
289728
290018
 
289729
290019
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/renderer/claims-render.ts
@@ -289735,6 +290025,7 @@ class SecretsChart extends BaseSecretsChart {
289735
290025
 
289736
290026
 
289737
290027
 
290028
+
289738
290029
  function normalizeProvidesApis(providesApis) {
289739
290030
  if (!providesApis)
289740
290031
  return [];
@@ -289756,6 +290047,7 @@ async function renderClaims(catalogScope, firestartrScope, data) {
289756
290047
  'TFWorkspaceClaim',
289757
290048
  'ArgoDeployClaim',
289758
290049
  'OrgWebhookClaim',
290050
+ 'OrgSettingsClaim',
289759
290051
  ], renderClaims);
289760
290052
  for (const renderClaims of sortedKinds) {
289761
290053
  for (const claimKey of Object.keys(renderClaims)) {
@@ -289770,7 +290062,8 @@ async function renderClaims(catalogScope, firestartrScope, data) {
289770
290062
  if (!previousCR) {
289771
290063
  logger.debug(`No CR found for claim ${claimKey}, it will be rendered from scratch`);
289772
290064
  }
289773
- const { firestartrEntity, extraCharts, catalogEntity } = await renderClaim(catalogScope, firestartrScope, claim, patches, previousCR);
290065
+ const claimPath = renderClaims[claimKey].claimPath;
290066
+ const { firestartrEntity, extraCharts, catalogEntity } = await renderClaim(catalogScope, firestartrScope, claim, patches, previousCR, claimPath);
289774
290067
  if (catalogEntity) {
289775
290068
  result[`${catalogEntity.kind}-${catalogEntity.metadata.name}`] =
289776
290069
  catalogEntity.toJson();
@@ -289799,7 +290092,7 @@ async function renderClaims(catalogScope, firestartrScope, data) {
289799
290092
  }
289800
290093
  return result;
289801
290094
  }
289802
- async function renderClaim(catalogScope, firestartrScope, claim, patches, previousCR = null) {
290095
+ async function renderClaim(catalogScope, firestartrScope, claim, patches, previousCR = null, claimPath) {
289803
290096
  let catalogEntity = undefined;
289804
290097
  let firestartrEntity = undefined;
289805
290098
  const extraCharts = [];
@@ -289867,6 +290160,20 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
289867
290160
  .join('/');
289868
290161
  const definitionUrl = `https://github.com/${org}/${repoName}/blob/${defaultBranch}/${encodedDefinitionFilePath}`;
289869
290162
  const sanitizedApiName = sanitizeApiEntityName(apiDefinition.name);
290163
+ const repoUrl = getRepositoryUrl();
290164
+ const apiAnnotations = {
290165
+ ...(claim.annotations || {}),
290166
+ title: apiDefinition.name,
290167
+ };
290168
+ if (repoUrl && claimPath) {
290169
+ const claimsRoot = getPath('claims');
290170
+ const relativePath = external_path_.relative(claimsRoot, claimPath)
290171
+ .split(external_path_.sep)
290172
+ .map((segment) => encodeURIComponent(segment))
290173
+ .join('/');
290174
+ apiAnnotations['backstage.io/edit-url'] =
290175
+ `${repoUrl}/blob/${defaultBranch}/${relativePath}`;
290176
+ }
289870
290177
  const apiChart = new charts.CatalogApiChart(catalogScope, `${chartId}-api-${sanitizedApiName}`, firestartrId, {
289871
290178
  name: sanitizedApiName,
289872
290179
  type: apiDefinition.type,
@@ -289874,10 +290181,7 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
289874
290181
  owner: claim.owner,
289875
290182
  system: claim.system,
289876
290183
  definitionUrl,
289877
- annotations: {
289878
- ...(claim.annotations || {}),
289879
- title: apiDefinition.name,
289880
- },
290184
+ annotations: apiAnnotations,
289881
290185
  }, []);
289882
290186
  await apiChart.render();
289883
290187
  const apiObject = await apiChart.postRenderer([]);
@@ -289930,6 +290234,11 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
289930
290234
  firestartrEntity = new charts.GithubOrgWebhookChart(firestartrScope, `github-${chartId}`, firestartrId, claim, renderPatches);
289931
290235
  }
289932
290236
  break;
290237
+ case 'OrgSettingsClaim':
290238
+ if (loadGithub) {
290239
+ firestartrEntity = new charts.GithubOrgSettingsChart(firestartrScope, `github-${chartId}`, firestartrId, claim, renderPatches);
290240
+ }
290241
+ break;
289933
290242
  default:
289934
290243
  console.error(`Unknown claim kind: ${claim.kind}`);
289935
290244
  break;
@@ -289946,7 +290255,7 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
289946
290255
  *
289947
290256
  */
289948
290257
  const [catalogChart, firestartrEntityChart] = await Promise.all([
289949
- loadCatalog ? catalogEntity.render() : Promise.resolve(undefined),
290258
+ catalogEntity ? catalogEntity.render() : Promise.resolve(undefined),
289950
290259
  firestartrEntity?.render(),
289951
290260
  ]);
289952
290261
  /*
@@ -289955,7 +290264,7 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
289955
290264
  *
289956
290265
  */
289957
290266
  return {
289958
- catalogEntity: loadCatalog
290267
+ catalogEntity: catalogChart
289959
290268
  ? await catalogChart.postRenderer(postPatches)
289960
290269
  : undefined,
289961
290270
  firestartrEntity: await (firestartrEntityChart
@@ -290044,6 +290353,39 @@ function validateComponentPagesPath(_renderClaims) {
290044
290353
  return;
290045
290354
  }
290046
290355
 
290356
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/githubOrgSettings.ts
290357
+ const GITHUB_ORG_SETTINGS_KIND = 'FirestartrGithubOrganizationSettings';
290358
+ const FIRESTARTR_CLAIM_REF_ANNOTATION = 'firestartr.dev/claim-ref';
290359
+ const CLAIM_REF_LABEL = 'claim-ref';
290360
+ function formatResourceRef(name, claimRef) {
290361
+ return claimRef ? `${name} (claim: ${claimRef})` : name;
290362
+ }
290363
+ // Render-time singleton: at most one FirestartrGithubOrganizationSettings per
290364
+ // GitHub org (case-insensitive) across the whole rendered set. See ADR 0003.
290365
+ function validateGithubOrgSettingsSingleton(crs) {
290366
+ const refsByOrg = new Map();
290367
+ for (const crKey of Object.keys(crs)) {
290368
+ const cr = crs[crKey];
290369
+ if (cr.kind !== GITHUB_ORG_SETTINGS_KIND)
290370
+ continue;
290371
+ const org = cr.spec?.org;
290372
+ if (typeof org !== 'string' || !org)
290373
+ continue;
290374
+ const name = cr.metadata?.name || crKey;
290375
+ const claimRef = cr.metadata?.annotations?.[FIRESTARTR_CLAIM_REF_ANNOTATION] ||
290376
+ cr.metadata?.labels?.[CLAIM_REF_LABEL];
290377
+ const normalizedOrg = org.toLowerCase();
290378
+ const refs = refsByOrg.get(normalizedOrg) || [];
290379
+ refs.push(formatResourceRef(name, claimRef));
290380
+ refsByOrg.set(normalizedOrg, refs);
290381
+ }
290382
+ for (const [org, refs] of refsByOrg.entries()) {
290383
+ if (refs.length < 2)
290384
+ continue;
290385
+ throw new Error(`Duplicate ${GITHUB_ORG_SETTINGS_KIND} resources found for GitHub organization "${org}": ${refs.join(', ')}`);
290386
+ }
290387
+ }
290388
+
290047
290389
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/renderer/renderer.ts
290048
290390
 
290049
290391
 
@@ -290053,6 +290395,7 @@ function validateComponentPagesPath(_renderClaims) {
290053
290395
 
290054
290396
 
290055
290397
 
290398
+
290056
290399
  /*
290057
290400
  * Function called when rendering but not importing
290058
290401
  *
@@ -290067,10 +290410,15 @@ function validateComponentPagesPath(_renderClaims) {
290067
290410
  async function renderer_render(catalogScope, firestartrScope, claimList) {
290068
290411
  const data = await loadClaimsList(claimList);
290069
290412
  const result = await renderClaims(catalogScope, firestartrScope, data);
290413
+ const fullCrSet = {
290414
+ ...data.fullCrs,
290415
+ ...result,
290416
+ };
290070
290417
  try {
290071
290418
  validateSubReferences(data.renderClaims);
290072
290419
  validateComponentPagesPath(data.renderClaims);
290073
290420
  validateTfStateKeyUniqueness(result);
290421
+ validateGithubOrgSettingsSingleton(fullCrSet);
290074
290422
  validateCrSizes(result);
290075
290423
  validatePermissionsUniqueness(result);
290076
290424
  }
@@ -290500,6 +290848,8 @@ async function addLastStateAndLastClaimAnnotations(filePath, lastStatePRLink, la
290500
290848
  INITIALIZERS_BY_FILE_NAME: INITIALIZERS_BY_FILE_NAME,
290501
290849
  NORMALIZERS: NORMALIZERS,
290502
290850
  AllowedProviders: AllowedProviders,
290851
+ setRepositoryUrl: setRepositoryUrl,
290852
+ setDefaultBranch: setDefaultBranch,
290503
290853
  runComparer: runComparer,
290504
290854
  isCatalogEntity: isCatalogEntity,
290505
290855
  loadCRs: loadCRs,
@@ -290523,7 +290873,7 @@ async function addLastStateAndLastClaimAnnotations(filePath, lastStatePRLink, la
290523
290873
  * This function returns nothing.
290524
290874
  *
290525
290875
  */
290526
- async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity, claimRefs = '', claimFilesList = '') {
290876
+ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity, claimRefs = '', claimFilesList = '', repositoryUrl, defaultBranch) {
290527
290877
  configureProvider(provider);
290528
290878
  setPath('initializers', initializersPath);
290529
290879
  setPath('crs', crsPath);
@@ -290532,6 +290882,8 @@ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, c
290532
290882
  setPath('claimsDefaults', claimsDefaults);
290533
290883
  setRenamesEnabled(renamesEnabled);
290534
290884
  setExcludedPaths(excludedPaths);
290885
+ setRepositoryUrl(repositoryUrl);
290886
+ setDefaultBranch(defaultBranch ?? 'main');
290535
290887
  const catalogApp = new lib.App({
290536
290888
  outdir: outputCatalogDir,
290537
290889
  outputFileExtension: '.yaml',
@@ -291058,6 +291410,107 @@ MemberCollectionGithubDecanter.collectionKind = 'gh-members';
291058
291410
  applyCollectionMixins(MemberCollectionGithubDecanter);
291059
291411
  /* harmony default export */ const github_member_collection = (MemberCollectionGithubDecanter);
291060
291412
 
291413
+ ;// CONCATENATED MODULE: ../importer/src/decanter/gh/github_org_settings.ts
291414
+
291415
+
291416
+ const ORG_SETTINGS_OPTIONAL_FIELDS = [
291417
+ 'twitter_username',
291418
+ 'company',
291419
+ 'blog',
291420
+ 'email',
291421
+ 'location',
291422
+ 'description',
291423
+ 'has_organization_projects',
291424
+ 'has_repository_projects',
291425
+ 'default_repository_permission',
291426
+ 'members_can_create_repositories',
291427
+ 'members_can_create_public_repositories',
291428
+ 'members_can_create_private_repositories',
291429
+ 'members_can_create_internal_repositories',
291430
+ 'members_can_create_pages',
291431
+ 'members_can_create_public_pages',
291432
+ 'members_can_create_private_pages',
291433
+ 'members_can_fork_private_repositories',
291434
+ 'web_commit_signoff_required',
291435
+ 'advanced_security_enabled_for_new_repositories',
291436
+ 'dependabot_alerts_enabled_for_new_repositories',
291437
+ 'dependabot_security_updates_enabled_for_new_repositories',
291438
+ 'dependency_graph_enabled_for_new_repositories',
291439
+ 'secret_scanning_enabled_for_new_repositories',
291440
+ 'secret_scanning_push_protection_enabled_for_new_repositories',
291441
+ ];
291442
+ class OrgSettingsGithubDecanter extends GithubDecanter {
291443
+ constructor() {
291444
+ super(...arguments);
291445
+ this.claimKind = 'OrgSettingsClaim';
291446
+ }
291447
+ __decantStart() {
291448
+ this.claim = {
291449
+ kind: this.claimKind,
291450
+ version: this.VERSION(),
291451
+ name: this.orgSettingsName(),
291452
+ };
291453
+ }
291454
+ __decantProviders() {
291455
+ importer_src_logger.info(`Decanting GitHub organization settings providers for ${this.org}`);
291456
+ this.__patchClaim({
291457
+ op: 'add',
291458
+ value: {
291459
+ github: this.data.providerPayload,
291460
+ },
291461
+ path: '/providers',
291462
+ });
291463
+ }
291464
+ async __gatherOrgSettings() {
291465
+ importer_src_logger.info(`Gathering GitHub organization settings for ${this.org}`);
291466
+ this.data.orgSettings = await this.github.org.getOrgInfo(this.org);
291467
+ }
291468
+ __gatherProviderPayload() {
291469
+ const billingEmail = this.data.orgSettings.billing_email;
291470
+ if (typeof billingEmail !== 'string' || billingEmail.trim() === '') {
291471
+ throw new Error(`GitHub organization ${this.org} did not return billing_email. ` +
291472
+ 'billing_email is required for OrgSettingsClaim / FirestartrGithubOrganizationSettings. ' +
291473
+ 'Run importer with credentials that can read billing email or create/manage the claim manually.');
291474
+ }
291475
+ const providerPayload = {
291476
+ name: this.orgSettingsName(),
291477
+ org: this.org,
291478
+ billing_email: billingEmail,
291479
+ };
291480
+ for (const field of ORG_SETTINGS_OPTIONAL_FIELDS) {
291481
+ const value = this.data.orgSettings[field];
291482
+ if (value !== undefined && value !== null) {
291483
+ providerPayload[field] = value;
291484
+ }
291485
+ }
291486
+ this.data.providerPayload = providerPayload;
291487
+ importer_src_logger.info(`Prepared GitHub organization settings claim payload for ${this.org}`);
291488
+ }
291489
+ async __adaptInitializerBase(_claim) {
291490
+ return await this.__loadInitializer('defaults_github_orgsettings.yaml');
291491
+ }
291492
+ orgSettingsName() {
291493
+ return `${this.org.toLowerCase()}-org-settings`;
291494
+ }
291495
+ }
291496
+
291497
+ ;// CONCATENATED MODULE: ../importer/src/decanter/gh/github_org_settings_collection.ts
291498
+
291499
+
291500
+
291501
+ class OrgSettingsCollectionGithubDecanter extends GithubDecanter {
291502
+ async collection(filters = []) {
291503
+ if (this.IS_SKIP_SET(filters, OrgSettingsCollectionGithubDecanter.collectionKind)) {
291504
+ return [];
291505
+ }
291506
+ const filteredOrgs = await this.filter(OrgSettingsCollectionGithubDecanter.collectionKind, filters, [this.org]);
291507
+ return filteredOrgs.map((orgName) => new OrgSettingsGithubDecanter({}, orgName));
291508
+ }
291509
+ }
291510
+ OrgSettingsCollectionGithubDecanter.collectionKind = 'gh-org-settings';
291511
+ applyCollectionMixins(OrgSettingsCollectionGithubDecanter);
291512
+ /* harmony default export */ const github_org_settings_collection = (OrgSettingsCollectionGithubDecanter);
291513
+
291061
291514
  ;// CONCATENATED MODULE: ../importer/src/utils/codeowner.ts
291062
291515
  function extractFromCodeOwners(codeOwnersContent) {
291063
291516
  if (!codeOwnersContent) {
@@ -291553,6 +292006,7 @@ applyCollectionMixins(RepoCollectionGithubDecanter);
291553
292006
 
291554
292007
 
291555
292008
 
292009
+
291556
292010
  // A single claim can render multiple CRs.
291557
292011
  // Some of those rendered kinds are derived/child resources whose parent is the
291558
292012
  // main CR for the claim, so they do not correspond to claim files that should be moved.
@@ -291564,6 +292018,7 @@ let previousCRs = {};
291564
292018
  const collections = {
291565
292019
  GroupCollectionGithubDecanter: github_group_collection,
291566
292020
  MemberCollectionGithubDecanter: github_member_collection,
292021
+ OrgSettingsCollectionGithubDecanter: github_org_settings_collection,
291567
292022
  RepoCollectionGithubDecanter: github_repo_collection,
291568
292023
  };
291569
292024
  function isInPreviousCRs(kind, name) {
@@ -291656,9 +292111,11 @@ function getClaimPathFromCR(claimsBasePath, cr) {
291656
292111
  FirestartrGithubGroup: 'groups',
291657
292112
  FirestartrGithubRepository: 'components',
291658
292113
  FirestartrGithubMembership: 'users',
292114
+ // common.io.writeClaim derives OrgSettingsClaim -> orgsettingss.
292115
+ FirestartrGithubOrganizationSettings: 'orgsettingss',
291659
292116
  };
291660
292117
  const claimRef = `${cr.metadata.annotations['firestartr.dev/claim-ref']}.yaml`.toLowerCase();
291661
- return external_path_.join(claimsBasePath, mapCrsToClaims[cr.kind], claimRef.replace(/^[^/]+/, ''));
292118
+ return external_path_.join(claimsBasePath, mapCrsToClaims[cr.kind], claimRef.replace(/^[^/]+\//, ''));
291662
292119
  }
291663
292120
  function getCrPath(crsBasePath, cr) {
291664
292121
  return external_path_.join(crsBasePath, `${cr.kind}.${cr.metadata.name}.yaml`);
@@ -291669,6 +292126,7 @@ async function getDataFromKinds(org, filters = [], needsReImport) {
291669
292126
  importGithubMemberships(org, filters, needsReImport).then((memberships) => (data['memberships'] = memberships)),
291670
292127
  importGithubGroups(org, filters, needsReImport).then((groups) => (data['groups'] = groups)),
291671
292128
  importGithubRepositories(org, filters, needsReImport).then((repos) => (data['repos'] = repos)),
292129
+ importGithubOrgSettings(org, filters, needsReImport).then((orgSettings) => (data['orgSettings'] = orgSettings)),
291672
292130
  ]);
291673
292131
  const renderClaims = {};
291674
292132
  const deps = {};
@@ -291695,6 +292153,12 @@ async function getDataFromKinds(org, filters = [], needsReImport) {
291695
292153
  membership.deps;
291696
292154
  postRender[`FirestartrGithubMembership-${membership.renderClaim.claim.name}`] = membership.postRenderFunctions;
291697
292155
  }
292156
+ for (const orgSettings of data['orgSettings']) {
292157
+ renderClaims[`OrgSettingsClaim-${orgSettings.renderClaim.claim.name}`] =
292158
+ orgSettings.renderClaim;
292159
+ deps[`FirestartrGithubOrganizationSettings-${orgSettings.renderClaim.claim.name}`] = orgSettings.deps;
292160
+ postRender[`FirestartrGithubOrganizationSettings-${orgSettings.renderClaim.claim.name}`] = orgSettings.postRenderFunctions;
292161
+ }
291698
292162
  return { renderClaims, deps: deps, postRender: postRender };
291699
292163
  }
291700
292164
  async function importGithubGroups(org, filters = [], needsReImport) {
@@ -291737,6 +292201,19 @@ async function importGithubMemberships(org, filters = [], needsReImport) {
291737
292201
  }
291738
292202
  return memberships;
291739
292203
  }
292204
+ async function importGithubOrgSettings(org, filters = [], needsReImport) {
292205
+ const orgSettingsList = [];
292206
+ const orgSettingsCollection = new github_org_settings_collection({}, org);
292207
+ const collection = await orgSettingsCollection.collection(filters);
292208
+ for (const orgSettings of collection) {
292209
+ orgSettings.needsReImport = needsReImport;
292210
+ await orgSettings.gather();
292211
+ await orgSettings.decant();
292212
+ orgSettingsList.push(await orgSettings.adapt());
292213
+ orgSettings.render();
292214
+ }
292215
+ return orgSettingsList;
292216
+ }
291740
292217
  async function getPreviousCrs(crsPath) { }
291741
292218
  /* harmony default export */ const decanter = ({ importGithubGitopsRepository });
291742
292219
 
@@ -291788,6 +292265,7 @@ const KIND_TO_COLLECTION_FILTERS = {
291788
292265
  FirestartrGithubRepository: 'gh-repo',
291789
292266
  FirestartrGithubGroup: 'gh-group',
291790
292267
  FirestartrGithubMembership: 'gh-members',
292268
+ FirestartrGithubOrganizationSettings: 'gh-org-settings',
291791
292269
  };
291792
292270
  const DEPENDANT_KINDS = [
291793
292271
  'FirestartrGithubRepositoryFeature',
@@ -291796,6 +292274,9 @@ const DEPENDANT_KINDS = [
291796
292274
  // we create a special Collection that will use
291797
292275
  class ReimportCollection {
291798
292276
  helperNameExtractor(cr) {
292277
+ if (cr.kind === 'FirestartrGithubOrganizationSettings') {
292278
+ return cr.spec.org;
292279
+ }
291799
292280
  return cr.metadata.annotations['firestartr.dev/external-name'];
291800
292281
  }
291801
292282
  isSkipped(cr, generatedFilters) {
@@ -291962,19 +292443,25 @@ function buildFilters(filters, force, crsPath, generatedFilters) {
291962
292443
  return generatedFilters;
291963
292444
  }
291964
292445
  function createSkipFilters(filters) {
291965
- const includedCollections = filters.map((f) => f.split(',')[0]);
291966
- const allFilters = filters.filter((f) => f.split(',')[0] === 'all');
292446
+ const crExistsFilter = 'all,FUNCTION=fCheckCRExistsOnDisk';
292447
+ const includedCollections = filters
292448
+ .filter((f) => f !== crExistsFilter)
292449
+ .map((f) => f.split(',')[0]);
292450
+ const allFilters = filters.filter((f) => f.split(',')[0] === 'all' && f !== crExistsFilter);
292451
+ const hasExplicitFilters = includedCollections.length > 0;
291967
292452
  for (const collectionClass of Object.values(collections)) {
291968
- if (allFilters.length > 0) {
291969
- for (const allFilter of allFilters) {
291970
- const adaptedFilter = allFilter.replace('all', collectionClass.collectionKind);
291971
- filters.push(adaptedFilter);
292453
+ const collectionKind = collectionClass.collectionKind;
292454
+ if (allFilters.length > 0 || !hasExplicitFilters) {
292455
+ for (const allFilter of [...allFilters, crExistsFilter]) {
292456
+ filters.push(allFilter.replace('all', collectionKind));
291972
292457
  }
291973
292458
  continue;
291974
292459
  }
291975
- if (includedCollections.indexOf(collectionClass.collectionKind) === -1) {
291976
- filters.push(`${collectionClass.collectionKind},SKIP=SKIP`);
292460
+ if (includedCollections.indexOf(collectionKind) === -1) {
292461
+ filters.push(`${collectionKind},SKIP=SKIP`);
292462
+ continue;
291977
292463
  }
292464
+ filters.push(crExistsFilter.replace('all', collectionKind));
291978
292465
  }
291979
292466
  return filters;
291980
292467
  }
@@ -292246,6 +292733,7 @@ const kindPluralMap = {
292246
292733
  githubrepositorysecretssections: 'FirestartrGithubRepositorySecretsSection',
292247
292734
  terraformmodules: 'FirestartrTerraformModule',
292248
292735
  githuborgwebhooks: 'FirestartrGithubOrgWebhook',
292736
+ githuborganizationsettings: 'FirestartrGithubOrganizationSettings',
292249
292737
  terraformworkspaces: 'FirestartrTerraformWorkspace',
292250
292738
  terraformworkspaceplans: 'FirestartrTerraformWorkspacePlan',
292251
292739
  providerconfigs: 'FirestartrProviderConfig',
@@ -292393,9 +292881,9 @@ function getOperatorProfile() {
292393
292881
  }
292394
292882
  async function getItem(kind, namespace, item) {
292395
292883
  const itemPath = `${namespace}/${kind}/${item.metadata.name}`;
292396
- return await getItemByItemPath(itemPath);
292884
+ return await ctl_getItemByItemPath(itemPath);
292397
292885
  }
292398
- async function getItemByItemPath(itemPath, apiGroup = catalog_common/* default.types.controller.FirestartrApiGroup */.Z.types.controller.FirestartrApiGroup, apiVersion = 'v1') {
292886
+ async function ctl_getItemByItemPath(itemPath, apiGroup = catalog_common/* default.types.controller.FirestartrApiGroup */.Z.types.controller.FirestartrApiGroup, apiVersion = 'v1') {
292399
292887
  try {
292400
292888
  operator_src_logger.debug(`The ctl is getting the item at '${itemPath}'.`);
292401
292889
  const { kc, opts } = await ctl_getConnection();
@@ -292419,6 +292907,39 @@ async function getItemByItemPath(itemPath, apiGroup = catalog_common/* default.t
292419
292907
  throw e;
292420
292908
  }
292421
292909
  }
292910
+ /**
292911
+ * Like getItemByItemPath but returns null when the resource is not found
292912
+ * (404) or there is a conflict (409), without logging those as errors.
292913
+ * Use this when a missing resource is an expected condition (e.g. checking
292914
+ * whether a parent CR has been provisioned before its children arrive).
292915
+ */
292916
+ async function getItemByItemPathOrNull(itemPath, apiGroup = catalog_common/* default.types.controller.FirestartrApiGroup */.Z.types.controller.FirestartrApiGroup, apiVersion = 'v1') {
292917
+ try {
292918
+ operator_src_logger.debug(`The ctl is getting the item at '${itemPath}'.`);
292919
+ const { kc, opts } = await ctl_getConnection();
292920
+ opts.headers['Content-Type'] = 'application/json';
292921
+ opts.headers['Accept'] = 'application/json';
292922
+ const url = apiGroup === catalog_common/* default.types.controller.KubernetesApiGroup */.Z.types.controller.KubernetesApiGroup
292923
+ ? `${kc.getCurrentCluster().server}/api/v1/namespaces/${itemPath}`
292924
+ : `${kc.getCurrentCluster().server}/apis/${apiGroup}/${apiVersion}/namespaces/${itemPath}`;
292925
+ operator_src_logger.silly(`Sending request ${url}`);
292926
+ const r = await fetch(url, { method: 'get', headers: opts.headers });
292927
+ if (r.status === 404 || r.status === 409) {
292928
+ operator_src_logger.debug(`Item at '${itemPath}' returned ${r.status} (expected), returning null.`);
292929
+ return null;
292930
+ }
292931
+ if (!r.ok) {
292932
+ const err = new Error(`Error on getItemByItemPath: ${itemPath}: ${r.statusText}`);
292933
+ operator_src_logger.error(`Error on getItemByItemPath: ${itemPath}: ${r.statusText}`);
292934
+ throw err;
292935
+ }
292936
+ return await r.json();
292937
+ }
292938
+ catch (e) {
292939
+ operator_src_logger.error(`Error on getItemByItemPath: ${e}`);
292940
+ throw e;
292941
+ }
292942
+ }
292422
292943
  async function writeManifest(kind, namespace, item, apiSlug) {
292423
292944
  const { kc, opts } = await ctl_getConnection();
292424
292945
  opts.headers['Content-Type'] = 'application/json';
@@ -292704,40 +293225,52 @@ async function checkIfRenamed(namespace, item) {
292704
293225
  }
292705
293226
  }
292706
293227
  async function upsertFinalizer(kind, namespace, item, finalizer) {
292707
- if ('finalizers' in item.metadata &&
292708
- item.metadata.finalizers.includes(finalizer)) {
292709
- operator_src_logger.debug(`The ctl tried to upsert the finalizer '${finalizer}' for '${kind}/${item.metadata.name}' in namespace '${namespace}', but it was already set.`);
292710
- return;
292711
- }
292712
- operator_src_logger.debug(`The ctl is setting the finalizer '${finalizer}' for '${kind}/${item.metadata.name}' in namespace '${namespace}'.`);
292713
293228
  const { kc, opts } = await ctl_getConnection();
292714
293229
  const url = `${kc.getCurrentCluster().server}/apis/firestartr.dev/v1/namespaces/${namespace}/${kind}/${item.metadata.name}`;
292715
- opts.headers['Content-Type'] = 'application/json-patch+json';
292716
- opts.headers['Accept'] = '*';
292717
- let patch;
292718
- if (!item['metadata']['finalizers']) {
292719
- patch = {
292720
- op: 'add',
292721
- path: '/metadata/finalizers',
292722
- value: [finalizer],
292723
- };
292724
- }
292725
- else {
292726
- patch = {
292727
- op: 'add',
292728
- path: '/metadata/finalizers/-',
292729
- value: finalizer,
292730
- };
292731
- }
292732
- const r = await fetch(url, {
292733
- method: 'PATCH',
292734
- headers: opts.headers,
292735
- body: JSON.stringify([patch]),
292736
- });
292737
- if (!r.ok) {
292738
- throw `Error on setFinalizer: ${namespace}/${kind}/${item['metadata']['name']}: ${r.statusText}`;
293230
+ for (let attempt = 0; attempt < 5; attempt++) {
293231
+ // Fresh GET to get current finalizers and resourceVersion
293232
+ const getResp = await fetch(url, {
293233
+ method: 'GET',
293234
+ headers: { ...opts.headers, Accept: 'application/json' },
293235
+ });
293236
+ if (!getResp.ok) {
293237
+ throw `Error fetching item for finalizer upsert: ${namespace}/${kind}/${item.metadata.name}: ${getResp.statusText}`;
293238
+ }
293239
+ const currentItem = await getResp.json();
293240
+ const currentFinalizers = currentItem.metadata.finalizers || [];
293241
+ if (currentFinalizers.includes(finalizer)) {
293242
+ operator_src_logger.debug(`The ctl tried to upsert the finalizer '${finalizer}' for '${kind}/${item.metadata.name}' in namespace '${namespace}', but it was already set.`);
293243
+ return;
293244
+ }
293245
+ operator_src_logger.debug(`The ctl is setting the finalizer '${finalizer}' for '${kind}/${item.metadata.name}' in namespace '${namespace}' (attempt ${attempt + 1}).`);
293246
+ const newFinalizers = [...currentFinalizers, finalizer];
293247
+ const body = JSON.stringify([
293248
+ {
293249
+ op: 'add',
293250
+ path: '/metadata/finalizers',
293251
+ value: newFinalizers,
293252
+ },
293253
+ ]);
293254
+ const patchResp = await fetch(url, {
293255
+ method: 'PATCH',
293256
+ headers: {
293257
+ ...opts.headers,
293258
+ 'Content-Type': 'application/json-patch+json',
293259
+ Accept: '*',
293260
+ 'If-Match': currentItem.metadata.resourceVersion,
293261
+ },
293262
+ body,
293263
+ });
293264
+ if (patchResp.ok) {
293265
+ return patchResp.json();
293266
+ }
293267
+ if (patchResp.status === 409) {
293268
+ operator_src_logger.debug(`Conflict upserting finalizer '${finalizer}' for '${kind}/${item.metadata.name}' (attempt ${attempt + 1}), retrying.`);
293269
+ continue;
293270
+ }
293271
+ throw `Error on upsertFinalizer: ${namespace}/${kind}/${item.metadata.name}: ${patchResp.statusText}`;
292739
293272
  }
292740
- return r.json();
293273
+ throw `Failed to upsert finalizer '${finalizer}' for '${namespace}/${kind}/${item.metadata.name}' after 5 attempts.`;
292741
293274
  }
292742
293275
  /**
292743
293276
  * Remove the given finalizer
@@ -292751,30 +293284,57 @@ async function unsetFinalizer(kind, namespace, item, finalizer) {
292751
293284
  const { kc, opts } = await ctl_getConnection();
292752
293285
  let itemObj;
292753
293286
  if (typeof item === 'string') {
292754
- itemObj = await getItemByItemPath([namespace, kind, item].join('/'));
293287
+ itemObj = await ctl_getItemByItemPath([namespace, kind, item].join('/'));
292755
293288
  }
292756
293289
  else {
292757
293290
  itemObj = item;
292758
293291
  }
292759
293292
  const name = itemObj.metadata.name;
292760
- operator_src_logger.debug(`The ctl is removing the finalizer '${finalizer}' from '${kind}/${name}' in namespace '${namespace}'.`);
292761
293293
  const url = `${kc.getCurrentCluster().server}/apis/firestartr.dev/v1/namespaces/${namespace}/${kind}/${name}`;
292762
- opts.headers['Content-Type'] = 'application/json-patch+json';
292763
- opts.headers['Accept'] = '*';
292764
- const patch = {
292765
- op: 'replace',
292766
- path: '/metadata/finalizers',
292767
- value: itemObj.metadata.finalizers.filter((f) => f !== finalizer),
292768
- };
292769
- const r = await fetch(url, {
292770
- method: 'PATCH',
292771
- headers: opts.headers,
292772
- body: JSON.stringify([patch]),
292773
- });
292774
- if (!r.ok) {
292775
- throw `Error on unsetFinalizer: ${namespace}/${kind}/${name}: ${r.statusText}`;
293294
+ for (let attempt = 0; attempt < 5; attempt++) {
293295
+ // Fresh GET to get current finalizers and resourceVersion
293296
+ const getResp = await fetch(url, {
293297
+ method: 'GET',
293298
+ headers: { ...opts.headers, Accept: 'application/json' },
293299
+ });
293300
+ if (!getResp.ok) {
293301
+ throw `Error fetching item for finalizer unset: ${namespace}/${kind}/${name}: ${getResp.statusText}`;
293302
+ }
293303
+ const currentItem = await getResp.json();
293304
+ const currentFinalizers = currentItem.metadata.finalizers || [];
293305
+ if (!currentFinalizers.includes(finalizer)) {
293306
+ operator_src_logger.debug(`The ctl tried to unset the finalizer '${finalizer}' for '${kind}/${name}' in namespace '${namespace}', but it was not present.`);
293307
+ return;
293308
+ }
293309
+ operator_src_logger.debug(`The ctl is removing the finalizer '${finalizer}' from '${kind}/${name}' in namespace '${namespace}' (attempt ${attempt + 1}).`);
293310
+ const newFinalizers = currentFinalizers.filter((f) => f !== finalizer);
293311
+ const body = JSON.stringify([
293312
+ {
293313
+ op: 'replace',
293314
+ path: '/metadata/finalizers',
293315
+ value: newFinalizers,
293316
+ },
293317
+ ]);
293318
+ const patchResp = await fetch(url, {
293319
+ method: 'PATCH',
293320
+ headers: {
293321
+ ...opts.headers,
293322
+ 'Content-Type': 'application/json-patch+json',
293323
+ Accept: '*',
293324
+ 'If-Match': currentItem.metadata.resourceVersion,
293325
+ },
293326
+ body,
293327
+ });
293328
+ if (patchResp.ok) {
293329
+ return patchResp.json();
293330
+ }
293331
+ if (patchResp.status === 409) {
293332
+ operator_src_logger.debug(`Conflict unsetting finalizer '${finalizer}' for '${kind}/${name}' (attempt ${attempt + 1}), retrying.`);
293333
+ continue;
293334
+ }
293335
+ throw `Error on unsetFinalizer: ${namespace}/${kind}/${name}: ${patchResp.statusText}`;
292776
293336
  }
292777
- return r.json();
293337
+ throw `Failed to unset finalizer '${finalizer}' for '${namespace}/${kind}/${name}' after 5 attempts.`;
292778
293338
  }
292779
293339
  /**
292780
293340
  * @deprecated Misspelled export kept for backward compatibility.
@@ -293041,7 +293601,7 @@ function conditionsSorter(conditions) {
293041
293601
 
293042
293602
 
293043
293603
  async function upsertInitialStatus(pluralKind, namespace, item) {
293044
- item = await getItemByItemPath(`${namespace}/${pluralKind}/${item.metadata.name}`);
293604
+ item = await ctl_getItemByItemPath(`${namespace}/${pluralKind}/${item.metadata.name}`);
293045
293605
  if (!('status' in item))
293046
293606
  item.status = {};
293047
293607
  if (!('conditions' in item.status))
@@ -293127,7 +293687,7 @@ function shouldForceReconcileByAnnotation(cr) {
293127
293687
  }
293128
293688
  async function updateSyncTransition(itemPath, reason, lastSyncTime, nextSyncTime, message, status) {
293129
293689
  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}'.`);
293130
- const k8sItem = await getItemByItemPath(itemPath);
293690
+ const k8sItem = await ctl_getItemByItemPath(itemPath);
293131
293691
  if (!('status' in k8sItem))
293132
293692
  k8sItem.status = {};
293133
293693
  if (!('conditions' in k8sItem.status))
@@ -293150,7 +293710,7 @@ async function updateSyncTransition(itemPath, reason, lastSyncTime, nextSyncTime
293150
293710
  async function updateRetryStatusInCR(pluralKind, namespace, name, retryCount, nextRetryTime) {
293151
293711
  const itemPath = `${namespace}/${pluralKind}/${name}`;
293152
293712
  try {
293153
- const item = await getItemByItemPath(itemPath);
293713
+ const item = await ctl_getItemByItemPath(itemPath);
293154
293714
  if (!('status' in item) || item.status === null)
293155
293715
  item.status = {};
293156
293716
  item.status.retryCount = retryCount;
@@ -293196,7 +293756,7 @@ async function writePrioritizedStatus(kind, namespace, item) {
293196
293756
  }
293197
293757
  async function updateTransition(itemPath, reason, type, statusValue, message = '', updateStatusOnly = false) {
293198
293758
  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}'.`);
293199
- const k8sItem = await getItemByItemPath(itemPath);
293759
+ const k8sItem = await ctl_getItemByItemPath(itemPath);
293200
293760
  if (!('status' in k8sItem))
293201
293761
  k8sItem.status = {};
293202
293762
  if (!('conditions' in k8sItem.status))
@@ -293269,7 +293829,7 @@ const SYNC_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Sync o
293269
293829
 
293270
293830
  const DEFAULT_REVISION_TIME = '1m';
293271
293831
  async function createWatcherForItem(itemPath, itemCR) {
293272
- const item = itemCR ?? (await getItemByItemPath(itemPath));
293832
+ const item = itemCR ?? (await ctl_getItemByItemPath(itemPath));
293273
293833
  const syncStatus = await getSyncStatus(itemPath, item);
293274
293834
  let nextTimeoutInMS = syncStatus.nextTimeoutInMS;
293275
293835
  // we have lapsed last interval
@@ -293301,7 +293861,7 @@ async function destroyWatcherForItem(watcher) {
293301
293861
  operator_src_logger.debug(`Disabled SyncWatcher for ${watcher.itemPath}`);
293302
293862
  }
293303
293863
  async function getSyncSpecs(itemPath, itemCR) {
293304
- const item = itemCR ?? (await getItemByItemPath(itemPath));
293864
+ const item = itemCR ?? (await ctl_getItemByItemPath(itemPath));
293305
293865
  return {
293306
293866
  item,
293307
293867
  syncable: helperIsSyncable(item),
@@ -293313,7 +293873,7 @@ async function getSyncSpecs(itemPath, itemCR) {
293313
293873
  };
293314
293874
  }
293315
293875
  async function getSyncStatus(itemPath, itemCR) {
293316
- const item = itemCR ?? (await getItemByItemPath(itemPath));
293876
+ const item = itemCR ?? (await ctl_getItemByItemPath(itemPath));
293317
293877
  const syncCondition = getConditionByType(item.status?.conditions ?? [], 'SYNCHRONIZED');
293318
293878
  // no sync condition present
293319
293879
  if (!syncCondition) {
@@ -293345,7 +293905,7 @@ async function getSyncStatus(itemPath, itemCR) {
293345
293905
  }
293346
293906
  }
293347
293907
  async function setSyncStatus(itemPath, reason, status, message) {
293348
- const item = await getItemByItemPath(itemPath);
293908
+ const item = await ctl_getItemByItemPath(itemPath);
293349
293909
  const machinery = assessSyncCalculationMachinery(item);
293350
293910
  const syncStatus = await machinery(item, reason, status, message);
293351
293911
  syncStatus.itemPath = itemPath;
@@ -293595,7 +294155,7 @@ async function loopKeeper(api) {
293595
294155
  }
293596
294156
  }
293597
294157
  async function getItemIfNeededSync(watcher) {
293598
- const item = await getItemByItemPath(watcher.itemPath);
294158
+ const item = await ctl_getItemByItemPath(watcher.itemPath);
293599
294159
  const isProvisioning = item.status?.conditions?.find((condition) => condition.type === 'PROVISIONING' && condition.status === 'True');
293600
294160
  if (isProvisioning)
293601
294161
  return null;
@@ -293685,7 +294245,7 @@ async function retry_loop(enqueueIfNeeded) {
293685
294245
  }
293686
294246
  async function getItemIfNeededRetry(watcher) {
293687
294247
  try {
293688
- const item = await getItemByItemPath(watcher.itemPath);
294248
+ const item = await ctl_getItemByItemPath(watcher.itemPath);
293689
294249
  const isProvisioning = item.status?.conditions?.find((condition) => condition.type === 'PROVISIONING' && condition.status === 'True');
293690
294250
  if (isProvisioning)
293691
294251
  return null;
@@ -293869,6 +294429,7 @@ const kindsWithFinalizer = [
293869
294429
  'FirestartrGithubRepository',
293870
294430
  'FirestartrGithubRepositoryFeature',
293871
294431
  'FirestartrGithubOrgWebhook',
294432
+ 'FirestartrGithubOrganizationSettings',
293872
294433
  'FirestartrGithubRepositorySecretsSection',
293873
294434
  ];
293874
294435
  const kindsWithDependants = [
@@ -293973,7 +294534,7 @@ async function handleUnsetFinalizer(pluralKind, namespace, item) {
293973
294534
  */
293974
294535
  function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
293975
294536
  workItem.getItem = () => {
293976
- return getItemByItemPath(informer_itemPath(pluralKind, workItem.item));
294537
+ return ctl_getItemByItemPath(informer_itemPath(pluralKind, workItem.item));
293977
294538
  };
293978
294539
  workItem.isDeadLetter = false;
293979
294540
  workItem.handler = {
@@ -293992,7 +294553,7 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
293992
294553
  return result;
293993
294554
  },
293994
294555
  writeConnectionSecret: writeConnectionSecret,
293995
- resolveReferences: () => resolve(workItem.item, getItemByItemPath, getSecret),
294556
+ resolveReferences: () => resolve(workItem.item, ctl_getItemByItemPath, getSecret),
293996
294557
  resolveOwnOutputs: () => {
293997
294558
  return resolveSecretRef(workItem.item.metadata.namespace, workItem.item, getSecret);
293998
294559
  },
@@ -294063,7 +294624,7 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
294063
294624
  if (needsUpdateSyncConditions) {
294064
294625
  if (operation === OperationType.SYNC) {
294065
294626
  // Fetch the CR once and reuse for both hasSyncFailed check and ERROR guard
294066
- const currentItem = await getItemByItemPath(workItem.handler.itemPath());
294627
+ const currentItem = await ctl_getItemByItemPath(workItem.handler.itemPath());
294067
294628
  const syncStatus = await getSyncStatus(workItem.handler.itemPath(), currentItem);
294068
294629
  if (syncStatus.hasSyncFailed) {
294069
294630
  return;
@@ -294312,64 +294873,40 @@ function dummy_fWait(ms) {
294312
294873
  });
294313
294874
  }
294314
294875
 
294315
- ;// CONCATENATED MODULE: ../operator/src/ownership.ts
294876
+ ;// CONCATENATED MODULE: ../operator/src/ctl_collections.ts
294316
294877
 
294317
294878
 
294318
294879
 
294319
- async function getOwnerReferences(item) {
294320
- return item.metadata?.ownerReferences || [];
294321
- }
294322
- async function ownership_setOwnerReference(itemPath, namespace, ownerKind, ownerName, blockOwnerDeletion = true) {
294323
- let item = null;
294880
+ // generator function to traverse elements
294881
+ // it is async and iterable
294882
+ async function* traverseCRCollection(pluralKind, namespace, options = {}, apiGroup = 'firestartr.dev', apiVersion = 'v1') {
294883
+ const { limit = 300 } = options; // between 250-300
294324
294884
  try {
294325
- // we need to search for the owner's uuid
294326
- const owner = await getItemByItemPath(`${namespace}/${ownerKind}/${ownerName}`);
294327
- const ownerReference = {
294328
- apiVersion: owner.apiVersion,
294329
- kind: owner.kind,
294330
- name: ownerName,
294331
- controller: true,
294332
- blockOwnerDeletion,
294333
- uid: owner.metadata.uid,
294334
- };
294335
- // we get the item (to prevent race conditions)
294336
- item = await getItemByItemPath(itemPath);
294337
- const ownerReferences = item.metadata.ownerReferences ?? [];
294338
- const existingRefIndex = ownerReferences.findIndex((ref) => ref.uid === ownerReference.uid);
294339
- if (existingRefIndex === -1) {
294340
- // Reference does not exist, add it
294341
- ownerReferences.push(ownerReference);
294342
- }
294343
- else {
294344
- ownerReferences[existingRefIndex] = ownerReference;
294345
- }
294346
- await writeOwnerReferences(definitions_getPluralFromKind(item.kind), item.metadata.namespace, item, ownerReferences);
294885
+ let continueToken = undefined;
294886
+ const { kc, opts } = await ctl_getConnection();
294887
+ const k8sApi = kc.makeApiClient(client_node_dist.CustomObjectsApi);
294888
+ const apiGroup = 'firestartr.dev';
294889
+ const apiVersion = 'v1';
294890
+ const apiPaths = `/apis/${apiGroup}/${apiVersion}/namespaces/${namespace}/${pluralKind}`;
294891
+ do {
294892
+ const res = await k8sApi.listNamespacedCustomObject(apiGroup, apiVersion, namespace, pluralKind, undefined, // pretty
294893
+ undefined, // allowWatchBookmarks
294894
+ continueToken, // _continue
294895
+ undefined, // fieldSelector
294896
+ undefined, // labelSelector
294897
+ limit);
294898
+ const body = res.body;
294899
+ const items = body.items || [];
294900
+ for (const item of items) {
294901
+ yield item;
294902
+ }
294903
+ continueToken = body.metadata?.continue;
294904
+ } while (continueToken);
294347
294905
  }
294348
294906
  catch (err) {
294349
- operator_src_logger.error(err);
294350
- throw `Setting OwnerReferences to ${item.kind}/${item.metadata.name}: ${err}`;
294351
- }
294352
- }
294353
- async function writeOwnerReferences(kind, namespace, item, ownerReferences) {
294354
- operator_src_logger.debug(`The ctl is setting the ownerReferences for '${kind}/${item.metadata.name}' in namespace '${namespace}'.`);
294355
- const { kc, opts } = await ctl_getConnection();
294356
- const url = `${kc.getCurrentCluster().server}/apis/firestartr.dev/v1/namespaces/${namespace}/${kind}/${item.metadata.name}`;
294357
- opts.headers['Content-Type'] = 'application/json-patch+json';
294358
- opts.headers['Accept'] = '*';
294359
- const patch = {
294360
- op: 'replace',
294361
- path: '/metadata/ownerReferences',
294362
- value: ownerReferences,
294363
- };
294364
- const r = await fetch(url, {
294365
- method: 'PATCH',
294366
- headers: opts.headers,
294367
- body: JSON.stringify([patch]),
294368
- });
294369
- if (!r.ok) {
294370
- throw `Error on setOwnerReferences: ${namespace}/${kind}/${item['metadata']['name']}: ${r.statusText}`;
294907
+ operator_src_logger.error(`Error traversing ${namespace}/${pluralKind}: ${err}`);
294908
+ throw new Error(`Error traversing ${namespace}/${pluralKind}: ${err}`);
294371
294909
  }
294372
- return r.json();
294373
294910
  }
294374
294911
 
294375
294912
  ;// CONCATENATED MODULE: ../operator/fdummies/index.ts
@@ -294378,6 +294915,11 @@ async function writeOwnerReferences(kind, namespace, item, ownerReferences) {
294378
294915
 
294379
294916
 
294380
294917
 
294918
+
294919
+ const dummyChildrenMap = {
294920
+ FirestartrDummyA: ['FirestartrDummyB'],
294921
+ FirestartrDummyB: ['FirestartrDummyC'],
294922
+ };
294381
294923
  function processFirestartrDummies(item, op, handler) {
294382
294924
  operator_src_logger.info(`FirestartrDummies Processor: ${op}`);
294383
294925
  try {
@@ -294408,20 +294950,93 @@ async function* updated(item, op, handler) {
294408
294950
  for await (const transition of doRun(item, op, handler)) {
294409
294951
  yield transition;
294410
294952
  }
294411
- await handleOwnerReferences(item, handler);
294953
+ await manageDummyOwnershipReferences(item, handler);
294412
294954
  }
294413
294955
  async function* created(item, op, handler) {
294414
294956
  for await (const transition of doRun(item, op, handler)) {
294415
294957
  yield transition;
294416
294958
  }
294417
- await handleOwnerReferences(item, handler);
294959
+ await manageDummyOwnershipReferences(item, handler);
294418
294960
  }
294419
- async function handleOwnerReferences(item, handler) {
294961
+ async function manageDummyOwnershipReferences(item, _handler) {
294962
+ /*******************************************************************************
294963
+ // suspended due to https://github.com/prefapp/gitops-k8s/issues/1767
294964
+ if ('needs' in item.spec) {
294965
+ const needs = item.spec.needs;
294966
+ await setOwnerReference(
294967
+ handler.itemPath(),
294968
+ item.metadata.namespace,
294969
+ getPluralFromKind(needs.kind),
294970
+ needs.name,
294971
+ );
294972
+ }
294973
+ ********************************************************************************/
294420
294974
  if ('needs' in item.spec) {
294421
- const needs = item.spec.needs;
294422
- await ownership_setOwnerReference(handler.itemPath(), item.metadata.namespace, definitions_getPluralFromKind(needs.kind), needs.name);
294975
+ await installParentFinalizer(item);
294423
294976
  }
294424
294977
  }
294978
+ async function manageDummyOwnershipPostDeletion(item, _handler) {
294979
+ if ('needs' in item.spec) {
294980
+ await manageChildrenReferences(item);
294981
+ }
294982
+ if (Object.prototype.hasOwnProperty.call(dummyChildrenMap, item.kind)) {
294983
+ await removeFinalizerIfNoMoreChildren(item);
294984
+ }
294985
+ }
294986
+ async function installParentFinalizer(item) {
294987
+ const needs = item.spec.needs;
294988
+ const parentItem = await ctl_getItemByItemPath([item.metadata.namespace, definitions_getPluralFromKind(needs.kind), needs.name].join('/'));
294989
+ await upsertFinalizer(definitions_getPluralFromKind(parentItem.kind), parentItem.metadata.namespace, parentItem, 'firestartr.dev/foreground-deletion');
294990
+ }
294991
+ async function manageChildrenReferences(item) {
294992
+ const parentItem = await ctl_getItemByItemPath([
294993
+ item.metadata.namespace,
294994
+ definitions_getPluralFromKind(item.spec.needs.kind),
294995
+ item.spec.needs.name,
294996
+ ].join('/'));
294997
+ await removeFinalizerIfNoMoreChildren(parentItem);
294998
+ }
294999
+ async function removeFinalizerIfNoMoreChildren(parentItem) {
295000
+ try {
295001
+ let numberOfChildren = 0;
295002
+ const childKinds = dummyChildrenMap[parentItem.kind];
295003
+ if (!childKinds)
295004
+ return;
295005
+ for (const childKind of childKinds) {
295006
+ const children = await findDummiesWithNeeds(childKind, parentItem);
295007
+ numberOfChildren += children.length;
295008
+ }
295009
+ if (numberOfChildren === 0) {
295010
+ try {
295011
+ await unsetFinalizer(definitions_getPluralFromKind(parentItem.kind), parentItem.metadata.namespace, parentItem, 'firestartr.dev/foreground-deletion');
295012
+ }
295013
+ catch (unsetErr) {
295014
+ if (typeof unsetErr === 'string' && unsetErr.includes('Not Found')) {
295015
+ operator_src_logger.info(`${parentItem.kind}/${parentItem.metadata.name} was already deleted; skipping finalizer removal`);
295016
+ }
295017
+ else {
295018
+ throw unsetErr;
295019
+ }
295020
+ }
295021
+ }
295022
+ }
295023
+ catch (err) {
295024
+ operator_src_logger.error(`Error managing children references in item: ${parentItem.kind}/${parentItem.metadata.name}: ${err}`);
295025
+ throw new Error(`Error managing children references in item: ${parentItem.kind}/${parentItem.metadata.name}: ${err}`);
295026
+ }
295027
+ }
295028
+ async function findDummiesWithNeeds(kind, parentItem) {
295029
+ const children = [];
295030
+ const pluralKind = definitions_getPluralFromKind(kind);
295031
+ for await (const crItem of traverseCRCollection(pluralKind, parentItem.metadata.namespace)) {
295032
+ if ('needs' in crItem.spec &&
295033
+ crItem.spec.needs.name === parentItem.metadata.name &&
295034
+ crItem.spec.needs.kind === parentItem.kind) {
295035
+ children.push(crItem);
295036
+ }
295037
+ }
295038
+ return children;
295039
+ }
294425
295040
  async function renamed() {
294426
295041
  throw new Error('Renamed operation not prepared');
294427
295042
  }
@@ -294507,6 +295122,7 @@ async function* markedToDeletion(item, op, handler) {
294507
295122
  message: 'destroyed',
294508
295123
  };
294509
295124
  await handler.finalize(handler.pluralKind, item.metadata.namespace, item, 'firestartr.dev/finalizer');
295125
+ await manageDummyOwnershipPostDeletion(item, handler);
294510
295126
  void handler.success();
294511
295127
  }
294512
295128
  catch (e) {
@@ -295203,12 +295819,20 @@ async function startQueueMetrics(meter, attributes) {
295203
295819
  const nWorkItemsInDeadLetterHandling = meter.createObservableGauge('firestartr_workitems_dead_letter_handling_total', {
295204
295820
  description: 'Number of workitems of the queue handled by the Dead Letter Handler',
295205
295821
  });
295822
+ const nWorkItemsBlocked = meter.createObservableGauge('firestartr_workitems_blocked_total', {
295823
+ description: 'Number of workitems currently blocked (children still being deleted, or parent not yet created/provisioned)',
295824
+ });
295825
+ const nWorkItemsDeferred = meter.createObservableGauge('firestartr_workitems_deferred_total', {
295826
+ description: 'Number of workitems moved to the deferred segment after repeated blocking',
295827
+ });
295206
295828
  const queueMetrics = getQueueMetrics();
295207
295829
  let total = queueMetrics.nItems;
295208
295830
  let pending = queueMetrics.nItemsPending;
295209
295831
  let processing = queueMetrics.nItemsProcessing;
295210
295832
  let finished = queueMetrics.nItemsFinished;
295211
295833
  let inDeadLetterHandling = queueMetrics.nItemsInDeadLetterHandling;
295834
+ let nBlocked = queueMetrics.nItemsBlocked || 0;
295835
+ let nDeferred = queueMetrics.nItemsDeferred || 0;
295212
295836
  nWorkItemsCounter.addCallback((observer) => observer.observe(total, { ...attributes, ...queueMetrics.nItemsTypes }));
295213
295837
  nWorkItemsPendingCounter.addCallback((observer) => observer.observe(pending, { ...attributes, ...queueMetrics.nItemsTypes }));
295214
295838
  nWorkItemsProcessingCounter.addCallback((observer) => observer.observe(processing, {
@@ -295220,6 +295844,8 @@ async function startQueueMetrics(meter, attributes) {
295220
295844
  ...attributes,
295221
295845
  ...queueMetrics.nItemsTypes,
295222
295846
  }));
295847
+ nWorkItemsBlocked.addCallback((observer) => observer.observe(nBlocked, { ...attributes }));
295848
+ nWorkItemsDeferred.addCallback((observer) => observer.observe(nDeferred, { ...attributes }));
295223
295849
  setInterval(() => {
295224
295850
  const queueMetrics = getQueueMetrics();
295225
295851
  total = queueMetrics.nItems;
@@ -295227,6 +295853,8 @@ async function startQueueMetrics(meter, attributes) {
295227
295853
  processing = queueMetrics.nItemsProcessing;
295228
295854
  finished = queueMetrics.nItemsFinished;
295229
295855
  inDeadLetterHandling = queueMetrics.nItemsInDeadLetterHandling;
295856
+ nBlocked = queueMetrics.nItemsBlocked || 0;
295857
+ nDeferred = queueMetrics.nItemsDeferred || 0;
295230
295858
  }, 1000);
295231
295859
  }
295232
295860
  async function startMemoryMetrics(meter, attributes) {
@@ -295401,15 +296029,131 @@ class ProcessItemSlot {
295401
296029
  }
295402
296030
  }
295403
296031
 
295404
- ;// CONCATENATED MODULE: ../operator/src/processItem.ts
295405
-
295406
-
295407
-
295408
-
296032
+ ;// CONCATENATED MODULE: ../operator/src/parentDependency.ts
295409
296033
 
296034
+ const PARENT_KIND_MAP = {
296035
+ FirestartrGithubRepositoryFeature: 'FirestartrGithubRepository',
296036
+ FirestartrGithubRepositorySecretsSection: 'FirestartrGithubRepository',
296037
+ FirestartrDummyB: 'FirestartrDummyA',
296038
+ FirestartrDummyC: 'FirestartrDummyB',
296039
+ };
296040
+ const DEPENDENT_KINDS = new Set(Object.keys(PARENT_KIND_MAP));
296041
+ const RELEVANT_KINDS = new Set();
296042
+ for (const [child, parent] of Object.entries(PARENT_KIND_MAP)) {
296043
+ RELEVANT_KINDS.add(child);
296044
+ RELEVANT_KINDS.add(parent);
296045
+ }
296046
+ function getParentKindForDependent(kind) {
296047
+ return PARENT_KIND_MAP[kind];
296048
+ }
296049
+ function isDependentKind(kind) {
296050
+ return DEPENDENT_KINDS.has(kind);
296051
+ }
296052
+ function isRelevantKind(kind) {
296053
+ return RELEVANT_KINDS.has(kind);
296054
+ }
296055
+ function getParentRef(workItem) {
296056
+ const ref = workItem.item.spec?.repositoryTarget?.ref;
296057
+ if (ref?.kind && ref?.name) {
296058
+ return { kind: ref.kind, name: ref.name };
296059
+ }
296060
+ const needs = workItem.item.spec?.needs;
296061
+ if (needs?.kind && needs?.name) {
296062
+ return { kind: needs.kind, name: needs.name };
296063
+ }
296064
+ return null;
296065
+ }
296066
+ function buildActiveParentKeys(queue) {
296067
+ const keys = new Set();
296068
+ for (const w of queue) {
296069
+ if (w.workStatus === WorkStatus.PENDING || w.isPicked) {
296070
+ keys.add(`${w.item.kind}/${w.item.metadata?.name}`);
296071
+ }
296072
+ }
296073
+ return keys;
296074
+ }
296075
+ /**
296076
+ * Scan the queue for dependent children whose parent is not in the active set
296077
+ * and verify whether each parent exists in the K8s cluster and has been
296078
+ * provisioned. Parents that are absent from the queue and either missing from
296079
+ * the cluster OR not yet provisioned are added to a deferred set, which
296080
+ * `hasActiveParent` uses to block the child from being dispatched.
296081
+ *
296082
+ * A parent CR exists in the cluster immediately after `kubectl apply`, but it
296083
+ * is not usable until the operator has reconciled it and set PROVISIONED=True.
296084
+ * Checking only for cluster existence would let children slip through while
296085
+ * the parent is still being processed. This function also checks the parent's
296086
+ * status conditions so that children are deferred until the parent is fully
296087
+ * provisioned.
296088
+ *
296089
+ * @param getItemByItemPath - function to look up a CR in the K8s cluster by
296090
+ * its item path (namespace/pluralKind/name). Should return null (not throw)
296091
+ * when the resource is absent or not yet available (e.g. 404/409), so that
296092
+ * missing parents are deferred without generating spurious error logs.
296093
+ */
296094
+ async function buildDeferredParentKeys(queue, activeParentKeys, getItemByItemPath) {
296095
+ const deferred = new Set();
296096
+ const checked = new Set();
296097
+ for (const w of queue) {
296098
+ if (w.operation !== OperationType.CREATED)
296099
+ continue;
296100
+ if (!isDependentKind(w.item.kind))
296101
+ continue;
296102
+ const parentRef = getParentRef(w);
296103
+ if (!parentRef)
296104
+ continue;
296105
+ const parentKey = `${parentRef.kind}/${parentRef.name}`;
296106
+ if (checked.has(parentKey))
296107
+ continue;
296108
+ checked.add(parentKey);
296109
+ if (activeParentKeys.has(parentKey))
296110
+ continue;
296111
+ const namespace = w.item.metadata?.namespace || 'default';
296112
+ const pluralKind = definitions_getPluralFromKind(parentRef.kind);
296113
+ if (!pluralKind)
296114
+ continue;
296115
+ try {
296116
+ const parentCr = await getItemByItemPath(`${namespace}/${pluralKind}/${parentRef.name}`);
296117
+ const isProvisioned = parentCr?.status?.conditions?.some((c) => c.type === 'PROVISIONED' && c.status === 'True');
296118
+ if (!isProvisioned) {
296119
+ deferred.add(parentKey);
296120
+ }
296121
+ }
296122
+ catch {
296123
+ deferred.add(parentKey);
296124
+ }
296125
+ }
296126
+ return deferred;
296127
+ }
296128
+ function hasActiveParent(workItem, queueOrKeys, deferredParentKeys) {
296129
+ if (workItem.operation !== OperationType.CREATED)
296130
+ return false;
296131
+ if (!DEPENDENT_KINDS.has(workItem.item.kind))
296132
+ return false;
296133
+ const parentRef = getParentRef(workItem);
296134
+ if (!parentRef)
296135
+ return false;
296136
+ const { kind: parentKind, name: parentName } = parentRef;
296137
+ const parentKey = `${parentKind}/${parentName}`;
296138
+ if (queueOrKeys instanceof Set) {
296139
+ if (queueOrKeys.has(parentKey))
296140
+ return true;
296141
+ if (deferredParentKeys?.has(parentKey))
296142
+ return true;
296143
+ return false;
296144
+ }
296145
+ const parentActive = queueOrKeys.some((w) => w.item.kind === parentKind &&
296146
+ w.item.metadata?.name === parentName &&
296147
+ (w.workStatus === WorkStatus.PENDING || w.isPicked));
296148
+ if (parentActive)
296149
+ return true;
296150
+ if (deferredParentKeys?.has(parentKey))
296151
+ return true;
296152
+ return false;
296153
+ }
295410
296154
 
296155
+ ;// CONCATENATED MODULE: ../operator/src/queueSort.ts
295411
296156
 
295412
- const queue = [];
295413
296157
  const WEIGHTS = {
295414
296158
  RENAMED: 15,
295415
296159
  UPDATED: 10,
@@ -295419,6 +296163,73 @@ const WEIGHTS = {
295419
296163
  SYNC: 1,
295420
296164
  NOTHING: 0,
295421
296165
  };
296166
+ // we need to assign weight to the deletion operation
296167
+ // to avoid blockades
296168
+ // https://github.com/prefapp/gitops-k8s/issues/1864
296169
+ // ghrepo feat | grss -> ghrepo -> ghgroup -> membership
296170
+ const DELETION_WEIGHTS = {
296171
+ // Leaf children first: C before B before A
296172
+ FirestartrDummyC: 6,
296173
+ FirestartrDummyB: 5,
296174
+ FirestartrDummyA: 4,
296175
+ FirestartrGithubRepositoryFeature: 5,
296176
+ FirestartrGithubRepositorySecretsSection: 4,
296177
+ FirestartrGithubRepository: 3,
296178
+ FirestartrGithubGroup: 2,
296179
+ FirestartrGithubMembership: 1,
296180
+ FirestartrTerraformWorkspace: 1,
296181
+ FirestartrGithubOrgWebhook: 1,
296182
+ };
296183
+ const CREATION_WEIGHTS = {
296184
+ // DummyA is root parent; DummyB is both child-of-A and parent-of-C
296185
+ FirestartrDummyA: 2,
296186
+ FirestartrDummyB: 1,
296187
+ FirestartrGithubRepository: 1,
296188
+ };
296189
+ function sortQueue(queue) {
296190
+ const sortedQueue = queue.sort((wa, wb) => {
296191
+ const weightA = WEIGHTS[wa.operation];
296192
+ const weightB = WEIGHTS[wb.operation];
296193
+ if (weightA !== weightB) {
296194
+ return weightB - weightA;
296195
+ }
296196
+ if (wa.operation === 'MARKED_TO_DELETION' &&
296197
+ wb.operation === 'MARKED_TO_DELETION') {
296198
+ const deletionWeightA = DELETION_WEIGHTS[wa.item.kind] || 0;
296199
+ const deletionWeightB = DELETION_WEIGHTS[wb.item.kind] || 0;
296200
+ if (deletionWeightA !== deletionWeightB) {
296201
+ return deletionWeightB - deletionWeightA;
296202
+ }
296203
+ }
296204
+ if (wa.operation === 'CREATED' && wb.operation === 'CREATED') {
296205
+ if (isRelevantKind(wa.item.kind) && isRelevantKind(wb.item.kind)) {
296206
+ const creationWeightA = CREATION_WEIGHTS[wa.item.kind] || 0;
296207
+ const creationWeightB = CREATION_WEIGHTS[wb.item.kind] || 0;
296208
+ if (creationWeightA !== creationWeightB) {
296209
+ return creationWeightB - creationWeightA;
296210
+ }
296211
+ }
296212
+ }
296213
+ return wa.upsertTime - wb.upsertTime;
296214
+ });
296215
+ return sortedQueue;
296216
+ }
296217
+
296218
+ ;// CONCATENATED MODULE: ../operator/src/processItem.ts
296219
+
296220
+
296221
+
296222
+
296223
+
296224
+
296225
+
296226
+
296227
+
296228
+
296229
+ const queue = [];
296230
+ let _deferredBookkeeper = null;
296231
+ let _activeParentKeys = new Set();
296232
+ let _deferredParentKeys = new Set();
295422
296233
  // We get the number of max slots from the environment variable, if it is not set, we default to 1
295423
296234
  function getMaxSlotsFromEnvironment() {
295424
296235
  const rawMaxSlots = catalog_common/* default.environment.getFromEnvironment */.Z.environment.getFromEnvironment(catalog_common/* default.types.envVars.operatorNumberOfMaxSlots */.Z.types.envVars.operatorNumberOfMaxSlots);
@@ -295472,6 +296283,11 @@ function getQueueMetrics() {
295472
296283
  nItemsPending: queue.filter((workItem) => workItem.workStatus === WorkStatus.PENDING).length,
295473
296284
  nItemsProcessing: queue.filter((workItem) => workItem.workStatus === WorkStatus.PROCESSING).length,
295474
296285
  nItemsInDeadLetterHandling: queue.filter((workItem) => workItem.isDeadLetter === true).length,
296286
+ nItemsBlocked: queue.filter((workItem) => workItem.isBlocked === true ||
296287
+ hasActiveParent(workItem, _activeParentKeys, _deferredParentKeys)).length,
296288
+ nItemsDeferred: _deferredBookkeeper
296289
+ ? queue.filter((workItem) => _deferredBookkeeper.isDeferred(workItem)).length
296290
+ : 0,
295475
296291
  nItemsTypes: {
295476
296292
  nothing,
295477
296293
  retry,
@@ -295484,30 +296300,21 @@ function getQueueMetrics() {
295484
296300
  },
295485
296301
  };
295486
296302
  }
295487
- // we need to assign weight to the deletion operation
295488
- // to avoid blockades
295489
- // https://github.com/prefapp/gitops-k8s/issues/1864
295490
- // ghrepo feat | grss -> ghrepo -> ghgroup -> membership
295491
- const DELETION_WEIGHTS = {
295492
- FirestartrGithubRepositoryFeature: 5,
295493
- FirestartrGithubRepositorySecretsSection: 4,
295494
- FirestartrGithubRepository: 3,
295495
- FirestartrGithubGroup: 2,
295496
- FirestartrGithubMembership: 1,
295497
- FirestartrTerraformWorkspace: 1,
295498
- FirestartrGithubOrgWebhook: 1,
295499
- };
295500
- // Do the kinds need different weights for the operations?
295501
- // We need to discuss this with the team in this issue: https://github.com/prefapp/gitops-k8s/issues/524
295502
- // const KIND_WEIGHTS: any = {
295503
- // "FirestartrTerraformWorkspace": 1,
295504
- // "FirestartrGithubGroup": 1,
295505
- // "FirestartrGithubMembership": 1,
295506
- // "FirestartrGithubRepository": 1,
295507
- // "FirestartrGithubRepositoryFeature": 1,
295508
- // "FirestartrTerraformWorkspacePlan": 1,
295509
- // }
295510
296303
  let INIT = false;
296304
+ let podIsTerminating = false;
296305
+ const handleTerminationSignal = (signal) => {
296306
+ podIsTerminating = true;
296307
+ // If there is no processor loop and no queued work, exit immediately so we don't
296308
+ // wait on other event-loop handles (informer watches, keep-alives, etc.).
296309
+ if (!INIT && queue.length === 0) {
296310
+ operator_src_logger.info(`The processor is going to shut down (received ${signal}, no loop started)`);
296311
+ process.exit(0);
296312
+ }
296313
+ };
296314
+ initSignalsHandler(new Map([
296315
+ ['SIGTERM', () => handleTerminationSignal('SIGTERM')],
296316
+ ['SIGINT', () => handleTerminationSignal('SIGINT')],
296317
+ ]));
295511
296318
  /**
295512
296319
  * Pushes a WorkItem to the queue
295513
296320
  * @param {WorkItem} workItem - WorkItem to process
@@ -295528,8 +296335,8 @@ async function processItem(workItem) {
295528
296335
  */
295529
296336
  async function processItem_loop() {
295530
296337
  loopWorkItemDebug(queue);
295531
- let podIsTerminating = false;
295532
296338
  const deferredBookkeeper = new DeferredSchedulingBookkeeper();
296339
+ _deferredBookkeeper = deferredBookkeeper;
295533
296340
  const processItemSlotsManager = initProcessItemsSlots(MAX_SLOTS, true, (w) => deferredBookkeeper.incrementBlockedAttempt(w));
295534
296341
  if (process.env.GARBAGE_QUEUE_COLLECTOR) {
295535
296342
  void workItemGarbageCollector(queue, deferredBookkeeper);
@@ -295559,6 +296366,21 @@ async function processItem_loop() {
295559
296366
  process.exit(0);
295560
296367
  break;
295561
296368
  }
296369
+ // Compute sort/partition + parent-key sets once per scheduling round so
296370
+ // that buildDeferredParentKeys (which hits the API server) and the
296371
+ // sort/partition are not repeated for every idle slot in the same iteration.
296372
+ const sorted = sortQueue(queue);
296373
+ const { nonDeferred, deferred } = deferredBookkeeper.partitionQueueByDeferred(sorted);
296374
+ const activeParentKeys = buildActiveParentKeys(queue);
296375
+ const deferredParentKeys = await buildDeferredParentKeys(queue, activeParentKeys, getItemByItemPathOrNull);
296376
+ _activeParentKeys = activeParentKeys;
296377
+ _deferredParentKeys = deferredParentKeys;
296378
+ const pickEligible = (arr) => arr
296379
+ .filter((w) => !w.isBlocked &&
296380
+ !w.isPicked &&
296381
+ !processItemSlotsManager.isWorkItemBlocked(w) &&
296382
+ !hasActiveParent(w, activeParentKeys, deferredParentKeys))
296383
+ .find((w) => w.workStatus === WorkStatus.PENDING);
295562
296384
  // every time an idle slot is available, we check if there is a work item to process and if there is, we process it
295563
296385
  // if there are more idle slots than work items, the next iterations of the loop will just do nothing
295564
296386
  // until there are new work items to process
@@ -295566,7 +296388,7 @@ async function processItem_loop() {
295566
296388
  if (podIsTerminating) {
295567
296389
  break;
295568
296390
  }
295569
- const w = nextWorkItem();
296391
+ const w = pickEligible(nonDeferred) || pickEligible(deferred);
295570
296392
  if (w) {
295571
296393
  // synchronously mark the work item as picked
295572
296394
  w.isPicked = true;
@@ -295578,41 +296400,10 @@ async function processItem_loop() {
295578
296400
  void idleSlot.runWorkItem(w);
295579
296401
  }
295580
296402
  }
295581
- await wait();
296403
+ await wait(podIsTerminating ? 200 : 2000);
295582
296404
  }
295583
296405
  }
295584
- /**
295585
- * Sorts the queue based on the operation type
295586
- * @param {WorkItem[]} queue - store of WorkItems
295587
- * @returns {WorkItem[]} - sorted queue
295588
- */
295589
- function sortQueue(queue) {
295590
- const sortedQueue = queue.sort((wa, wb) => {
295591
- // --- PRIMARY SORT: By Weight (Descending) ---
295592
- const weightA = WEIGHTS[wa.operation];
295593
- const weightB = WEIGHTS[wb.operation];
295594
- // Check if weights are different
295595
- if (weightA !== weightB) {
295596
- // Sort in descending order (higher weight first)
295597
- // If weightA is larger, return -1 (a comes before b)
295598
- return weightB - weightA;
295599
- }
295600
- // in case of deletions we need to
295601
- // establish a secondary sort by kind
295602
- if (wa.operation === 'MARKED_TO_DELETION' &&
295603
- wb.operation === 'MARKED_TO_DELETION') {
295604
- const deletionWeightA = DELETION_WEIGHTS[wa.item.kind] || 0;
295605
- const deletionWeightB = DELETION_WEIGHTS[wb.item.kind] || 0;
295606
- if (deletionWeightA !== deletionWeightB) {
295607
- return deletionWeightB - deletionWeightA;
295608
- }
295609
- }
295610
- // --- 3rd SORT: By upsertTime (Ascending) ---
295611
- // If weights are equal, sort by the oldest upsertTime (ascending)
295612
- return wa.upsertTime - wb.upsertTime;
295613
- });
295614
- return sortedQueue;
295615
- }
296406
+
295616
296407
  /**
295617
296408
  * Wait for a given time
295618
296409
  * @param t Time to wait in milliseconds
@@ -297943,11 +298734,9 @@ function tf_checkrun_operatorProfile() {
297943
298734
  async function TFCheckRun(cmd, item) {
297944
298735
  try {
297945
298736
  const prInfo = extractPrInfo(item);
297946
- const kind = item.kind;
297947
298737
  const checkRun = await tf_checkrun_operatorProfile().feedback.createCheckRun(prInfo.org, prInfo.repo, helperCreateCheckRunName(cmd, item), {
297948
298738
  pullNumber: Number(prInfo.prNumber),
297949
- includeCheckRunComment: true,
297950
- checkRunComment: `The ${kind} is being processed (cmd=${cmd}). Details: `,
298739
+ // check-run comments removed: redundant with native checks widget (#1985)
297951
298740
  });
297952
298741
  checkRun.mdOptionsDetails({
297953
298742
  quotes: 'terraform',
@@ -299680,7 +300469,7 @@ async function ctx_buildContext(claim, namespace, command) {
299680
300469
  cr['metadata']['namespace'] = namespace;
299681
300470
  operator_src_logger.debug(`The Terraform workspace has finished rendering the custom resource '${cr.kind}/${cr.metadata.name}' in namespace '${cr.metadata.namespace}'.`);
299682
300471
  // Finally, we resolve the deps in the rendered CR
299683
- deps = await resolve(cr, getItemByItemPath, getSecret, namespace);
300472
+ deps = await resolve(cr, ctl_getItemByItemPath, getSecret, namespace);
299684
300473
  operator_src_logger.debug(`The Terraform workspace has finished resolving all dependencies for claim '${claim.name}'.`);
299685
300474
  };
299686
300475
  compute['dryRunExec'] = async () => {
@@ -299846,7 +300635,7 @@ const MODULES = {
299846
300635
  FirestartrGithubRepository: {
299847
300636
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-repo',
299848
300637
  // github-repo-v0.7.0
299849
- ref: '6bdbcd9b813837bec9d1c576952bd88744508883',
300638
+ ref: 'd919ffbff4349c453f75a3b7246b8306a45b12e3',
299850
300639
  },
299851
300640
  FirestartrGithubRepositoryFeature: {
299852
300641
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-files-set',
@@ -299863,6 +300652,11 @@ const MODULES = {
299863
300652
  // github-org-webhook-v0.2.0
299864
300653
  ref: '12d72ba15780647b2f9c2905938913344bfeaa4d',
299865
300654
  },
300655
+ FirestartrGithubOrganizationSettings: {
300656
+ module: 'git::https://github.com/prefapp/tfm.git//modules/github-org-settings',
300657
+ // feat/org-settings-module at 2026-06-16
300658
+ ref: '0e3f3f897ffff35a52285d0c681c0d81026d6d8a',
300659
+ },
299866
300660
  };
299867
300661
  function getFirestartrDefaultTFM(kind) {
299868
300662
  if (kind in MODULES) {
@@ -301393,6 +302187,72 @@ class EntityGHMembership extends base_Entity {
301393
302187
  }
301394
302188
  }
301395
302189
 
302190
+ ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgsettings/index.ts
302191
+
302192
+
302193
+ class EntityGHOrgSettings extends base_Entity {
302194
+ constructor(artifact) {
302195
+ super(artifact, {
302196
+ config: {},
302197
+ });
302198
+ }
302199
+ async loadResources(tfOp) {
302200
+ gh_provisioner_src_logger.info(`[gh-provisioner] running ${tfOp} on ${this.k8sId}`);
302201
+ try {
302202
+ const cr = this.cr;
302203
+ this.patchData({
302204
+ path: '/config',
302205
+ op: PatchOperations.replace,
302206
+ value: {
302207
+ billingEmail: cr.spec.billingEmail,
302208
+ company: cr.spec.company,
302209
+ blog: cr.spec.blog,
302210
+ email: cr.spec.email,
302211
+ twitterUsername: cr.spec.twitterUsername,
302212
+ location: cr.spec.location,
302213
+ name: cr.spec.name,
302214
+ description: cr.spec.description,
302215
+ hasOrganizationProjects: cr.spec.hasOrganizationProjects,
302216
+ hasRepositoryProjects: cr.spec.hasRepositoryProjects,
302217
+ defaultRepositoryPermission: cr.spec.defaultRepositoryPermission,
302218
+ membersCanCreateRepositories: cr.spec.membersCanCreateRepositories,
302219
+ membersCanCreatePublicRepositories: cr.spec.membersCanCreatePublicRepositories,
302220
+ membersCanCreatePrivateRepositories: cr.spec.membersCanCreatePrivateRepositories,
302221
+ membersCanCreateInternalRepositories: cr.spec.membersCanCreateInternalRepositories,
302222
+ membersCanCreatePages: cr.spec.membersCanCreatePages,
302223
+ membersCanCreatePublicPages: cr.spec.membersCanCreatePublicPages,
302224
+ membersCanCreatePrivatePages: cr.spec.membersCanCreatePrivatePages,
302225
+ membersCanForkPrivateRepositories: cr.spec.membersCanForkPrivateRepositories,
302226
+ webCommitSignoffRequired: cr.spec.webCommitSignoffRequired,
302227
+ advancedSecurityEnabledForNewRepositories: cr.spec.advancedSecurityEnabledForNewRepositories,
302228
+ dependabotAlertsEnabledForNewRepositories: cr.spec.dependabotAlertsEnabledForNewRepositories,
302229
+ dependabotSecurityUpdatesEnabledForNewRepositories: cr.spec.dependabotSecurityUpdatesEnabledForNewRepositories,
302230
+ dependencyGraphEnabledForNewRepositories: cr.spec.dependencyGraphEnabledForNewRepositories,
302231
+ secretScanningEnabledForNewRepositories: cr.spec.secretScanningEnabledForNewRepositories,
302232
+ secretScanningPushProtectionEnabledForNewRepositories: cr.spec.secretScanningPushProtectionEnabledForNewRepositories,
302233
+ },
302234
+ });
302235
+ gh_provisioner_src_logger.debug(`[gh-provisioner] ${this.k8sId} loaded its data`);
302236
+ }
302237
+ catch (err) {
302238
+ const message = err instanceof Error ? err.message : String(err);
302239
+ gh_provisioner_src_logger.error(`[gh-provisioner] ${this.k8sId} error loading resources: ${message}`);
302240
+ throw new Error(`[gh-provisioner] ${this.k8sId} error loading resources: ${message}`);
302241
+ }
302242
+ }
302243
+ async postProvision(tfOp) { }
302244
+ async loadAddressesToImport() {
302245
+ this.patchImportData({
302246
+ op: PatchOperations.add,
302247
+ path: '/imports/-',
302248
+ value: {
302249
+ to: 'github_organization_settings.this',
302250
+ id: this.cr.spec.org,
302251
+ },
302252
+ });
302253
+ }
302254
+ }
302255
+
301396
302256
  ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgwebhook/index.ts
301397
302257
 
301398
302258
 
@@ -301468,6 +302328,7 @@ class EntityGHOrgWebHook extends base_Entity {
301468
302328
 
301469
302329
 
301470
302330
 
302331
+
301471
302332
  function entities_getEntity(cr) {
301472
302333
  const entityClass = getEntityClass(cr.kind);
301473
302334
  return new entityClass(cr);
@@ -301486,6 +302347,8 @@ function getEntityClass(kind) {
301486
302347
  return EntityGHMembership;
301487
302348
  case 'FirestartrGithubOrgWebhook':
301488
302349
  return EntityGHOrgWebHook;
302350
+ case 'FirestartrGithubOrganizationSettings':
302351
+ return EntityGHOrgSettings;
301489
302352
  default:
301490
302353
  throw new Error(`kind ${kind} has no entity associated`);
301491
302354
  }
@@ -301898,6 +302761,7 @@ const GITHUB_RESOURCE_KINDS = [
301898
302761
  'FirestartrGithubRepositoryFeature',
301899
302762
  'FirestartrGithubRepositorySecretsSection',
301900
302763
  'FirestartrGithubOrgWebhook',
302764
+ 'FirestartrGithubOrganizationSettings',
301901
302765
  ];
301902
302766
  const GITHUB_REPOSITORY_DEPENDENT_KINDS = [
301903
302767
  'FirestartrGithubRepositoryFeature',
@@ -302132,7 +302996,7 @@ function getPrAwareItemByItemPath(opts, currentStatus) {
302132
302996
  const baseResource = await getBaseGithubResource(itemPath, opts);
302133
302997
  if (baseResource)
302134
302998
  return baseResource;
302135
- return getItemByItemPath(itemPath, apiGroup, apiVersion);
302999
+ return ctl_getItemByItemPath(itemPath, apiGroup, apiVersion);
302136
303000
  };
302137
303001
  }
302138
303002
  async function getBaseGithubResource(itemPath, opts) {
@@ -302293,40 +303157,64 @@ function getSafeCommandByStatus(status) {
302293
303157
  }
302294
303158
  }
302295
303159
 
302296
- ;// CONCATENATED MODULE: ../operator/src/ctl_collections.ts
303160
+ ;// CONCATENATED MODULE: ../operator/src/ownership.ts
302297
303161
 
302298
303162
 
302299
303163
 
302300
- // generator function to traverse elements
302301
- // it is async and iterable
302302
- async function* traverseCRCollection(pluralKind, namespace, options = {}, apiGroup = 'firestartr.dev', apiVersion = 'v1') {
302303
- const { limit = 300 } = options; // between 250-300
303164
+ async function getOwnerReferences(item) {
303165
+ return item.metadata?.ownerReferences || [];
303166
+ }
303167
+ async function ownership_setOwnerReference(itemPath, namespace, ownerKind, ownerName, blockOwnerDeletion = true) {
303168
+ let item = null;
302304
303169
  try {
302305
- let continueToken = undefined;
302306
- const { kc, opts } = await ctl_getConnection();
302307
- const k8sApi = kc.makeApiClient(client_node_dist.CustomObjectsApi);
302308
- const apiGroup = 'firestartr.dev';
302309
- const apiVersion = 'v1';
302310
- const apiPaths = `/apis/${apiGroup}/${apiVersion}/namespaces/${namespace}/${pluralKind}`;
302311
- do {
302312
- const res = await k8sApi.listNamespacedCustomObject(apiGroup, apiVersion, namespace, pluralKind, undefined, // pretty
302313
- undefined, // allowWatchBookmarks
302314
- continueToken, // _continue
302315
- undefined, // fieldSelector
302316
- undefined, // labelSelector
302317
- limit);
302318
- const body = res.body;
302319
- const items = body.items || [];
302320
- for (const item of items) {
302321
- yield item;
302322
- }
302323
- continueToken = body.metadata?.continue;
302324
- } while (continueToken);
303170
+ // we need to search for the owner's uuid
303171
+ const owner = await getItemByItemPath(`${namespace}/${ownerKind}/${ownerName}`);
303172
+ const ownerReference = {
303173
+ apiVersion: owner.apiVersion,
303174
+ kind: owner.kind,
303175
+ name: ownerName,
303176
+ controller: true,
303177
+ blockOwnerDeletion,
303178
+ uid: owner.metadata.uid,
303179
+ };
303180
+ // we get the item (to prevent race conditions)
303181
+ item = await getItemByItemPath(itemPath);
303182
+ const ownerReferences = item.metadata.ownerReferences ?? [];
303183
+ const existingRefIndex = ownerReferences.findIndex((ref) => ref.uid === ownerReference.uid);
303184
+ if (existingRefIndex === -1) {
303185
+ // Reference does not exist, add it
303186
+ ownerReferences.push(ownerReference);
303187
+ }
303188
+ else {
303189
+ ownerReferences[existingRefIndex] = ownerReference;
303190
+ }
303191
+ await writeOwnerReferences(getPluralFromKind(item.kind), item.metadata.namespace, item, ownerReferences);
302325
303192
  }
302326
303193
  catch (err) {
302327
- operator_src_logger.error(`Error traversing ${namespace}/${pluralKind}: ${err}`);
302328
- throw new Error(`Error traversing ${namespace}/${pluralKind}: ${err}`);
303194
+ log.error(err);
303195
+ throw `Setting OwnerReferences to ${item.kind}/${item.metadata.name}: ${err}`;
303196
+ }
303197
+ }
303198
+ async function writeOwnerReferences(kind, namespace, item, ownerReferences) {
303199
+ log.debug(`The ctl is setting the ownerReferences for '${kind}/${item.metadata.name}' in namespace '${namespace}'.`);
303200
+ const { kc, opts } = await getConnection();
303201
+ const url = `${kc.getCurrentCluster().server}/apis/firestartr.dev/v1/namespaces/${namespace}/${kind}/${item.metadata.name}`;
303202
+ opts.headers['Content-Type'] = 'application/json-patch+json';
303203
+ opts.headers['Accept'] = '*';
303204
+ const patch = {
303205
+ op: 'replace',
303206
+ path: '/metadata/ownerReferences',
303207
+ value: ownerReferences,
303208
+ };
303209
+ const r = await fetch(url, {
303210
+ method: 'PATCH',
303211
+ headers: opts.headers,
303212
+ body: JSON.stringify([patch]),
303213
+ });
303214
+ if (!r.ok) {
303215
+ throw `Error on setOwnerReferences: ${namespace}/${kind}/${item['metadata']['name']}: ${r.statusText}`;
302329
303216
  }
303217
+ return r.json();
302330
303218
  }
302331
303219
 
302332
303220
  ;// CONCATENATED MODULE: ../operator/src/children.ts
@@ -302373,7 +303261,7 @@ async function manageOwnershipReferences(item, handler, op) {
302373
303261
  *******************************************************************************/
302374
303262
  if (kindsWithFirestartrGithubRepositoryDependence.indexOf(item.kind) !== -1) {
302375
303263
  // we need the parent
302376
- const parentItem = await getItemByItemPath([
303264
+ const parentItem = await ctl_getItemByItemPath([
302377
303265
  item.metadata.namespace,
302378
303266
  definitions_getPluralFromKind('FirestartrGithubRepository'),
302379
303267
  item.spec.repositoryTarget.ref.name,
@@ -302384,24 +303272,24 @@ async function manageOwnershipReferences(item, handler, op) {
302384
303272
  async function manageOwnershipReferencesPostDeletion(item, handler, op) {
302385
303273
  // We will check if the repo has still some references left
302386
303274
  if (kindsWithFirestartrGithubRepositoryDependence.indexOf(item.kind) !== -1) {
302387
- await manageChildrenReferences(item, handler, op);
303275
+ await ownership_manageChildrenReferences(item, handler, op);
302388
303276
  }
302389
303277
  // if the parent is being deleted is ok to control there are no more children
302390
303278
  // for preventing a stuck deletion
302391
303279
  else if (kindsWithChildren.indexOf(item.kind) !== -1) {
302392
- await removeFinalizerIfNoMoreChildren(item, handler, op);
303280
+ await ownership_removeFinalizerIfNoMoreChildren(item, handler, op);
302393
303281
  }
302394
303282
  }
302395
- async function manageChildrenReferences(item, handler, op) {
303283
+ async function ownership_manageChildrenReferences(item, handler, op) {
302396
303284
  // for now is only FirestartrGithubRepository
302397
- const parentItem = await getItemByItemPath([
303285
+ const parentItem = await ctl_getItemByItemPath([
302398
303286
  item.metadata.namespace,
302399
303287
  definitions_getPluralFromKind('FirestartrGithubRepository'),
302400
303288
  item.spec.repositoryTarget.ref.name,
302401
303289
  ].join('/'));
302402
- await removeFinalizerIfNoMoreChildren(parentItem, handler, op);
303290
+ await ownership_removeFinalizerIfNoMoreChildren(parentItem, handler, op);
302403
303291
  }
302404
- async function removeFinalizerIfNoMoreChildren(parentItem, handler, op) {
303292
+ async function ownership_removeFinalizerIfNoMoreChildren(parentItem, handler, op) {
302405
303293
  try {
302406
303294
  let numberOfChildren = 0;
302407
303295
  for (const child of kindsWithFirestartrGithubRepositoryDependence) {
@@ -302411,7 +303299,17 @@ async function removeFinalizerIfNoMoreChildren(parentItem, handler, op) {
302411
303299
  operator_src_logger.error(`Number of children ${numberOfChildren}`);
302412
303300
  if (numberOfChildren === 0) {
302413
303301
  operator_src_logger.info(`${parentItem.kind}/${parentItem.metadata.name} has no more children. Removing finalizer of foreground-deletion`);
302414
- await unsetFinalizer(definitions_getPluralFromKind(parentItem.kind), parentItem.metadata.namespace, parentItem, 'firestartr.dev/foreground-deletion');
303302
+ try {
303303
+ await unsetFinalizer(definitions_getPluralFromKind(parentItem.kind), parentItem.metadata.namespace, parentItem, 'firestartr.dev/foreground-deletion');
303304
+ }
303305
+ catch (unsetErr) {
303306
+ if (typeof unsetErr === 'string' && unsetErr.includes('Not Found')) {
303307
+ operator_src_logger.info(`${parentItem.kind}/${parentItem.metadata.name} was already deleted; skipping finalizer removal`);
303308
+ }
303309
+ else {
303310
+ throw unsetErr;
303311
+ }
303312
+ }
302415
303313
  }
302416
303314
  }
302417
303315
  catch (err) {
@@ -302454,10 +303352,8 @@ async function GHCheckRun(cmd, item) {
302454
303352
  throw new Error('GHCheckRun: prNumber not retrievable');
302455
303353
  }
302456
303354
  const checkRun = await gh_checkrun_operatorProfile().feedback.createCheckRun(prInfo.org, prInfo.repo, gh_checkrun_helperCreateCheckRunName(cmd, item), {
302457
- //Number(pr_number),
302458
303355
  pullNumber: Number(prInfo.prNumber),
302459
- includeCheckRunComment: true,
302460
- checkRunComment: `The Github ${item.kind} is being processed (cmd=${cmd}). Details: `,
303356
+ // check-run comments removed: redundant with native checks widget (#1985)
302461
303357
  });
302462
303358
  checkRun.mdOptionsDetails({
302463
303359
  quotes: 'terraform',
@@ -303183,6 +304079,7 @@ function getProvisionImplementation(plural) {
303183
304079
  case 'githubrepositoryfeatures':
303184
304080
  case 'githubmemberships':
303185
304081
  case 'githuborgwebhooks':
304082
+ case 'githuborganizationsettings':
303186
304083
  implementation = process_operation_processOperation;
303187
304084
  break;
303188
304085
  case 'fsdummiesa':
@@ -303296,6 +304193,14 @@ const cdk8s_rendererSubcommands = {
303296
304193
  { name: 'disableRenames', type: Boolean, defaultValue: false },
303297
304194
  { name: 'claimRefsList', type: String, defaultValue: '' },
303298
304195
  { name: 'claimFilesList', type: String, defaultValue: '' },
304196
+ /**
304197
+ * Repository URL for backstage.io/edit-url annotation
304198
+ */
304199
+ { name: 'repositoryUrl', type: String },
304200
+ /**
304201
+ * Default branch for backstage.io/edit-url annotation
304202
+ */
304203
+ { name: 'defaultBranch', type: String, defaultValue: 'main' },
303299
304204
  /**
303300
304205
  * Path where the claims defaults are located
303301
304206
  */
@@ -303324,7 +304229,7 @@ const cdk8s_rendererSubcommands = {
303324
304229
  run: async (options) => {
303325
304230
  if (options['render']) {
303326
304231
  console.table(options);
303327
- await runRenderer(options['globals'], options['initializers'], options['claims'], options['previousCRs'], options['claimsDefaults'], options['outputCatalogDir'], options['outputCrDir'], !options['disableRenames'], options['provider'], options['excludePath'], options['validateReferentialIntegrity'], options['claimRefsList'], options['claimFilesList']);
304232
+ await runRenderer(options['globals'], options['initializers'], options['claims'], options['previousCRs'], options['claimsDefaults'], options['outputCatalogDir'], options['outputCrDir'], !options['disableRenames'], options['provider'], options['excludePath'], options['validateReferentialIntegrity'], options['claimRefsList'], options['claimFilesList'], options['repositoryUrl'], options['defaultBranch']);
303328
304233
  }
303329
304234
  else if (options['compare']) {
303330
304235
  await cdk8s_renderer.runComparer(options['claimsFromMain'], options['claimsFromPr'], options['claimsDefaults'], options['wetReposConfig'], options['outputComparer']);
@@ -303606,7 +304511,7 @@ const crs_analyzerSubcommand = {
303606
304511
  };
303607
304512
 
303608
304513
  ;// CONCATENATED MODULE: ./package.json
303609
- const package_namespaceObject = JSON.parse('{"i8":"2.7.0-snapshot-13"}');
304514
+ const package_namespaceObject = JSON.parse('{"i8":"2.7.0-snapshot-15"}');
303610
304515
  ;// CONCATENATED MODULE: ../../package.json
303611
304516
  const package_namespaceObject_1 = {"i8":"2.6.4"};
303612
304517
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts