@firestartr/cli 2.1.0-snapshot → 2.1.0-snapshot-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 (2) hide show
  1. package/build/index.js +43 -12
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -367438,12 +367438,12 @@ class RepoGithubDecanter extends GithubDecanter {
367438
367438
  });
367439
367439
  }
367440
367440
  const directWriters = this.data.teamsAndMembers.directMembers
367441
- .filter((member) => member.role === 'push')
367441
+ .filter((member) => member.role === 'write')
367442
367442
  .map((member) => {
367443
367443
  return `user-imported-ref:${member.name}`;
367444
367444
  });
367445
367445
  const outsideWriters = this.data.teamsAndMembers.outsideMembers
367446
- .filter((member) => member.role === 'push')
367446
+ .filter((member) => member.role === 'write')
367447
367447
  .map((member) => {
367448
367448
  return `collaborator:${member.name.toLowerCase()}`;
367449
367449
  });
@@ -367462,12 +367462,12 @@ class RepoGithubDecanter extends GithubDecanter {
367462
367462
  });
367463
367463
  }
367464
367464
  const directReaders = this.data.teamsAndMembers.directMembers
367465
- .filter((member) => member.role === 'pull')
367465
+ .filter((member) => member.role === 'read')
367466
367466
  .map((member) => {
367467
367467
  return `user-imported-ref:${member.name}`;
367468
367468
  });
367469
367469
  const outsideReaders = this.data.teamsAndMembers.outsideMembers
367470
- .filter((member) => member.role === 'pull')
367470
+ .filter((member) => member.role === 'read')
367471
367471
  .map((member) => {
367472
367472
  return `collaborator:${member.name.toLowerCase()}`;
367473
367473
  });
@@ -367502,7 +367502,11 @@ class RepoGithubDecanter extends GithubDecanter {
367502
367502
  };
367503
367503
  });
367504
367504
  this.data['teamsAndMembers']['teams'] = teams;
367505
- this.data['teamsAndMembers']['directMembers'] = directMembers;
367505
+ // GitHub's `affiliation=direct` includes outside collaborators, so we must
367506
+ // exclude them from directMembers to avoid tagging them as user-imported-ref.
367507
+ const outsideMemberNames = new Set(outsideMembers.map((m) => m.name.toLowerCase()));
367508
+ const filteredDirectMembers = directMembers.filter((m) => !outsideMemberNames.has(m.name.toLowerCase()));
367509
+ this.data['teamsAndMembers']['directMembers'] = filteredDirectMembers;
367506
367510
  this.data['teamsAndMembers']['outsideMembers'] = outsideMembers;
367507
367511
  }
