@firestartr/cli 2.10.0-snapshot-org-secrets-3 → 2.10.0-snapshot-org-secrets-validation-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.
package/build/index.js
CHANGED
|
@@ -332479,12 +332479,16 @@ function renameVariantCrFiles(outputDir, renderedMap) {
|
|
|
332479
332479
|
|
|
332480
332480
|
const IS_COMPONENT_CLAIM_REF = new RegExp(/^ComponentClaim-/);
|
|
332481
332481
|
const IS_TF_WORKSPACE = new RegExp(/^TFWorkspaceClaim-/);
|
|
332482
|
+
const IS_ORG_SETTINGS_CLAIM = new RegExp(/^OrgSettingsClaim-/);
|
|
332483
|
+
const COMPONENT_REF_PATTERN = /^component:(.+)$/;
|
|
332482
332484
|
function validateSubReferences(renderClaims) {
|
|
332483
332485
|
for (const ref of Object.keys(renderClaims)) {
|
|
332484
332486
|
if (IS_COMPONENT_CLAIM_REF.test(ref))
|
|
332485
332487
|
validateClaimsSecretsRefs(ref, renderClaims);
|
|
332486
332488
|
else if (IS_TF_WORKSPACE.test(ref))
|
|
332487
332489
|
validateTFClaimsSecretsRefs(ref, renderClaims);
|
|
332490
|
+
else if (IS_ORG_SETTINGS_CLAIM.test(ref))
|
|
332491
|
+
validateOrgSettingsComponentRefs(ref, renderClaims);
|
|
332488
332492
|
}
|
|
332489
332493
|
}
|
|
332490
332494
|
function validateTFClaimsSecretsRefs(ref, renderClaims) {
|
|
@@ -332536,6 +332540,57 @@ function searchSecretKey(secretClaim, key) {
|
|
|
332536
332540
|
}
|
|
332537
332541
|
return found;
|
|
332538
332542
|
}
|
|
332543
|
+
function validateOrgSettingsComponentRefs(ref, renderClaims) {
|
|
332544
|
+
const claim = renderClaims[ref].claim;
|
|
332545
|
+
validateOrgSecretsSelectedRepositories(claim, renderClaims);
|
|
332546
|
+
validateActionsVariablesSelectedRepositories(claim, renderClaims);
|
|
332547
|
+
}
|
|
332548
|
+
function validateOrgSecretsSelectedRepositories(claim, renderClaims) {
|
|
332549
|
+
const orgSecrets = claim?.providers?.github?.org_secrets;
|
|
332550
|
+
if (!orgSecrets || typeof orgSecrets !== 'object')
|
|
332551
|
+
return;
|
|
332552
|
+
for (const section of ['actions', 'codespaces', 'dependabot']) {
|
|
332553
|
+
const secrets = orgSecrets[section];
|
|
332554
|
+
if (!Array.isArray(secrets))
|
|
332555
|
+
continue;
|
|
332556
|
+
for (const secret of secrets) {
|
|
332557
|
+
if (!secret.selected_repositories)
|
|
332558
|
+
continue;
|
|
332559
|
+
for (const repoRef of secret.selected_repositories) {
|
|
332560
|
+
const match = repoRef.match(COMPONENT_REF_PATTERN);
|
|
332561
|
+
if (!match)
|
|
332562
|
+
continue;
|
|
332563
|
+
const [, componentName] = match;
|
|
332564
|
+
const expectedKey = `ComponentClaim-${componentName}`;
|
|
332565
|
+
if (!renderClaims[expectedKey]) {
|
|
332566
|
+
throw new Error(`CrossReference error: OrgSettingsClaim/${claim.name} references a non-existent component "${componentName}" in org_secrets.${section}.${secret.name}.selected_repositories`);
|
|
332567
|
+
}
|
|
332568
|
+
}
|
|
332569
|
+
}
|
|
332570
|
+
}
|
|
332571
|
+
}
|
|
332572
|
+
function validateActionsVariablesSelectedRepositories(claim, renderClaims) {
|
|
332573
|
+
const actionsVariables = claim?.providers?.github?.actions_variables;
|
|
332574
|
+
if (!Array.isArray(actionsVariables))
|
|
332575
|
+
return;
|
|
332576
|
+
for (const variable of actionsVariables) {
|
|
332577
|
+
if (variable.visibility !== 'selected')
|
|
332578
|
+
continue;
|
|
332579
|
+
const selectedRepos = variable.selected_repositories;
|
|
332580
|
+
if (!Array.isArray(selectedRepos) || selectedRepos.length === 0)
|
|
332581
|
+
continue;
|
|
332582
|
+
for (const ref of selectedRepos) {
|
|
332583
|
+
const match = ref.match(COMPONENT_REF_PATTERN);
|
|
332584
|
+
if (!match)
|
|
332585
|
+
continue;
|
|
332586
|
+
const componentName = match[1];
|
|
332587
|
+
const expectedKey = `ComponentClaim-${componentName}`;
|
|
332588
|
+
if (!renderClaims[expectedKey]) {
|
|
332589
|
+
throw new Error(`CrossReference error: OrgSettingsClaim/${claim.name} references a non-existent component "${componentName}" in actions_variables.${variable.name}.selected_repositories`);
|
|
332590
|
+
}
|
|
332591
|
+
}
|
|
332592
|
+
}
|
|
332593
|
+
}
|
|
332539
332594
|
|
|
332540
332595
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/componentPagesPath.ts
|
|
332541
332596
|
/**
|
|
@@ -332588,7 +332643,6 @@ function validateGithubOrgSettingsSingleton(crs) {
|
|
|
332588
332643
|
const GITHUB_ORG_VARIABLE_SECTION_KIND = 'FirestartrGithubOrganizationVariableSection';
|
|
332589
332644
|
const githubOrgVariableSection_FIRESTARTR_CLAIM_REF_ANNOTATION = 'firestartr.dev/claim-ref';
|
|
332590
332645
|
const githubOrgVariableSection_CLAIM_REF_LABEL = 'claim-ref';
|
|
332591
|
-
const COMPONENT_REF_PATTERN = /^component:(.+)$/;
|
|
332592
332646
|
function githubOrgVariableSection_formatResourceRef(name, claimRef) {
|
|
332593
332647
|
return claimRef ? `${name} (claim: ${claimRef})` : name;
|
|
332594
332648
|
}
|
|
@@ -332644,34 +332698,6 @@ function validateActionsVariablesUniqueness(crs) {
|
|
|
332644
332698
|
}
|
|
332645
332699
|
}
|
|
332646
332700
|
}
|
|
332647
|
-
function validateActionsVariablesSelectedRepositories(renderClaims) {
|
|
332648
|
-
for (const claimKey of Object.keys(renderClaims)) {
|
|
332649
|
-
if (!claimKey.startsWith('OrgSettingsClaim-'))
|
|
332650
|
-
continue;
|
|
332651
|
-
const claimData = renderClaims[claimKey];
|
|
332652
|
-
const claim = claimData?.claim;
|
|
332653
|
-
const actionsVariables = claim?.providers?.github?.actions_variables;
|
|
332654
|
-
if (!Array.isArray(actionsVariables))
|
|
332655
|
-
continue;
|
|
332656
|
-
for (const variable of actionsVariables) {
|
|
332657
|
-
if (variable.visibility !== 'selected')
|
|
332658
|
-
continue;
|
|
332659
|
-
const selectedRepos = variable.selected_repositories;
|
|
332660
|
-
if (!Array.isArray(selectedRepos) || selectedRepos.length === 0)
|
|
332661
|
-
continue;
|
|
332662
|
-
for (const ref of selectedRepos) {
|
|
332663
|
-
const match = ref.match(COMPONENT_REF_PATTERN);
|
|
332664
|
-
if (!match)
|
|
332665
|
-
continue;
|
|
332666
|
-
const componentName = match[1];
|
|
332667
|
-
const expectedKey = `ComponentClaim-${componentName}`;
|
|
332668
|
-
if (!renderClaims[expectedKey]) {
|
|
332669
|
-
throw new Error(`CrossReference error: OrgSettingsClaim/${claim.name} references a non-existent component "${componentName}" in actions_variables.${variable.name}.selected_repositories`);
|
|
332670
|
-
}
|
|
332671
|
-
}
|
|
332672
|
-
}
|
|
332673
|
-
}
|
|
332674
|
-
}
|
|
332675
332701
|
|
|
332676
332702
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/githubOrgSecretSection.ts
|
|
332677
332703
|
const GITHUB_ORG_SECRET_SECTION_KIND = 'FirestartrGithubOrganizationSecretSection';
|
|
@@ -332816,7 +332842,6 @@ async function renderer_render(catalogScope, firestartrScope, claimList) {
|
|
|
332816
332842
|
try {
|
|
332817
332843
|
validateSubReferences(data.renderClaims);
|
|
332818
332844
|
validateComponentPagesPath(data.renderClaims);
|
|
332819
|
-
validateActionsVariablesSelectedRepositories(data.renderClaims);
|
|
332820
332845
|
validateOrgSecretsCrossReferences(data.renderClaims);
|
|
332821
332846
|
validateTfStateKeyUniqueness(result);
|
|
332822
332847
|
validateGithubOrgSettingsSingleton(fullCrSet);
|
|
@@ -526235,7 +526260,7 @@ const crsStatusSubcommand = {
|
|
|
526235
526260
|
};
|
|
526236
526261
|
|
|
526237
526262
|
;// CONCATENATED MODULE: ./package.json
|
|
526238
|
-
const package_namespaceObject = JSON.parse('{"i8":"2.10.0-snapshot-org-secrets-
|
|
526263
|
+
const package_namespaceObject = JSON.parse('{"i8":"2.10.0-snapshot-org-secrets-validation-1"}');
|
|
526239
526264
|
;// CONCATENATED MODULE: ../../package.json
|
|
526240
526265
|
const package_namespaceObject_1 = {"i8":"2.9.0"};
|
|
526241
526266
|
// EXTERNAL MODULE: ../../node_modules/semver/index.js
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RenderedCrMap } from '../renderer/types';
|
|
2
2
|
export declare function validateGithubOrgVariableSectionSingleton(crs: RenderedCrMap): void;
|
|
3
3
|
export declare function validateActionsVariablesUniqueness(crs: RenderedCrMap): void;
|
|
4
|
-
export declare function validateActionsVariablesSelectedRepositories(renderClaims: RenderClaims): void;
|