@firestartr/cli 1.54.0-snapshot-0 → 1.54.0-snapshot-2

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
@@ -357045,6 +357045,7 @@ class FirestartrAllClaim {
357045
357045
 
357046
357046
 
357047
357047
 
357048
+
357048
357049
  class RefValuesNormalizer extends Normalizer {
357049
357050
  constructor() {
357050
357051
  super(...arguments);
@@ -357084,6 +357085,14 @@ providerValues, resolveRef, references = new Map()) {
357084
357085
  for (const key in providerValues) {
357085
357086
  values[key] = await interpolateObject(providerValues[key], references, resolveRef);
357086
357087
  }
357088
+ let secretRefCount = 0;
357089
+ for (const key in providerValues) {
357090
+ if (isRepoSecretRef(providerValues[key])) {
357091
+ values[key] = await interpolateSecretClaimRef(providerValues[key], references,
357092
+ // closure to increase the refCount and avoid collision
357093
+ () => secretRefCount++);
357094
+ }
357095
+ }
357087
357096
  return { values, references: Array.from(updatedReferences.values()) };
357088
357097
  }
357089
357098
  async function interpolateObject(toInterpolate, references, resolveRef) {
@@ -357153,6 +357162,40 @@ async function replaceReferencesValues(contents, references, resolveRef) {
357153
357162
  }
357154
357163
  return replacedContent;
357155
357164
  }
357165
+ async function interpolateSecretClaimRef(secretClaimRef, references, getSecretRefCountF) {
357166
+ const extractedSecretClaimRef = {
357167
+ ...extractRepoSecretRef(secretClaimRef),
357168
+ // force the kind to ALWAYS be a Secret
357169
+ kind: 'Secret',
357170
+ };
357171
+ // has already been visited
357172
+ const alreadyPresentKey = findSecretKey(extractedSecretClaimRef, references);
357173
+ if (alreadyPresentKey)
357174
+ return alreadyPresentKey;
357175
+ // new reference we have to build it
357176
+ const secretClaimRefInternalKey = `secret-ref-${getSecretRefCountF()}`;
357177
+ // we set the secret value
357178
+ references.set(secretClaimRefInternalKey, {
357179
+ name: secretClaimRefInternalKey,
357180
+ ref: extractedSecretClaimRef,
357181
+ });
357182
+ return secretClaimRefInternalKey;
357183
+ }
357184
+ function findSecretKey(secretClaimRef, references) {
357185
+ const entry = Array.from(references.entries()).find(([, value]) => {
357186
+ // Destructure the entry to easily access the value.
357187
+ // Check if the value is an object and matches all properties.
357188
+ return (typeof value === 'object' &&
357189
+ value !== null &&
357190
+ value.ref !== null &&
357191
+ typeof value.ref === 'object' &&
357192
+ value.ref.kind === secretClaimRef.kind &&
357193
+ value.ref.name === secretClaimRef.name &&
357194
+ value.ref.key === secretClaimRef.key);
357195
+ });
357196
+ // If a matching entry was found, return its key (the first element of the entry array).
357197
+ return entry ? entry[0] : undefined;
357198
+ }
357156
357199
 
357157
357200
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/normalizers/RevisionNormalizer.ts
357158
357201
 
@@ -357284,14 +357327,20 @@ const kindMap = {
357284
357327
  secret: 'SecretsClaim',
357285
357328
  domain: 'DomainClaim',
357286
357329
  };
357330
+ // this function is intended to search for refs of the same kind
357331
+ // it is used to search for circular references (i.e. a reference to oneself)
357332
+ // to extract all type of references use extractAllRefs
357287
357333
  function extractRefs(renderClaims, kind) {
357288
357334
  const result = {};
357289
357335
  for (const key in renderClaims) {
357290
357336
  const claim = renderClaims[key].claim;
357291
357337
  let refs = [];
357338
+ // for workspaces
357339
+ let [tfWorkspaceRefs, secretsRefs] = [[], []];
357292
357340
  switch (kind) {
357293
357341
  case 'TFWorkspaceClaim':
357294
- refs = getTfWorkspacesRefs(claim.providers.terraform.values);
357342
+ [tfWorkspaceRefs, secretsRefs] = getTfWorkspacesRefs(claim.providers.terraform.values);
357343
+ refs = [...tfWorkspaceRefs];
357295
357344
  break;
357296
357345
  case 'GroupClaim':
357297
357346
  /**
@@ -357315,11 +357364,13 @@ function extractAllRefs(claimData) {
357315
357364
  refs.push(...extractVirtualRefs(parsedClaim));
357316
357365
  switch (parsedClaim.kind) {
357317
357366
  case 'TFWorkspaceClaim': {
357318
- const tfWorkspaceRefs = getTfWorkspacesRefs(parsedClaim.providers.terraform.values);
357367
+ const [tfWorkspaceRefs, secretRefs] = getTfWorkspacesRefs(parsedClaim.providers.terraform.values);
357319
357368
  tfWorkspaceRefs.forEach((ref, idx, arr) => {
357320
357369
  arr[idx] = `TFWorkspaceClaim-${ref}`;
357321
357370
  });
357371
+ cdk8s_renderer_src_logger.debug(`Obtained the following secret refs for ${parsedClaim.kind}/${parsedClaim.name}: ${JSON.stringify(secretRefs)}`);
357322
357372
  refs.push(...tfWorkspaceRefs);
357373
+ refs.push(...secretRefs);
357323
357374
  break;
357324
357375
  }
357325
357376
  case 'GroupClaim': {
@@ -357364,22 +357415,28 @@ function getGroupParentRef(parent, references = []) {
357364
357415
  }
357365
357416
  return references;
357366
357417
  }
357367
- function getTfWorkspacesRefs(values, references = []) {
357418
+ function getTfWorkspacesRefs(values, references = [], secretsRefs = []) {
357368
357419
  const regex = catalog_common.types.regex.TFWorkspaceRefRegex;
357369
357420
  for (const key in values) {
357370
357421
  switch (typeof values[key]) {
357371
357422
  case 'object':
357372
- getTfWorkspacesRefs(values[key], references);
357423
+ getTfWorkspacesRefs(values[key], references, secretsRefs);
357373
357424
  break;
357374
357425
  case 'string':
357426
+ // Extract all implicit refs
357375
357427
  for (const match of values[key].matchAll(regex)) {
357376
357428
  const [_, claimName] = match;
357377
357429
  references.push(claimName);
357378
357430
  }
357431
+ // extract a secretsclaim ref
357432
+ if (isRepoSecretRef(values[key])) {
357433
+ const secretRef = extractRepoSecretRef(values[key]);
357434
+ secretsRefs.push(`SecretsClaim-${secretRef.name}`);
357435
+ }
357379
357436
  break;
357380
357437
  }
357381
357438
  }
357382
- return references;
357439
+ return [references, secretsRefs];
357383
357440
  }
357384
357441
  function getComponentVarsAndSecretsRefs(parsedClaim) {
357385
357442
  const refs = {};
@@ -359560,7 +359617,6 @@ var ajv_default = /*#__PURE__*/__nccwpck_require__.n(dist_ajv);
359560
359617
 
359561
359618
 
359562
359619
 
359563
-
359564
359620
  function validate_validate(featurePath) {
359565
359621
  __validateDirStructure(featurePath);
359566
359622
  const configData = __validateFeatureConfig(featurePath);
@@ -359575,17 +359631,6 @@ function __validateDirStructure(featurePath) {
359575
359631
  if (!isFile(external_path_.join(featurePath, 'config.yaml'))) {
359576
359632
  throw `Feature: ${featurePath}/config.yaml not found or not a file`;
359577
359633
  }
359578
- if (!isDirectory(external_path_.join(featurePath, 'templates/docs'))) {
359579
- throw `Feature: ${featurePath}templates/docs not a directory`;
359580
- }
359581
- if (!__validateDocsHasReadmes(featurePath)) {
359582
- throw `Feature: ${featurePath}: should have at least one .md file in the templates/docs`;
359583
- }
359584
- }
359585
- function __validateDocsHasReadmes(featurePath) {
359586
- const dirEntries = external_fs_default().readdirSync(external_path_.join(featurePath, 'templates/docs'));
359587
- return (dirEntries.some((entryFile) => !isDirectory(external_path_.join(featurePath, '/templates/docs', entryFile)) &&
359588
- entryFile.endsWith('.md')) !== undefined);
359589
359634
  }
359590
359635
  function __validateFeatureConfig(featurePath) {
359591
359636
  try {
@@ -360641,7 +360686,6 @@ function buildExpectedOutput(config, renderDir) {
360641
360686
  localPath: external_node_path_.join(renderDir, f.dest),
360642
360687
  repoPath: f.dest,
360643
360688
  userManaged: f.user_managed,
360644
- targetBranch: f.target_branch ?? '',
360645
360689
  }));
360646
360690
  return {
360647
360691
  files,
@@ -363464,6 +363508,8 @@ var FirestartrTerraformWorkspaceSpecReferencesRefKind;
363464
363508
  FirestartrTerraformWorkspaceSpecReferencesRefKind["FIRESTARTR_TERRAFORM_WORKSPACE"] = "FirestartrTerraformWorkspace";
363465
363509
  /** ExternalSecret */
363466
363510
  FirestartrTerraformWorkspaceSpecReferencesRefKind["EXTERNAL_SECRET"] = "ExternalSecret";
363511
+ /** Secret */
363512
+ FirestartrTerraformWorkspaceSpecReferencesRefKind["SECRET"] = "Secret";
363467
363513
  })(FirestartrTerraformWorkspaceSpecReferencesRefKind || (FirestartrTerraformWorkspaceSpecReferencesRefKind = {}));
363468
363514
  /**
363469
363515
  * @schema FirestartrTerraformWorkspaceSpecContextBackendRefKind
@@ -367733,12 +367779,19 @@ function updateConditionByType(conditionList, type, newCondition) {
367733
367779
  return conditionList;
367734
367780
  }
367735
367781
 
367782
+ ;// CONCATENATED MODULE: ../operator/src/utils/operationErrorMessages.ts
367783
+ const APPLY_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform apply operation.';
367784
+ const DESTROY_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform destroy operation.';
367785
+ const PLAN_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform plan operation.';
367786
+ const SYNC_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Sync operation.';
367787
+
367736
367788
  ;// CONCATENATED MODULE: ../operator/src/syncCtl.ts
367737
367789
  // Machinery for syncing
367738
367790
 
367739
367791
 
367740
367792
 
367741
367793
 
367794
+
367742
367795
  const DEFAULT_REVISION_TIME = '1m';
367743
367796
  async function createWatcherForItem(itemPath, itemCR) {
367744
367797
  const item = itemCR ?? (await getItemByItemPath(itemPath));
@@ -367801,7 +367854,7 @@ async function getSyncStatus(itemPath, itemCR) {
367801
367854
  : (await getSyncSpecs(itemPath, item)).schedule
367802
367855
  ? 'Scheduled'
367803
367856
  : 'Period';
367804
- return {
367857
+ const syncStatus = {
367805
367858
  itemPath,
367806
367859
  syncMode: mode,
367807
367860
  conditions: [syncCondition],
@@ -367809,6 +367862,11 @@ async function getSyncStatus(itemPath, itemCR) {
367809
367862
  nextTimeoutInMS: isLapsed ? -1 : nextSyncDate.getTime() - Date.now(),
367810
367863
  intervalLapsed: isLapsed,
367811
367864
  };
367865
+ if (syncCondition) {
367866
+ syncStatus.hasSyncFailed =
367867
+ syncCondition.message === SYNC_DEFAULT_ERROR_MESSAGE;
367868
+ }
367869
+ return syncStatus;
367812
367870
  }
367813
367871
  }
367814
367872
  async function setSyncStatus(itemPath, reason, status, message) {
@@ -368457,6 +368515,15 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
368457
368515
  yield transition;
368458
368516
  }
368459
368517
  if (needsUpdateSyncConditions) {
368518
+ if (operation === OperationType.SYNC) {
368519
+ // let's check if the process has not failed
368520
+ const syncStatus = await getSyncStatus(workItem.handler.itemPath());
368521
+ if (syncStatus.hasSyncFailed) {
368522
+ // we do not update sync because we are not going to trigger
368523
+ // a RETRY operation if the sync has failed
368524
+ return;
368525
+ }
368526
+ }
368460
368527
  await setSyncStatus(workItem.handler.itemPath(), operation, operation === OperationType.SYNC ? 'True' : 'False', 'Sync process finished');
368461
368528
  void syncCtl.updateItem(informer_itemPath(pluralKind, item));
368462
368529
  }
@@ -369477,9 +369544,7 @@ function provisionFeatureFiles(scope, feature) {
369477
369544
  ? { ignoreChanges: ['content'] }
369478
369545
  : {};
369479
369546
  const repoConfig = {
369480
- branch: file.targetBranch.length === 0
369481
- ? defaultBranchName
369482
- : file.targetBranch,
369547
+ branch: file.targetBranch || defaultBranchName,
369483
369548
  commitMessage: `feat: ${feature.spec.type} ${feature.spec.version}`,
369484
369549
  content: cdktf_lib.Fn.base64decode(file.content),
369485
369550
  file: file.path,
@@ -371177,11 +371242,6 @@ function helperCreateCheckRunName(cmd, item) {
371177
371242
  return `${item.kind} - ${cmd}`;
371178
371243
  }
371179
371244
 
371180
- ;// CONCATENATED MODULE: ../operator/src/utils/operationErrorMessages.ts
371181
- const APPLY_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform apply operation.';
371182
- const DESTROY_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform destroy operation.';
371183
- const PLAN_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform plan operation.';
371184
-
371185
371245
  ;// CONCATENATED MODULE: ../operator/cdktf.ts
371186
371246
 
371187
371247
 
@@ -371954,6 +372014,8 @@ ${this.mainBlock}
371954
372014
  }
371955
372015
 
371956
372016
  ;// CONCATENATED MODULE: ../terraform_provisioner/src/resolutor/resolver.ts
372017
+
372018
+ const REG_IS_CLAIM_SECRET_REF = new RegExp(/^secret-ref-\d+$/);
371957
372019
  function resolveString(value, refs) {
371958
372020
  const regex = new RegExp(/(\$\{\{\s*references\.[\w\-.]+\s*\}\})/);
371959
372021
  if (hasRefs(value, regex) > 0) {
@@ -372007,6 +372069,18 @@ function getRefNameFromKey(key) {
372007
372069
  // name is in the first matching group
372008
372070
  return match[1];
372009
372071
  }
372072
+ function resolveClaimSecret(value, refs) {
372073
+ if (typeof value === 'string' && REG_IS_CLAIM_SECRET_REF.test(value)) {
372074
+ if (!Object.prototype.hasOwnProperty.call(refs, value)) {
372075
+ terraform_provisioner_src_logger.error(`SecretsClaim ref ${value} is not present on references`);
372076
+ throw new Error(`SecretsClaim ref ${value} is not present on references`);
372077
+ }
372078
+ return refs[value];
372079
+ }
372080
+ else {
372081
+ return value;
372082
+ }
372083
+ }
372010
372084
  function resolveRef(key, references, wantsInterpolation = false) {
372011
372085
  const refName = getRefNameFromKey(key);
372012
372086
  // check if key exists
@@ -372055,6 +372129,9 @@ function walkList(list, resolveScalar) {
372055
372129
  function resolveValues(values, refs) {
372056
372130
  return walker_walk(values, (value) => resolveScalar(value, refs));
372057
372131
  }
372132
+ function resolveClaimSecrets(values, refs) {
372133
+ return walker_walk(values, (value) => resolveClaimSecret(value, refs));
372134
+ }
372058
372135
 
372059
372136
  ;// CONCATENATED MODULE: ../terraform_provisioner/src/writer_tfvars_json.ts
372060
372137
 
@@ -372066,7 +372143,9 @@ class WriterTfVarsJson extends writer {
372066
372143
  this.references = references;
372067
372144
  }
372068
372145
  __replaceReferences(values, references) {
372069
- return resolveValues(values, references);
372146
+ values = resolveValues(values, references);
372147
+ values = resolveClaimSecrets(values, references);
372148
+ return values;
372070
372149
  }
372071
372150
  __resolveDeps() {
372072
372151
  const replaced = this.__replaceReferences(this.values, this.references);
@@ -372622,7 +372701,7 @@ async function* process_operation_observe(item, op, handler) {
372622
372701
  yield transition;
372623
372702
  }
372624
372703
  }
372625
- async function* doPlanJSONFormat(item, op, handler) {
372704
+ async function* doPlanJSONFormat(item, op, handler, setResult = function (_r) { }) {
372626
372705
  let error = false;
372627
372706
  try {
372628
372707
  yield {
@@ -372723,34 +372802,83 @@ async function* doPlanJSONFormat(item, op, handler) {
372723
372802
  }
372724
372803
  finally {
372725
372804
  if (error) {
372726
- yield {
372727
- item,
372728
- reason: op,
372729
- type: 'PROVISIONED',
372730
- status: 'False',
372731
- message: PLAN_DEFAULT_ERROR_MESSAGE,
372732
- };
372733
- yield {
372734
- item,
372735
- reason: op,
372736
- type: 'PLANNING',
372737
- status: 'False',
372738
- message: PLAN_DEFAULT_ERROR_MESSAGE,
372739
- };
372740
- yield {
372741
- item,
372742
- reason: op,
372743
- type: 'OUT_OF_SYNC',
372744
- status: 'False',
372745
- message: PLAN_DEFAULT_ERROR_MESSAGE,
372746
- };
372747
- yield {
372748
- item,
372749
- reason: op,
372750
- type: 'ERROR',
372751
- status: 'True',
372752
- message: PLAN_DEFAULT_ERROR_MESSAGE,
372753
- };
372805
+ if (op === OperationType.SYNC) {
372806
+ // if there is an error on a sync we never put the state on error
372807
+ // it would be problematic because the RETRY op kicks in
372808
+ if (error) {
372809
+ yield {
372810
+ item,
372811
+ reason: op,
372812
+ type: 'SYNCHRONIZED',
372813
+ status: 'True',
372814
+ message: SYNC_DEFAULT_ERROR_MESSAGE,
372815
+ };
372816
+ yield {
372817
+ item,
372818
+ reason: op,
372819
+ type: 'PROVISIONED',
372820
+ status: 'True',
372821
+ message: 'doPlanJSONFormat',
372822
+ };
372823
+ yield {
372824
+ item,
372825
+ reason: op,
372826
+ type: 'PLANNING',
372827
+ status: 'False',
372828
+ message: 'doPlanJSONFormat',
372829
+ };
372830
+ yield {
372831
+ item,
372832
+ reason: op,
372833
+ type: 'OUT_OF_SYNC',
372834
+ status: 'False',
372835
+ message: 'doPlanJSONFormat',
372836
+ };
372837
+ yield {
372838
+ item,
372839
+ reason: op,
372840
+ type: 'ERROR',
372841
+ status: 'False',
372842
+ message: 'doPlanJSONFormat',
372843
+ };
372844
+ }
372845
+ setResult('SYNC_ERROR_PLAN');
372846
+ }
372847
+ else {
372848
+ yield {
372849
+ item,
372850
+ reason: op,
372851
+ type: 'PROVISIONED',
372852
+ status: 'False',
372853
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
372854
+ };
372855
+ yield {
372856
+ item,
372857
+ reason: op,
372858
+ type: 'PLANNING',
372859
+ status: 'False',
372860
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
372861
+ };
372862
+ yield {
372863
+ item,
372864
+ reason: op,
372865
+ type: 'OUT_OF_SYNC',
372866
+ status: 'False',
372867
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
372868
+ };
372869
+ yield {
372870
+ item,
372871
+ reason: op,
372872
+ type: 'ERROR',
372873
+ status: 'True',
372874
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
372875
+ };
372876
+ }
372877
+ }
372878
+ else {
372879
+ if (op === OperationType.SYNC) {
372880
+ setResult('SYNC_SUCCESS');
372881
+ }
372754
372882
  }
372755
372883
  }
372756
372884
  }
@@ -372793,6 +372921,7 @@ function isDestroyRetry(item) {
372793
372921
  return false;
372794
372922
  }
372795
372923
  async function* process_operation_sync(item, op, handler, syncPolicy, generalPolicy) {
372924
+ let doResult = '';
372796
372925
  if (!syncPolicy) {
372797
372926
  operator_src_logger.debug(`The Terraform processor is only observing item '${item.kind}/${item.metadata.name}' because no sync policy was found for operation '${op}'.`);
372798
372927
  yield* doPlanJSONFormat(item, op, handler);
@@ -372809,23 +372938,30 @@ async function* process_operation_sync(item, op, handler, syncPolicy, generalPol
372809
372938
  break;
372810
372939
  }
372811
372940
  case 'observe': {
372812
- yield* doPlanJSONFormat(item, op, handler);
372941
+ yield* doPlanJSONFormat(item, op, handler, (result) => {
372942
+ doResult = result;
372943
+ });
372813
372944
  break;
372814
372945
  }
372815
372946
  default: {
372816
372947
  operator_src_logger.debug(`The Terraform processor detected a sync policy '${syncPolicy}' for item '${item.kind}/${item.metadata.name}' that is not supported.`);
372817
- yield* doPlanJSONFormat(item, op, handler);
372948
+ yield* doPlanJSONFormat(item, op, handler, (result) => {
372949
+ doResult = result;
372950
+ });
372818
372951
  break;
372819
372952
  }
372820
372953
  }
372821
372954
  }
372822
- yield {
372823
- item,
372824
- reason: op,
372825
- type: 'SYNCHRONIZED',
372826
- status: 'True',
372827
- message: 'Sync process finished',
372828
- };
372955
+ operator_src_logger.debug(`doResult is ${doResult}`);
372956
+ if (doResult === 'SYNC_SUCCESS') {
372957
+ yield {
372958
+ item,
372959
+ reason: op,
372960
+ type: 'SYNCHRONIZED',
372961
+ status: 'True',
372962
+ message: 'Sync process finished',
372963
+ };
372964
+ }
372829
372965
  }
372830
372966
  async function* process_operation_markedToDeletion(item, op, handler) {
372831
372967
  let error = false;
@@ -373228,6 +373364,9 @@ function resolveReferences(item, deps) {
373228
373364
  // if(!process.env.TONISILLO) process.exit(1)
373229
373365
  for (const iRef of itemReferences) {
373230
373366
  const ref = deps[`${iRef.ref.kind}-${iRef.ref.name}`];
373367
+ if (iRef.ref.kind === 'Secret') {
373368
+ ref.secret = ref.cr;
373369
+ }
373231
373370
  if (!ref) {
373232
373371
  throw new Error(`Reference ${iRef.ref.kind}-${iRef.ref.name} not found`);
373233
373372
  }
@@ -374162,6 +374301,7 @@ var sdk_metrics_build_src = __nccwpck_require__(84016);
374162
374301
 
374163
374302
 
374164
374303
 
374304
+
374165
374305
  const INTERVAL_IN_SEGS = 60;
374166
374306
  class CRStateMetrics {
374167
374307
  constructor(kind, namespace, meter) {
@@ -374184,6 +374324,9 @@ class CRStateMetrics {
374184
374324
  this.deletedGauge = meter.createGauge('firestartr_deleted_total', {
374185
374325
  description: 'Total number of CRs in DELETED state',
374186
374326
  });
374327
+ this.errorOnSyncGauge = meter.createGauge('firestartr_error_on_sync_total', {
374328
+ description: 'Total number of CRs with failed SYNCs',
374329
+ });
374187
374330
  this.namespace = namespace;
374188
374331
  }
374189
374332
  async start() {
@@ -374212,10 +374355,18 @@ class CRStateMetrics {
374212
374355
  let errorCount = 0;
374213
374356
  let planningCount = 0;
374214
374357
  let deletedCount = 0;
374358
+ let errorOnSyncCount = 0;
374215
374359
  for (const item of items) {
374216
374360
  const status = item.status?.conditions.find((condition) => condition.type !== 'SYNCHRONIZED' && condition.status === 'True');
374217
374361
  if (!status)
374218
374362
  continue;
374363
+ const syncCondition = item.status.conditions.find((condition) => {
374364
+ return condition.type === 'SYNCHRONIZED';
374365
+ });
374366
+ if (syncCondition &&
374367
+ syncCondition.message === SYNC_DEFAULT_ERROR_MESSAGE) {
374368
+ errorOnSyncCount++;
374369
+ }
374219
374370
  switch (status.type) {
374220
374371
  case 'PROVISIONED':
374221
374372
  provisionedCount++;
@@ -374261,6 +374412,10 @@ class CRStateMetrics {
374261
374412
  namespace: this.namespace,
374262
374413
  kind: this.kind,
374263
374414
  });
374415
+ this.errorOnSyncGauge.record(errorOnSyncCount, {
374416
+ namespace: this.namespace,
374417
+ kind: this.kind,
374418
+ });
374264
374419
  }
374265
374420
  catch (err) {
374266
374421
  console.log(`CRStateMetrics: update ${err}`);
@@ -2491,7 +2491,9 @@ export declare enum FirestartrTerraformWorkspaceSpecReferencesRefKind {
2491
2491
  /** FirestartrTerraformWorkspace */
2492
2492
  FIRESTARTR_TERRAFORM_WORKSPACE = "FirestartrTerraformWorkspace",
2493
2493
  /** ExternalSecret */
2494
- EXTERNAL_SECRET = "ExternalSecret"
2494
+ EXTERNAL_SECRET = "ExternalSecret",
2495
+ /** Secret */
2496
+ SECRET = "Secret"
2495
2497
  }
2496
2498
  /**
2497
2499
  * @schema FirestartrTerraformWorkspaceSpecContextBackendRefKind
@@ -2,5 +2,5 @@ import { RenderClaims } from '../renderer/types';
2
2
  export declare function extractRefs(renderClaims: RenderClaims, kind: string): any;
3
3
  export declare function extractAllRefs(claimData: string): any[];
4
4
  export declare function getGroupParentRef(parent: string, references?: any[]): any[];
5
- export declare function getTfWorkspacesRefs(values: any, references?: any[]): any[];
5
+ export declare function getTfWorkspacesRefs(values: any, references?: any[], secretsRefs?: any[]): any[][];
6
6
  export declare function getComponentVarsAndSecretsRefs(parsedClaim: any): string[];
@@ -5,7 +5,6 @@ export interface ConfigFile {
5
5
  dest: string;
6
6
  src: string;
7
7
  user_managed: boolean;
8
- target_branch: string;
9
8
  }
10
9
  export interface FeatureConfig {
11
10
  files?: ConfigFile[];
@@ -15,7 +14,6 @@ export interface ExpectedFile {
15
14
  localPath: string;
16
15
  repoPath: string;
17
16
  userManaged: boolean;
18
- targetBranch: string;
19
17
  }
20
18
  export interface ExpectedOutput {
21
19
  files: ExpectedFile[];
@@ -8,6 +8,7 @@ export default class CRStateMetrics {
8
8
  planningGauge: any;
9
9
  deletedGauge: any;
10
10
  errorGauge: any;
11
+ errorOnSyncGauge: any;
11
12
  onUpdate: boolean;
12
13
  namespace: string;
13
14
  kc: any;
@@ -14,6 +14,7 @@ export type SyncStatus = {
14
14
  syncStatusPresent?: boolean;
15
15
  intervalLapsed?: boolean;
16
16
  syncMode?: SyncMode;
17
+ hasSyncFailed?: boolean;
17
18
  };
18
19
  export type SyncWatcher = {
19
20
  itemPath: string;
@@ -1,3 +1,4 @@
1
1
  export declare const APPLY_DEFAULT_ERROR_MESSAGE = "An error occurred while executing the Terraform apply operation.";
2
2
  export declare const DESTROY_DEFAULT_ERROR_MESSAGE = "An error occurred while executing the Terraform destroy operation.";
3
3
  export declare const PLAN_DEFAULT_ERROR_MESSAGE = "An error occurred while executing the Terraform plan operation.";
4
+ export declare const SYNC_DEFAULT_ERROR_MESSAGE = "An error occurred while executing the Sync operation.";
@@ -1,2 +1,3 @@
1
1
  export { getRefNameFromKey, resolveRef, resolveScalar } from './resolver';
2
2
  export declare function resolveValues(values: any, refs: any): any;
3
+ export declare function resolveClaimSecrets(values: any, refs: any): any;
@@ -1,3 +1,4 @@
1
1
  export declare function resolveScalar(value: any, refs: any): any;
2
2
  export declare function getRefNameFromKey(key: string): string;
3
+ export declare function resolveClaimSecret(value: string, refs: any): any;
3
4
  export declare function resolveRef(key: string, references: any, wantsInterpolation?: boolean): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.54.0-snapshot-0",
3
+ "version": "1.54.0-snapshot-2",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",