@firestartr/cli 2.11.0-snapshot-orgsettings-binding-1 → 2.11.0-snapshot-objects-in-patches

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -280314,7 +280314,7 @@ function getCronNextInterval(cronLine, tz) {
280314
280314
 
280315
280315
  /***/ }),
280316
280316
 
280317
- /***/ 3342:
280317
+ /***/ 99029:
280318
280318
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
280319
280319
 
280320
280320
  // ESM COMPAT FLAG
@@ -285979,66 +285979,6 @@ 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
-
286042
285982
  ;// CONCATENATED MODULE: ../github/src/profile.ts
286043
285983
  // Profile definitions and store for github package (immutable and ambient profiles)
286044
285984
  const profileStore = new Map();
@@ -286472,7 +286412,6 @@ function withProfile(profileName) {
286472
286412
 
286473
286413
 
286474
286414
 
286475
-
286476
286415
  /* harmony default export */ const github = ({
286477
286416
  org: organization,
286478
286417
  repo: repository,
@@ -286495,9 +286434,6 @@ function withProfile(profileName) {
286495
286434
  encryption: {
286496
286435
  encryptRepoSecret: encryptRepoSecret,
286497
286436
  getRepoPublicKey: getRepoPublicKey,
286498
- getOrgPublicKey: getOrgPublicKey,
286499
- encryptOrgSecret: encryptOrgSecret,
286500
- getOrgSecret: getOrgSecret,
286501
286437
  },
286502
286438
  withProfile: withProfile,
286503
286439
  createProfile: createProfile,
@@ -319398,8 +319334,8 @@ var dist = __nccwpck_require__(44516);
319398
319334
  var dist_default = /*#__PURE__*/__nccwpck_require__.n(dist);
319399
319335
  // EXTERNAL MODULE: ../catalog_common/index.ts + 44 modules
319400
319336
  var catalog_common = __nccwpck_require__(78542);
319401
- // EXTERNAL MODULE: ../github/index.ts + 38 modules
319402
- var github = __nccwpck_require__(3342);
319337
+ // EXTERNAL MODULE: ../github/index.ts + 37 modules
319338
+ var github = __nccwpck_require__(99029);
319403
319339
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/patches/base.ts
319404
319340
  class BasePatches {
319405
319341
  constructor() { }
@@ -322167,31 +322103,6 @@ function extractAllRefs(claimData) {
322167
322103
  }
322168
322104
  }
322169
322105
  }
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
- }
322195
322106
  break;
322196
322107
  }
322197
322108
  }
@@ -323363,30 +323274,6 @@ const organizationSettingsProperties = {
323363
323274
  ],
323364
323275
  },
323365
323276
  },
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
- },
323390
323277
  };
323391
323278
  /* harmony default export */ const github_orgsettings_schema = ({
323392
323279
  $schema: SCHEMA,
@@ -323574,75 +323461,6 @@ const organizationSettingsProperties = {
323574
323461
  },
323575
323462
  });
323576
323463
 
323577
- ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/orgSecrets.schema.ts
323578
-
323579
- /* harmony default export */ const orgSecrets_schema = ({
323580
- $schema: SCHEMA,
323581
- $id: 'GithubOrgClaimSecrets',
323582
- definitions: {
323583
- GithubOrgClaimSecrets: {
323584
- $id: 'firestartr.dev://github/GithubOrgClaimSecrets',
323585
- type: 'object',
323586
- description: 'Organization-level GitHub Actions secrets',
323587
- properties: {
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',
323604
- },
323605
- },
323606
- },
323607
- additionalProperties: false,
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
- },
323639
- },
323640
- required: ['name', 'value'],
323641
- additionalProperties: false,
323642
- },
323643
- },
323644
- });
323645
-
323646
323464
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/index.ts
323647
323465
 
323648
323466
 
