@firestartr/cli 2.11.0-snapshot-gh-pages-public-https-1 → 2.11.0-snapshot-orgsettings-binding-1

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 (22) hide show
  1. package/build/index.js +1055 -94
  2. package/build/packages/cdk8s_renderer/imports/firestartr.dev.d.ts +458 -18
  3. package/build/packages/cdk8s_renderer/src/charts/github/index.d.ts +1 -0
  4. package/build/packages/cdk8s_renderer/src/charts/github/orgSecretSectionChart.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/schemas/index.d.ts +88 -27
  7. package/build/packages/cdk8s_renderer/src/claims/github/component.schema.d.ts +23 -1
  8. package/build/packages/cdk8s_renderer/src/claims/github/index.d.ts +88 -27
  9. package/build/packages/cdk8s_renderer/src/claims/github/orgSecrets.schema.d.ts +67 -0
  10. package/build/packages/cdk8s_renderer/src/claims/github/orgSettings.d.ts +20 -0
  11. package/build/packages/cdk8s_renderer/src/claims/github/orgsettings.schema.d.ts +24 -0
  12. package/build/packages/cdk8s_renderer/src/claims/github/repository.d.ts +9 -2
  13. package/build/packages/cdk8s_renderer/src/renderer/claims-render.d.ts +1 -1
  14. package/build/packages/cdk8s_renderer/src/validations/githubOrgSecretSection.d.ts +4 -0
  15. package/build/packages/gh_provisioner/src/entities/ghorgsecretsection/index.d.ts +7 -0
  16. package/build/packages/gh_provisioner/src/entities/ghorgsecretsection/secrets.d.ts +16 -0
  17. package/build/packages/gh_provisioner/src/entities/ghrepo/index.d.ts +6 -1
  18. package/build/packages/github/index.d.ts +7 -1
  19. package/build/packages/github/src/orgSecrets.d.ts +10 -0
  20. package/package.json +1 -1
  21. package/build/packages/cdk8s_renderer/src/claims/github/pages.d.ts +0 -11
  22. package/build/packages/cdk8s_renderer/src/claims/github/pages.schema.d.ts +0 -52
package/build/index.js CHANGED
@@ -280314,7 +280314,7 @@ function getCronNextInterval(cronLine, tz) {
280314
280314
 
280315
280315
  /***/ }),
280316
280316
 
280317
- /***/ 99029:
280317
+ /***/ 3342:
280318
280318
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
280319
280319
 
280320
280320
  // ESM COMPAT FLAG
@@ -285979,6 +285979,66 @@ async function encryptRepoSecret(owner, repo, section, plaintextValue, octokit)
285979
285979
  }
285980
285980
  }
285981
285981
 
285982
+ ;// CONCATENATED MODULE: ../github/src/orgSecrets.ts
285983
+
285984
+
285985
+
285986
+ async function getOrgPublicKey(org, section, octokit) {
285987
+ logger.info(`Retrieving org public key for ${org} (${section})`);
285988
+ try {
285989
+ if (!octokit) {
285990
+ octokit = await getOctokitForOrg(org);
285991
+ }
285992
+ const { data } = await octokit.rest[`${section}`].getOrgPublicKey({
285993
+ org,
285994
+ });
285995
+ return data;
285996
+ }
285997
+ catch (error) {
285998
+ logger.error(`Error retrieving org public key (${section}) for ${org}: ${error}`);
285999
+ throw error;
286000
+ }
286001
+ }
286002
+ async function encryptOrgSecret(org, section, plaintextValue, preFetchedKey, octokit) {
286003
+ try {
286004
+ const { key_id, key } = preFetchedKey
286005
+ ? preFetchedKey
286006
+ : await getOrgPublicKey(org, section, octokit);
286007
+ await libsodium_wrappers.ready;
286008
+ const publicKey = libsodium_wrappers.from_base64(key, libsodium_wrappers.base64_variants.ORIGINAL);
286009
+ const secretBytes = libsodium_wrappers.from_string(plaintextValue);
286010
+ const encryptedBytes = libsodium_wrappers.crypto_box_seal(secretBytes, publicKey);
286011
+ const encryptedValue = libsodium_wrappers.to_base64(encryptedBytes, libsodium_wrappers.base64_variants.ORIGINAL);
286012
+ return {
286013
+ key_id,
286014
+ encrypted_value: encryptedValue,
286015
+ };
286016
+ }
286017
+ catch (err) {
286018
+ logger.error(`Error encrypting org secret (${section}) for ${org}: ${err}`);
286019
+ throw err;
286020
+ }
286021
+ }
286022
+ async function getOrgSecret(org, section, name, octokit) {
286023
+ logger.info(`Checking org secret ${name} (${section}) for ${org}`);
286024
+ try {
286025
+ if (!octokit) {
286026
+ octokit = await getOctokitForOrg(org);
286027
+ }
286028
+ const response = await octokit.rest[`${section}`].getOrgSecret({
286029
+ org,
286030
+ secret_name: name,
286031
+ });
286032
+ return response.data;
286033
+ }
286034
+ catch (err) {
286035
+ if (err && err.status === 404) {
286036
+ return null;
286037
+ }
286038
+ throw err;
286039
+ }
286040
+ }
286041
+
285982
286042
  ;// CONCATENATED MODULE: ../github/src/profile.ts
285983
286043
  // Profile definitions and store for github package (immutable and ambient profiles)
285984
286044
  const profileStore = new Map();
@@ -286412,6 +286472,7 @@ function withProfile(profileName) {
286412
286472
 
286413
286473
 
286414
286474
 
286475
+
286415
286476
  /* harmony default export */ const github = ({
286416
286477
  org: organization,
286417
286478
  repo: repository,
@@ -286434,6 +286495,9 @@ function withProfile(profileName) {
286434
286495
  encryption: {
286435
286496
  encryptRepoSecret: encryptRepoSecret,
286436
286497
  getRepoPublicKey: getRepoPublicKey,
286498
+ getOrgPublicKey: getOrgPublicKey,
286499
+ encryptOrgSecret: encryptOrgSecret,
286500
+ getOrgSecret: getOrgSecret,
286437
286501
  },
286438
286502
  withProfile: withProfile,
286439
286503
  createProfile: createProfile,
@@ -319334,8 +319398,8 @@ var dist = __nccwpck_require__(44516);
319334
319398
  var dist_default = /*#__PURE__*/__nccwpck_require__.n(dist);
319335
319399
  // EXTERNAL MODULE: ../catalog_common/index.ts + 44 modules
319336
319400
  var catalog_common = __nccwpck_require__(78542);
319337
- // EXTERNAL MODULE: ../github/index.ts + 37 modules
319338
- var github = __nccwpck_require__(99029);
319401
+ // EXTERNAL MODULE: ../github/index.ts + 38 modules
319402
+ var github = __nccwpck_require__(3342);
319339
319403
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/patches/base.ts
319340
319404
  class BasePatches {
319341
319405
  constructor() { }
@@ -322103,6 +322167,31 @@ function extractAllRefs(claimData) {
322103
322167
  }
322104
322168
  }
322105
322169
  }
322170
+ const orgSecrets = parsedClaim.providers?.github?.org_secrets;
322171
+ if (orgSecrets && typeof orgSecrets === 'object') {
322172
+ const secretRefRegex = /^ref:secretsclaim:([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)$/;
322173
+ for (const section of ['actions', 'codespaces', 'dependabot']) {
322174
+ const secrets = orgSecrets[section];
322175
+ if (!Array.isArray(secrets))
322176
+ continue;
322177
+ for (const secret of secrets) {
322178
+ if (secret.value) {
322179
+ const match = secret.value.match(secretRefRegex);
322180
+ if (match) {
322181
+ refs.push(`SecretsClaim-${match[1]}`);
322182
+ }
322183
+ }
322184
+ if (Array.isArray(secret.selected_repositories)) {
322185
+ for (const repoRef of secret.selected_repositories) {
322186
+ const compMatch = repoRef.match(/^component:(.+)$/);
322187
+ if (compMatch) {
322188
+ refs.push(`ComponentClaim-${compMatch[1]}`);
322189
+ }
322190
+ }
322191
+ }
322192
+ }
322193
+ }
322194
+ }
322106
322195
  break;
322107
322196
  }
322108
322197
  }
@@ -323011,7 +323100,20 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
323011
323100
  type: 'boolean',
323012
323101
  },
323013
323102
  pages: {
323014
- $ref: 'firestartr.dev://github/GithubPages',
323103
+ type: 'object',
323104
+ properties: {
323105
+ cname: { type: 'string' },
323106
+ buildType: { type: 'string', enum: ['workflow', 'legacy'] },
323107
+ source: {
323108
+ type: 'object',
323109
+ properties: {
323110
+ branch: { type: 'string' },
323111
+ path: { type: 'string' },
323112
+ },
323113
+ additionalProperties: false,
323114
+ },
323115
+ },
323116
+ additionalProperties: false,
323015
323117
  },
323016
323118
  additionalRules: {
323017
323119
  type: 'array',
@@ -323261,6 +323363,30 @@ const organizationSettingsProperties = {
323261
323363
  ],
323262
323364
  },
323263
323365
  },