367508
367512
  async __gatherPages() {
@@ -367923,7 +367927,7 @@ async function reimportGithubGitopsRepository(org, crsPath, configPath, generate
367923
367927
  }
367924
367928
  cr.metadata.annotations[reImportAnnotation] = 'true';
367925
367929
  cr.metadata.annotations[importAnnotation] = 'true';
367926
- // we set an annotion to trigger the update
367930
+ // we set an annotation to trigger the update
367927
367931
  cr.metadata.annotations[reconcileAtAnnotation] = new Date()
367928
367932
  .toISOString()
367929
367933
  .replace(/\.\d{3}Z$/, 'Z'); // exact format: 2026-04-19T20:45:00Z
@@ -367935,10 +367939,10 @@ async function reimportGithubGitopsRepository(org, crsPath, configPath, generate
367935
367939
  // we need to search for dependencies if proceeds
367936
367940
  if (!collection.IS_SKIP_SET(generatedFilters, 'gh-repo')) {
367937
367941
  importer_src_logger.info(`Searching for dependencies to annotate with ${reImportAnnotation} and ${importAnnotation}`);
367938
- await searchForDependencies(org, crsPath, configPath, generatedFilters, crsWithDependenciesToAnnotate, reImportAnnotation, importAnnotation);
367942
+ await searchForDependencies(org, crsPath, configPath, generatedFilters, crsWithDependenciesToAnnotate, reImportAnnotation, importAnnotation, reconcileAtAnnotation);
367939
367943
  }
367940
367944
  }
367941
- async function searchForDependencies(org, crsPath, configPath, generatedFilters, crsWithDependenciesToAnnotate, reImportAnnotation, importAnnotation) {
367945
+ async function searchForDependencies(org, crsPath, configPath, generatedFilters, crsWithDependenciesToAnnotate, reImportAnnotation, importAnnotation, reconcileAtAnnotation) {
367942
367946
  // we need to perform a search in all the crsPath
367943
367947
  await searchCRs(crsPath, async (cr, filePath) => {
367944
367948
  importer_src_logger.debug(`${JSON.stringify(cr)}`);
@@ -367956,6 +367960,10 @@ async function searchForDependencies(org, crsPath, configPath, generatedFilters,
367956
367960
  }
367957
367961
  cr.metadata.annotations[reImportAnnotation] = 'true';
367958
367962
  cr.metadata.annotations[importAnnotation] = 'true';
367963
+ // we set an annotation to trigger the update
367964
+ cr.metadata.annotations[reconcileAtAnnotation] = new Date()
367965
+ .toISOString()
367966
+ .replace(/\.\d{3}Z$/, 'Z'); // exact format: 2026-04-19T20:45:00Z
367959
367967
  // we write the cr back to the file system
367960
367968
  const newContent = catalog_common.io.toYaml(cr);
367961
367969
  await promises_default().writeFile(filePath, newContent, 'utf-8');
@@ -369061,7 +369069,7 @@ function shouldForceReconcileByAnnotation(cr) {
369061
369069
  operator_src_logger.warn(`Timestamp is invalid for the annotation ${cr.kind}/${cr.metadata?.name || 'unknown'}: ${annotationValue}`);
369062
369070
  return false;
369063
369071
  }
369064
- // Buscamos el timestamp más reciente de TODAS las conditions
369072
+ // Find the most recent timestamp across all conditions
369065
369073
  let latestConditionTime = 0;
369066
369074
  for (const condition of cr.status?.conditions || []) {
369067
369075
  const timeStr = condition.lastUpdateTime || condition.lastTransitionTime;
@@ -369073,7 +369081,7 @@ function shouldForceReconcileByAnnotation(cr) {
369073
369081
  }
369074
369082
  }
369075
369083
  const shouldForce = annotationTime > latestConditionTime;
369076
- operator_src_logger.debug(shouldForce, `Evaluating force-reconcile for ${cr.metadata.name}: annotation time (${new Date(annotationTime).toISOString()}) vs latest condition time (${new Date(latestConditionTime).toISOString()})`);
369084
+ operator_src_logger.debug(`Evaluating force-reconcile for ${cr.metadata.name}: annotation time (${new Date(annotationTime).toISOString()}) vs latest condition time (${new Date(latestConditionTime).toISOString()})`, { metadata: { shouldForce } });
369077
369085
  if (shouldForce) {
369078
369086
  operator_src_logger.info(`force-reconcile activated for ${cr.metadata.name} → annotation (${annotationValue}) is newer than latest condition time (${new Date(latestConditionTime).toISOString()})`);
369079
369087
  }
@@ -370757,6 +370765,19 @@ function getQueueMetrics() {
370757
370765
  },
370758
370766
  };
370759
370767
  }
370768
+ // we need to assign weight to the deletion operation
370769
+ // to avoid blockades
370770
+ // https://github.com/prefapp/gitops-k8s/issues/1864
370771
+ // ghrepo feat | grss -> ghrepo -> ghgroup -> membership
370772
+ const DELETION_WEIGHTS = {
370773
+ FirestartrGithubRepositoryFeature: 5,
370774
+ FirestartrGithubRepositorySecretsSection: 4,
370775
+ FirestartrGithubRepository: 3,
370776
+ FirestartrGithubGroup: 2,
370777
+ FirestartrGithubMembership: 1,
370778
+ FirestartrTerraformWorkspace: 1,
370779
+ FirestartrGithubOrgWebhook: 1,
370780
+ };
370760
370781
  // Do the kinds need different weights for the operations?
370761
370782
  // We need to discuss this with the team in this issue: https://github.com/prefapp/gitops-k8s/issues/524
370762
370783
  // const KIND_WEIGHTS: any = {
@@ -370826,7 +370847,17 @@ function sortQueue(queue) {
370826
370847
  // If weightA is larger, return -1 (a comes before b)
370827
370848
  return weightB - weightA;
370828
370849
  }
370829
- // --- SECONDARY SORT: By upsertTime (Ascending) ---
370850
+ // in case of deletions we need to
370851
+ // establish a secondary sort by kind
370852
+ if (wa.operation === 'MARKED_TO_DELETION' &&
370853
+ wb.operation === 'MARKED_TO_DELETION') {
370854
+ const deletionWeightA = DELETION_WEIGHTS[wa.item.kind] || 0;
370855
+ const deletionWeightB = DELETION_WEIGHTS[wb.item.kind] || 0;
370856
+ if (deletionWeightA !== deletionWeightB) {
370857
+ return deletionWeightB - deletionWeightA;
370858
+ }
370859
+ }
370860
+ // --- 3rd SORT: By upsertTime (Ascending) ---
370830
370861
  // If weights are equal, sort by the oldest upsertTime (ascending)
370831
370862
  return wa.upsertTime - wb.upsertTime;
370832
370863
  });
@@ -379455,7 +379486,7 @@ const crs_analyzerSubcommand = {
379455
379486
  };
379456
379487
 
379457
379488
  ;// CONCATENATED MODULE: ./package.json
379458
- const package_namespaceObject = JSON.parse('{"i8":"2.1.0-snapshot"}');
379489
+ const package_namespaceObject = JSON.parse('{"i8":"2.1.0-snapshot-1"}');
379459
379490
  ;// CONCATENATED MODULE: ../../package.json
379460
379491
  const package_namespaceObject_1 = {"i8":"2.0.0"};
379461
379492
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "2.1.0-snapshot",
3
+ "version": "2.1.0-snapshot-1",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",