@@ -323652,7 +323470,6 @@ const organizationSettingsProperties = {
323652
323470
 
323653
323471
 
323654
323472
 
323655
-
323656
323473
  const GithubSchemas = [
323657
323474
  github_group_schema,
323658
323475
  github_user_schema,
@@ -323662,7 +323479,6 @@ const GithubSchemas = [
323662
323479
  github_orgsettings_schema,
323663
323480
  component_secrets_vars_schema,
323664
323481
  component_labels_schema,
323665
- orgSecrets_schema,
323666
323482
  ];
323667
323483
 
323668
323484
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/tfworkspaces/terraform.schema.ts
@@ -327674,382 +327490,6 @@ var FirestartrGithubMembershipSpecContextProviderRefKind;
327674
327490
  /** FirestartrProviderConfig */
327675
327491
  FirestartrGithubMembershipSpecContextProviderRefKind["FIRESTARTR_PROVIDER_CONFIG"] = "FirestartrProviderConfig";
327676
327492
  })(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 = {}));
328053
327493
  /**
328054
327494
  * A resource to handle GitHub Organization Settings.
328055
327495
  *
@@ -331464,78 +330904,6 @@ class GithubOrgVariableSectionChart extends BaseGithubChart {
331464
330904
  }
331465
330905
  }
331466
330906
 
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
-
331539
330907
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/github/index.ts
331540
330908
 
331541
330909
 
@@ -331544,7 +330912,6 @@ class GithubOrgSecretSectionChart extends BaseGithubChart {
331544
330912
 
331545
330913
 
331546
330914
 
331547
-
331548
330915
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/charts/catalog/base.ts
331549
330916
 
331550
330917
  class BaseCatalogChart extends BaseChart {
@@ -332293,7 +331660,6 @@ class SecretsChart extends BaseSecretsChart {
332293
331660
  GithubOrgWebhookChart: GithubOrgWebhookChart,
332294
331661
  GithubOrgSettingsChart: GithubOrgSettingsChart,
332295
331662
  GithubOrgVariableSectionChart: GithubOrgVariableSectionChart,
332296
- GithubOrgSecretSectionChart: GithubOrgSecretSectionChart,
332297
331663
  });
332298
331664
 
332299
331665
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/renderer/claims-render.ts
@@ -332345,21 +331711,16 @@ async function renderClaims(catalogScope, firestartrScope, data) {
332345
331711
  const variableSectionPreviousCR = claim.kind === 'OrgSettingsClaim'
332346
331712
  ? getPreviousCRfromClaim({ kind: claim.kind, name: `${claim.name}-variable-section` }, crs, 'FirestartrGithubOrganizationVariableSection')
332347
331713
  : false;
332348
- const secretSectionPreviousCR = claim.kind === 'OrgSettingsClaim'
332349
- ? getPreviousCRfromClaim({ kind: claim.kind, name: `${claim.name}-secret-section` }, crs, 'FirestartrGithubOrganizationSecretSection')
332350
- : false;
332351
331714
  const patches = await extractPatches(renderClaims[claimKey], previousCR);
332352
331715
  let variableSectionPatches = undefined;
332353
- let secretSectionPatches = undefined;
332354
331716
  if (claim.kind === 'OrgSettingsClaim') {
332355
331717
  variableSectionPatches = await extractPatches(renderClaims[claimKey], variableSectionPreviousCR);
332356
- secretSectionPatches = await extractPatches(renderClaims[claimKey], secretSectionPreviousCR);
332357
331718
  }
332358
331719
  if (!previousCR) {
332359
331720
  logger.debug(`No CR found for claim ${claimKey}, it will be rendered from scratch`);
332360
331721
  }
332361
331722
  const claimPath = renderClaims[claimKey].claimPath;
332362
- const { firestartrEntity, extraCharts, catalogEntity } = await renderClaim(catalogScope, firestartrScope, claim, patches, previousCR, claimPath, variableSectionPreviousCR, variableSectionPatches, secretSectionPreviousCR, secretSectionPatches);
331723
+ const { firestartrEntity, extraCharts, catalogEntity } = await renderClaim(catalogScope, firestartrScope, claim, patches, previousCR, claimPath, variableSectionPreviousCR, variableSectionPatches);
332363
331724
  if (catalogEntity) {
332364
331725
  result[`${catalogEntity.kind}-${catalogEntity.metadata.name}`] =
332365
331726
  catalogEntity.toJson();
@@ -332388,7 +331749,7 @@ async function renderClaims(catalogScope, firestartrScope, data) {
332388
331749
  }
332389
331750
  return result;
332390
331751
  }
332391
- async function renderClaim(catalogScope, firestartrScope, claim, patches, previousCR = null, claimPath, variableSectionPreviousCR = false, variableSectionPatches, secretSectionPreviousCR = false, secretSectionPatches) {
331752
+ async function renderClaim(catalogScope, firestartrScope, claim, patches, previousCR = null, claimPath, variableSectionPreviousCR = false, variableSectionPatches) {
332392
331753
  let catalogEntity = undefined;
332393
331754
  let firestartrEntity = undefined;
332394
331755
  const extraCharts = [];
@@ -332557,27 +331918,6 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
332557
331918
  },
332558
331919
  chart: variableSectionObject,
332559
331920
  });
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
- });
332581
331921
  }
332582
331922
  break;
332583
331923
  default:
@@ -332700,33 +332040,8 @@ function searchSecretKey(secretClaim, key) {
332700
332040
  }
332701
332041
  function validateOrgSettingsComponentRefs(ref, renderClaims) {
332702
332042
  const claim = renderClaims[ref].claim;
332703
- validateOrgSecretsSelectedRepositories(claim, renderClaims);
332704
332043
  validateActionsVariablesSelectedRepositories(claim, renderClaims);
332705
332044
  }
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
- }
332730
332045
  function validateActionsVariablesSelectedRepositories(claim, renderClaims) {
332731
332046
  const actionsVariables = claim?.providers?.github?.actions_variables;
332732
332047
  if (!Array.isArray(actionsVariables))
@@ -332857,116 +332172,6 @@ function validateActionsVariablesUniqueness(crs) {
332857
332172
  }
332858
332173
  }
332859
332174
 
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
-
332970
332175
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/renderer/renderer.ts
332971
332176
 
332972
332177
 
@@ -332978,7 +332183,6 @@ function validateOrgSecretsCrossReferences(renderClaims) {
332978
332183
 
332979
332184
 
332980
332185
 
332981
-
332982
332186
  /*
332983
332187
  * Function called when rendering but not importing
332984
332188
  *
@@ -333000,13 +332204,10 @@ async function renderer_render(catalogScope, firestartrScope, claimList) {
333000
332204
  try {
333001
332205
  validateSubReferences(data.renderClaims);
333002
332206
  validateComponentPagesPath(data.renderClaims);
333003
- validateOrgSecretsCrossReferences(data.renderClaims);
333004
332207
  validateTfStateKeyUniqueness(result);
333005
332208
  validateGithubOrgSettingsSingleton(fullCrSet);
333006
332209
  validateGithubOrgVariableSectionSingleton(fullCrSet);
333007
332210
  validateActionsVariablesUniqueness(result);
333008
- validateGithubOrgSecretSectionSingleton(fullCrSet);
333009
- validateSecretNamesUniqueness(result);
333010
332211
  validateCrSizes(result);
333011
332212
  validatePermissionsUniqueness(result);
333012
332213
  }
@@ -335339,7 +334540,6 @@ const kindPluralMap = {
335339
334540
  githuborgwebhooks: 'FirestartrGithubOrgWebhook',
335340
334541
  githuborganizationsettings: 'FirestartrGithubOrganizationSettings',
335341
334542
  githuborganizationvariablesections: 'FirestartrGithubOrganizationVariableSection',
335342
- githuborganizationsecretsections: 'FirestartrGithubOrganizationSecretSection',
335343
334543
  terraformworkspaces: 'FirestartrTerraformWorkspace',
335344
334544
  terraformworkspaceplans: 'FirestartrTerraformWorkspacePlan',
335345
334545
  providerconfigs: 'FirestartrProviderConfig',
@@ -337318,7 +336518,6 @@ const kindsWithFinalizer = [
337318
336518
  'FirestartrGithubOrgWebhook',
337319
336519
  'FirestartrGithubOrganizationSettings',
337320
336520
  'FirestartrGithubOrganizationVariableSection',
337321
- 'FirestartrGithubOrganizationSecretSection',
337322
336521
  'FirestartrGithubRepositorySecretsSection',
337323
336522
  ];
337324
336523
  const kindsWithDependants = [
@@ -340268,7 +339467,7 @@ async function configGit() {
340268
339467
  }
340269
339468
  // Import github dynamically to avoid Jest ESM issues when not specifically running this function
340270
339469
  // (see CONSTITUTION and RULES: must not change test machinery)
340271
- const githubModule = await Promise.resolve(/* import() */).then(__nccwpck_require__.bind(__nccwpck_require__, 3342));
339470
+ const githubModule = await Promise.resolve(/* import() */).then(__nccwpck_require__.bind(__nccwpck_require__, 99029));
340272
339471
  const github = githubModule.default || githubModule;