323366
+ org_secrets: {
323367
+ type: 'object',
323368
+ properties: {
323369
+ actions: {
323370
+ type: 'array',
323371
+ items: {
323372
+ $ref: 'firestartr.dev://github/GithubOrgClaimSecret',
323373
+ },
323374
+ },
323375
+ codespaces: {
323376
+ type: 'array',
323377
+ items: {
323378
+ $ref: 'firestartr.dev://github/GithubOrgClaimSecret',
323379
+ },
323380
+ },
323381
+ dependabot: {
323382
+ type: 'array',
323383
+ items: {
323384
+ $ref: 'firestartr.dev://github/GithubOrgClaimSecret',
323385
+ },
323386
+ },
323387
+ },
323388
+ additionalProperties: false,
323389
+ },
323264
323390
  };
323265
323391
  /* harmony default export */ const github_orgsettings_schema = ({
323266
323392
  $schema: SCHEMA,
@@ -323448,38 +323574,71 @@ const organizationSettingsProperties = {
323448
323574
  },
323449
323575
  });
323450
323576
 
323451
- ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/pages.schema.ts
323577
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/orgSecrets.schema.ts
323452
323578
 
323453
- /* harmony default export */ const pages_schema = ({
323579
+ /* harmony default export */ const orgSecrets_schema = ({
323454
323580
  $schema: SCHEMA,
323455
- $id: 'GithubPages',
323581
+ $id: 'GithubOrgClaimSecrets',
323456
323582
  definitions: {
323457
- GithubPages: {
323458
- $id: 'firestartr.dev://github/GithubPages',
323583
+ GithubOrgClaimSecrets: {
323584
+ $id: 'firestartr.dev://github/GithubOrgClaimSecrets',
323459
323585
  type: 'object',
323460
- description: 'GitHub Pages configuration shared across component and repository claims',
323586
+ description: 'Organization-level GitHub Actions secrets',
323461
323587
  properties: {
323462
- cname: { type: 'string' },
323463
- public: { type: 'boolean' },
323464
- https_enforced: { type: 'boolean' },
323465
- buildType: { type: 'string', enum: ['workflow', 'legacy'] },
323466
- source: {
323467
- type: 'object',
323468
- properties: {
323469
- branch: { type: 'string' },
323470
- path: { type: 'string', enum: ['/', '/docs'] },
323588
+ actions: {
323589
+ type: 'array',
323590
+ items: {
323591
+ $ref: 'firestartr.dev://github/GithubOrgClaimSecret',
323592
+ },
323593
+ },
323594
+ codespaces: {
323595
+ type: 'array',
323596
+ items: {
323597
+ $ref: 'firestartr.dev://github/GithubOrgClaimSecret',
323598
+ },
323599
+ },
323600
+ dependabot: {
323601
+ type: 'array',
323602
+ items: {
323603
+ $ref: 'firestartr.dev://github/GithubOrgClaimSecret',
323471
323604
  },
323472
- additionalProperties: false,
323473
323605
  },
323474
323606
  },
323475
323607
  additionalProperties: false,
323476
- if: {
323477
- required: ['https_enforced'],
323478
- properties: { https_enforced: { const: true } },
323479
- },
323480
- then: {
323481
- required: ['cname'],
323608
+ },
323609
+ GithubOrgClaimSecretRef: {
323610
+ $id: 'firestartr.dev://github/GithubOrgClaimSecretRef',
323611
+ type: 'string',
323612
+ description: 'the reference of the secret',
323613
+ pattern: '^ref:secretsclaim:([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)$',
323614
+ },
323615
+ GithubOrgClaimSecret: {
323616
+ $id: 'firestartr.dev://github/GithubOrgClaimSecret',
323617
+ type: 'object',
323618
+ description: 'An organization-level secret for GitHub Actions',
323619
+ properties: {
323620
+ name: {
323621
+ type: 'string',
323622
+ description: 'the name of the secret',
323623
+ },
323624
+ value: {
323625
+ $ref: 'firestartr.dev://github/GithubOrgClaimSecretRef',
323626
+ },
323627
+ visibility: {
323628
+ type: 'string',
323629
+ enum: ['all', 'selected', 'private'],
323630
+ description: 'which repositories can access the secret',
323631
+ },
323632
+ selected_repositories: {
323633
+ type: 'array',
323634
+ items: {
323635
+ type: 'string',
323636
+ },
323637
+ description: 'list of repository refs when visibility is selected',
323638
+ },
323482
323639
  },
323640
+ required: ['name', 'value'],
323641
+ additionalProperties: false,
323483
323642
  },
323484
323643
  },
323485
323644
  });
@@ -323503,7 +323662,7 @@ const GithubSchemas = [
323503
323662
  github_orgsettings_schema,
323504
323663
  component_secrets_vars_schema,
323505
323664
  component_labels_schema,
323506
- pages_schema,
323665
+ orgSecrets_schema,
323507
323666
  ];
323508
323667
 
323509
323668
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/tfworkspaces/terraform.schema.ts
@@ -327515,6 +327674,382 @@ var FirestartrGithubMembershipSpecContextProviderRefKind;
327515
327674
  /** FirestartrProviderConfig */
327516
327675
  FirestartrGithubMembershipSpecContextProviderRefKind["FIRESTARTR_PROVIDER_CONFIG"] = "FirestartrProviderConfig";
327517
327676
  })(FirestartrGithubMembershipSpecContextProviderRefKind || (FirestartrGithubMembershipSpecContextProviderRefKind = {}));
327677
+ /**
327678
+ * A resource to handle GitHub Organization Actions Secrets.
327679
+ *
327680
+ * @schema FirestartrGithubOrganizationSecretSection
327681
+ */
327682
+ class FirestartrGithubOrganizationSecretSection extends lib.ApiObject {
327683
+ /**
327684
+ * Renders a Kubernetes manifest for "FirestartrGithubOrganizationSecretSection".
327685
+ *
327686
+ * This can be used to inline resource manifests inside other objects (e.g. as templates).
327687
+ *
327688
+ * @param props initialization props
327689
+ */
327690
+ static manifest(props) {
327691
+ return {
327692
+ ...FirestartrGithubOrganizationSecretSection.GVK,
327693
+ ...toJson_FirestartrGithubOrganizationSecretSectionProps(props),
327694
+ };
327695
+ }
327696
+ /**
327697
+ * Defines a "FirestartrGithubOrganizationSecretSection" API object
327698
+ * @param scope the scope in which to define this object
327699
+ * @param id a scope-local name for the object
327700
+ * @param props initialization props
327701
+ */
327702
+ constructor(scope, id, props) {
327703
+ super(scope, id, {
327704
+ ...FirestartrGithubOrganizationSecretSection.GVK,
327705
+ ...props,
327706
+ });
327707
+ }
327708
+ /**
327709
+ * Renders the object to Kubernetes JSON.
327710
+ */
327711
+ toJson() {
327712
+ const resolved = super.toJson();
327713
+ return {
327714
+ ...FirestartrGithubOrganizationSecretSection.GVK,
327715
+ ...toJson_FirestartrGithubOrganizationSecretSectionProps(resolved),
327716
+ };
327717
+ }
327718
+ }
327719
+ /**
327720
+ * Returns the apiVersion and kind for "FirestartrGithubOrganizationSecretSection"
327721
+ */
327722
+ FirestartrGithubOrganizationSecretSection.GVK = {
327723
+ apiVersion: 'firestartr.dev/v1',
327724
+ kind: 'FirestartrGithubOrganizationSecretSection',
327725
+ };
327726
+
327727
+ /**
327728
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionProps' to JSON representation.
327729
+ */
327730
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327731
+ function toJson_FirestartrGithubOrganizationSecretSectionProps(obj) {
327732
+ if (obj === undefined) {
327733
+ return undefined;
327734
+ }
327735
+ const result = {
327736
+ 'metadata': obj.metadata,
327737
+ 'spec': toJson_FirestartrGithubOrganizationSecretSectionSpec(obj.spec),
327738
+ };
327739
+ // filter undefined values
327740
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327741
+ }
327742
+ /**
327743
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpec' to JSON representation.
327744
+ */
327745
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327746
+ function toJson_FirestartrGithubOrganizationSecretSectionSpec(obj) {
327747
+ if (obj === undefined) {
327748
+ return undefined;
327749
+ }
327750
+ const result = {
327751
+ 'org': obj.org,
327752
+ 'secrets': toJson_FirestartrGithubOrganizationSecretSectionSpecSecrets(obj.secrets),
327753
+ 'context': toJson_FirestartrGithubOrganizationSecretSectionSpecContext(obj.context),
327754
+ 'firestartr': toJson_FirestartrGithubOrganizationSecretSectionSpecFirestartr(obj.firestartr),
327755
+ };
327756
+ // filter undefined values
327757
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327758
+ }
327759
+ /**
327760
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecSecrets' to JSON representation.
327761
+ */
327762
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327763
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecSecrets(obj) {
327764
+ if (obj === undefined) {
327765
+ return undefined;
327766
+ }
327767
+ const result = {
327768
+ 'actions': obj.actions?.map(y => toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsActions(y)),
327769
+ 'codespaces': obj.codespaces?.map(y => toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsCodespaces(y)),
327770
+ 'dependabot': obj.dependabot?.map(y => toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsDependabot(y)),
327771
+ };
327772
+ // filter undefined values
327773
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327774
+ }
327775
+ /**
327776
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecContext' to JSON representation.
327777
+ */
327778
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327779
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecContext(obj) {
327780
+ if (obj === undefined) {
327781
+ return undefined;
327782
+ }
327783
+ const result = {
327784
+ 'backend': toJson_FirestartrGithubOrganizationSecretSectionSpecContextBackend(obj.backend),
327785
+ 'provider': toJson_FirestartrGithubOrganizationSecretSectionSpecContextProvider(obj.provider),
327786
+ };
327787
+ // filter undefined values
327788
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327789
+ }
327790
+ /**
327791
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecFirestartr' to JSON representation.
327792
+ */
327793
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327794
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecFirestartr(obj) {
327795
+ if (obj === undefined) {
327796
+ return undefined;
327797
+ }
327798
+ const result = {
327799
+ 'tfStateKey': obj.tfStateKey,
327800
+ };
327801
+ // filter undefined values
327802
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327803
+ }
327804
+ /**
327805
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecSecretsActions' to JSON representation.
327806
+ */
327807
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327808
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsActions(obj) {
327809
+ if (obj === undefined) {
327810
+ return undefined;
327811
+ }
327812
+ const result = {
327813
+ 'name': obj.name,
327814
+ 'ref': toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsActionsRef(obj.ref),
327815
+ 'visibility': obj.visibility,
327816
+ 'selectedRepositories': obj.selectedRepositories?.map(y => y),
327817
+ };
327818
+ // filter undefined values
327819
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327820
+ }
327821
+ /**
327822
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecSecretsCodespaces' to JSON representation.
327823
+ */
327824
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327825
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsCodespaces(obj) {
327826
+ if (obj === undefined) {
327827
+ return undefined;
327828
+ }
327829
+ const result = {
327830
+ 'name': obj.name,
327831
+ 'ref': toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesRef(obj.ref),
327832
+ 'visibility': obj.visibility,
327833
+ 'selectedRepositories': obj.selectedRepositories?.map(y => y),
327834
+ };
327835
+ // filter undefined values
327836
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327837
+ }
327838
+ /**
327839
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecSecretsDependabot' to JSON representation.
327840
+ */
327841
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327842
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsDependabot(obj) {
327843
+ if (obj === undefined) {
327844
+ return undefined;
327845
+ }
327846
+ const result = {
327847
+ 'name': obj.name,
327848
+ 'ref': toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotRef(obj.ref),
327849
+ 'visibility': obj.visibility,
327850
+ 'selectedRepositories': obj.selectedRepositories?.map(y => y),
327851
+ };
327852
+ // filter undefined values
327853
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327854
+ }
327855
+ /**
327856
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecContextBackend' to JSON representation.
327857
+ */
327858
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327859
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecContextBackend(obj) {
327860
+ if (obj === undefined) {
327861
+ return undefined;
327862
+ }
327863
+ const result = {
327864
+ 'ref': toJson_FirestartrGithubOrganizationSecretSectionSpecContextBackendRef(obj.ref),
327865
+ };
327866
+ // filter undefined values
327867
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327868
+ }
327869
+ /**
327870
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecContextProvider' to JSON representation.
327871
+ */
327872
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327873
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecContextProvider(obj) {
327874
+ if (obj === undefined) {
327875
+ return undefined;
327876
+ }
327877
+ const result = {
327878
+ 'ref': toJson_FirestartrGithubOrganizationSecretSectionSpecContextProviderRef(obj.ref),
327879
+ };
327880
+ // filter undefined values
327881
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327882
+ }
327883
+ /**
327884
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecSecretsActionsRef' to JSON representation.
327885
+ */
327886
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327887
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsActionsRef(obj) {
327888
+ if (obj === undefined) {
327889
+ return undefined;
327890
+ }
327891
+ const result = {
327892
+ 'kind': obj.kind,
327893
+ 'name': obj.name,
327894
+ 'key': obj.key,
327895
+ };
327896
+ // filter undefined values
327897
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327898
+ }
327899
+ /* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327900
+ /**
327901
+ * Which repositories can access the secret.
327902
+ *
327903
+ * @schema FirestartrGithubOrganizationSecretSectionSpecSecretsActionsVisibility
327904
+ */
327905
+ var FirestartrGithubOrganizationSecretSectionSpecSecretsActionsVisibility;
327906
+ (function (FirestartrGithubOrganizationSecretSectionSpecSecretsActionsVisibility) {
327907
+ /** all */
327908
+ FirestartrGithubOrganizationSecretSectionSpecSecretsActionsVisibility["ALL"] = "all";
327909
+ /** selected */
327910
+ FirestartrGithubOrganizationSecretSectionSpecSecretsActionsVisibility["SELECTED"] = "selected";
327911
+ /** private */
327912
+ FirestartrGithubOrganizationSecretSectionSpecSecretsActionsVisibility["PRIVATE"] = "private";
327913
+ })(FirestartrGithubOrganizationSecretSectionSpecSecretsActionsVisibility || (FirestartrGithubOrganizationSecretSectionSpecSecretsActionsVisibility = {}));
327914
+ /**
327915
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesRef' to JSON representation.
327916
+ */
327917
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327918
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesRef(obj) {
327919
+ if (obj === undefined) {
327920
+ return undefined;
327921
+ }
327922
+ const result = {
327923
+ 'kind': obj.kind,
327924
+ 'name': obj.name,
327925
+ 'key': obj.key,
327926
+ };
327927
+ // filter undefined values
327928
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327929
+ }
327930
+ /* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327931
+ /**
327932
+ * Which repositories can access the secret.
327933
+ *
327934
+ * @schema FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesVisibility
327935
+ */
327936
+ var FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesVisibility;
327937
+ (function (FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesVisibility) {
327938
+ /** all */
327939
+ FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesVisibility["ALL"] = "all";
327940
+ /** selected */
327941
+ FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesVisibility["SELECTED"] = "selected";
327942
+ /** private */
327943
+ FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesVisibility["PRIVATE"] = "private";
327944
+ })(FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesVisibility || (FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesVisibility = {}));
327945
+ /**
327946
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotRef' to JSON representation.
327947
+ */
327948
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327949
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotRef(obj) {
327950
+ if (obj === undefined) {
327951
+ return undefined;
327952
+ }
327953
+ const result = {
327954
+ 'kind': obj.kind,
327955
+ 'name': obj.name,
327956
+ 'key': obj.key,
327957
+ };
327958
+ // filter undefined values
327959
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327960
+ }
327961
+ /* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327962
+ /**
327963
+ * Which repositories can access the secret.
327964
+ *
327965
+ * @schema FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotVisibility
327966
+ */
327967
+ var FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotVisibility;
327968
+ (function (FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotVisibility) {
327969
+ /** all */
327970
+ FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotVisibility["ALL"] = "all";
327971
+ /** selected */
327972
+ FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotVisibility["SELECTED"] = "selected";
327973
+ /** private */
327974
+ FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotVisibility["PRIVATE"] = "private";
327975
+ })(FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotVisibility || (FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotVisibility = {}));
327976
+ /**
327977
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecContextBackendRef' to JSON representation.
327978
+ */
327979
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327980
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecContextBackendRef(obj) {
327981
+ if (obj === undefined) {
327982
+ return undefined;
327983
+ }
327984
+ const result = {
327985
+ 'kind': obj.kind,
327986
+ 'name': obj.name,
327987
+ };
327988
+ // filter undefined values
327989
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
327990
+ }
327991
+ /**
327992
+ * Converts an object of type 'FirestartrGithubOrganizationSecretSectionSpecContextProviderRef' to JSON representation.
327993
+ */
327994
+ /* eslint-disable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
327995
+ function toJson_FirestartrGithubOrganizationSecretSectionSpecContextProviderRef(obj) {
327996
+ if (obj === undefined) {
327997
+ return undefined;
327998
+ }
327999
+ const result = {
328000
+ 'kind': obj.kind,
328001
+ 'name': obj.name,
328002
+ };
328003
+ // filter undefined values
328004
+ return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
328005
+ }
328006
+ /* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
328007
+ /**
328008
+ * The type of Kubernetes resource to reference.
328009
+ *
328010
+ * @schema FirestartrGithubOrganizationSecretSectionSpecSecretsActionsRefKind
328011
+ */
328012
+ var FirestartrGithubOrganizationSecretSectionSpecSecretsActionsRefKind;
328013
+ (function (FirestartrGithubOrganizationSecretSectionSpecSecretsActionsRefKind) {
328014
+ /** Secret */
328015
+ FirestartrGithubOrganizationSecretSectionSpecSecretsActionsRefKind["SECRET"] = "Secret";
328016
+ })(FirestartrGithubOrganizationSecretSectionSpecSecretsActionsRefKind || (FirestartrGithubOrganizationSecretSectionSpecSecretsActionsRefKind = {}));
328017
+ /**
328018
+ * The type of Kubernetes resource to reference.
328019
+ *
328020
+ * @schema FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesRefKind
328021
+ */
328022
+ var FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesRefKind;
328023
+ (function (FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesRefKind) {
328024
+ /** Secret */
328025
+ FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesRefKind["SECRET"] = "Secret";
328026
+ })(FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesRefKind || (FirestartrGithubOrganizationSecretSectionSpecSecretsCodespacesRefKind = {}));
328027
+ /**
328028
+ * The type of Kubernetes resource to reference.
328029
+ *
328030
+ * @schema FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotRefKind
328031
+ */
328032
+ var FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotRefKind;
328033
+ (function (FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotRefKind) {
328034
+ /** Secret */
328035
+ FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotRefKind["SECRET"] = "Secret";
328036
+ })(FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotRefKind || (FirestartrGithubOrganizationSecretSectionSpecSecretsDependabotRefKind = {}));
328037
+ /**
328038
+ * @schema FirestartrGithubOrganizationSecretSectionSpecContextBackendRefKind
328039
+ */
328040
+ var FirestartrGithubOrganizationSecretSectionSpecContextBackendRefKind;
328041
+ (function (FirestartrGithubOrganizationSecretSectionSpecContextBackendRefKind) {
328042
+ /** FirestartrProviderConfig */
328043
+ FirestartrGithubOrganizationSecretSectionSpecContextBackendRefKind["FIRESTARTR_PROVIDER_CONFIG"] = "FirestartrProviderConfig";
328044
+ })(FirestartrGithubOrganizationSecretSectionSpecContextBackendRefKind || (FirestartrGithubOrganizationSecretSectionSpecContextBackendRefKind = {}));
328045
+ /**
328046
+ * @schema FirestartrGithubOrganizationSecretSectionSpecContextProviderRefKind
328047
+ */
328048
+ var FirestartrGithubOrganizationSecretSectionSpecContextProviderRefKind;
328049
+ (function (FirestartrGithubOrganizationSecretSectionSpecContextProviderRefKind) {
328050
+ /** FirestartrProviderConfig */
328051
+ FirestartrGithubOrganizationSecretSectionSpecContextProviderRefKind["FIRESTARTR_PROVIDER_CONFIG"] = "FirestartrProviderConfig";
328052
+ })(FirestartrGithubOrganizationSecretSectionSpecContextProviderRefKind || (FirestartrGithubOrganizationSecretSectionSpecContextProviderRefKind = {}));
327518
328053
  /**
327519
328054
  * A resource to handle GitHub Organization Settings.
327520
328055
  *
@@ -328469,8 +329004,6 @@ function toJson_FirestartrGithubRepositorySpecPages(obj) {
328469
329004
  }
328470
329005
  const result = {
328471
329006
  'cname': obj.cname,
328472
- 'public': obj.public,
328473
- 'https_enforced': obj.httpsEnforced,
328474
329007
  'source': toJson_FirestartrGithubRepositorySpecPagesSource(obj.source),
328475
329008
  'buildType': obj.buildType,
328476
329009
  };
@@ -328797,17 +329330,6 @@ function toJson_FirestartrGithubRepositorySpecContextProviderRef(obj) {
328797
329330
  // filter undefined values
328798
329331
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
328799
329332
  }
328800
- /* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
328801
- /**
328802
- * @schema FirestartrGithubRepositorySpecPagesSourcePath
328803
- */
328804
- var FirestartrGithubRepositorySpecPagesSourcePath;
328805
- (function (FirestartrGithubRepositorySpecPagesSourcePath) {
328806
- /** / */
328807
- FirestartrGithubRepositorySpecPagesSourcePath["VALUE_FORWARD_SLASH"] = "/";
328808
- /** /docs */
328809
- FirestartrGithubRepositorySpecPagesSourcePath["VALUE_FORWARD_SLASH_DOCS"] = "/docs";
328810
- })(FirestartrGithubRepositorySpecPagesSourcePath || (FirestartrGithubRepositorySpecPagesSourcePath = {}));
328811
329333
  /**
328812
329334
  * Converts an object of type 'FirestartrGithubRepositorySpecVarsVariableItemSchemaRef' to JSON representation.
328813
329335
  */
@@ -330598,17 +331120,6 @@ class RepoSecretsSectionChart extends BaseGithubChart {
330598
331120
 
330599
331121
 
330600
331122
 
330601
- function normalizePages(pages) {
330602
- if (!pages)
330603
- return undefined;
330604
- return {
330605
- cname: pages.cname,
330606
- public: pages.public,
330607
- httpsEnforced: pages.https_enforced,
330608
- source: pages.source,
330609
- buildType: pages.buildType,
330610
- };
330611
- }
330612
331123
  class GithubRepositoryChart extends BaseGithubChart {
330613
331124
  template() {
330614
331125
  const claim = this.get('claim');
@@ -330657,7 +331168,7 @@ class GithubRepositoryChart extends BaseGithubChart {
330657
331168
  actions,
330658
331169
  permissions: this.createPermissions(claim),
330659
331170
  vars: this.createVars(claim),
330660
- pages: normalizePages(claim.providers.github.pages),
331171
+ pages: claim.providers.github.pages,
330661
331172
  branchProtections: [],
330662
331173
  writeConnectionSecretToRef: {
330663
331174
  name: `firestartrgithubrepository-${claim.name}-outputs`.toLowerCase(),
@@ -330953,6 +331464,78 @@ class GithubOrgVariableSectionChart extends BaseGithubChart {
330953
331464
  }
330954
331465
  }
330955
331466
 
331467
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/github/orgSecretSectionChart.ts
331468
+
331469
+
331470
+
331471
+ class GithubOrgSecretSectionChart extends BaseGithubChart {
331472
+ template() {
331473
+ const claim = this.get('claim');
331474
+ const firestartrId = this.get('firestartrId');
331475
+ const githubProvider = claim.providers.github;
331476
+ const orgSecrets = githubProvider.org_secrets || {};
331477
+ const renderSecrets = (section) => {
331478
+ const secrets = orgSecrets[section];
331479
+ if (!Array.isArray(secrets))
331480
+ return [];
331481
+ return secrets.map((secret) => {
331482
+ const parts = secret.value.split(':');
331483
+ const selectedRepositories = (secret.selected_repositories || []).map((ref) => {
331484
+ const match = ref.match(/^component:(.+)$/);
331485
+ if (!match) {
331486
+ throw new ChartRenderError('OrgSettingsClaim', claim.name, `Invalid component ref "${ref}" in selected_repositories. Expected format: component:<name>`);
331487
+ }
331488
+ const componentName = match[1];
331489
+ const resolvedCr = this.refResolver('ComponentClaim', componentName);
331490
+ const org = resolvedCr?.spec?.org;
331491
+ const repoName = resolvedCr?.metadata?.annotations?.['firestartr.dev/external-name'] || resolvedCr?.metadata?.name?.replace(/-[0-9a-f-]{36}$/, '');
331492
+ if (!org || !repoName) {
331493
+ throw new ChartRenderError('OrgSettingsClaim', claim.name, `Referenced component "${componentName}" has no GitHub provider configured`);
331494
+ }
331495
+ return `${org}/${repoName}`;
331496
+ });
331497
+ return {
331498
+ name: secret.name,
331499
+ ref: {
331500
+ kind: 'Secret',
331501
+ name: parts[2],
331502
+ key: parts[3],
331503
+ },
331504
+ visibility: secret.visibility || 'all',
331505
+ selectedRepositories,
331506
+ };
331507
+ });
331508
+ };
331509
+ const template = {
331510
+ metadata: {
331511
+ name: `${githubProvider.name}-secrets`,
331512
+ },
331513
+ spec: {
331514
+ org: githubProvider.org,
331515
+ secrets: {
331516
+ actions: renderSecrets('actions'),
331517
+ codespaces: renderSecrets('codespaces'),
331518
+ dependabot: renderSecrets('dependabot'),
331519
+ },
331520
+ firestartr: {
331521
+ tfStateKey: firestartrId ? `${firestartrId}-secrets` : firestartrId,
331522
+ },
331523
+ writeConnectionSecretToRef: {
331524
+ name: `firestartrgithuborganizationsecretsection-${githubProvider.name}-secrets-outputs`.toLowerCase(),
331525
+ outputs: [{ key: 'managed_secrets' }, { key: 'secret_ids' }],
331526
+ },
331527
+ },
331528
+ };
331529
+ return JSON.parse(JSON.stringify(template));
331530
+ }
331531
+ gvk() {
331532
+ return FirestartrGithubOrganizationSecretSection.GVK;
331533
+ }
331534
+ instanceApiObject(template) {
331535
+ return new FirestartrGithubOrganizationSecretSection(this, template.metadata.name, template);
331536
+ }
331537
+ }
331538
+
330956
331539
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/github/index.ts
330957
331540
 
330958
331541
 
@@ -330961,6 +331544,7 @@ class GithubOrgVariableSectionChart extends BaseGithubChart {
330961
331544
 
330962
331545
 
330963
331546
 
331547
+
330964
331548
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/catalog/base.ts
330965
331549
 
330966
331550
  class BaseCatalogChart extends BaseChart {
@@ -331709,6 +332293,7 @@ class SecretsChart extends BaseSecretsChart {
331709
332293
  GithubOrgWebhookChart: GithubOrgWebhookChart,
331710
332294
  GithubOrgSettingsChart: GithubOrgSettingsChart,
331711
332295
  GithubOrgVariableSectionChart: GithubOrgVariableSectionChart,
332296
+ GithubOrgSecretSectionChart: GithubOrgSecretSectionChart,
331712
332297
  });
331713
332298
 
331714
332299
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/renderer/claims-render.ts
@@ -331760,16 +332345,21 @@ async function renderClaims(catalogScope, firestartrScope, data) {
331760
332345
  const variableSectionPreviousCR = claim.kind === 'OrgSettingsClaim'
331761
332346
  ? getPreviousCRfromClaim({ kind: claim.kind, name: `${claim.name}-variable-section` }, crs, 'FirestartrGithubOrganizationVariableSection')
331762
332347
  : false;
332348
+ const secretSectionPreviousCR = claim.kind === 'OrgSettingsClaim'
332349
+ ? getPreviousCRfromClaim({ kind: claim.kind, name: `${claim.name}-secret-section` }, crs, 'FirestartrGithubOrganizationSecretSection')
332350
+ : false;
331763
332351
  const patches = await extractPatches(renderClaims[claimKey], previousCR);
331764
332352
  let variableSectionPatches = undefined;
332353
+ let secretSectionPatches = undefined;
331765
332354
  if (claim.kind === 'OrgSettingsClaim') {
331766
332355
  variableSectionPatches = await extractPatches(renderClaims[claimKey], variableSectionPreviousCR);
332356
+ secretSectionPatches = await extractPatches(renderClaims[claimKey], secretSectionPreviousCR);
331767
332357
  }
331768
332358
  if (!previousCR) {
331769
332359
  logger.debug(`No CR found for claim ${claimKey}, it will be rendered from scratch`);
331770
332360
  }
331771
332361
  const claimPath = renderClaims[claimKey].claimPath;
331772
- const { firestartrEntity, extraCharts, catalogEntity } = await renderClaim(catalogScope, firestartrScope, claim, patches, previousCR, claimPath, variableSectionPreviousCR, variableSectionPatches);
332362
+ const { firestartrEntity, extraCharts, catalogEntity } = await renderClaim(catalogScope, firestartrScope, claim, patches, previousCR, claimPath, variableSectionPreviousCR, variableSectionPatches, secretSectionPreviousCR, secretSectionPatches);
331773
332363
  if (catalogEntity) {
331774
332364
  result[`${catalogEntity.kind}-${catalogEntity.metadata.name}`] =
331775
332365
  catalogEntity.toJson();
@@ -331798,7 +332388,7 @@ async function renderClaims(catalogScope, firestartrScope, data) {
331798
332388
  }
331799
332389
  return result;
331800
332390
  }
331801
- async function renderClaim(catalogScope, firestartrScope, claim, patches, previousCR = null, claimPath, variableSectionPreviousCR = false, variableSectionPatches) {
332391
+ async function renderClaim(catalogScope, firestartrScope, claim, patches, previousCR = null, claimPath, variableSectionPreviousCR = false, variableSectionPatches, secretSectionPreviousCR = false, secretSectionPatches) {
331802
332392
  let catalogEntity = undefined;
331803
332393
  let firestartrEntity = undefined;
331804
332394
  const extraCharts = [];
@@ -331967,6 +332557,27 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
331967
332557
  },
331968
332558
  chart: variableSectionObject,
331969
332559
  });
332560
+ const secretSectionFirestartrId = secretSectionPreviousCR
332561
+ ? secretSectionPreviousCR.spec?.firestartr?.tfStateKey
332562
+ : firestartrId
332563
+ ? `${firestartrId}-secrets`
332564
+ : null;
332565
+ const ssRenderPatches = secretSectionPatches
332566
+ ? secretSectionPatches.filter((patch) => !patch.isPostPatch)
332567
+ : renderPatches;
332568
+ const ssPostPatches = secretSectionPatches
332569
+ ? secretSectionPatches.filter((patch) => patch.isPostPatch)
332570
+ : postPatches;
332571
+ const secretSectionChart = new charts.GithubOrgSecretSectionChart(firestartrScope, `github-secrets-${chartId}`, secretSectionFirestartrId, claim, ssRenderPatches);
332572
+ await secretSectionChart.render();
332573
+ const secretSectionObject = await secretSectionChart.postRenderer(ssPostPatches);
332574
+ extraCharts.push({
332575
+ claim: {
332576
+ kind: claim.kind,
332577
+ name: `${claim.name}-secret-section`,
332578
+ },
332579
+ chart: secretSectionObject,
332580
+ });
331970
332581
  }
331971
332582
  break;
331972
332583
  default:
@@ -332089,8 +332700,33 @@ function searchSecretKey(secretClaim, key) {
332089
332700
  }
332090
332701
  function validateOrgSettingsComponentRefs(ref, renderClaims) {
332091
332702
  const claim = renderClaims[ref].claim;
332703
+ validateOrgSecretsSelectedRepositories(claim, renderClaims);
332092
332704
  validateActionsVariablesSelectedRepositories(claim, renderClaims);
332093
332705
  }
332706
+ function validateOrgSecretsSelectedRepositories(claim, renderClaims) {
332707
+ const orgSecrets = claim?.providers?.github?.org_secrets;
332708
+ if (!orgSecrets || typeof orgSecrets !== 'object')
332709
+ return;
332710
+ for (const section of ['actions', 'codespaces', 'dependabot']) {
332711
+ const secrets = orgSecrets[section];
332712
+ if (!Array.isArray(secrets))
332713
+ continue;
332714
+ for (const secret of secrets) {
332715
+ if (!secret.selected_repositories)
332716
+ continue;
332717
+ for (const repoRef of secret.selected_repositories) {
332718
+ const match = repoRef.match(COMPONENT_REF_PATTERN);
332719
+ if (!match)
332720
+ continue;
332721
+ const [, componentName] = match;
332722
+ const expectedKey = `ComponentClaim-${componentName}`;
332723
+ if (!renderClaims[expectedKey]) {
332724
+ throw new Error(`CrossReference error: OrgSettingsClaim/${claim.name} references a non-existent component "${componentName}" in org_secrets.${section}.${secret.name}.selected_repositories`);
332725
+ }
332726
+ }
332727
+ }
332728
+ }
332729
+ }
332094
332730
  function validateActionsVariablesSelectedRepositories(claim, renderClaims) {
332095
332731
  const actionsVariables = claim?.providers?.github?.actions_variables;
332096
332732
  if (!Array.isArray(actionsVariables))
@@ -332221,6 +332857,116 @@ function validateActionsVariablesUniqueness(crs) {
332221
332857
  }
332222
332858
  }
332223
332859
 
332860
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/githubOrgSecretSection.ts
332861
+ const GITHUB_ORG_SECRET_SECTION_KIND = 'FirestartrGithubOrganizationSecretSection';
332862
+ const githubOrgSecretSection_FIRESTARTR_CLAIM_REF_ANNOTATION = 'firestartr.dev/claim-ref';
332863
+ const githubOrgSecretSection_CLAIM_REF_LABEL = 'claim-ref';
332864
+ const SECRETS_CLAIM_REF_PATTERN = /^ref:secretsclaim:([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)$/;
332865
+ function githubOrgSecretSection_formatResourceRef(name, claimRef) {
332866
+ return claimRef ? `${name} (claim: ${claimRef})` : name;
332867
+ }
332868
+ function validateGithubOrgSecretSectionSingleton(crs) {
332869
+ const refsByOrg = new Map();
332870
+ const seenClaimRefs = new Map();
332871
+ for (const crKey of Object.keys(crs)) {
332872
+ const cr = crs[crKey];
332873
+ if (cr.kind !== GITHUB_ORG_SECRET_SECTION_KIND)
332874
+ continue;
332875
+ const org = cr.spec?.org;
332876
+ if (typeof org !== 'string' || !org)
332877
+ continue;
332878
+ const name = cr.metadata?.name || crKey;
332879
+ const claimRef = cr.metadata?.annotations?.[githubOrgSecretSection_FIRESTARTR_CLAIM_REF_ANNOTATION] ||
332880
+ cr.metadata?.labels?.[githubOrgSecretSection_CLAIM_REF_LABEL];
332881
+ const normalizedOrg = org.toLowerCase();
332882
+ if (claimRef) {
332883
+ const seen = seenClaimRefs.get(normalizedOrg) || new Set();
332884
+ if (seen.has(claimRef))
332885
+ continue;
332886
+ seen.add(claimRef);
332887
+ seenClaimRefs.set(normalizedOrg, seen);
332888
+ }
332889
+ const refs = refsByOrg.get(normalizedOrg) || [];
332890
+ refs.push(githubOrgSecretSection_formatResourceRef(name, claimRef));
332891
+ refsByOrg.set(normalizedOrg, refs);
332892
+ }
332893
+ for (const [org, refs] of refsByOrg.entries()) {
332894
+ if (refs.length < 2)
332895
+ continue;
332896
+ throw new Error(`Duplicate ${GITHUB_ORG_SECRET_SECTION_KIND} resources found for GitHub organization "${org}": ${refs.join(', ')}`);
332897
+ }
332898
+ }
332899
+ function validateSecretNamesUniqueness(crs) {
332900
+ for (const crKey of Object.keys(crs)) {
332901
+ const cr = crs[crKey];
332902
+ if (cr.kind !== GITHUB_ORG_SECRET_SECTION_KIND)
332903
+ continue;
332904
+ const secrets = cr.spec?.secrets;
332905
+ if (!secrets || typeof secrets !== 'object')
332906
+ continue;
332907
+ for (const section of ['actions', 'codespaces', 'dependabot']) {
332908
+ const sectionSecrets = secrets[section];
332909
+ if (!Array.isArray(sectionSecrets))
332910
+ continue;
332911
+ const names = new Set();
332912
+ for (const secret of sectionSecrets) {
332913
+ const secretName = secret?.name;
332914
+ if (!secretName)
332915
+ continue;
332916
+ if (names.has(secretName)) {
332917
+ const org = cr.spec?.org || 'unknown';
332918
+ throw new Error(`Duplicate secret name "${secretName}" found in ${section} section of ${GITHUB_ORG_SECRET_SECTION_KIND} for organization "${org}"`);
332919
+ }
332920
+ names.add(secretName);
332921
+ }
332922
+ }
332923
+ }
332924
+ }
332925
+ function validateOrgSecretsCrossReferences(renderClaims) {
332926
+ for (const claimKey of Object.keys(renderClaims)) {
332927
+ if (!claimKey.startsWith('OrgSettingsClaim-'))
332928
+ continue;
332929
+ const claimData = renderClaims[claimKey];
332930
+ const claim = claimData?.claim;
332931
+ const orgSecrets = claim?.providers?.github?.org_secrets;
332932
+ if (!orgSecrets || typeof orgSecrets !== 'object')
332933
+ continue;
332934
+ for (const section of ['actions', 'codespaces', 'dependabot']) {
332935
+ const secrets = orgSecrets[section];
332936
+ if (!Array.isArray(secrets))
332937
+ continue;
332938
+ for (const secret of secrets) {
332939
+ if (!secret.value)
332940
+ continue;
332941
+ const match = secret.value.match(SECRETS_CLAIM_REF_PATTERN);
332942
+ if (!match)
332943
+ continue;
332944
+ const [, secretClaimName, secretKey] = match;
332945
+ const expectedKey = `SecretsClaim-${secretClaimName}`;
332946
+ if (!renderClaims[expectedKey])
332947
+ continue;
332948
+ const secretClaim = renderClaims[expectedKey]?.claim;
332949
+ const externalSecrets = secretClaim?.providers?.external_secrets?.externalSecrets?.secrets;
332950
+ const pushSecrets = secretClaim?.providers?.external_secrets?.pushSecrets;
332951
+ let keyFound = false;
332952
+ if (Array.isArray(pushSecrets)) {
332953
+ keyFound =
332954
+ pushSecrets.find((s) => s.secretName === secretKey) !==
332955
+ undefined;
332956
+ }
332957
+ if (!keyFound && Array.isArray(externalSecrets)) {
332958
+ keyFound =
332959
+ externalSecrets.find((s) => s.secretName === secretKey) !==
332960
+ undefined;
332961
+ }
332962
+ if (!keyFound) {
332963
+ throw new Error(`CrossReference error: OrgSettingsClaim/${claim.name} references a non-existent secret key "${secretKey}" in SecretsClaim/${secretClaimName} via org_secrets.${section}.${secret.name}`);
332964
+ }
332965
+ }
332966
+ }
332967
+ }
332968
+ }
332969
+
332224
332970
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/renderer/renderer.ts
332225
332971
 
332226
332972
 
@@ -332232,6 +332978,7 @@ function validateActionsVariablesUniqueness(crs) {
332232
332978
 
332233
332979
 
332234
332980
 
332981
+
332235
332982
  /*
332236
332983
  * Function called when rendering but not importing
332237
332984
  *
@@ -332253,10 +333000,13 @@ async function renderer_render(catalogScope, firestartrScope, claimList) {
332253
333000
  try {
332254
333001
  validateSubReferences(data.renderClaims);
332255
333002
  validateComponentPagesPath(data.renderClaims);
333003
+ validateOrgSecretsCrossReferences(data.renderClaims);
332256
333004
  validateTfStateKeyUniqueness(result);
332257
333005
  validateGithubOrgSettingsSingleton(fullCrSet);
332258
333006
  validateGithubOrgVariableSectionSingleton(fullCrSet);
332259
333007
  validateActionsVariablesUniqueness(result);
333008
+ validateGithubOrgSecretSectionSingleton(fullCrSet);
333009
+ validateSecretNamesUniqueness(result);
332260
333010
  validateCrSizes(result);
332261
333011
  validatePermissionsUniqueness(result);
332262
333012
  }
@@ -333488,27 +334238,33 @@ class RepoGithubDecanter extends GithubDecanter {
333488
334238
  }
333489
334239
  __decantPages() {
333490
334240
  if (this.data.pages) {
333491
- const pagesData = this.data.pages;
333492
- const pagesConfig = {
333493
- buildType: pagesData.build_type,
333494
- ...(typeof pagesData.cname === 'string' && pagesData.cname.length > 0
333495
- ? { cname: pagesData.cname }
333496
- : {}),
333497
- ...(typeof pagesData.public === 'boolean'
333498
- ? { public: pagesData.public }
333499
- : {}),
333500
- ...(typeof pagesData.https_enforced === 'boolean'
333501
- ? { https_enforced: pagesData.https_enforced }
333502
- : {}),
333503
- };
333504
- if (pagesData.build_type === 'legacy') {
333505
- pagesConfig.source = pagesData.source;
334241
+ if (this.data.pages.build_type === 'workflow') {
334242
+ this.__patchClaim({
334243
+ op: 'add',
334244
+ path: '/providers/github/pages',
334245
+ value: {
334246
+ buildType: 'workflow',
334247
+ ...(typeof this.data.pages.cname === 'string' &&
334248
+ this.data.pages.cname.length > 0
334249
+ ? { cname: this.data.pages.cname }
334250
+ : {}),
334251
+ },
334252
+ });
334253
+ }
334254
+ else if (this.data.pages.build_type === 'legacy') {
334255
+ this.__patchClaim({
334256
+ op: 'add',
334257
+ path: '/providers/github/pages',
334258
+ value: {
334259
+ buildType: 'legacy',
334260
+ ...(typeof this.data.pages.cname === 'string' &&
334261
+ this.data.pages.cname.length > 0
334262
+ ? { cname: this.data.pages.cname }
334263
+ : {}),
334264
+ source: this.data.pages.source,
334265
+ },
334266
+ });
333506
334267
  }
333507
- this.__patchClaim({
333508
- op: 'add',
333509
- path: '/providers/github/pages',
333510
- value: pagesConfig,
333511
- });
333512
334268
  }
333513
334269
  }
333514
334270
  __decantOIDC() {
@@ -334583,6 +335339,7 @@ const kindPluralMap = {
334583
335339
  githuborgwebhooks: 'FirestartrGithubOrgWebhook',
334584
335340
  githuborganizationsettings: 'FirestartrGithubOrganizationSettings',
334585
335341
  githuborganizationvariablesections: 'FirestartrGithubOrganizationVariableSection',
335342
+ githuborganizationsecretsections: 'FirestartrGithubOrganizationSecretSection',
334586
335343
  terraformworkspaces: 'FirestartrTerraformWorkspace',
334587
335344
  terraformworkspaceplans: 'FirestartrTerraformWorkspacePlan',
334588
335345
  providerconfigs: 'FirestartrProviderConfig',
@@ -336561,6 +337318,7 @@ const kindsWithFinalizer = [
336561
337318
  'FirestartrGithubOrgWebhook',
336562
337319
  'FirestartrGithubOrganizationSettings',
336563
337320
  'FirestartrGithubOrganizationVariableSection',
337321
+ 'FirestartrGithubOrganizationSecretSection',
336564
337322
  'FirestartrGithubRepositorySecretsSection',
336565
337323
  ];
336566
337324
  const kindsWithDependants = [
@@ -339510,7 +340268,7 @@ async function configGit() {
339510
340268
  }
339511
340269
  // Import github dynamically to avoid Jest ESM issues when not specifically running this function
339512
340270
  // (see CONSTITUTION and RULES: must not change test machinery)
339513
- const githubModule = await Promise.resolve(/* import() */).then(__nccwpck_require__.bind(__nccwpck_require__, 99029));
340271
+ const githubModule = await Promise.resolve(/* import() */).then(__nccwpck_require__.bind(__nccwpck_require__, 3342));
339514
340272
  const github = githubModule.default || githubModule;
339515
340273
  if (external_fs_.existsSync(gitconfigPath)) {
339516
340274
  external_fs_.rmSync(gitconfigPath);
@@ -343079,8 +343837,8 @@ const MODULES = {
343079
343837
  },
343080
343838
  FirestartrGithubRepository: {
343081
343839
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-repo',
343082
- // github-repo feat/1385: add public and https_enforced to pages
343083
- ref: '441b93d8a0d78f6088db096a852305f63a227eaa',
343840
+ // github-repo-v0.9.0
343841
+ ref: '76074c2817032b199962c380481617d99f78d9d7',
343084
343842
  },
343085
343843
  FirestartrGithubRepositoryFeature: {
343086
343844
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-files-set',
@@ -343107,6 +343865,11 @@ const MODULES = {
343107
343865
  // github-org-variables-section-v0.1.0
343108
343866
  ref: 'fb9c01d0a1e03e5134479da13d0faf55891dfedf',
343109
343867
  },
343868
+ FirestartrGithubOrganizationSecretSection: {
343869
+ module: 'git::https://github.com/prefapp/tfm.git//modules/github-org-secrets-section',
343870
+ // feat/1364-feat-add-github-org-secrets-section-module
343871
+ ref: '170e6cf',
343872
+ },
343110
343873
  };
343111
343874
  function getFirestartrDefaultTFM(kind) {
343112
343875
  if (kind in MODULES) {
@@ -343965,14 +344728,14 @@ class EntityGHRepo extends base_Entity {
343965
344728
  },
343966
344729
  });
343967
344730
  }
343968
- async validatePages(tfOp, repoAlreadyExists) {
344731
+ /**
344732
+ * Validation logic for GitHub Pages branch settings:
344733
+ * - On create: If pages branch is set, it must equal the default branch.
344734
+ * - On update: If pages branch is set and is not the default, it must exist in remote.
344735
+ */
344736
+ async validatePagesBranch(tfOp, repoAlreadyExists) {
343969
344737
  const pages = this.cr.spec.pages;
343970
- if (!pages)
343971
- return;
343972
- if (pages.https_enforced && !pages.cname) {
343973
- throw new Error(`[gh-provisioner] ${this.k8sId} https_enforced requires cname to be set in pages configuration`);
343974
- }
343975
- if (!pages.source || !pages.source.branch)
344738
+ if (!pages || !pages.source || !pages.source.branch)
343976
344739
  return;
343977
344740
  const branch = pages.source.branch;
343978
344741
  const defaultBranch = this.cr.spec.repo.defaultBranch;
@@ -343996,6 +344759,7 @@ class EntityGHRepo extends base_Entity {
343996
344759
  if (err && err.status === 404) {
343997
344760
  throw new Error(`Pages branch '${branch}' does not exist in the repository '${org}/${repo}'.`);
343998
344761
  }
344762
+ // Other errors propagate
343999
344763
  throw err;
344000
344764
  }
344001
344765
  }
@@ -344008,7 +344772,7 @@ class EntityGHRepo extends base_Entity {
344008
344772
  return await github["default"].repo.repoExists(this.cr.spec.org, this.cr.name);
344009
344773
  }));
344010
344774
  if (tfOp !== 'destroy' && tfOp !== 'plan-destroy') {
344011
- await this.validatePages(tfOp, repoAlreadyExists);
344775
+ await this.validatePagesBranch(tfOp, repoAlreadyExists);
344012
344776
  }
344013
344777
  await this.provisionRepository();
344014
344778
  this.provisionPages();
@@ -344155,9 +344919,6 @@ class EntityGHRepo extends base_Entity {
344155
344919
  if (this.cr.spec.pages) {
344156
344920
  const source = this.cr.spec.pages.source ?? {};
344157
344921
  const buildType = this.cr.spec.pages.buildType ?? 'legacy';
344158
- const cname = this.cr.spec.pages.cname;
344159
- const public_ = this.cr.spec.pages.public;
344160
- const httpsEnforced = this.cr.spec.pages.https_enforced;
344161
344922
  this.patchData({
344162
344923
  path: '/config/pages',
344163
344924
  op: PatchOperations.add,
@@ -344171,11 +344932,7 @@ class EntityGHRepo extends base_Entity {
344171
344932
  },
344172
344933
  }
344173
344934
  : {}),
344174
- ...(cname !== undefined ? { cname } : {}),
344175
- ...(public_ !== undefined ? { public: public_ } : {}),
344176
- ...(httpsEnforced !== undefined
344177
- ? { https_enforced: httpsEnforced }
344178
- : {}),
344935
+ cname: this.cr.spec.pages.cname,
344179
344936
  },
344180
344937
  });
344181
344938
  }
@@ -345003,6 +345760,206 @@ class EntityGHOrgVarsSection extends base_Entity {
345003
345760
  async loadAddressesToImport() { }
345004
345761
  }
345005
345762
 
345763
+ ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgsecretsection/secrets.ts
345764
+
345765
+
345766
+
345767
+
345768
+ const secrets_SECTIONS = ['actions', 'codespaces', 'dependabot'];
345769
+
345770
+ async function provisionOrgSecrets(entity, secrets) {
345771
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${entity.k8sId} provisioning org secrets`);
345772
+ for (const section of secrets_SECTIONS) {
345773
+ const sectionSecrets = secrets[section] || [];
345774
+ if (sectionSecrets.length === 0)
345775
+ continue;
345776
+ let preFetchedKey;
345777
+ try {
345778
+ preFetchedKey = await fetchOrgPublicKey(entity, section);
345779
+ }
345780
+ catch (err) {
345781
+ const message = err instanceof Error ? err.message : String(err);
345782
+ throw new Error(`[gh-provisioner] ${entity.k8sId} failed to fetch ${section} org public key: ${message}`);
345783
+ }
345784
+ for (const secret of sectionSecrets) {
345785
+ await provisionOrgSecret(entity, section, secret, preFetchedKey);
345786
+ }
345787
+ }
345788
+ }
345789
+ async function fetchOrgPublicKey(entity, section) {
345790
+ return (await entity.runWithGithubProvider(async () => {
345791
+ return await github["default"].encryption.getOrgPublicKey(entity.cr.spec.org, section);
345792
+ }));
345793
+ }
345794
+ async function provisionOrgSecret(entity, section, secret, preFetchedKey) {
345795
+ gh_provisioner_src_logger.info(`[gh-provisioner] provisioning org secret ${entity.k8sId}/${section}/${secret.name}`);
345796
+ if (process.env['AVOID_PROVIDER_SECRET_ENCRYPTION']) {
345797
+ await secrets_createUnencryptedSecret(entity, section, secret);
345798
+ }
345799
+ else {
345800
+ await secrets_createEncryptedSecret(entity, section, secret, preFetchedKey);
345801
+ }
345802
+ gh_provisioner_src_logger.info(`[gh-provisioner] org secret provisioned ${section}/${secret.name}`);
345803
+ }
345804
+ async function secrets_createEncryptedSecret(entity, section, secret, preFetchedKey) {
345805
+ const plainSecret = base_Entity.refResolver(secret.ref);
345806
+ const plainTextSecret = plainSecret.getOutput(secret.ref.key);
345807
+ const plaintextSha256 = external_crypto_default().createHash('sha256')
345808
+ .update(plainTextSecret)
345809
+ .digest('hex');
345810
+ const { encrypted_value } = (await entity.runWithGithubProvider(async () => {
345811
+ return await github["default"].encryption.encryptOrgSecret(entity.cr.spec.org, section, plainTextSecret, preFetchedKey);
345812
+ }));
345813
+ entity.patchData({
345814
+ op: PatchOperations.add,
345815
+ path: `/config/${section}/${secret.name}`,
345816
+ value: {
345817
+ value: encrypted_value,
345818
+ visibility: secret.visibility || 'all',
345819
+ ...(secret.selectedRepositories && secret.selectedRepositories.length > 0
345820
+ ? { selected_repositories: secret.selectedRepositories }
345821
+ : {}),
345822
+ },
345823
+ });
345824
+ entity.patchData({
345825
+ op: PatchOperations.add,
345826
+ path: `/config/${section}_sha256/${secret.name}`,
345827
+ value: plaintextSha256,
345828
+ });
345829
+ }
345830
+ async function secrets_createUnencryptedSecret(entity, section, secret) {
345831
+ const plainSecret = base_Entity.refResolver(secret.ref);
345832
+ const plainTextSecret = plainSecret.getOutput(secret.ref.key);
345833
+ const plaintextSha256 = external_crypto_default().createHash('sha256')
345834
+ .update(plainTextSecret)
345835
+ .digest('hex');
345836
+ entity.patchData({
345837
+ op: PatchOperations.add,
345838
+ path: `/config/${section}/${secret.name}`,
345839
+ value: {
345840
+ value: plainTextSecret,
345841
+ visibility: secret.visibility || 'all',
345842
+ ...(secret.selectedRepositories && secret.selectedRepositories.length > 0
345843
+ ? { selected_repositories: secret.selectedRepositories }
345844
+ : {}),
345845
+ },
345846
+ });
345847
+ entity.patchData({
345848
+ op: PatchOperations.add,
345849
+ path: `/config/${section}_sha256/${secret.name}`,
345850
+ value: plaintextSha256,
345851
+ });
345852
+ }
345853
+ async function adoptSecretsIfNeeded(entity, secrets) {
345854
+ const managedSecrets = entity.cr.fResolveSelfOutputs('managed_secrets') || [];
345855
+ for (const section of secrets_SECTIONS) {
345856
+ const sectionSecrets = secrets[section] || [];
345857
+ if (sectionSecrets.length === 0)
345858
+ continue;
345859
+ const declaredNames = sectionSecrets.map((s) => s.name);
345860
+ const newToModule = declaredNames.filter((name) => !managedSecrets.includes(name));
345861
+ if (newToModule.length === 0) {
345862
+ gh_provisioner_src_logger.debug(`[gh-provisioner] ${entity.k8sId} all declared ${section} secrets are already managed`);
345863
+ continue;
345864
+ }
345865
+ if (managedSecrets.length === 0) {
345866
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${entity.k8sId} no managed_secrets output — first reconciliation, treating all ${newToModule.length} ${section} secret(s) as new to module`);
345867
+ }
345868
+ for (const secretName of newToModule) {
345869
+ try {
345870
+ const existing = (await entity.runWithGithubProvider(async () => {
345871
+ return await github["default"].encryption.getOrgSecret(entity.cr.spec.org, section, secretName);
345872
+ }));
345873
+ if (existing) {
345874
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${entity.k8sId} adopting pre-existing ${section} secret '${secretName}' on GitHub org '${entity.cr.spec.org}'`);
345875
+ const resourceType = `github_${section}_organization_secret`;
345876
+ entity.patchImportData({
345877
+ op: PatchOperations.add,
345878
+ path: '/imports/-',
345879
+ value: {
345880
+ to: `${resourceType}.this["${secretName}"]`,
345881
+ id: secretName,
345882
+ },
345883
+ });
345884
+ const secretEntry = sectionSecrets.find((s) => s.name === secretName);
345885
+ if (secretEntry &&
345886
+ secretEntry.visibility === 'selected' &&
345887
+ (section === 'actions' || section === 'dependabot')) {
345888
+ const bindingType = `github_${section}_organization_secret_repositories`;
345889
+ entity.patchImportData({
345890
+ op: PatchOperations.add,
345891
+ path: '/imports/-',
345892
+ value: {
345893
+ to: `${bindingType}.this["${secretName}"]`,
345894
+ id: secretName,
345895
+ },
345896
+ });
345897
+ }
345898
+ }
345899
+ }
345900
+ catch (err) {
345901
+ if (err && err.status === 404) {
345902
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${entity.k8sId} ${section} secret '${secretName}' not found on GitHub org '${entity.cr.spec.org}' — will be created by TFM`);
345903
+ }
345904
+ else if (err && (err.status === 401 || err.status === 403)) {
345905
+ gh_provisioner_src_logger.warn(`[gh-provisioner] ${entity.k8sId} token lacks scope to check ${section} secret '${secretName}' on org '${entity.cr.spec.org}' — skipping adoption gracefully`);
345906
+ }
345907
+ else {
345908
+ gh_provisioner_src_logger.warn(`[gh-provisioner] ${entity.k8sId} unexpected error checking ${section} secret '${secretName}' on org '${entity.cr.spec.org}': ${err instanceof Error ? err.message : String(err)}`);
345909
+ }
345910
+ }
345911
+ }
345912
+ }
345913
+ }
345914
+
345915
+ ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgsecretsection/index.ts
345916
+
345917
+
345918
+
345919
+ class EntityGHOrgSecretSection extends base_Entity {
345920
+ constructor(artifact) {
345921
+ super(artifact, {
345922
+ config: {
345923
+ org: '',
345924
+ actions: {},
345925
+ codespaces: {},
345926
+ dependabot: {},
345927
+ actions_sha256: {},
345928
+ codespaces_sha256: {},
345929
+ dependabot_sha256: {},
345930
+ },
345931
+ });
345932
+ }
345933
+ async loadResources(tfOp) {
345934
+ gh_provisioner_src_logger.info(`[gh-provisioner] running ${tfOp} on ${this.k8sId}`);
345935
+ try {
345936
+ const cr = this.cr;
345937
+ const org = cr.spec.org;
345938
+ const secrets = cr.spec.secrets || {};
345939
+ this.patchData({
345940
+ op: PatchOperations.replace,
345941
+ path: '/config/org',
345942
+ value: org,
345943
+ });
345944
+ await provisionOrgSecrets(this, secrets);
345945
+ const redactedDoc = JSON.parse(JSON.stringify(this._document, (key, value) => typeof value === 'string' && value.length > 50 ? '[REDACTED]' : value));
345946
+ this.synthMessage(`[gh-provisioner] ${this.k8sId} config:\n${JSON.stringify(redactedDoc, null, 2)}`);
345947
+ this.synthEnd(`[gh-provisioner] ${this.k8sId} loaded its data`);
345948
+ if (tfOp === 'apply') {
345949
+ await adoptSecretsIfNeeded(this, secrets);
345950
+ }
345951
+ gh_provisioner_src_logger.debug(`[gh-provisioner] ${this.k8sId} loaded its data`);
345952
+ }
345953
+ catch (err) {
345954
+ const message = err instanceof Error ? err.message : String(err);
345955
+ gh_provisioner_src_logger.error(`[gh-provisioner] ${this.k8sId} error loading resources: ${message}`);
345956
+ throw new Error(`[gh-provisioner] ${this.k8sId} error loading resources: ${message}`);
345957
+ }
345958
+ }
345959
+ async postProvision(_tfOp) { }
345960
+ async loadAddressesToImport() { }
345961
+ }
345962
+
345006
345963
  ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgwebhook/index.ts
345007
345964
 
345008
345965
 
@@ -345080,6 +346037,7 @@ class EntityGHOrgWebHook extends base_Entity {
345080
346037
 
345081
346038
 
345082
346039
 
346040
+
345083
346041
  function entities_getEntity(cr) {
345084
346042
  const entityClass = getEntityClass(cr.kind);
345085
346043
  return new entityClass(cr);
@@ -345102,6 +346060,8 @@ function getEntityClass(kind) {
345102
346060
  return EntityGHOrgSettings;
345103
346061
  case 'FirestartrGithubOrganizationVariableSection':
345104
346062
  return EntityGHOrgVarsSection;
346063
+ case 'FirestartrGithubOrganizationSecretSection':
346064
+ return EntityGHOrgSecretSection;
345105
346065
  default:
345106
346066
  throw new Error(`kind ${kind} has no entity associated`);
345107
346067
  }
@@ -346851,6 +347811,7 @@ const provisionImplementations = {
346851
347811
  githuborgwebhooks: process_operation_processOperation,
346852
347812
  githuborganizationsettings: process_operation_processOperation,
346853
347813
  githuborganizationvariablesections: process_operation_processOperation,
347814
+ githuborganizationsecretsections: process_operation_processOperation,
346854
347815
  fsdummiesa: processFirestartrDummies,
346855
347816
  fsdummiesb: processFirestartrDummies,
346856
347817
  fsdummiesc: processFirestartrDummies,
@@ -525669,7 +526630,7 @@ const crsStatusSubcommand = {
525669
526630
  };
525670
526631
 
525671
526632
  ;// CONCATENATED MODULE: ./package.json
525672
- const package_namespaceObject = JSON.parse('{"i8":"2.11.0-snapshot-gh-pages-public-https-1"}');
526633
+ const package_namespaceObject = JSON.parse('{"i8":"2.11.0-snapshot-orgsettings-binding-1"}');
525673
526634
  ;// CONCATENATED MODULE: ../../package.json
525674
526635
  const package_namespaceObject_1 = {"i8":"2.10.0"};
525675
526636
  // EXTERNAL MODULE: ../../node_modules/semver/index.js