@firestartr/cli 2.4.0-snapshot-5 → 2.4.0-snapshot-7

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
@@ -287141,7 +287141,10 @@ var lib = __nccwpck_require__(77228);
287141
287141
  const __PATH_VARIABLES = {};
287142
287142
  const __EXCLUDED_PATHS = [];
287143
287143
  function setExcludedPaths(excludedPaths) {
287144
- __EXCLUDED_PATHS.push(...excludedPaths);
287144
+ __EXCLUDED_PATHS.length = 0;
287145
+ for (const path of excludedPaths) {
287146
+ __EXCLUDED_PATHS.push(path);
287147
+ }
287145
287148
  }
287146
287149
  function getAdditionalPaths() {
287147
287150
  return __EXCLUDED_PATHS;
@@ -293774,7 +293777,6 @@ function toJson_FirestartrGithubRepositorySpecRepo(obj) {
293774
293777
  'allowUpdateBranch': obj.allowUpdateBranch,
293775
293778
  'hasIssues': obj.hasIssues,
293776
293779
  'hasWiki': obj.hasWiki,
293777
- 'pages': obj.pages,
293778
293780
  'topics': obj.topics?.map(y => y),
293779
293781
  'labels': obj.labels?.map(y => toJson_FirestartrGithubRepositorySpecRepoLabels(y)),
293780
293782
  'visibility': obj.visibility,
@@ -297175,6 +297177,20 @@ function searchSecretKey(secretClaim, key) {
297175
297177
  return found;
297176
297178
  }
297177
297179
 
297180
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/componentPagesPath.ts
297181
+ /**
297182
+ * Intentionally a no-op.
297183
+ *
297184
+ * Claim-kind-specific constraints such as ComponentClaim
297185
+ * providers.github.pages.source.path belong in the ComponentClaim schema
297186
+ * or in the claim->CR build/normalization step, not in src/validations.
297187
+ *
297188
+ * This function is kept to preserve the existing exported API for callers.
297189
+ */
297190
+ function validateComponentPagesPath(_renderClaims) {
297191
+ return;
297192
+ }
297193
+
297178
297194
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/renderer/renderer.ts
297179
297195
 
297180
297196
 
@@ -297183,6 +297199,7 @@ function searchSecretKey(secretClaim, key) {
297183
297199
 
297184
297200
 
297185
297201
 
297202
+
297186
297203
  /*
297187
297204
  * Function called when rendering but not importing
297188
297205
  *
@@ -297199,6 +297216,7 @@ async function renderer_render(catalogScope, firestartrScope, claimList) {
297199
297216
  const result = await renderClaims(catalogScope, firestartrScope, data);
297200
297217
  try {
297201
297218
  validateSubReferences(data.renderClaims);
297219
+ validateComponentPagesPath(data.renderClaims);
297202
297220
  validateTfStateKeyUniqueness(result);
297203
297221
  validateCrSizes(result);
297204
297222
  validatePermissionsUniqueness(result);
@@ -298293,15 +298311,23 @@ class RepoGithubDecanter extends GithubDecanter {
298293
298311
  });
298294
298312
  }
298295
298313
  __decantPages() {
298296
- if (this.data.repoDetails.has_pages) {
298297
- this.__patchClaim({
298298
- op: 'add',
298299
- value: {
298300
- cname: this.data.pages.cname,
298301
- source: this.data.pages.source,
298302
- },
298303
- path: '/providers/github/pages',
298304
- });
298314
+ if (this.data.pages) {
298315
+ if (this.data.pages.build_type === 'workflow') {
298316
+ importer_src_logger.info(`Repository ${this.data.repoDetails.name} is using GitHub Actions for Pages deployment, skipping Pages configuration in claim as it's managed via workflow.`);
298317
+ }
298318
+ else if (this.data.pages.build_type === 'legacy') {
298319
+ this.__patchClaim({
298320
+ op: 'add',
298321
+ path: '/providers/github/pages',
298322
+ value: {
298323
+ ...(typeof this.data.pages.cname === 'string' &&
298324
+ this.data.pages.cname.length > 0
298325
+ ? { cname: this.data.pages.cname }
298326
+ : {}),
298327
+ source: this.data.pages.source,
298328
+ },
298329
+ });
298330
+ }
298305
298331
  }
298306
298332
  }
298307
298333
  __decantOIDC() {
@@ -305820,7 +305846,7 @@ const MODULES = {
305820
305846
  },
305821
305847
  FirestartrGithubRepository: {
305822
305848
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-repo',
305823
- ref: 'github-repo-v0.2.0',
305849
+ ref: 'feat/1195-github-repo-problem-on-github-pages',
305824
305850
  },
305825
305851
  FirestartrGithubRepositoryFeature: {
305826
305852
  module: 'git::https://github.com/prefapp/tfm.git//modules/github-files-set',
@@ -306569,6 +306595,42 @@ class EntityGHRepo extends base_Entity {
306569
306595
  },
306570
306596
  });
306571
306597
  }
306598
+ /**
306599
+ * Validation logic for GitHub Pages branch settings:
306600
+ * - On create: If pages branch is set, it must equal the default branch.
306601
+ * - On update: If pages branch is set and is not the default, it must exist in remote.
306602
+ */
306603
+ async validatePagesBranch(tfOp, repoAlreadyExists) {
306604
+ const pages = this.cr.spec.pages;
306605
+ if (!pages || !pages.source || !pages.source.branch)
306606
+ return;
306607
+ const branch = pages.source.branch;
306608
+ const defaultBranch = this.cr.spec.repo.defaultBranch;
306609
+ const repo = this.cr.name;
306610
+ const org = this.cr.spec.org;
306611
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${this.k8sId} validating pages branch '${branch}' against default branch '${defaultBranch}' for operation '${tfOp}'`);
306612
+ if (!repoAlreadyExists) {
306613
+ if (branch !== defaultBranch) {
306614
+ throw new Error(`Pages branch must equal default branch on creation. Provided: '${branch}', expected: '${defaultBranch}'`);
306615
+ }
306616
+ return;
306617
+ }
306618
+ else if (branch !== defaultBranch) {
306619
+ gh_provisioner_src_logger.info(`[gh-provisioner] ${this.k8sId} validating pages branch '${branch}' against default branch '${defaultBranch}' for operation '${tfOp}' - branch is different from default, checking existence in remote`);
306620
+ try {
306621
+ await this.runWithGithubProvider(async () => {
306622
+ await github.branches.getBranch(repo, branch, org);
306623
+ });
306624
+ }
306625
+ catch (err) {
306626
+ if (err && err.status === 404) {
306627
+ throw new Error(`Pages branch '${branch}' does not exist in the repository '${org}/${repo}'.`);
306628
+ }
306629
+ // Other errors propagate
306630
+ throw err;
306631
+ }
306632
+ }
306633
+ }
306572
306634
  async loadResources(tfOp) {
306573
306635
  let repoAlreadyExists = false;
306574
306636
  try {
@@ -306576,7 +306638,11 @@ class EntityGHRepo extends base_Entity {
306576
306638
  repoAlreadyExists = (await this.runWithGithubProvider(async () => {
306577
306639
  return await github.repo.repoExists(this.cr.spec.org, this.cr.name);
306578
306640
  }));
306641
+ if (tfOp !== 'destroy' && tfOp !== 'plan-destroy') {
306642
+ await this.validatePagesBranch(tfOp, repoAlreadyExists);
306643
+ }
306579
306644
  await this.provisionRepository();
306645
+ this.provisionPages();
306580
306646
  await provisionDefaultBranch(this);
306581
306647
  await provisionCodeowners(this);
306582
306648
  await provisionVariables(this);
@@ -306684,10 +306750,25 @@ class EntityGHRepo extends base_Entity {
306684
306750
  ignoreVulnerabilityAlertsDuringRead: this.cr.spec.repo.ignoreVulnerabilityAlertsDuringRead,
306685
306751
  mergeCommitTitle: this.cr.spec.repo.mergeCommitTitle,
306686
306752
  squashMergeCommitMessage: this.cr.spec.repo.squashMergeCommitMessage,
306687
- pages: this.cr.spec.pages,
306688
306753
  },
306689
306754
  });
306690
306755
  }
306756
+ provisionPages() {
306757
+ if (this.cr.spec.pages) {
306758
+ const source = this.cr.spec.pages.source ?? {};
306759
+ this.patchData({
306760
+ path: '/config/pages',
306761
+ op: PatchOperations.add,
306762
+ value: {
306763
+ source: {
306764
+ branch: source.branch || this.cr.spec.repo.defaultBranch,
306765
+ path: source.path || '/',
306766
+ },
306767
+ cname: this.cr.spec.pages.cname,
306768
+ },
306769
+ });
306770
+ }
306771
+ }
306691
306772
  }
306692
306773
 
306693
306774
  ;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghfeature/helpers/managed_files.ts
@@ -307456,7 +307537,7 @@ async function runGhProvisioner(data, opts) {
307456
307537
  gh_provisioner_src_logger.error(`[gh-provisioner] Error running runGhProvisioner: ${message}`);
307457
307538
  if (!synthFinished && entity)
307458
307539
  entity.synthEnd(message);
307459
- if (entity && entity.inDebugMode) {
307540
+ if (entity && entity.inDebugMode && synthFinished) {
307460
307541
  await debugTerraformOutput(entity, message);
307461
307542
  }
307462
307543
  throw new Error(`[gh-provisioner] Error running runGhProvisioner: ${message}`);
@@ -309248,7 +309329,7 @@ const crs_analyzerSubcommand = {
309248
309329
  };
309249
309330
 
309250
309331
  ;// CONCATENATED MODULE: ./package.json
309251
- const package_namespaceObject = JSON.parse('{"i8":"2.4.0-snapshot-5"}');
309332
+ const package_namespaceObject = JSON.parse('{"i8":"2.4.0-snapshot-7"}');
309252
309333
  ;// CONCATENATED MODULE: ../../package.json
309253
309334
  const package_namespaceObject_1 = {"i8":"2.3.0"};
309254
309335
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts
@@ -1010,10 +1010,6 @@ export interface FirestartrGithubRepositorySpecRepo {
1010
1010
  * @schema FirestartrGithubRepositorySpecRepo#hasWiki
1011
1011
  */
1012
1012
  readonly hasWiki?: boolean;
1013
- /**
1014
- * @schema FirestartrGithubRepositorySpecRepo#pages
1015
- */
1016
- readonly pages?: any;
1017
1013
  /**
1018
1014
  * @schema FirestartrGithubRepositorySpecRepo#topics
1019
1015
  */
@@ -0,0 +1,11 @@
1
+ import { RenderClaims } from '../renderer/types';
2
+ /**
3
+ * Intentionally a no-op.
4
+ *
5
+ * Claim-kind-specific constraints such as ComponentClaim
6
+ * providers.github.pages.source.path belong in the ComponentClaim schema
7
+ * or in the claim->CR build/normalization step, not in src/validations.
8
+ *
9
+ * This function is kept to preserve the existing exported API for callers.
10
+ */
11
+ export declare function validateComponentPagesPath(_renderClaims: RenderClaims): void;
@@ -1,8 +1,15 @@
1
1
  import { Entity } from '../base';
2
2
  export declare class EntityGHRepo extends Entity {
3
3
  constructor(artifact: any);
4
+ /**
5
+ * Validation logic for GitHub Pages branch settings:
6
+ * - On create: If pages branch is set, it must equal the default branch.
7
+ * - On update: If pages branch is set and is not the default, it must exist in remote.
8
+ */
9
+ private validatePagesBranch;
4
10
  loadResources(tfOp: string): Promise<void>;
5
11
  postProvision(tfOp: string): Promise<void>;
6
12
  loadAddressesToImport(): Promise<void>;
7
13
  provisionRepository(): Promise<void>;
14
+ provisionPages(): void;
8
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "2.4.0-snapshot-5",
3
+ "version": "2.4.0-snapshot-7",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",