340273
339472
  if (external_fs_.existsSync(gitconfigPath)) {
340274
339473
  external_fs_.rmSync(gitconfigPath);
@@ -343865,11 +343064,6 @@ const MODULES = {
343865
343064
  // github-org-variables-section-v0.1.0
343866
343065
  ref: 'fb9c01d0a1e03e5134479da13d0faf55891dfedf',
343867
343066
  },
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
- },
343873
343067
  };
343874
343068
  function getFirestartrDefaultTFM(kind) {
343875
343069
  if (kind in MODULES) {
@@ -345760,206 +344954,6 @@ class EntityGHOrgVarsSection extends base_Entity {
345760
344954
  async loadAddressesToImport() { }
345761
344955
  }
345762
344956
 
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
-
345963
344957
  ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghorgwebhook/index.ts
345964
344958
 
345965
344959
 
@@ -346037,7 +345031,6 @@ class EntityGHOrgWebHook extends base_Entity {
346037
345031
 
346038
345032
 
346039
345033
 
346040
-
346041
345034
  function entities_getEntity(cr) {
346042
345035
  const entityClass = getEntityClass(cr.kind);
346043
345036
  return new entityClass(cr);
@@ -346060,8 +345053,6 @@ function getEntityClass(kind) {
346060
345053
  return EntityGHOrgSettings;
346061
345054
  case 'FirestartrGithubOrganizationVariableSection':
346062
345055
  return EntityGHOrgVarsSection;
346063
- case 'FirestartrGithubOrganizationSecretSection':
346064
- return EntityGHOrgSecretSection;
346065
345056
  default:
346066
345057
  throw new Error(`kind ${kind} has no entity associated`);
346067
345058
  }
@@ -347811,7 +346802,6 @@ const provisionImplementations = {
347811
346802
  githuborgwebhooks: process_operation_processOperation,
347812
346803
  githuborganizationsettings: process_operation_processOperation,
347813
346804
  githuborganizationvariablesections: process_operation_processOperation,
347814
- githuborganizationsecretsections: process_operation_processOperation,
347815
346805
  fsdummiesa: processFirestartrDummies,
347816
346806
  fsdummiesb: processFirestartrDummies,
347817
346807
  fsdummiesc: processFirestartrDummies,
@@ -526630,7 +525620,7 @@ const crsStatusSubcommand = {
526630
525620
  };
526631
525621
 
526632
525622
  ;// CONCATENATED MODULE: ./package.json
526633
- const package_namespaceObject = JSON.parse('{"i8":"2.11.0-snapshot-orgsettings-binding-1"}');
525623
+ const package_namespaceObject = JSON.parse('{"i8":"2.11.0-snapshot-objects-in-patches"}');
526634
525624
  ;// CONCATENATED MODULE: ../../package.json
526635
525625
  const package_namespaceObject_1 = {"i8":"2.10.0"};
526636
525626
  // EXTERNAL MODULE: ../../node_modules/semver/index.js