@firestartr/cli 2.7.0-snapshot-12 → 2.7.0-snapshot-14

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 (26) hide show
  1. package/build/index.js +1177 -275
  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/renderer/claims-render.d.ts +1 -1
  17. package/build/packages/cdk8s_renderer/src/validations/githubOrgSettings.d.ts +2 -0
  18. package/build/packages/gh_provisioner/src/entities/ghorgsettings/index.d.ts +7 -0
  19. package/build/packages/importer/src/decanter/gh/github_org_settings.d.ts +10 -0
  20. package/build/packages/importer/src/decanter/gh/github_org_settings_collection.d.ts +10 -0
  21. package/build/packages/importer/src/decanter/index.d.ts +2 -0
  22. package/build/packages/operator/src/ctl.d.ts +7 -0
  23. package/build/packages/operator/src/parentDependency.d.ts +30 -0
  24. package/build/packages/operator/src/processItem.d.ts +3 -0
  25. package/build/packages/operator/src/queueSort.d.ts +2 -0
  26. 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() {
@@ -288783,7 +289006,9 @@ class GithubRepositoryChart extends BaseGithubChart {
288783
289006
  allowUpdateBranch: claim.providers.github.allowUpdateBranch,
288784
289007
  hasIssues: claim.providers.github.hasIssues,
288785
289008
  hasWiki: claim.providers.github.hasWiki,
288786
- hasDiscussions: claim.providers.github.hasDiscussions,
289009
+ ...(claim.providers.github.hasDiscussions !== undefined && {
289010
+ hasDiscussions: claim.providers.github.hasDiscussions,
289011
+ }),
288787
289012
  visibility: claim.providers.github.visibility,
288788
289013
  defaultBranch: claim.providers.github?.branchStrategy?.defaultBranch,
288789
289014
  codeowners: createCodeOwnersData(claim),
@@ -288973,12 +289198,71 @@ class GithubOrgWebhookChart extends BaseGithubChart {
288973
289198
  }
288974
289199
  }
288975
289200
 
289201
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/github/orgSettingsChart.ts
289202
+
289203
+
289204
+ class GithubOrgSettingsChart extends BaseGithubChart {
289205
+ template() {
289206
+ const claim = this.get('claim');
289207
+ const firestartrId = this.get('firestartrId');
289208
+ const githubProvider = claim.providers.github;
289209
+ const template = {
289210
+ metadata: {
289211
+ name: githubProvider.name,
289212
+ },
289213
+ spec: {
289214
+ org: githubProvider.org,
289215
+ billingEmail: githubProvider.billing_email,
289216
+ company: githubProvider.company,
289217
+ blog: githubProvider.blog,
289218
+ email: githubProvider.email,
289219
+ twitterUsername: githubProvider.twitter_username,
289220
+ location: githubProvider.location,
289221
+ description: githubProvider.description,
289222
+ hasOrganizationProjects: githubProvider.has_organization_projects,
289223
+ hasRepositoryProjects: githubProvider.has_repository_projects,
289224
+ defaultRepositoryPermission: githubProvider.default_repository_permission,
289225
+ membersCanCreateRepositories: githubProvider.members_can_create_repositories,
289226
+ membersCanCreatePublicRepositories: githubProvider.members_can_create_public_repositories,
289227
+ membersCanCreatePrivateRepositories: githubProvider.members_can_create_private_repositories,
289228
+ membersCanCreateInternalRepositories: githubProvider.members_can_create_internal_repositories,
289229
+ membersCanCreatePages: githubProvider.members_can_create_pages,
289230
+ membersCanCreatePublicPages: githubProvider.members_can_create_public_pages,
289231
+ membersCanCreatePrivatePages: githubProvider.members_can_create_private_pages,
289232
+ membersCanForkPrivateRepositories: githubProvider.members_can_fork_private_repositories,
289233
+ webCommitSignoffRequired: githubProvider.web_commit_signoff_required,
289234
+ advancedSecurityEnabledForNewRepositories: githubProvider.advanced_security_enabled_for_new_repositories,
289235
+ dependabotAlertsEnabledForNewRepositories: githubProvider.dependabot_alerts_enabled_for_new_repositories,
289236
+ dependabotSecurityUpdatesEnabledForNewRepositories: githubProvider.dependabot_security_updates_enabled_for_new_repositories,
289237
+ dependencyGraphEnabledForNewRepositories: githubProvider.dependency_graph_enabled_for_new_repositories,
289238
+ secretScanningEnabledForNewRepositories: githubProvider.secret_scanning_enabled_for_new_repositories,
289239
+ secretScanningPushProtectionEnabledForNewRepositories: githubProvider.secret_scanning_push_protection_enabled_for_new_repositories,
289240
+ firestartr: {
289241
+ tfStateKey: firestartrId,
289242
+ },
289243
+ writeConnectionSecretToRef: {
289244
+ name: `firestartrgithuborganizationsettings-${githubProvider.name}-outputs`.toLowerCase(),
289245
+ outputs: [],
289246
+ },
289247
+ },
289248
+ };
289249
+ return JSON.parse(JSON.stringify(template));
289250
+ }
289251
+ gvk() {
289252
+ return FirestartrGithubOrganizationSettings.GVK;
289253
+ }
289254
+ instanceApiObject(template) {
289255
+ return new FirestartrGithubOrganizationSettings(this, template.metadata.name, template);
289256
+ }
289257
+ }
289258
+
288976
289259
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/github/index.ts
288977
289260
 
288978
289261
 
288979
289262
 
288980
289263
 
288981
289264
 
289265
+
288982
289266
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/catalog/base.ts
288983
289267
 
288984
289268
  class BaseCatalogChart extends BaseChart {
@@ -289722,6 +290006,7 @@ class SecretsChart extends BaseSecretsChart {
289722
290006
  ArgoDeployChart: ArgoDeployChart,
289723
290007
  SecretsChart: SecretsChart,
289724
290008
  GithubOrgWebhookChart: GithubOrgWebhookChart,
290009
+ GithubOrgSettingsChart: GithubOrgSettingsChart,
289725
290010
  });
289726
290011
 
289727
290012
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/renderer/claims-render.ts
@@ -289733,6 +290018,7 @@ class SecretsChart extends BaseSecretsChart {
289733
290018
 
289734
290019
 
289735
290020
 
290021
+
289736
290022
  function normalizeProvidesApis(providesApis) {
289737
290023
  if (!providesApis)
289738
290024
  return [];
@@ -289754,6 +290040,7 @@ async function renderClaims(catalogScope, firestartrScope, data) {
289754
290040
  'TFWorkspaceClaim',
289755
290041
  'ArgoDeployClaim',
289756
290042
  'OrgWebhookClaim',
290043
+ 'OrgSettingsClaim',
289757
290044
  ], renderClaims);
289758
290045
  for (const renderClaims of sortedKinds) {
289759
290046
  for (const claimKey of Object.keys(renderClaims)) {
@@ -289768,7 +290055,8 @@ async function renderClaims(catalogScope, firestartrScope, data) {
289768
290055
  if (!previousCR) {
289769
290056
  logger.debug(`No CR found for claim ${claimKey}, it will be rendered from scratch`);
289770
290057
  }
289771
- const { firestartrEntity, extraCharts, catalogEntity } = await renderClaim(catalogScope, firestartrScope, claim, patches, previousCR);
290058
+ const claimPath = renderClaims[claimKey].claimPath;
290059
+ const { firestartrEntity, extraCharts, catalogEntity } = await renderClaim(catalogScope, firestartrScope, claim, patches, previousCR, claimPath);
289772
290060
  if (catalogEntity) {
289773
290061
  result[`${catalogEntity.kind}-${catalogEntity.metadata.name}`] =
289774
290062
  catalogEntity.toJson();
@@ -289797,7 +290085,7 @@ async function renderClaims(catalogScope, firestartrScope, data) {
289797
290085
  }
289798
290086
  return result;
289799
290087
  }
289800
- async function renderClaim(catalogScope, firestartrScope, claim, patches, previousCR = null) {
290088
+ async function renderClaim(catalogScope, firestartrScope, claim, patches, previousCR = null, claimPath) {
289801
290089
  let catalogEntity = undefined;
289802
290090
  let firestartrEntity = undefined;
289803
290091
  const extraCharts = [];
@@ -289865,6 +290153,20 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
289865
290153
  .join('/');
289866
290154
  const definitionUrl = `https://github.com/${org}/${repoName}/blob/${defaultBranch}/${encodedDefinitionFilePath}`;
289867
290155
  const sanitizedApiName = sanitizeApiEntityName(apiDefinition.name);
290156
+ const repoUrl = getRepositoryUrl();
290157
+ const apiAnnotations = {
290158
+ ...(claim.annotations || {}),
290159
+ title: apiDefinition.name,
290160
+ };
290161
+ if (repoUrl && claimPath) {
290162
+ const claimsRoot = getPath('claims');
290163
+ const relativePath = external_path_.relative(claimsRoot, claimPath)
290164
+ .split(external_path_.sep)
290165
+ .map((segment) => encodeURIComponent(segment))
290166
+ .join('/');
290167
+ apiAnnotations['backstage.io/edit-url'] =
290168
+ `${repoUrl}/blob/${defaultBranch}/${relativePath}`;
290169
+ }
289868
290170
  const apiChart = new charts.CatalogApiChart(catalogScope, `${chartId}-api-${sanitizedApiName}`, firestartrId, {
289869
290171
  name: sanitizedApiName,
289870
290172
  type: apiDefinition.type,
@@ -289872,10 +290174,7 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
289872
290174
  owner: claim.owner,
289873
290175
  system: claim.system,
289874
290176
  definitionUrl,
289875
- annotations: {
289876
- ...(claim.annotations || {}),
289877
- title: apiDefinition.name,
289878
- },
290177
+ annotations: apiAnnotations,
289879
290178
  }, []);
289880
290179
  await apiChart.render();
289881
290180
  const apiObject = await apiChart.postRenderer([]);
@@ -289928,6 +290227,11 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
289928
290227
  firestartrEntity = new charts.GithubOrgWebhookChart(firestartrScope, `github-${chartId}`, firestartrId, claim, renderPatches);
289929
290228
  }
289930
290229
  break;
290230
+ case 'OrgSettingsClaim':
290231
+ if (loadGithub) {
290232
+ firestartrEntity = new charts.GithubOrgSettingsChart(firestartrScope, `github-${chartId}`, firestartrId, claim, renderPatches);
290233
+ }
290234
+ break;
289931
290235
  default:
289932
290236
  console.error(`Unknown claim kind: ${claim.kind}`);
289933
290237
  break;
@@ -289944,7 +290248,7 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
289944
290248
  *
289945
290249
  */
289946
290250
  const [catalogChart, firestartrEntityChart] = await Promise.all([
289947
- loadCatalog ? catalogEntity.render() : Promise.resolve(undefined),
290251
+ catalogEntity ? catalogEntity.render() : Promise.resolve(undefined),
289948
290252
  firestartrEntity?.render(),
289949
290253
  ]);
289950
290254
  /*
@@ -289953,7 +290257,7 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
289953
290257
  *
289954
290258
  */
289955
290259
  return {
289956
- catalogEntity: loadCatalog
290260
+ catalogEntity: catalogChart
289957
290261
  ? await catalogChart.postRenderer(postPatches)
289958
290262
  : undefined,
289959
290263
  firestartrEntity: await (firestartrEntityChart
@@ -290042,6 +290346,39 @@ function validateComponentPagesPath(_renderClaims) {
290042
290346
  return;
290043
290347
  }
290044
290348
 
290349
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/githubOrgSettings.ts
290350
+ const GITHUB_ORG_SETTINGS_KIND = 'FirestartrGithubOrganizationSettings';
290351
+ const FIRESTARTR_CLAIM_REF_ANNOTATION = 'firestartr.dev/claim-ref';
290352
+ const CLAIM_REF_LABEL = 'claim-ref';
290353
+ function formatResourceRef(name, claimRef) {
290354
+ return claimRef ? `${name} (claim: ${claimRef})` : name;
290355
+ }
290356
+ // Render-time singleton: at most one FirestartrGithubOrganizationSettings per
290357
+ // GitHub org (case-insensitive) across the whole rendered set. See ADR 0003.
290358
+ function validateGithubOrgSettingsSingleton(crs) {
290359
+ const refsByOrg = new Map();
290360
+ for (const crKey of Object.keys(crs)) {
290361
+ const cr = crs[crKey];
290362
+ if (cr.kind !== GITHUB_ORG_SETTINGS_KIND)
290363
+ continue;
290364
+ const org = cr.spec?.org;
290365
+ if (typeof org !== 'string' || !org)
290366
+ continue;
290367
+ const name = cr.metadata?.name || crKey;
290368
+ const claimRef = cr.metadata?.annotations?.[FIRESTARTR_CLAIM_REF_ANNOTATION] ||
290369
+ cr.metadata?.labels?.[CLAIM_REF_LABEL];
290370
+ const normalizedOrg = org.toLowerCase();
290371
+ const refs = refsByOrg.get(normalizedOrg) || [];
290372
+ refs.push(formatResourceRef(name, claimRef));
290373
+ refsByOrg.set(normalizedOrg, refs);
290374
+ }
290375
+ for (const [org, refs] of refsByOrg.entries()) {
290376
+ if (refs.length < 2)
290377
+ continue;
290378
+ throw new Error(`Duplicate ${GITHUB_ORG_SETTINGS_KIND} resources found for GitHub organization "${org}": ${refs.join(', ')}`);
290379
+ }
290380
+ }
290381
+
290045
290382
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/renderer/renderer.ts
290046
290383
 
290047
290384
 
@@ -290051,6 +290388,7 @@ function validateComponentPagesPath(_renderClaims) {
290051
290388
 
290052
290389
 
290053
290390
 
290391
+
290054
290392
  /*
290055
290393
  * Function called when rendering but not importing
290056
290394
  *
@@ -290065,10 +290403,15 @@ function validateComponentPagesPath(_renderClaims) {
290065
290403
  async function renderer_render(catalogScope, firestartrScope, claimList) {
290066
290404
  const data = await loadClaimsList(claimList);
290067
290405
  const result = await renderClaims(catalogScope, firestartrScope, data);
290406
+ const fullCrSet = {
290407
+ ...data.fullCrs,
290408
+ ...result,
290409
+ };
290068
290410
  try {
290069
290411
  validateSubReferences(data.renderClaims);
290070
290412
  validateComponentPagesPath(data.renderClaims);
290071
290413
  validateTfStateKeyUniqueness(result);
290414
+ validateGithubOrgSettingsSingleton(fullCrSet);
290072
290415
  validateCrSizes(result);
290073
290416
  validatePermissionsUniqueness(result);
290074
290417
  }
@@ -290498,6 +290841,8 @@ async function addLastStateAndLastClaimAnnotations(filePath, lastStatePRLink, la
290498
290841
  INITIALIZERS_BY_FILE_NAME: INITIALIZERS_BY_FILE_NAME,
290499
290842
  NORMALIZERS: NORMALIZERS,
290500
290843
  AllowedProviders: AllowedProviders,
290844
+ setRepositoryUrl: setRepositoryUrl,
290845
+ setDefaultBranch: setDefaultBranch,
290501
290846
  runComparer: runComparer,
290502
290847
  isCatalogEntity: isCatalogEntity,
290503
290848
  loadCRs: loadCRs,
@@ -290521,7 +290866,7 @@ async function addLastStateAndLastClaimAnnotations(filePath, lastStatePRLink, la
290521
290866
  * This function returns nothing.
290522
290867
  *
290523
290868
  */
290524
- async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity, claimRefs = '', claimFilesList = '') {
290869
+ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity, claimRefs = '', claimFilesList = '', repositoryUrl, defaultBranch) {
290525
290870
  configureProvider(provider);
290526
290871
  setPath('initializers', initializersPath);
290527
290872
  setPath('crs', crsPath);
@@ -290530,6 +290875,8 @@ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, c
290530
290875
  setPath('claimsDefaults', claimsDefaults);
290531
290876
  setRenamesEnabled(renamesEnabled);
290532
290877
  setExcludedPaths(excludedPaths);
290878
+ setRepositoryUrl(repositoryUrl);
290879
+ setDefaultBranch(defaultBranch ?? 'main');
290533
290880
  const catalogApp = new lib.App({
290534
290881
  outdir: outputCatalogDir,
290535
290882
  outputFileExtension: '.yaml',
@@ -291056,6 +291403,107 @@ MemberCollectionGithubDecanter.collectionKind = 'gh-members';
291056
291403
  applyCollectionMixins(MemberCollectionGithubDecanter);
291057
291404
  /* harmony default export */ const github_member_collection = (MemberCollectionGithubDecanter);
291058
291405
 
291406
+ ;// CONCATENATED MODULE: ../importer/src/decanter/gh/github_org_settings.ts
291407
+
291408
+
291409
+ const ORG_SETTINGS_OPTIONAL_FIELDS = [
291410
+ 'twitter_username',
291411
+ 'company',
291412
+ 'blog',
291413
+ 'email',
291414
+ 'location',
291415
+ 'description',
291416
+ 'has_organization_projects',
291417
+ 'has_repository_projects',
291418
+ 'default_repository_permission',
291419
+ 'members_can_create_repositories',
291420
+ 'members_can_create_public_repositories',
291421
+ 'members_can_create_private_repositories',
291422
+ 'members_can_create_internal_repositories',
291423
+ 'members_can_create_pages',
291424
+ 'members_can_create_public_pages',
291425
+ 'members_can_create_private_pages',
291426
+ 'members_can_fork_private_repositories',
291427
+ 'web_commit_signoff_required',
291428
+ 'advanced_security_enabled_for_new_repositories',
291429
+ 'dependabot_alerts_enabled_for_new_repositories',
291430
+ 'dependabot_security_updates_enabled_for_new_repositories',
291431
+ 'dependency_graph_enabled_for_new_repositories',
291432
+ 'secret_scanning_enabled_for_new_repositories',
291433
+ 'secret_scanning_push_protection_enabled_for_new_repositories',
291434
+ ];
291435
+ class OrgSettingsGithubDecanter extends GithubDecanter {
291436
+ constructor() {
291437
+ super(...arguments);
291438
+ this.claimKind = 'OrgSettingsClaim';
291439
+ }
291440
+ __decantStart() {
291441
+ this.claim = {
291442
+ kind: this.claimKind,
291443
+ version: this.VERSION(),
291444
+ name: this.orgSettingsName(),
291445
+ };
291446
+ }
291447
+ __decantProviders() {
291448
+ importer_src_logger.info(`Decanting GitHub organization settings providers for ${this.org}`);
291449
+ this.__patchClaim({
291450
+ op: 'add',
291451
+ value: {
291452
+ github: this.data.providerPayload,
291453
+ },
291454
+ path: '/providers',
291455
+ });
291456
+ }
291457
+ async __gatherOrgSettings() {
291458
+ importer_src_logger.info(`Gathering GitHub organization settings for ${this.org}`);
291459
+ this.data.orgSettings = await this.github.org.getOrgInfo(this.org);
291460
+ }
291461
+ __gatherProviderPayload() {
291462
+ const billingEmail = this.data.orgSettings.billing_email;
291463
+ if (typeof billingEmail !== 'string' || billingEmail.trim() === '') {
291464
+ throw new Error(`GitHub organization ${this.org} did not return billing_email. ` +
291465
+ 'billing_email is required for OrgSettingsClaim / FirestartrGithubOrganizationSettings. ' +
291466
+ 'Run importer with credentials that can read billing email or create/manage the claim manually.');
291467
+ }
291468
+ const providerPayload = {
291469
+ name: this.orgSettingsName(),
291470
+ org: this.org,
291471
+ billing_email: billingEmail,
291472
+ };
291473
+ for (const field of ORG_SETTINGS_OPTIONAL_FIELDS) {
291474
+ const value = this.data.orgSettings[field];
291475
+ if (value !== undefined && value !== null) {
291476
+ providerPayload[field] = value;
291477
+ }
291478
+ }
291479
+ this.data.providerPayload = providerPayload;
291480
+ importer_src_logger.info(`Prepared GitHub organization settings claim payload for ${this.org}`);
291481
+ }
291482
+ async __adaptInitializerBase(_claim) {
291483
+ return await this.__loadInitializer('defaults_github_orgsettings.yaml');
291484
+ }
291485
+ orgSettingsName() {
291486
+ return `${this.org.toLowerCase()}-org-settings`;
291487
+ }
291488
+ }
291489
+
291490
+ ;// CONCATENATED MODULE: ../importer/src/decanter/gh/github_org_settings_collection.ts
291491
+
291492
+
291493
+
291494
+ class OrgSettingsCollectionGithubDecanter extends GithubDecanter {
291495
+ async collection(filters = []) {
291496
+ if (this.IS_SKIP_SET(filters, OrgSettingsCollectionGithubDecanter.collectionKind)) {
291497
+ return [];
291498
+ }
291499
+ const filteredOrgs = await this.filter(OrgSettingsCollectionGithubDecanter.collectionKind, filters, [this.org]);
291500
+ return filteredOrgs.map((orgName) => new OrgSettingsGithubDecanter({}, orgName));
291501
+ }
291502
+ }
291503
+ OrgSettingsCollectionGithubDecanter.collectionKind = 'gh-org-settings';
291504
+ applyCollectionMixins(OrgSettingsCollectionGithubDecanter);
291505
+ /* harmony default export */ const github_org_settings_collection = (OrgSettingsCollectionGithubDecanter);
291506
+
291059
291507
  ;// CONCATENATED MODULE: ../importer/src/utils/codeowner.ts
291060
291508
  function extractFromCodeOwners(codeOwnersContent) {
291061
291509
  if (!codeOwnersContent) {
@@ -291169,7 +291617,9 @@ class RepoGithubDecanter extends GithubDecanter {
291169
291617
  },
291170
291618
  topics: this.data.repoDetails.topics,
291171
291619
  hasWiki: this.data.repoDetails.has_wiki,
291172
- hasDiscussions: this.data.repoDetails.has_discussions,
291620
+ ...(this.data.repoDetails.has_discussions === true && {
291621
+ hasDiscussions: true,
291622
+ }),
291173
291623
  },
291174
291624
  },
291175
291625
  path: '/providers',
@@ -291549,6 +291999,7 @@ applyCollectionMixins(RepoCollectionGithubDecanter);
291549
291999
 
291550
292000
 
291551
292001
 
292002
+
291552
292003
  // A single claim can render multiple CRs.
291553
292004
  // Some of those rendered kinds are derived/child resources whose parent is the
291554
292005
  // main CR for the claim, so they do not correspond to claim files that should be moved.
@@ -291560,6 +292011,7 @@ let previousCRs = {};
291560
292011
  const collections = {
291561
292012
  GroupCollectionGithubDecanter: github_group_collection,
291562
292013
  MemberCollectionGithubDecanter: github_member_collection,
292014
+ OrgSettingsCollectionGithubDecanter: github_org_settings_collection,
291563
292015
  RepoCollectionGithubDecanter: github_repo_collection,
291564
292016
  };
291565
292017
  function isInPreviousCRs(kind, name) {
@@ -291652,9 +292104,11 @@ function getClaimPathFromCR(claimsBasePath, cr) {
291652
292104
  FirestartrGithubGroup: 'groups',
291653
292105
  FirestartrGithubRepository: 'components',
291654
292106
  FirestartrGithubMembership: 'users',
292107
+ // common.io.writeClaim derives OrgSettingsClaim -> orgsettingss.
292108
+ FirestartrGithubOrganizationSettings: 'orgsettingss',
291655
292109
  };
291656
292110
  const claimRef = `${cr.metadata.annotations['firestartr.dev/claim-ref']}.yaml`.toLowerCase();
291657
- return external_path_.join(claimsBasePath, mapCrsToClaims[cr.kind], claimRef.replace(/^[^/]+/, ''));
292111
+ return external_path_.join(claimsBasePath, mapCrsToClaims[cr.kind], claimRef.replace(/^[^/]+\//, ''));
291658
292112
  }
291659
292113
  function getCrPath(crsBasePath, cr) {
291660
292114
  return external_path_.join(crsBasePath, `${cr.kind}.${cr.metadata.name}.yaml`);
@@ -291665,6 +292119,7 @@ async function getDataFromKinds(org, filters = [], needsReImport) {
291665
292119
  importGithubMemberships(org, filters, needsReImport).then((memberships) => (data['memberships'] = memberships)),
291666
292120
  importGithubGroups(org, filters, needsReImport).then((groups) => (data['groups'] = groups)),
291667
292121
  importGithubRepositories(org, filters, needsReImport).then((repos) => (data['repos'] = repos)),
292122
+ importGithubOrgSettings(org, filters, needsReImport).then((orgSettings) => (data['orgSettings'] = orgSettings)),
291668
292123
  ]);
291669
292124
  const renderClaims = {};
291670
292125
  const deps = {};
@@ -291691,6 +292146,12 @@ async function getDataFromKinds(org, filters = [], needsReImport) {
291691
292146
  membership.deps;
291692
292147
  postRender[`FirestartrGithubMembership-${membership.renderClaim.claim.name}`] = membership.postRenderFunctions;
291693
292148
  }
292149
+ for (const orgSettings of data['orgSettings']) {
292150
+ renderClaims[`OrgSettingsClaim-${orgSettings.renderClaim.claim.name}`] =
292151
+ orgSettings.renderClaim;
292152
+ deps[`FirestartrGithubOrganizationSettings-${orgSettings.renderClaim.claim.name}`] = orgSettings.deps;
292153
+ postRender[`FirestartrGithubOrganizationSettings-${orgSettings.renderClaim.claim.name}`] = orgSettings.postRenderFunctions;
292154
+ }
291694
292155
  return { renderClaims, deps: deps, postRender: postRender };
291695
292156
  }
291696
292157
  async function importGithubGroups(org, filters = [], needsReImport) {
@@ -291733,6 +292194,19 @@ async function importGithubMemberships(org, filters = [], needsReImport) {
291733
292194
  }
291734
292195
  return memberships;
291735
292196
  }
292197
+ async function importGithubOrgSettings(org, filters = [], needsReImport) {
292198
+ const orgSettingsList = [];
292199
+ const orgSettingsCollection = new github_org_settings_collection({}, org);
292200
+ const collection = await orgSettingsCollection.collection(filters);
292201
+ for (const orgSettings of collection) {
292202
+ orgSettings.needsReImport = needsReImport;
292203
+ await orgSettings.gather();
292204
+ await orgSettings.decant();
292205
+ orgSettingsList.push(await orgSettings.adapt());
292206
+ orgSettings.render();
292207
+ }
292208
+ return orgSettingsList;
292209
+ }
291736
292210
  async function getPreviousCrs(crsPath) { }
291737
292211
  /* harmony default export */ const decanter = ({ importGithubGitopsRepository });
291738
292212
 
@@ -291784,6 +292258,7 @@ const KIND_TO_COLLECTION_FILTERS = {
291784
292258
  FirestartrGithubRepository: 'gh-repo',
291785
292259
  FirestartrGithubGroup: 'gh-group',
291786
292260
  FirestartrGithubMembership: 'gh-members',
292261
+ FirestartrGithubOrganizationSettings: 'gh-org-settings',
291787
292262
  };
291788
292263
  const DEPENDANT_KINDS = [
291789
292264
  'FirestartrGithubRepositoryFeature',
@@ -291792,6 +292267,9 @@ const DEPENDANT_KINDS = [
291792
292267
  // we create a special Collection that will use
291793
292268
  class ReimportCollection {
291794
292269
  helperNameExtractor(cr) {
292270
+ if (cr.kind === 'FirestartrGithubOrganizationSettings') {
292271
+ return cr.spec.org;
292272
+ }
291795
292273
  return cr.metadata.annotations['firestartr.dev/external-name'];
291796
292274
  }
291797
292275
  isSkipped(cr, generatedFilters) {
@@ -291958,19 +292436,25 @@ function buildFilters(filters, force, crsPath, generatedFilters) {
291958
292436
  return generatedFilters;
291959
292437
  }
291960
292438
  function createSkipFilters(filters) {
291961
- const includedCollections = filters.map((f) => f.split(',')[0]);
291962
- const allFilters = filters.filter((f) => f.split(',')[0] === 'all');
292439
+ const crExistsFilter = 'all,FUNCTION=fCheckCRExistsOnDisk';
292440
+ const includedCollections = filters
292441
+ .filter((f) => f !== crExistsFilter)
292442
+ .map((f) => f.split(',')[0]);
292443
+ const allFilters = filters.filter((f) => f.split(',')[0] === 'all' && f !== crExistsFilter);
292444
+ const hasExplicitFilters = includedCollections.length > 0;
291963
292445
  for (const collectionClass of Object.values(collections)) {
291964
- if (allFilters.length > 0) {
291965
- for (const allFilter of allFilters) {
291966
- const adaptedFilter = allFilter.replace('all', collectionClass.collectionKind);
291967
- filters.push(adaptedFilter);
292446
+ const collectionKind = collectionClass.collectionKind;
292447
+ if (allFilters.length > 0 || !hasExplicitFilters) {
292448
+ for (const allFilter of [...allFilters, crExistsFilter]) {
292449
+ filters.push(allFilter.replace('all', collectionKind));
291968
292450
  }
291969
292451
  continue;
291970
292452
  }
291971
- if (includedCollections.indexOf(collectionClass.collectionKind) === -1) {
291972
- filters.push(`${collectionClass.collectionKind},SKIP=SKIP`);
292453
+ if (includedCollections.indexOf(collectionKind) === -1) {
292454
+ filters.push(`${collectionKind},SKIP=SKIP`);
292455
+ continue;
291973
292456
  }
292457
+ filters.push(crExistsFilter.replace('all', collectionKind));
291974
292458
  }
291975
292459
  return filters;
291976
292460
  }
@@ -292242,6 +292726,7 @@ const kindPluralMap = {
292242
292726
  githubrepositorysecretssections: 'FirestartrGithubRepositorySecretsSection',
292243
292727
  terraformmodules: 'FirestartrTerraformModule',
292244
292728
  githuborgwebhooks: 'FirestartrGithubOrgWebhook',
292729
+ githuborganizationsettings: 'FirestartrGithubOrganizationSettings',
292245
292730
  terraformworkspaces: 'FirestartrTerraformWorkspace',
292246
292731
  terraformworkspaceplans: 'FirestartrTerraformWorkspacePlan',
292247
292732
  providerconfigs: 'FirestartrProviderConfig',
@@ -292389,9 +292874,9 @@ function getOperatorProfile() {
292389
292874
  }
292390
292875
  async function getItem(kind, namespace, item) {
292391
292876
  const itemPath = `${namespace}/${kind}/${item.metadata.name}`;
292392
- return await getItemByItemPath(itemPath);
292877
+ return await ctl_getItemByItemPath(itemPath);
292393
292878
  }
292394
- async function getItemByItemPath(itemPath, apiGroup = catalog_common/* default.types.controller.FirestartrApiGroup */.Z.types.controller.FirestartrApiGroup, apiVersion = 'v1') {
292879
+ async function ctl_getItemByItemPath(itemPath, apiGroup = catalog_common/* default.types.controller.FirestartrApiGroup */.Z.types.controller.FirestartrApiGroup, apiVersion = 'v1') {
292395
292880
  try {
292396
292881
  operator_src_logger.debug(`The ctl is getting the item at '${itemPath}'.`);
292397
292882
  const { kc, opts } = await ctl_getConnection();
@@ -292415,6 +292900,39 @@ async function getItemByItemPath(itemPath, apiGroup = catalog_common/* default.t
292415
292900
  throw e;
292416
292901
  }
292417
292902
  }
292903
+ /**
292904
+ * Like getItemByItemPath but returns null when the resource is not found
292905
+ * (404) or there is a conflict (409), without logging those as errors.
292906
+ * Use this when a missing resource is an expected condition (e.g. checking
292907
+ * whether a parent CR has been provisioned before its children arrive).
292908
+ */
292909
+ async function getItemByItemPathOrNull(itemPath, apiGroup = catalog_common/* default.types.controller.FirestartrApiGroup */.Z.types.controller.FirestartrApiGroup, apiVersion = 'v1') {
292910
+ try {
292911
+ operator_src_logger.debug(`The ctl is getting the item at '${itemPath}'.`);
292912
+ const { kc, opts } = await ctl_getConnection();
292913
+ opts.headers['Content-Type'] = 'application/json';
292914
+ opts.headers['Accept'] = 'application/json';
292915
+ const url = apiGroup === catalog_common/* default.types.controller.KubernetesApiGroup */.Z.types.controller.KubernetesApiGroup
292916
+ ? `${kc.getCurrentCluster().server}/api/v1/namespaces/${itemPath}`
292917
+ : `${kc.getCurrentCluster().server}/apis/${apiGroup}/${apiVersion}/namespaces/${itemPath}`;
292918
+ operator_src_logger.silly(`Sending request ${url}`);
292919
+ const r = await fetch(url, { method: 'get', headers: opts.headers });
292920
+ if (r.status === 404 || r.status === 409) {
292921
+ operator_src_logger.debug(`Item at '${itemPath}' returned ${r.status} (expected), returning null.`);
292922
+ return null;
292923
+ }
292924
+ if (!r.ok) {
292925
+ const err = new Error(`Error on getItemByItemPath: ${itemPath}: ${r.statusText}`);
292926
+ operator_src_logger.error(`Error on getItemByItemPath: ${itemPath}: ${r.statusText}`);
292927
+ throw err;
292928
+ }
292929
+ return await r.json();
292930
+ }
292931
+ catch (e) {
292932
+ operator_src_logger.error(`Error on getItemByItemPath: ${e}`);
292933
+ throw e;
292934
+ }
292935
+ }
292418
292936
  async function writeManifest(kind, namespace, item, apiSlug) {
292419
292937
  const { kc, opts } = await ctl_getConnection();
292420
292938
  opts.headers['Content-Type'] = 'application/json';
@@ -292700,40 +293218,52 @@ async function checkIfRenamed(namespace, item) {
292700
293218
  }
292701
293219
  }
292702
293220
  async function upsertFinalizer(kind, namespace, item, finalizer) {
292703
- if ('finalizers' in item.metadata &&
292704
- item.metadata.finalizers.includes(finalizer)) {
292705
- 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.`);
292706
- return;
292707
- }
292708
- operator_src_logger.debug(`The ctl is setting the finalizer '${finalizer}' for '${kind}/${item.metadata.name}' in namespace '${namespace}'.`);
292709
293221
  const { kc, opts } = await ctl_getConnection();
292710
293222
  const url = `${kc.getCurrentCluster().server}/apis/firestartr.dev/v1/namespaces/${namespace}/${kind}/${item.metadata.name}`;
292711
- opts.headers['Content-Type'] = 'application/json-patch+json';
292712
- opts.headers['Accept'] = '*';
292713
- let patch;
292714
- if (!item['metadata']['finalizers']) {
292715
- patch = {
292716
- op: 'add',
292717
- path: '/metadata/finalizers',
292718
- value: [finalizer],
292719
- };
292720
- }
292721
- else {
292722
- patch = {
292723
- op: 'add',
292724
- path: '/metadata/finalizers/-',
292725
- value: finalizer,
292726
- };
292727
- }
292728
- const r = await fetch(url, {
292729
- method: 'PATCH',
292730
- headers: opts.headers,
292731
- body: JSON.stringify([patch]),
292732
- });
292733
- if (!r.ok) {
292734
- throw `Error on setFinalizer: ${namespace}/${kind}/${item['metadata']['name']}: ${r.statusText}`;
293223
+ for (let attempt = 0; attempt < 5; attempt++) {
293224
+ // Fresh GET to get current finalizers and resourceVersion
293225
+ const getResp = await fetch(url, {
293226
+ method: 'GET',
293227
+ headers: { ...opts.headers, Accept: 'application/json' },
293228
+ });
293229
+ if (!getResp.ok) {
293230
+ throw `Error fetching item for finalizer upsert: ${namespace}/${kind}/${item.metadata.name}: ${getResp.statusText}`;
293231
+ }
293232
+ const currentItem = await getResp.json();
293233
+ const currentFinalizers = currentItem.metadata.finalizers || [];
293234
+ if (currentFinalizers.includes(finalizer)) {
293235
+ 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.`);
293236
+ return;
293237
+ }
293238
+ operator_src_logger.debug(`The ctl is setting the finalizer '${finalizer}' for '${kind}/${item.metadata.name}' in namespace '${namespace}' (attempt ${attempt + 1}).`);
293239
+ const newFinalizers = [...currentFinalizers, finalizer];
293240
+ const body = JSON.stringify([
293241
+ {
293242
+ op: 'add',
293243
+ path: '/metadata/finalizers',
293244
+ value: newFinalizers,
293245
+ },
293246
+ ]);
293247
+ const patchResp = await fetch(url, {
293248
+ method: 'PATCH',
293249
+ headers: {
293250
+ ...opts.headers,
293251
+ 'Content-Type': 'application/json-patch+json',
293252
+ Accept: '*',
293253
+ 'If-Match': currentItem.metadata.resourceVersion,
293254
+ },
293255
+ body,
293256
+ });
293257
+ if (patchResp.ok) {
293258
+ return patchResp.json();
293259
+ }
293260
+ if (patchResp.status === 409) {
293261
+ operator_src_logger.debug(`Conflict upserting finalizer '${finalizer}' for '${kind}/${item.metadata.name}' (attempt ${attempt + 1}), retrying.`);
293262
+ continue;
293263
+ }
293264
+ throw `Error on upsertFinalizer: ${namespace}/${kind}/${item.metadata.name}: ${patchResp.statusText}`;
292735
293265
  }
292736
- return r.json();
293266
+ throw `Failed to upsert finalizer '${finalizer}' for '${namespace}/${kind}/${item.metadata.name}' after 5 attempts.`;
292737
293267
  }
292738
293268
  /**
292739
293269
  * Remove the given finalizer
@@ -292747,30 +293277,57 @@ async function unsetFinalizer(kind, namespace, item, finalizer) {
292747
293277
  const { kc, opts } = await ctl_getConnection();
292748
293278
  let itemObj;
292749
293279
  if (typeof item === 'string') {
292750
- itemObj = await getItemByItemPath([namespace, kind, item].join('/'));
293280
+ itemObj = await ctl_getItemByItemPath([namespace, kind, item].join('/'));
292751
293281
  }
292752
293282
  else {
292753
293283
  itemObj = item;
292754
293284
  }
292755
293285
  const name = itemObj.metadata.name;
292756
- operator_src_logger.debug(`The ctl is removing the finalizer '${finalizer}' from '${kind}/${name}' in namespace '${namespace}'.`);
292757
293286
  const url = `${kc.getCurrentCluster().server}/apis/firestartr.dev/v1/namespaces/${namespace}/${kind}/${name}`;
292758
- opts.headers['Content-Type'] = 'application/json-patch+json';
292759
- opts.headers['Accept'] = '*';
292760
- const patch = {
292761
- op: 'replace',
292762
- path: '/metadata/finalizers',
292763
- value: itemObj.metadata.finalizers.filter((f) => f !== finalizer),
292764
- };
292765
- const r = await fetch(url, {
292766
- method: 'PATCH',
292767
- headers: opts.headers,
292768
- body: JSON.stringify([patch]),
292769
- });
292770
- if (!r.ok) {
292771
- throw `Error on unsetFinalizer: ${namespace}/${kind}/${name}: ${r.statusText}`;
293287
+ for (let attempt = 0; attempt < 5; attempt++) {
293288
+ // Fresh GET to get current finalizers and resourceVersion
293289
+ const getResp = await fetch(url, {
293290
+ method: 'GET',
293291
+ headers: { ...opts.headers, Accept: 'application/json' },
293292
+ });
293293
+ if (!getResp.ok) {
293294
+ throw `Error fetching item for finalizer unset: ${namespace}/${kind}/${name}: ${getResp.statusText}`;
293295
+ }
293296
+ const currentItem = await getResp.json();
293297
+ const currentFinalizers = currentItem.metadata.finalizers || [];
293298
+ if (!currentFinalizers.includes(finalizer)) {
293299
+ operator_src_logger.debug(`The ctl tried to unset the finalizer '${finalizer}' for '${kind}/${name}' in namespace '${namespace}', but it was not present.`);
293300
+ return;
293301
+ }
293302
+ operator_src_logger.debug(`The ctl is removing the finalizer '${finalizer}' from '${kind}/${name}' in namespace '${namespace}' (attempt ${attempt + 1}).`);
293303
+ const newFinalizers = currentFinalizers.filter((f) => f !== finalizer);
293304
+ const body = JSON.stringify([
293305
+ {
293306
+ op: 'replace',
293307
+ path: '/metadata/finalizers',
293308
+ value: newFinalizers,
293309
+ },
293310
+ ]);
293311
+ const patchResp = await fetch(url, {
293312
+ method: 'PATCH',
293313
+ headers: {
293314
+ ...opts.headers,
293315
+ 'Content-Type': 'application/json-patch+json',
293316
+ Accept: '*',
293317
+ 'If-Match': currentItem.metadata.resourceVersion,
293318
+ },
293319
+ body,
293320
+ });
293321
+ if (patchResp.ok) {
293322
+ return patchResp.json();
293323
+ }
293324
+ if (patchResp.status === 409) {
293325
+ operator_src_logger.debug(`Conflict unsetting finalizer '${finalizer}' for '${kind}/${name}' (attempt ${attempt + 1}), retrying.`);
293326
+ continue;
293327
+ }
293328
+ throw `Error on unsetFinalizer: ${namespace}/${kind}/${name}: ${patchResp.statusText}`;
292772
293329
  }
292773
- return r.json();
293330
+ throw `Failed to unset finalizer '${finalizer}' for '${namespace}/${kind}/${name}' after 5 attempts.`;
292774
293331
  }
292775
293332
  /**
292776
293333
  * @deprecated Misspelled export kept for backward compatibility.
@@ -293037,7 +293594,7 @@ function conditionsSorter(conditions) {
293037
293594
 
293038
293595
 
293039
293596
  async function upsertInitialStatus(pluralKind, namespace, item) {
293040
- item = await getItemByItemPath(`${namespace}/${pluralKind}/${item.metadata.name}`);
293597
+ item = await ctl_getItemByItemPath(`${namespace}/${pluralKind}/${item.metadata.name}`);
293041
293598
  if (!('status' in item))
293042
293599
  item.status = {};
293043
293600
  if (!('conditions' in item.status))
@@ -293123,7 +293680,7 @@ function shouldForceReconcileByAnnotation(cr) {
293123
293680
  }
293124
293681
  async function updateSyncTransition(itemPath, reason, lastSyncTime, nextSyncTime, message, status) {
293125
293682
  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}'.`);
293126
- const k8sItem = await getItemByItemPath(itemPath);
293683
+ const k8sItem = await ctl_getItemByItemPath(itemPath);
293127
293684
  if (!('status' in k8sItem))
293128
293685
  k8sItem.status = {};
293129
293686
  if (!('conditions' in k8sItem.status))
@@ -293146,7 +293703,7 @@ async function updateSyncTransition(itemPath, reason, lastSyncTime, nextSyncTime
293146
293703
  async function updateRetryStatusInCR(pluralKind, namespace, name, retryCount, nextRetryTime) {
293147
293704
  const itemPath = `${namespace}/${pluralKind}/${name}`;
293148
293705
  try {
293149
- const item = await getItemByItemPath(itemPath);
293706
+ const item = await ctl_getItemByItemPath(itemPath);
293150
293707
  if (!('status' in item) || item.status === null)
293151
293708
  item.status = {};
293152
293709
  item.status.retryCount = retryCount;
@@ -293192,7 +293749,7 @@ async function writePrioritizedStatus(kind, namespace, item) {
293192
293749
  }
293193
293750
  async function updateTransition(itemPath, reason, type, statusValue, message = '', updateStatusOnly = false) {
293194
293751
  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}'.`);
293195
- const k8sItem = await getItemByItemPath(itemPath);
293752
+ const k8sItem = await ctl_getItemByItemPath(itemPath);
293196
293753
  if (!('status' in k8sItem))
293197
293754
  k8sItem.status = {};
293198
293755
  if (!('conditions' in k8sItem.status))
@@ -293265,7 +293822,7 @@ const SYNC_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Sync o
293265
293822
 
293266
293823
  const DEFAULT_REVISION_TIME = '1m';
293267
293824
  async function createWatcherForItem(itemPath, itemCR) {
293268
- const item = itemCR ?? (await getItemByItemPath(itemPath));
293825
+ const item = itemCR ?? (await ctl_getItemByItemPath(itemPath));
293269
293826
  const syncStatus = await getSyncStatus(itemPath, item);
293270
293827
  let nextTimeoutInMS = syncStatus.nextTimeoutInMS;
293271
293828
  // we have lapsed last interval
@@ -293297,7 +293854,7 @@ async function destroyWatcherForItem(watcher) {
293297
293854
  operator_src_logger.debug(`Disabled SyncWatcher for ${watcher.itemPath}`);
293298
293855
  }
293299
293856
  async function getSyncSpecs(itemPath, itemCR) {
293300
- const item = itemCR ?? (await getItemByItemPath(itemPath));
293857
+ const item = itemCR ?? (await ctl_getItemByItemPath(itemPath));
293301
293858
  return {
293302
293859
  item,
293303
293860
  syncable: helperIsSyncable(item),
@@ -293309,7 +293866,7 @@ async function getSyncSpecs(itemPath, itemCR) {
293309
293866
  };
293310
293867
  }
293311
293868
  async function getSyncStatus(itemPath, itemCR) {
293312
- const item = itemCR ?? (await getItemByItemPath(itemPath));
293869
+ const item = itemCR ?? (await ctl_getItemByItemPath(itemPath));
293313
293870
  const syncCondition = getConditionByType(item.status?.conditions ?? [], 'SYNCHRONIZED');
293314
293871
  // no sync condition present
293315
293872
  if (!syncCondition) {
@@ -293341,7 +293898,7 @@ async function getSyncStatus(itemPath, itemCR) {
293341
293898
  }
293342
293899
  }
293343
293900
  async function setSyncStatus(itemPath, reason, status, message) {
293344
- const item = await getItemByItemPath(itemPath);
293901
+ const item = await ctl_getItemByItemPath(itemPath);
293345
293902
  const machinery = assessSyncCalculationMachinery(item);
293346
293903
  const syncStatus = await machinery(item, reason, status, message);
293347
293904
  syncStatus.itemPath = itemPath;
@@ -293591,7 +294148,7 @@ async function loopKeeper(api) {
293591
294148
  }
293592
294149
  }
293593
294150
  async function getItemIfNeededSync(watcher) {
293594
- const item = await getItemByItemPath(watcher.itemPath);
294151
+ const item = await ctl_getItemByItemPath(watcher.itemPath);
293595
294152
  const isProvisioning = item.status?.conditions?.find((condition) => condition.type === 'PROVISIONING' && condition.status === 'True');
293596
294153
  if (isProvisioning)
293597
294154
  return null;
@@ -293681,7 +294238,7 @@ async function retry_loop(enqueueIfNeeded) {
293681
294238
  }
293682
294239
  async function getItemIfNeededRetry(watcher) {
293683
294240
  try {
293684
- const item = await getItemByItemPath(watcher.itemPath);
294241
+ const item = await ctl_getItemByItemPath(watcher.itemPath);
293685
294242
  const isProvisioning = item.status?.conditions?.find((condition) => condition.type === 'PROVISIONING' && condition.status === 'True');
293686
294243
  if (isProvisioning)
293687
294244
  return null;
@@ -293865,6 +294422,7 @@ const kindsWithFinalizer = [
293865
294422
  'FirestartrGithubRepository',
293866
294423
  'FirestartrGithubRepositoryFeature',
293867
294424
  'FirestartrGithubOrgWebhook',
294425
+ 'FirestartrGithubOrganizationSettings',
293868
294426
  'FirestartrGithubRepositorySecretsSection',
293869
294427
  ];
293870
294428
  const kindsWithDependants = [
@@ -293969,7 +294527,7 @@ async function handleUnsetFinalizer(pluralKind, namespace, item) {
293969
294527
  */
293970
294528
  function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
293971
294529
  workItem.getItem = () => {
293972
- return getItemByItemPath(informer_itemPath(pluralKind, workItem.item));
294530
+ return ctl_getItemByItemPath(informer_itemPath(pluralKind, workItem.item));
293973
294531
  };
293974
294532
  workItem.isDeadLetter = false;
293975
294533
  workItem.handler = {
@@ -293988,7 +294546,7 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
293988
294546
  return result;
293989
294547
  },
293990
294548
  writeConnectionSecret: writeConnectionSecret,
293991
- resolveReferences: () => resolve(workItem.item, getItemByItemPath, getSecret),
294549
+ resolveReferences: () => resolve(workItem.item, ctl_getItemByItemPath, getSecret),
293992
294550
  resolveOwnOutputs: () => {
293993
294551
  return resolveSecretRef(workItem.item.metadata.namespace, workItem.item, getSecret);
293994
294552
  },
@@ -294059,7 +294617,7 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
294059
294617
  if (needsUpdateSyncConditions) {
294060
294618
  if (operation === OperationType.SYNC) {
294061
294619
  // Fetch the CR once and reuse for both hasSyncFailed check and ERROR guard
294062
- const currentItem = await getItemByItemPath(workItem.handler.itemPath());
294620
+ const currentItem = await ctl_getItemByItemPath(workItem.handler.itemPath());
294063
294621
  const syncStatus = await getSyncStatus(workItem.handler.itemPath(), currentItem);
294064
294622
  if (syncStatus.hasSyncFailed) {
294065
294623
  return;
@@ -294308,64 +294866,40 @@ function dummy_fWait(ms) {
294308
294866
  });
294309
294867
  }
294310
294868
 
294311
- ;// CONCATENATED MODULE: ../operator/src/ownership.ts
294869
+ ;// CONCATENATED MODULE: ../operator/src/ctl_collections.ts
294312
294870
 
294313
294871
 
294314
294872
 
294315
- async function getOwnerReferences(item) {
294316
- return item.metadata?.ownerReferences || [];
294317
- }
294318
- async function ownership_setOwnerReference(itemPath, namespace, ownerKind, ownerName, blockOwnerDeletion = true) {
294319
- let item = null;
294873
+ // generator function to traverse elements
294874
+ // it is async and iterable
294875
+ async function* traverseCRCollection(pluralKind, namespace, options = {}, apiGroup = 'firestartr.dev', apiVersion = 'v1') {
294876
+ const { limit = 300 } = options; // between 250-300
294320
294877
  try {
294321
- // we need to search for the owner's uuid
294322
- const owner = await getItemByItemPath(`${namespace}/${ownerKind}/${ownerName}`);
294323
- const ownerReference = {
294324
- apiVersion: owner.apiVersion,
294325
- kind: owner.kind,
294326
- name: ownerName,
294327
- controller: true,
294328
- blockOwnerDeletion,
294329
- uid: owner.metadata.uid,
294330
- };
294331
- // we get the item (to prevent race conditions)
294332
- item = await getItemByItemPath(itemPath);
294333
- const ownerReferences = item.metadata.ownerReferences ?? [];
294334
- const existingRefIndex = ownerReferences.findIndex((ref) => ref.uid === ownerReference.uid);
294335
- if (existingRefIndex === -1) {
294336
- // Reference does not exist, add it
294337
- ownerReferences.push(ownerReference);
294338
- }
294339
- else {
294340
- ownerReferences[existingRefIndex] = ownerReference;
294341
- }
294342
- await writeOwnerReferences(definitions_getPluralFromKind(item.kind), item.metadata.namespace, item, ownerReferences);
294878
+ let continueToken = undefined;
294879
+ const { kc, opts } = await ctl_getConnection();
294880
+ const k8sApi = kc.makeApiClient(client_node_dist.CustomObjectsApi);
294881
+ const apiGroup = 'firestartr.dev';
294882
+ const apiVersion = 'v1';
294883
+ const apiPaths = `/apis/${apiGroup}/${apiVersion}/namespaces/${namespace}/${pluralKind}`;
294884
+ do {
294885
+ const res = await k8sApi.listNamespacedCustomObject(apiGroup, apiVersion, namespace, pluralKind, undefined, // pretty
294886
+ undefined, // allowWatchBookmarks
294887
+ continueToken, // _continue
294888
+ undefined, // fieldSelector
294889
+ undefined, // labelSelector
294890
+ limit);
294891
+ const body = res.body;
294892
+ const items = body.items || [];
294893
+ for (const item of items) {
294894
+ yield item;
294895
+ }
294896
+ continueToken = body.metadata?.continue;
294897
+ } while (continueToken);
294343
294898
  }
294344
294899
  catch (err) {
294345
- operator_src_logger.error(err);
294346
- throw `Setting OwnerReferences to ${item.kind}/${item.metadata.name}: ${err}`;
294347
- }
294348
- }
294349
- async function writeOwnerReferences(kind, namespace, item, ownerReferences) {
294350
- operator_src_logger.debug(`The ctl is setting the ownerReferences for '${kind}/${item.metadata.name}' in namespace '${namespace}'.`);
294351
- const { kc, opts } = await ctl_getConnection();
294352
- const url = `${kc.getCurrentCluster().server}/apis/firestartr.dev/v1/namespaces/${namespace}/${kind}/${item.metadata.name}`;
294353
- opts.headers['Content-Type'] = 'application/json-patch+json';
294354
- opts.headers['Accept'] = '*';
294355
- const patch = {
294356
- op: 'replace',
294357
- path: '/metadata/ownerReferences',
294358
- value: ownerReferences,
294359
- };
294360
- const r = await fetch(url, {
294361
- method: 'PATCH',
294362
- headers: opts.headers,
294363
- body: JSON.stringify([patch]),
294364
- });
294365
- if (!r.ok) {
294366
- throw `Error on setOwnerReferences: ${namespace}/${kind}/${item['metadata']['name']}: ${r.statusText}`;
294900
+ operator_src_logger.error(`Error traversing ${namespace}/${pluralKind}: ${err}`);
294901
+ throw new Error(`Error traversing ${namespace}/${pluralKind}: ${err}`);
294367
294902
  }
294368
- return r.json();
294369
294903
  }
294370
294904
 
294371
294905
  ;// CONCATENATED MODULE: ../operator/fdummies/index.ts
@@ -294374,6 +294908,11 @@ async function writeOwnerReferences(kind, namespace, item, ownerReferences) {
294374
294908
 
294375
294909
 
294376
294910
 
294911
+
294912
+ const dummyChildrenMap = {
294913
+ FirestartrDummyA: ['FirestartrDummyB'],
294914
+ FirestartrDummyB: ['FirestartrDummyC'],
294915
+ };
294377
294916
  function processFirestartrDummies(item, op, handler) {
294378
294917
  operator_src_logger.info(`FirestartrDummies Processor: ${op}`);
294379
294918
  try {
@@ -294404,20 +294943,93 @@ async function* updated(item, op, handler) {
294404
294943
  for await (const transition of doRun(item, op, handler)) {
294405
294944
  yield transition;
294406
294945
  }
294407
- await handleOwnerReferences(item, handler);
294946
+ await manageDummyOwnershipReferences(item, handler);
294408
294947
  }
294409
294948
  async function* created(item, op, handler) {
294410
294949
  for await (const transition of doRun(item, op, handler)) {
294411
294950
  yield transition;
294412
294951
  }
294413
- await handleOwnerReferences(item, handler);
294952
+ await manageDummyOwnershipReferences(item, handler);
294414
294953
  }
294415
- async function handleOwnerReferences(item, handler) {
294954
+ async function manageDummyOwnershipReferences(item, _handler) {
294955
+ /*******************************************************************************
294956
+ // suspended due to https://github.com/prefapp/gitops-k8s/issues/1767
294957
+ if ('needs' in item.spec) {
294958
+ const needs = item.spec.needs;
294959
+ await setOwnerReference(
294960
+ handler.itemPath(),
294961
+ item.metadata.namespace,
294962
+ getPluralFromKind(needs.kind),
294963
+ needs.name,
294964
+ );
294965
+ }
294966
+ ********************************************************************************/
294416
294967
  if ('needs' in item.spec) {
294417
- const needs = item.spec.needs;
294418
- await ownership_setOwnerReference(handler.itemPath(), item.metadata.namespace, definitions_getPluralFromKind(needs.kind), needs.name);
294968
+ await installParentFinalizer(item);
294419
294969
  }
294420
294970
  }
294971
+ async function manageDummyOwnershipPostDeletion(item, _handler) {
294972
+ if ('needs' in item.spec) {
294973
+ await manageChildrenReferences(item);
294974
+ }
294975
+ if (Object.prototype.hasOwnProperty.call(dummyChildrenMap, item.kind)) {
294976
+ await removeFinalizerIfNoMoreChildren(item);
294977
+ }
294978
+ }
294979
+ async function installParentFinalizer(item) {
294980
+ const needs = item.spec.needs;
294981
+ const parentItem = await ctl_getItemByItemPath([item.metadata.namespace, definitions_getPluralFromKind(needs.kind), needs.name].join('/'));
294982
+ await upsertFinalizer(definitions_getPluralFromKind(parentItem.kind), parentItem.metadata.namespace, parentItem, 'firestartr.dev/foreground-deletion');
294983
+ }
294984
+ async function manageChildrenReferences(item) {
294985
+ const parentItem = await ctl_getItemByItemPath([
294986
+ item.metadata.namespace,
294987
+ definitions_getPluralFromKind(item.spec.needs.kind),
294988
+ item.spec.needs.name,
294989
+ ].join('/'));
294990
+ await removeFinalizerIfNoMoreChildren(parentItem);
294991
+ }
294992
+ async function removeFinalizerIfNoMoreChildren(parentItem) {
294993
+ try {
294994
+ let numberOfChildren = 0;
294995
+ const childKinds = dummyChildrenMap[parentItem.kind];
294996
+ if (!childKinds)
294997
+ return;
294998
+ for (const childKind of childKinds) {
294999
+ const children = await findDummiesWithNeeds(childKind, parentItem);
295000
+ numberOfChildren += children.length;
295001
+ }
295002
+ if (numberOfChildren === 0) {
295003
+ try {
295004
+ await unsetFinalizer(definitions_getPluralFromKind(parentItem.kind), parentItem.metadata.namespace, parentItem, 'firestartr.dev/foreground-deletion');
295005
+ }
295006
+ catch (unsetErr) {
295007
+ if (typeof unsetErr === 'string' && unsetErr.includes('Not Found')) {
295008
+ operator_src_logger.info(`${parentItem.kind}/${parentItem.metadata.name} was already deleted; skipping finalizer removal`);
295009
+ }
295010
+ else {
295011
+ throw unsetErr;
295012
+ }
295013
+ }
295014
+ }
295015
+ }
295016
+ catch (err) {
295017
+ operator_src_logger.error(`Error managing children references in item: ${parentItem.kind}/${parentItem.metadata.name}: ${err}`);
295018
+ throw new Error(`Error managing children references in item: ${parentItem.kind}/${parentItem.metadata.name}: ${err}`);
295019
+ }
295020
+ }
295021
+ async function findDummiesWithNeeds(kind, parentItem) {
295022
+ const children = [];
295023
+ const pluralKind = definitions_getPluralFromKind(kind);
295024
+ for await (const crItem of traverseCRCollection(pluralKind, parentItem.metadata.namespace)) {
295025
+ if ('needs' in crItem.spec &&
295026
+ crItem.spec.needs.name === parentItem.metadata.name &&
295027
+ crItem.spec.needs.kind === parentItem.kind) {
295028
+ children.push(crItem);
295029
+ }
295030
+ }
295031
+ return children;
295032
+ }
294421
295033
  async function renamed() {
294422
295034
  throw new Error('Renamed operation not prepared');
294423
295035
  }
@@ -294503,6 +295115,7 @@ async function* markedToDeletion(item, op, handler) {
294503
295115
  message: 'destroyed',
294504
295116
  };
294505
295117
  await handler.finalize(handler.pluralKind, item.metadata.namespace, item, 'firestartr.dev/finalizer');
295118
+ await manageDummyOwnershipPostDeletion(item, handler);
294506
295119
  void handler.success();
294507
295120
  }
294508
295121
  catch (e) {
@@ -295199,12 +295812,20 @@ async function startQueueMetrics(meter, attributes) {
295199
295812
  const nWorkItemsInDeadLetterHandling = meter.createObservableGauge('firestartr_workitems_dead_letter_handling_total', {
295200
295813
  description: 'Number of workitems of the queue handled by the Dead Letter Handler',
295201
295814
  });
295815
+ const nWorkItemsBlocked = meter.createObservableGauge('firestartr_workitems_blocked_total', {
295816
+ description: 'Number of workitems currently blocked (children still being deleted, or parent not yet created/provisioned)',
295817
+ });
295818
+ const nWorkItemsDeferred = meter.createObservableGauge('firestartr_workitems_deferred_total', {
295819
+ description: 'Number of workitems moved to the deferred segment after repeated blocking',
295820
+ });
295202
295821
  const queueMetrics = getQueueMetrics();
295203
295822
  let total = queueMetrics.nItems;
295204
295823
  let pending = queueMetrics.nItemsPending;
295205
295824
  let processing = queueMetrics.nItemsProcessing;
295206
295825
  let finished = queueMetrics.nItemsFinished;
295207
295826
  let inDeadLetterHandling = queueMetrics.nItemsInDeadLetterHandling;
295827
+ let nBlocked = queueMetrics.nItemsBlocked || 0;
295828
+ let nDeferred = queueMetrics.nItemsDeferred || 0;
295208
295829
  nWorkItemsCounter.addCallback((observer) => observer.observe(total, { ...attributes, ...queueMetrics.nItemsTypes }));
295209
295830
  nWorkItemsPendingCounter.addCallback((observer) => observer.observe(pending, { ...attributes, ...queueMetrics.nItemsTypes }));
295210
295831
  nWorkItemsProcessingCounter.addCallback((observer) => observer.observe(processing, {
@@ -295216,6 +295837,8 @@ async function startQueueMetrics(meter, attributes) {
295216
295837
  ...attributes,
295217
295838
  ...queueMetrics.nItemsTypes,
295218
295839
  }));
295840
+ nWorkItemsBlocked.addCallback((observer) => observer.observe(nBlocked, { ...attributes }));
295841
+ nWorkItemsDeferred.addCallback((observer) => observer.observe(nDeferred, { ...attributes }));
295219
295842
  setInterval(() => {
295220
295843
  const queueMetrics = getQueueMetrics();
295221
295844
  total = queueMetrics.nItems;
@@ -295223,6 +295846,8 @@ async function startQueueMetrics(meter, attributes) {
295223
295846
  processing = queueMetrics.nItemsProcessing;
295224
295847
  finished = queueMetrics.nItemsFinished;
295225
295848
  inDeadLetterHandling = queueMetrics.nItemsInDeadLetterHandling;
295849
+ nBlocked = queueMetrics.nItemsBlocked || 0;
295850
+ nDeferred = queueMetrics.nItemsDeferred || 0;
295226
295851
  }, 1000);
295227
295852
  }
295228
295853
  async function startMemoryMetrics(meter, attributes) {
@@ -295397,15 +296022,131 @@ class ProcessItemSlot {
295397
296022
  }
295398
296023
  }
295399
296024
 
295400
- ;// CONCATENATED MODULE: ../operator/src/processItem.ts
295401
-
295402
-
295403
-
295404
-
296025
+ ;// CONCATENATED MODULE: ../operator/src/parentDependency.ts
295405
296026
 
296027
+ const PARENT_KIND_MAP = {
296028
+ FirestartrGithubRepositoryFeature: 'FirestartrGithubRepository',
296029
+ FirestartrGithubRepositorySecretsSection: 'FirestartrGithubRepository',
296030
+ FirestartrDummyB: 'FirestartrDummyA',
296031
+ FirestartrDummyC: 'FirestartrDummyB',
296032
+ };
296033
+ const DEPENDENT_KINDS = new Set(Object.keys(PARENT_KIND_MAP));
296034
+ const RELEVANT_KINDS = new Set();
296035
+ for (const [child, parent] of Object.entries(PARENT_KIND_MAP)) {
296036
+ RELEVANT_KINDS.add(child);
296037
+ RELEVANT_KINDS.add(parent);
296038
+ }
296039
+ function getParentKindForDependent(kind) {
296040
+ return PARENT_KIND_MAP[kind];
296041
+ }
296042
+ function isDependentKind(kind) {
296043
+ return DEPENDENT_KINDS.has(kind);
296044
+ }
296045
+ function isRelevantKind(kind) {
296046
+ return RELEVANT_KINDS.has(kind);
296047
+ }
296048
+ function getParentRef(workItem) {
296049
+ const ref = workItem.item.spec?.repositoryTarget?.ref;
296050
+ if (ref?.kind && ref?.name) {
296051
+ return { kind: ref.kind, name: ref.name };
296052
+ }
296053
+ const needs = workItem.item.spec?.needs;
296054
+ if (needs?.kind && needs?.name) {
296055
+ return { kind: needs.kind, name: needs.name };
296056
+ }
296057
+ return null;
296058
+ }
296059
+ function buildActiveParentKeys(queue) {
296060
+ const keys = new Set();
296061
+ for (const w of queue) {
296062
+ if (w.workStatus === WorkStatus.PENDING || w.isPicked) {
296063
+ keys.add(`${w.item.kind}/${w.item.metadata?.name}`);
296064
+ }
296065
+ }
296066
+ return keys;
296067
+ }
296068
+ /**
296069
+ * Scan the queue for dependent children whose parent is not in the active set
296070
+ * and verify whether each parent exists in the K8s cluster and has been
296071
+ * provisioned. Parents that are absent from the queue and either missing from
296072
+ * the cluster OR not yet provisioned are added to a deferred set, which
296073
+ * `hasActiveParent` uses to block the child from being dispatched.
296074
+ *
296075
+ * A parent CR exists in the cluster immediately after `kubectl apply`, but it
296076
+ * is not usable until the operator has reconciled it and set PROVISIONED=True.
296077
+ * Checking only for cluster existence would let children slip through while
296078
+ * the parent is still being processed. This function also checks the parent's
296079
+ * status conditions so that children are deferred until the parent is fully
296080
+ * provisioned.
296081
+ *
296082
+ * @param getItemByItemPath - function to look up a CR in the K8s cluster by
296083
+ * its item path (namespace/pluralKind/name). Should return null (not throw)
296084
+ * when the resource is absent or not yet available (e.g. 404/409), so that
296085
+ * missing parents are deferred without generating spurious error logs.
296086
+ */
296087
+ async function buildDeferredParentKeys(queue, activeParentKeys, getItemByItemPath) {
296088
+ const deferred = new Set();
296089
+ const checked = new Set();
296090
+ for (const w of queue) {
296091
+ if (w.operation !== OperationType.CREATED)
296092
+ continue;
296093
+ if (!isDependentKind(w.item.kind))
296094
+ continue;
296095
+ const parentRef = getParentRef(w);
296096
+ if (!parentRef)
296097
+ continue;
296098
+ const parentKey = `${parentRef.kind}/${parentRef.name}`;
296099
+ if (checked.has(parentKey))
296100
+ continue;
296101
+ checked.add(parentKey);
296102
+ if (activeParentKeys.has(parentKey))
296103
+ continue;
296104
+ const namespace = w.item.metadata?.namespace || 'default';
296105
+ const pluralKind = definitions_getPluralFromKind(parentRef.kind);
296106
+ if (!pluralKind)
296107
+ continue;
296108
+ try {
296109
+ const parentCr = await getItemByItemPath(`${namespace}/${pluralKind}/${parentRef.name}`);
296110
+ const isProvisioned = parentCr?.status?.conditions?.some((c) => c.type === 'PROVISIONED' && c.status === 'True');
296111
+ if (!isProvisioned) {
296112
+ deferred.add(parentKey);
296113
+ }
296114
+ }
296115
+ catch {
296116
+ deferred.add(parentKey);
296117
+ }
296118
+ }
296119
+ return deferred;
296120
+ }
296121
+ function hasActiveParent(workItem, queueOrKeys, deferredParentKeys) {
296122
+ if (workItem.operation !== OperationType.CREATED)
296123
+ return false;
296124
+ if (!DEPENDENT_KINDS.has(workItem.item.kind))
296125
+ return false;
296126
+ const parentRef = getParentRef(workItem);
296127
+ if (!parentRef)
296128
+ return false;
296129
+ const { kind: parentKind, name: parentName } = parentRef;
296130
+ const parentKey = `${parentKind}/${parentName}`;
296131
+ if (queueOrKeys instanceof Set) {
296132
+ if (queueOrKeys.has(parentKey))
296133
+ return true;
296134
+ if (deferredParentKeys?.has(parentKey))
296135
+ return true;
296136
+ return false;
296137
+ }
296138
+ const parentActive = queueOrKeys.some((w) => w.item.kind === parentKind &&
296139
+ w.item.metadata?.name === parentName &&
296140
+ (w.workStatus === WorkStatus.PENDING || w.isPicked));
296141
+ if (parentActive)
296142
+ return true;
296143
+ if (deferredParentKeys?.has(parentKey))
296144
+ return true;
296145
+ return false;
296146
+ }
295406
296147
 
296148
+ ;// CONCATENATED MODULE: ../operator/src/queueSort.ts
295407
296149
 
295408
- const queue = [];
295409
296150
  const WEIGHTS = {
295410
296151
  RENAMED: 15,
295411
296152
  UPDATED: 10,
@@ -295415,6 +296156,73 @@ const WEIGHTS = {
295415
296156
  SYNC: 1,
295416
296157
  NOTHING: 0,
295417
296158
  };
296159
+ // we need to assign weight to the deletion operation
296160
+ // to avoid blockades
296161
+ // https://github.com/prefapp/gitops-k8s/issues/1864
296162
+ // ghrepo feat | grss -> ghrepo -> ghgroup -> membership
296163
+ const DELETION_WEIGHTS = {
296164
+ // Leaf children first: C before B before A
296165
+ FirestartrDummyC: 6,
296166
+ FirestartrDummyB: 5,
296167
+ FirestartrDummyA: 4,
296168
+ FirestartrGithubRepositoryFeature: 5,
296169
+ FirestartrGithubRepositorySecretsSection: 4,
296170
+ FirestartrGithubRepository: 3,
296171
+ FirestartrGithubGroup: 2,
296172
+ FirestartrGithubMembership: 1,
296173
+ FirestartrTerraformWorkspace: 1,
296174
+ FirestartrGithubOrgWebhook: 1,
296175
+ };
296176
+ const CREATION_WEIGHTS = {
296177
+ // DummyA is root parent; DummyB is both child-of-A and parent-of-C
296178
+ FirestartrDummyA: 2,
296179
+ FirestartrDummyB: 1,
296180
+ FirestartrGithubRepository: 1,
296181
+ };
296182
+ function sortQueue(queue) {
296183
+ const sortedQueue = queue.sort((wa, wb) => {
296184
+ const weightA = WEIGHTS[wa.operation];
296185
+ const weightB = WEIGHTS[wb.operation];
296186
+ if (weightA !== weightB) {
296187
+ return weightB - weightA;
296188
+ }
296189
+ if (wa.operation === 'MARKED_TO_DELETION' &&
296190
+ wb.operation === 'MARKED_TO_DELETION') {
296191
+ const deletionWeightA = DELETION_WEIGHTS[wa.item.kind] || 0;
296192
+ const deletionWeightB = DELETION_WEIGHTS[wb.item.kind] || 0;
296193
+ if (deletionWeightA !== deletionWeightB) {
296194
+ return deletionWeightB - deletionWeightA;
296195
+ }
296196
+ }
296197
+ if (wa.operation === 'CREATED' && wb.operation === 'CREATED') {
296198
+ if (isRelevantKind(wa.item.kind) && isRelevantKind(wb.item.kind)) {
296199
+ const creationWeightA = CREATION_WEIGHTS[wa.item.kind] || 0;
296200
+ const creationWeightB = CREATION_WEIGHTS[wb.item.kind] || 0;
296201
+ if (creationWeightA !== creationWeightB) {
296202
+ return creationWeightB - creationWeightA;
296203
+ }
296204
+ }
296205
+ }
296206
+ return wa.upsertTime - wb.upsertTime;
296207
+ });
296208
+ return sortedQueue;
296209
+ }
296210
+
296211
+ ;// CONCATENATED MODULE: ../operator/src/processItem.ts
296212
+
296213
+
296214
+
296215
+
296216
+
296217
+
296218
+
296219
+
296220
+
296221
+
296222
+ const queue = [];
296223
+ let _deferredBookkeeper = null;
296224
+ let _activeParentKeys = new Set();
296225
+ let _deferredParentKeys = new Set();
295418
296226
  // We get the number of max slots from the environment variable, if it is not set, we default to 1
295419
296227
  function getMaxSlotsFromEnvironment() {
295420
296228
  const rawMaxSlots = catalog_common/* default.environment.getFromEnvironment */.Z.environment.getFromEnvironment(catalog_common/* default.types.envVars.operatorNumberOfMaxSlots */.Z.types.envVars.operatorNumberOfMaxSlots);
@@ -295468,6 +296276,11 @@ function getQueueMetrics() {
295468
296276
  nItemsPending: queue.filter((workItem) => workItem.workStatus === WorkStatus.PENDING).length,
295469
296277
  nItemsProcessing: queue.filter((workItem) => workItem.workStatus === WorkStatus.PROCESSING).length,
295470
296278
  nItemsInDeadLetterHandling: queue.filter((workItem) => workItem.isDeadLetter === true).length,
296279
+ nItemsBlocked: queue.filter((workItem) => workItem.isBlocked === true ||
296280
+ hasActiveParent(workItem, _activeParentKeys, _deferredParentKeys)).length,
296281
+ nItemsDeferred: _deferredBookkeeper
296282
+ ? queue.filter((workItem) => _deferredBookkeeper.isDeferred(workItem)).length
296283
+ : 0,
295471
296284
  nItemsTypes: {
295472
296285
  nothing,
295473
296286
  retry,
@@ -295480,30 +296293,21 @@ function getQueueMetrics() {
295480
296293
  },
295481
296294
  };
295482
296295
  }
295483
- // we need to assign weight to the deletion operation
295484
- // to avoid blockades
295485
- // https://github.com/prefapp/gitops-k8s/issues/1864
295486
- // ghrepo feat | grss -> ghrepo -> ghgroup -> membership
295487
- const DELETION_WEIGHTS = {
295488
- FirestartrGithubRepositoryFeature: 5,
295489
- FirestartrGithubRepositorySecretsSection: 4,
295490
- FirestartrGithubRepository: 3,
295491
- FirestartrGithubGroup: 2,
295492
- FirestartrGithubMembership: 1,
295493
- FirestartrTerraformWorkspace: 1,
295494
- FirestartrGithubOrgWebhook: 1,
295495
- };
295496
- // Do the kinds need different weights for the operations?
295497
- // We need to discuss this with the team in this issue: https://github.com/prefapp/gitops-k8s/issues/524
295498
- // const KIND_WEIGHTS: any = {
295499
- // "FirestartrTerraformWorkspace": 1,
295500
- // "FirestartrGithubGroup": 1,
295501
- // "FirestartrGithubMembership": 1,
295502
- // "FirestartrGithubRepository": 1,
295503
- // "FirestartrGithubRepositoryFeature": 1,
295504
- // "FirestartrTerraformWorkspacePlan": 1,
295505
- // }
295506
296296
  let INIT = false;
296297
+ let podIsTerminating = false;
296298
+ const handleTerminationSignal = (signal) => {
296299
+ podIsTerminating = true;
296300
+ // If there is no processor loop and no queued work, exit immediately so we don't
296301
+ // wait on other event-loop handles (informer watches, keep-alives, etc.).
296302
+ if (!INIT && queue.length === 0) {
296303
+ operator_src_logger.info(`The processor is going to shut down (received ${signal}, no loop started)`);
296304
+ process.exit(0);
296305
+ }
296306
+ };
296307
+ initSignalsHandler(new Map([
296308
+ ['SIGTERM', () => handleTerminationSignal('SIGTERM')],
296309
+ ['SIGINT', () => handleTerminationSignal('SIGINT')],
296310
+ ]));
295507
296311
  /**
295508
296312
  * Pushes a WorkItem to the queue
295509
296313
  * @param {WorkItem} workItem - WorkItem to process
@@ -295524,8 +296328,8 @@ async function processItem(workItem) {
295524
296328
  */
295525
296329
  async function processItem_loop() {
295526
296330
  loopWorkItemDebug(queue);
295527
- let podIsTerminating = false;
295528
296331
  const deferredBookkeeper = new DeferredSchedulingBookkeeper();
296332
+ _deferredBookkeeper = deferredBookkeeper;
295529
296333
  const processItemSlotsManager = initProcessItemsSlots(MAX_SLOTS, true, (w) => deferredBookkeeper.incrementBlockedAttempt(w));
295530
296334
  if (process.env.GARBAGE_QUEUE_COLLECTOR) {
295531
296335
  void workItemGarbageCollector(queue, deferredBookkeeper);
@@ -295555,6 +296359,21 @@ async function processItem_loop() {
295555
296359
  process.exit(0);
295556
296360
  break;
295557
296361
  }
296362
+ // Compute sort/partition + parent-key sets once per scheduling round so
296363
+ // that buildDeferredParentKeys (which hits the API server) and the
296364
+ // sort/partition are not repeated for every idle slot in the same iteration.
296365
+ const sorted = sortQueue(queue);
296366
+ const { nonDeferred, deferred } = deferredBookkeeper.partitionQueueByDeferred(sorted);
296367
+ const activeParentKeys = buildActiveParentKeys(queue);
296368
+ const deferredParentKeys = await buildDeferredParentKeys(queue, activeParentKeys, getItemByItemPathOrNull);
296369
+ _activeParentKeys = activeParentKeys;
296370
+ _deferredParentKeys = deferredParentKeys;
296371
+ const pickEligible = (arr) => arr
296372
+ .filter((w) => !w.isBlocked &&
296373
+ !w.isPicked &&
296374
+ !processItemSlotsManager.isWorkItemBlocked(w) &&
296375
+ !hasActiveParent(w, activeParentKeys, deferredParentKeys))
296376
+ .find((w) => w.workStatus === WorkStatus.PENDING);
295558
296377
  // every time an idle slot is available, we check if there is a work item to process and if there is, we process it
295559
296378
  // if there are more idle slots than work items, the next iterations of the loop will just do nothing
295560
296379
  // until there are new work items to process
@@ -295562,7 +296381,7 @@ async function processItem_loop() {
295562
296381
  if (podIsTerminating) {
295563
296382
  break;
295564
296383
  }
295565
- const w = nextWorkItem();
296384
+ const w = pickEligible(nonDeferred) || pickEligible(deferred);
295566
296385
  if (w) {
295567
296386
  // synchronously mark the work item as picked
295568
296387
  w.isPicked = true;
@@ -295574,41 +296393,10 @@ async function processItem_loop() {
295574
296393
  void idleSlot.runWorkItem(w);
295575
296394
  }
295576
296395
  }
295577
- await wait();
296396
+ await wait(podIsTerminating ? 200 : 2000);
295578
296397
  }
295579
296398
  }
295580
- /**
295581
- * Sorts the queue based on the operation type
295582
- * @param {WorkItem[]} queue - store of WorkItems
295583
- * @returns {WorkItem[]} - sorted queue
295584
- */
295585
- function sortQueue(queue) {
295586
- const sortedQueue = queue.sort((wa, wb) => {
295587
- // --- PRIMARY SORT: By Weight (Descending) ---
295588
- const weightA = WEIGHTS[wa.operation];
295589
- const weightB = WEIGHTS[wb.operation];
295590
- // Check if weights are different
295591
- if (weightA !== weightB) {
295592
- // Sort in descending order (higher weight first)
295593
- // If weightA is larger, return -1 (a comes before b)
295594
- return weightB - weightA;
295595
- }
295596
- // in case of deletions we need to
295597
- // establish a secondary sort by kind
295598
- if (wa.operation === 'MARKED_TO_DELETION' &&
295599
- wb.operation === 'MARKED_TO_DELETION') {
295600
- const deletionWeightA = DELETION_WEIGHTS[wa.item.kind] || 0;
295601
- const deletionWeightB = DELETION_WEIGHTS[wb.item.kind] || 0;
295602
- if (deletionWeightA !== deletionWeightB) {
295603
- return deletionWeightB - deletionWeightA;
295604
- }
295605
- }
295606
- // --- 3rd SORT: By upsertTime (Ascending) ---
295607
- // If weights are equal, sort by the oldest upsertTime (ascending)
295608
- return wa.upsertTime - wb.upsertTime;
295609
- });
295610
- return sortedQueue;
295611
- }
296399
+
295612
296400
  /**
295613
296401
  * Wait for a given time
295614
296402
  * @param t Time to wait in milliseconds
@@ -297939,11 +298727,9 @@ function tf_checkrun_operatorProfile() {
297939
298727
  async function TFCheckRun(cmd, item) {
297940
298728
  try {
297941
298729
  const prInfo = extractPrInfo(item);
297942
- const kind = item.kind;
297943
298730
  const checkRun = await tf_checkrun_operatorProfile().feedback.createCheckRun(prInfo.org, prInfo.repo, helperCreateCheckRunName(cmd, item), {
297944
298731
  pullNumber: Number(prInfo.prNumber),
297945
- includeCheckRunComment: true,
297946
- checkRunComment: `The ${kind} is being processed (cmd=${cmd}). Details: `,
298732
+ // check-run comments removed: redundant with native checks widget (#1985)
297947
298733
  });
297948
298734
  checkRun.mdOptionsDetails({
297949
298735
  quotes: 'terraform',
@@ -299676,7 +300462,7 @@ async function ctx_buildContext(claim, namespace, command) {
299676
300462
  cr['metadata']['namespace'] = namespace;
299677
300463
  operator_src_logger.debug(`The Terraform workspace has finished rendering the custom resource '${cr.kind}/${cr.metadata.name}' in namespace '${cr.metadata.namespace}'.`);
299678
300464
  // Finally, we resolve the deps in the rendered CR
299679
- deps = await resolve(cr, getItemByItemPath, getSecret, namespace);
300465
+ deps = await resolve(cr, ctl_getItemByItemPath, getSecret, namespace);
299680
300466
  operator_src_logger.debug(`The Terraform workspace has finished resolving all dependencies for claim '${claim.name}'.`);
299681
300467
  };
299682
300468
  compute['dryRunExec'] = async () => {
@@ -299842,7 +300628,7 @@ const MODULES = {
299842
300628
  FirestartrGithubRepository: {
299843
300629
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-repo',
299844
300630
  // github-repo-v0.7.0
299845
- ref: '6bdbcd9b813837bec9d1c576952bd88744508883',
300631
+ ref: 'd919ffbff4349c453f75a3b7246b8306a45b12e3',
299846
300632
  },
299847
300633
  FirestartrGithubRepositoryFeature: {
299848
300634
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-files-set',
@@ -299859,6 +300645,11 @@ const MODULES = {
299859
300645
  // github-org-webhook-v0.2.0
299860
300646
  ref: '12d72ba15780647b2f9c2905938913344bfeaa4d',
299861
300647
  },
300648
+ FirestartrGithubOrganizationSettings: {
300649
+ module: 'git::https://github.com/prefapp/tfm.git//modules/github-org-settings',
300650
+ // feat/org-settings-module at 2026-06-16
300651
+ ref: '0e3f3f897ffff35a52285d0c681c0d81026d6d8a',
300652
+ },
299862
300653
  };
299863
300654
  function getFirestartrDefaultTFM(kind) {
299864
300655
  if (kind in MODULES) {
@@ -301389,6 +302180,72 @@ class EntityGHMembership extends base_Entity {
301389
302180
  }
301390
302181
  }
301391
302182
 
302183
+ ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgsettings/index.ts
302184
+
302185
+
302186
+ class EntityGHOrgSettings extends base_Entity {
302187
+ constructor(artifact) {
302188
+ super(artifact, {
302189
+ config: {},
302190
+ });
302191
+ }
302192
+ async loadResources(tfOp) {
302193
+ gh_provisioner_src_logger.info(`[gh-provisioner] running ${tfOp} on ${this.k8sId}`);
302194
+ try {
302195
+ const cr = this.cr;
302196
+ this.patchData({
302197
+ path: '/config',
302198
+ op: PatchOperations.replace,
302199
+ value: {
302200
+ billingEmail: cr.spec.billingEmail,
302201
+ company: cr.spec.company,
302202
+ blog: cr.spec.blog,
302203
+ email: cr.spec.email,
302204
+ twitterUsername: cr.spec.twitterUsername,
302205
+ location: cr.spec.location,
302206
+ name: cr.spec.name,
302207
+ description: cr.spec.description,
302208
+ hasOrganizationProjects: cr.spec.hasOrganizationProjects,
302209
+ hasRepositoryProjects: cr.spec.hasRepositoryProjects,
302210
+ defaultRepositoryPermission: cr.spec.defaultRepositoryPermission,
302211
+ membersCanCreateRepositories: cr.spec.membersCanCreateRepositories,
302212
+ membersCanCreatePublicRepositories: cr.spec.membersCanCreatePublicRepositories,
302213
+ membersCanCreatePrivateRepositories: cr.spec.membersCanCreatePrivateRepositories,
302214
+ membersCanCreateInternalRepositories: cr.spec.membersCanCreateInternalRepositories,
302215
+ membersCanCreatePages: cr.spec.membersCanCreatePages,
302216
+ membersCanCreatePublicPages: cr.spec.membersCanCreatePublicPages,
302217
+ membersCanCreatePrivatePages: cr.spec.membersCanCreatePrivatePages,
302218
+ membersCanForkPrivateRepositories: cr.spec.membersCanForkPrivateRepositories,
302219
+ webCommitSignoffRequired: cr.spec.webCommitSignoffRequired,
302220
+ advancedSecurityEnabledForNewRepositories: cr.spec.advancedSecurityEnabledForNewRepositories,
302221
+ dependabotAlertsEnabledForNewRepositories: cr.spec.dependabotAlertsEnabledForNewRepositories,
302222
+ dependabotSecurityUpdatesEnabledForNewRepositories: cr.spec.dependabotSecurityUpdatesEnabledForNewRepositories,
302223
+ dependencyGraphEnabledForNewRepositories: cr.spec.dependencyGraphEnabledForNewRepositories,
302224
+ secretScanningEnabledForNewRepositories: cr.spec.secretScanningEnabledForNewRepositories,
302225
+ secretScanningPushProtectionEnabledForNewRepositories: cr.spec.secretScanningPushProtectionEnabledForNewRepositories,
302226
+ },
302227
+ });
302228
+ gh_provisioner_src_logger.debug(`[gh-provisioner] ${this.k8sId} loaded its data`);
302229
+ }
302230
+ catch (err) {
302231
+ const message = err instanceof Error ? err.message : String(err);
302232
+ gh_provisioner_src_logger.error(`[gh-provisioner] ${this.k8sId} error loading resources: ${message}`);
302233
+ throw new Error(`[gh-provisioner] ${this.k8sId} error loading resources: ${message}`);
302234
+ }
302235
+ }
302236
+ async postProvision(tfOp) { }
302237
+ async loadAddressesToImport() {
302238
+ this.patchImportData({
302239
+ op: PatchOperations.add,
302240
+ path: '/imports/-',
302241
+ value: {
302242
+ to: 'github_organization_settings.this',
302243
+ id: this.cr.spec.org,
302244
+ },
302245
+ });
302246
+ }
302247
+ }
302248
+
301392
302249
  ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgwebhook/index.ts
301393
302250
 
301394
302251
 
@@ -301464,6 +302321,7 @@ class EntityGHOrgWebHook extends base_Entity {
301464
302321
 
301465
302322
 
301466
302323
 
302324
+
301467
302325
  function entities_getEntity(cr) {
301468
302326
  const entityClass = getEntityClass(cr.kind);
301469
302327
  return new entityClass(cr);
@@ -301482,6 +302340,8 @@ function getEntityClass(kind) {
301482
302340
  return EntityGHMembership;
301483
302341
  case 'FirestartrGithubOrgWebhook':
301484
302342
  return EntityGHOrgWebHook;
302343
+ case 'FirestartrGithubOrganizationSettings':
302344
+ return EntityGHOrgSettings;
301485
302345
  default:
301486
302346
  throw new Error(`kind ${kind} has no entity associated`);
301487
302347
  }
@@ -301894,6 +302754,7 @@ const GITHUB_RESOURCE_KINDS = [
301894
302754
  'FirestartrGithubRepositoryFeature',
301895
302755
  'FirestartrGithubRepositorySecretsSection',
301896
302756
  'FirestartrGithubOrgWebhook',
302757
+ 'FirestartrGithubOrganizationSettings',
301897
302758
  ];
301898
302759
  const GITHUB_REPOSITORY_DEPENDENT_KINDS = [
301899
302760
  'FirestartrGithubRepositoryFeature',
@@ -302128,7 +302989,7 @@ function getPrAwareItemByItemPath(opts, currentStatus) {
302128
302989
  const baseResource = await getBaseGithubResource(itemPath, opts);
302129
302990
  if (baseResource)
302130
302991
  return baseResource;
302131
- return getItemByItemPath(itemPath, apiGroup, apiVersion);
302992
+ return ctl_getItemByItemPath(itemPath, apiGroup, apiVersion);
302132
302993
  };
302133
302994
  }
302134
302995
  async function getBaseGithubResource(itemPath, opts) {
@@ -302289,40 +303150,64 @@ function getSafeCommandByStatus(status) {
302289
303150
  }
302290
303151
  }
302291
303152
 
302292
- ;// CONCATENATED MODULE: ../operator/src/ctl_collections.ts
303153
+ ;// CONCATENATED MODULE: ../operator/src/ownership.ts
302293
303154
 
302294
303155
 
302295
303156
 
302296
- // generator function to traverse elements
302297
- // it is async and iterable
302298
- async function* traverseCRCollection(pluralKind, namespace, options = {}, apiGroup = 'firestartr.dev', apiVersion = 'v1') {
302299
- const { limit = 300 } = options; // between 250-300
303157
+ async function getOwnerReferences(item) {
303158
+ return item.metadata?.ownerReferences || [];
303159
+ }
303160
+ async function ownership_setOwnerReference(itemPath, namespace, ownerKind, ownerName, blockOwnerDeletion = true) {
303161
+ let item = null;
302300
303162
  try {
302301
- let continueToken = undefined;
302302
- const { kc, opts } = await ctl_getConnection();
302303
- const k8sApi = kc.makeApiClient(client_node_dist.CustomObjectsApi);
302304
- const apiGroup = 'firestartr.dev';
302305
- const apiVersion = 'v1';
302306
- const apiPaths = `/apis/${apiGroup}/${apiVersion}/namespaces/${namespace}/${pluralKind}`;
302307
- do {
302308
- const res = await k8sApi.listNamespacedCustomObject(apiGroup, apiVersion, namespace, pluralKind, undefined, // pretty
302309
- undefined, // allowWatchBookmarks
302310
- continueToken, // _continue
302311
- undefined, // fieldSelector
302312
- undefined, // labelSelector
302313
- limit);
302314
- const body = res.body;
302315
- const items = body.items || [];
302316
- for (const item of items) {
302317
- yield item;
302318
- }
302319
- continueToken = body.metadata?.continue;
302320
- } while (continueToken);
303163
+ // we need to search for the owner's uuid
303164
+ const owner = await getItemByItemPath(`${namespace}/${ownerKind}/${ownerName}`);
303165
+ const ownerReference = {
303166
+ apiVersion: owner.apiVersion,
303167
+ kind: owner.kind,
303168
+ name: ownerName,
303169
+ controller: true,
303170
+ blockOwnerDeletion,
303171
+ uid: owner.metadata.uid,
303172
+ };
303173
+ // we get the item (to prevent race conditions)
303174
+ item = await getItemByItemPath(itemPath);
303175
+ const ownerReferences = item.metadata.ownerReferences ?? [];
303176
+ const existingRefIndex = ownerReferences.findIndex((ref) => ref.uid === ownerReference.uid);
303177
+ if (existingRefIndex === -1) {
303178
+ // Reference does not exist, add it
303179
+ ownerReferences.push(ownerReference);
303180
+ }
303181
+ else {
303182
+ ownerReferences[existingRefIndex] = ownerReference;
303183
+ }
303184
+ await writeOwnerReferences(getPluralFromKind(item.kind), item.metadata.namespace, item, ownerReferences);
302321
303185
  }
302322
303186
  catch (err) {
302323
- operator_src_logger.error(`Error traversing ${namespace}/${pluralKind}: ${err}`);
302324
- throw new Error(`Error traversing ${namespace}/${pluralKind}: ${err}`);
303187
+ log.error(err);
303188
+ throw `Setting OwnerReferences to ${item.kind}/${item.metadata.name}: ${err}`;
303189
+ }
303190
+ }
303191
+ async function writeOwnerReferences(kind, namespace, item, ownerReferences) {
303192
+ log.debug(`The ctl is setting the ownerReferences for '${kind}/${item.metadata.name}' in namespace '${namespace}'.`);
303193
+ const { kc, opts } = await getConnection();
303194
+ const url = `${kc.getCurrentCluster().server}/apis/firestartr.dev/v1/namespaces/${namespace}/${kind}/${item.metadata.name}`;
303195
+ opts.headers['Content-Type'] = 'application/json-patch+json';
303196
+ opts.headers['Accept'] = '*';
303197
+ const patch = {
303198
+ op: 'replace',
303199
+ path: '/metadata/ownerReferences',
303200
+ value: ownerReferences,
303201
+ };
303202
+ const r = await fetch(url, {
303203
+ method: 'PATCH',
303204
+ headers: opts.headers,
303205
+ body: JSON.stringify([patch]),
303206
+ });
303207
+ if (!r.ok) {
303208
+ throw `Error on setOwnerReferences: ${namespace}/${kind}/${item['metadata']['name']}: ${r.statusText}`;
302325
303209
  }
303210
+ return r.json();
302326
303211
  }
302327
303212
 
302328
303213
  ;// CONCATENATED MODULE: ../operator/src/children.ts
@@ -302369,7 +303254,7 @@ async function manageOwnershipReferences(item, handler, op) {
302369
303254
  *******************************************************************************/
302370
303255
  if (kindsWithFirestartrGithubRepositoryDependence.indexOf(item.kind) !== -1) {
302371
303256
  // we need the parent
302372
- const parentItem = await getItemByItemPath([
303257
+ const parentItem = await ctl_getItemByItemPath([
302373
303258
  item.metadata.namespace,
302374
303259
  definitions_getPluralFromKind('FirestartrGithubRepository'),
302375
303260
  item.spec.repositoryTarget.ref.name,
@@ -302380,24 +303265,24 @@ async function manageOwnershipReferences(item, handler, op) {
302380
303265
  async function manageOwnershipReferencesPostDeletion(item, handler, op) {
302381
303266
  // We will check if the repo has still some references left
302382
303267
  if (kindsWithFirestartrGithubRepositoryDependence.indexOf(item.kind) !== -1) {
302383
- await manageChildrenReferences(item, handler, op);
303268
+ await ownership_manageChildrenReferences(item, handler, op);
302384
303269
  }
302385
303270
  // if the parent is being deleted is ok to control there are no more children
302386
303271
  // for preventing a stuck deletion
302387
303272
  else if (kindsWithChildren.indexOf(item.kind) !== -1) {
302388
- await removeFinalizerIfNoMoreChildren(item, handler, op);
303273
+ await ownership_removeFinalizerIfNoMoreChildren(item, handler, op);
302389
303274
  }
302390
303275
  }
302391
- async function manageChildrenReferences(item, handler, op) {
303276
+ async function ownership_manageChildrenReferences(item, handler, op) {
302392
303277
  // for now is only FirestartrGithubRepository
302393
- const parentItem = await getItemByItemPath([
303278
+ const parentItem = await ctl_getItemByItemPath([
302394
303279
  item.metadata.namespace,
302395
303280
  definitions_getPluralFromKind('FirestartrGithubRepository'),
302396
303281
  item.spec.repositoryTarget.ref.name,
302397
303282
  ].join('/'));
302398
- await removeFinalizerIfNoMoreChildren(parentItem, handler, op);
303283
+ await ownership_removeFinalizerIfNoMoreChildren(parentItem, handler, op);
302399
303284
  }
302400
- async function removeFinalizerIfNoMoreChildren(parentItem, handler, op) {
303285
+ async function ownership_removeFinalizerIfNoMoreChildren(parentItem, handler, op) {
302401
303286
  try {
302402
303287
  let numberOfChildren = 0;
302403
303288
  for (const child of kindsWithFirestartrGithubRepositoryDependence) {
@@ -302407,7 +303292,17 @@ async function removeFinalizerIfNoMoreChildren(parentItem, handler, op) {
302407
303292
  operator_src_logger.error(`Number of children ${numberOfChildren}`);
302408
303293
  if (numberOfChildren === 0) {
302409
303294
  operator_src_logger.info(`${parentItem.kind}/${parentItem.metadata.name} has no more children. Removing finalizer of foreground-deletion`);
302410
- await unsetFinalizer(definitions_getPluralFromKind(parentItem.kind), parentItem.metadata.namespace, parentItem, 'firestartr.dev/foreground-deletion');
303295
+ try {
303296
+ await unsetFinalizer(definitions_getPluralFromKind(parentItem.kind), parentItem.metadata.namespace, parentItem, 'firestartr.dev/foreground-deletion');
303297
+ }
303298
+ catch (unsetErr) {
303299
+ if (typeof unsetErr === 'string' && unsetErr.includes('Not Found')) {
303300
+ operator_src_logger.info(`${parentItem.kind}/${parentItem.metadata.name} was already deleted; skipping finalizer removal`);
303301
+ }
303302
+ else {
303303
+ throw unsetErr;
303304
+ }
303305
+ }
302411
303306
  }
302412
303307
  }
302413
303308
  catch (err) {
@@ -302450,10 +303345,8 @@ async function GHCheckRun(cmd, item) {
302450
303345
  throw new Error('GHCheckRun: prNumber not retrievable');
302451
303346
  }
302452
303347
  const checkRun = await gh_checkrun_operatorProfile().feedback.createCheckRun(prInfo.org, prInfo.repo, gh_checkrun_helperCreateCheckRunName(cmd, item), {
302453
- //Number(pr_number),
302454
303348
  pullNumber: Number(prInfo.prNumber),
302455
- includeCheckRunComment: true,
302456
- checkRunComment: `The Github ${item.kind} is being processed (cmd=${cmd}). Details: `,
303349
+ // check-run comments removed: redundant with native checks widget (#1985)
302457
303350
  });
302458
303351
  checkRun.mdOptionsDetails({
302459
303352
  quotes: 'terraform',
@@ -303179,6 +304072,7 @@ function getProvisionImplementation(plural) {
303179
304072
  case 'githubrepositoryfeatures':
303180
304073
  case 'githubmemberships':
303181
304074
  case 'githuborgwebhooks':
304075
+ case 'githuborganizationsettings':
303182
304076
  implementation = process_operation_processOperation;
303183
304077
  break;
303184
304078
  case 'fsdummiesa':
@@ -303292,6 +304186,14 @@ const cdk8s_rendererSubcommands = {
303292
304186
  { name: 'disableRenames', type: Boolean, defaultValue: false },
303293
304187
  { name: 'claimRefsList', type: String, defaultValue: '' },
303294
304188
  { name: 'claimFilesList', type: String, defaultValue: '' },
304189
+ /**
304190
+ * Repository URL for backstage.io/edit-url annotation
304191
+ */
304192
+ { name: 'repositoryUrl', type: String },
304193
+ /**
304194
+ * Default branch for backstage.io/edit-url annotation
304195
+ */
304196
+ { name: 'defaultBranch', type: String, defaultValue: 'main' },
303295
304197
  /**
303296
304198
  * Path where the claims defaults are located
303297
304199
  */
@@ -303320,7 +304222,7 @@ const cdk8s_rendererSubcommands = {
303320
304222
  run: async (options) => {
303321
304223
  if (options['render']) {
303322
304224
  console.table(options);
303323
- 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']);
304225
+ 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']);
303324
304226
  }
303325
304227
  else if (options['compare']) {
303326
304228
  await cdk8s_renderer.runComparer(options['claimsFromMain'], options['claimsFromPr'], options['claimsDefaults'], options['wetReposConfig'], options['outputComparer']);
@@ -303602,7 +304504,7 @@ const crs_analyzerSubcommand = {
303602
304504
  };
303603
304505
 
303604
304506
  ;// CONCATENATED MODULE: ./package.json
303605
- const package_namespaceObject = JSON.parse('{"i8":"2.7.0-snapshot-12"}');
304507
+ const package_namespaceObject = JSON.parse('{"i8":"2.7.0-snapshot-14"}');
303606
304508
  ;// CONCATENATED MODULE: ../../package.json
303607
304509
  const package_namespaceObject_1 = {"i8":"2.6.4"};
303608
304510
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts