@firestartr/cli 1.54.0-snapshot-14 → 1.55.0-snapshot-0

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
@@ -151708,7 +151708,7 @@ module.exports = exports.default;
151708
151708
 
151709
151709
  /***/ }),
151710
151710
 
151711
- /***/ 89323:
151711
+ /***/ 60762:
151712
151712
  /***/ ((module, exports) => {
151713
151713
 
151714
151714
 
@@ -151775,7 +151775,7 @@ var _isArrayLike = __nccwpck_require__(10860);
151775
151775
 
151776
151776
  var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
151777
151777
 
151778
- var _getIterator = __nccwpck_require__(89323);
151778
+ var _getIterator = __nccwpck_require__(60762);
151779
151779
 
151780
151780
  var _getIterator2 = _interopRequireDefault(_getIterator);
151781
151781
 
@@ -358145,10 +358145,26 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
358145
358145
  type: 'string',
358146
358146
  description: 'The github organization name',
358147
358147
  },
358148
+ name: {
358149
+ type: 'string',
358150
+ description: 'The github repo name',
358151
+ },
358152
+ orgPermissions: {
358153
+ type: 'string',
358154
+ description: 'The level of org Permission',
358155
+ },
358156
+ archiveOnDestroy: {
358157
+ type: 'boolean',
358158
+ description: 'whether this repo should be archived when the claim is deleted',
358159
+ },
358148
358160
  visibility: {
358149
358161
  type: 'string',
358150
358162
  enum: ['private', 'public', 'internal'],
358151
358163
  },
358164
+ description: {
358165
+ type: 'string',
358166
+ description: 'The purpose of this repo',
358167
+ },
358152
358168
  features: {
358153
358169
  type: 'array',
358154
358170
  items: {
@@ -359648,6 +359664,13 @@ var ajv_default = /*#__PURE__*/__nccwpck_require__.n(dist_ajv);
359648
359664
  },
359649
359665
  },
359650
359666
  },
359667
+ filesTemplates: {
359668
+ type: 'array',
359669
+ description: 'a list of references to a different file where files key is filled by an expanded template',
359670
+ items: {
359671
+ type: 'string',
359672
+ },
359673
+ },
359651
359674
  },
359652
359675
  required: ['args', 'feature_name', 'files', 'patches'],
359653
359676
  title: 'root',
@@ -359667,7 +359690,7 @@ var ajv_default = /*#__PURE__*/__nccwpck_require__.n(dist_ajv);
359667
359690
  additionalProperties: false,
359668
359691
  properties: {
359669
359692
  $lit: {
359670
- type: 'string',
359693
+ type: ['string', 'boolean'],
359671
359694
  },
359672
359695
  $ref: {
359673
359696
  type: 'array',
@@ -359679,7 +359702,7 @@ var ajv_default = /*#__PURE__*/__nccwpck_require__.n(dist_ajv);
359679
359702
  type: 'string',
359680
359703
  },
359681
359704
  $default: {
359682
- type: ['string', 'array'],
359705
+ type: ['string', 'array', 'boolean'],
359683
359706
  },
359684
359707
  },
359685
359708
  },
@@ -359759,7 +359782,9 @@ function __validateFeatureConfig(featurePath) {
359759
359782
  }
359760
359783
  }
359761
359784
  function __validateFeatureConfigData(configData) {
359762
- const ajv = new (ajv_default())();
359785
+ const ajv = new (ajv_default())({
359786
+ allowUnionTypes: true,
359787
+ });
359763
359788
  const validate = ajv.compile(src_schema);
359764
359789
  const valid = validate(configData);
359765
359790
  if (!valid) {
@@ -360593,10 +360618,14 @@ function addTraceabilityStamp(context, content) {
360593
360618
 
360594
360619
 
360595
360620
 
360621
+
360596
360622
  function render(featurePath, featureRenderPath, entity, firestartrConfig = {}, featureArgs = {}) {
360597
360623
  const configData = validate_validate(featurePath);
360598
360624
  const context = buildContext(entity, configData.args, firestartrConfig, featureArgs);
360599
360625
  context.config = JSON.parse(renderContent(JSON.stringify(configData), context));
360626
+ if ('filesTemplates' in context.config) {
360627
+ expandFiles(featurePath, configData, context);
360628
+ }
360600
360629
  const output = { files: [] };
360601
360630
  context.config.files.forEach((file) => {
360602
360631
  const { src, dest } = file;
@@ -360654,6 +360683,22 @@ function buildContext(entity, args, firestartrConfig, featureArgs) {
360654
360683
  context.traceability = featureArgs['traceability'] || {};
360655
360684
  return context;
360656
360685
  }
360686
+ function expandFiles(featurePath, configData, context) {
360687
+ let files = [];
360688
+ for (const tpl of configData.filesTemplates) {
360689
+ const addToFiles = expandFilesTemplate(featurePath, tpl, context);
360690
+ files = files.concat(addToFiles).flat(Infinity);
360691
+ }
360692
+ context.config.files = context.config.files.concat(files).flat(Infinity);
360693
+ }
360694
+ function expandFilesTemplate(featurePath, tplPath, context) {
360695
+ const template = external_fs_default().readFileSync(external_path_default().join(featurePath, tplPath)).toString();
360696
+ const renderedTemplate = renderContent(template, context);
360697
+ const data = catalog_common.io.fromYaml(renderedTemplate) || { files: [] };
360698
+ if (!data.files)
360699
+ data.files = [];
360700
+ return data.files.filter((file) => file);
360701
+ }
360657
360702
  function renderContent(template, ctx) {
360658
360703
  return mustache_mustache.render(template, ctx, {}, ['{{|', '|}}']);
360659
360704
  }
@@ -360723,7 +360768,7 @@ function loadAndValidateRenderTests(featurePath) {
360723
360768
  throw new Error(`render_tests.yaml is required but not found at ${file}`);
360724
360769
  }
360725
360770
  const raw = loadYaml(file);
360726
- const ajv = new (ajv_default())({ allErrors: true, strict: true });
360771
+ const ajv = new (ajv_default())({ allErrors: true, strict: true, allowUnionTypes: true });
360727
360772
  const validate = ajv.compile(renderTestsSchema);
360728
360773
  const ok = validate(raw);
360729
360774
  if (!ok) {
@@ -367240,6 +367285,9 @@ const kindPluralMap = {
367240
367285
  providerconfigs: 'FirestartrProviderConfig',
367241
367286
  externalsecrets: 'ExternalSecret',
367242
367287
  secrets: 'Secret',
367288
+ fsdummiesa: 'FirestartrDummyA',
367289
+ fsdummiesb: 'FirestartrDummyB',
367290
+ fsdummiesc: 'FirestartrDummyC',
367243
367291
  };
367244
367292
  function getKindFromPlural(plural) {
367245
367293
  return kindPluralMap[plural];
@@ -368535,6 +368583,9 @@ var WorkStatus;
368535
368583
 
368536
368584
 
368537
368585
  const kindsWithFinalizer = [
368586
+ 'FirestartrDummyA',
368587
+ 'FirestartrDummyB',
368588
+ 'FirestartrDummyC',
368538
368589
  'FirestartrTerraformWorkspace',
368539
368590
  'FirestartrGithubGroup',
368540
368591
  'FirestartrGithubMembership',
@@ -368543,6 +368594,11 @@ const kindsWithFinalizer = [
368543
368594
  'FirestartrGithubOrgWebhook',
368544
368595
  'FirestartrGithubRepositorySecretsSection',
368545
368596
  ];
368597
+ const kindsWithDependants = [
368598
+ 'FirestartrDummyA',
368599
+ 'FirestartrDummyB',
368600
+ 'FirestartrGithubRepository',
368601
+ ];
368546
368602
  /**
368547
368603
  * Observe whenever a new item is added, modified or deleted in a given kind
368548
368604
  * @param {string} pluralKind - Kind to observe
@@ -368653,6 +368709,28 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
368653
368709
  itemPath: () => informer_itemPath(pluralKind, workItem.item),
368654
368710
  error: () => retryCtl.errorReconciling(informer_itemPath(pluralKind, workItem.item)),
368655
368711
  success: () => retryCtl.successReconciling(informer_itemPath(pluralKind, workItem.item)),
368712
+ needsBlocking: (item) => {
368713
+ if (kindsWithDependants.indexOf(item.kind) === -1) {
368714
+ return false;
368715
+ }
368716
+ if (item.metadata.finalizers &&
368717
+ item.metadata.finalizers.indexOf('foregroundDeletion') !== -1) {
368718
+ // it will block for five seconds
368719
+ workItem.isBlocked = true;
368720
+ const tTimeout = setTimeout(() => {
368721
+ workItem.isBlocked = false;
368722
+ }, 1000 * 5);
368723
+ workItem.fUnblock = () => {
368724
+ clearTimeout(tTimeout);
368725
+ workItem.isBlocked = false;
368726
+ };
368727
+ return true;
368728
+ }
368729
+ else {
368730
+ workItem.isBlocked = false;
368731
+ return false;
368732
+ }
368733
+ },
368656
368734
  };
368657
368735
  workItem.process = async function* (item, operation, handler) {
368658
368736
  const needsUpdateSyncConditions = operation === OperationType.RENAMED ||
@@ -368681,6 +368759,7 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
368681
368759
  operator_src_logger.debug(`The informer received an item with an operation type of '${operation}', which is not a specific operation.`);
368682
368760
  }
368683
368761
  };
368762
+ workItem.isBlocked = false;
368684
368763
  queue(workItem);
368685
368764
  }
368686
368765
  function informer_itemPath(kind, item) {
@@ -368904,6 +368983,327 @@ function dummy_fWait(ms) {
368904
368983
  });
368905
368984
  }
368906
368985
 
368986
+ ;// CONCATENATED MODULE: ../operator/src/ownership.ts
368987
+
368988
+
368989
+
368990
+ async function getOwnerReferences(item) {
368991
+ return item.metadata?.ownerReferences || [];
368992
+ }
368993
+ async function setOwnerReference(itemPath, namespace, ownerKind, ownerName, blockOwnerDeletion = true) {
368994
+ let item = null;
368995
+ try {
368996
+ // we need to search for the owner's uuid
368997
+ const owner = await getItemByItemPath(`${namespace}/${ownerKind}/${ownerName}`);
368998
+ const ownerReference = {
368999
+ apiVersion: owner.apiVersion,
369000
+ kind: owner.kind,
369001
+ name: ownerName,
369002
+ controller: true,
369003
+ blockOwnerDeletion,
369004
+ uid: owner.metadata.uid,
369005
+ };
369006
+ // we get the item (to prevent race conditions)
369007
+ item = await getItemByItemPath(itemPath);
369008
+ const ownerReferences = item.metadata.ownerReferences ?? [];
369009
+ const existingRefIndex = ownerReferences.findIndex((ref) => ref.uid === ownerReference.uid);
369010
+ if (existingRefIndex === -1) {
369011
+ // Reference does not exist, add it
369012
+ ownerReferences.push(ownerReference);
369013
+ }
369014
+ else {
369015
+ ownerReferences[existingRefIndex] = ownerReference;
369016
+ }
369017
+ await writeOwnerReferences(definitions_getPluralFromKind(item.kind), item.metadata.namespace, item, ownerReferences);
369018
+ }
369019
+ catch (err) {
369020
+ operator_src_logger.error(err);
369021
+ throw `Setting OwnerReferences to ${item.kind}/${item.metadata.name}: ${err}`;
369022
+ }
369023
+ }
369024
+ async function writeOwnerReferences(kind, namespace, item, ownerReferences) {
369025
+ operator_src_logger.debug(`The ctl is setting the ownerReferences for '${kind}/${item.metadata.name}' in namespace '${namespace}'.`);
369026
+ const { kc, opts } = await ctl_getConnection();
369027
+ const url = `${kc.getCurrentCluster().server}/apis/firestartr.dev/v1/namespaces/${namespace}/${kind}/${item.metadata.name}`;
369028
+ opts.headers['Content-Type'] = 'application/json-patch+json';
369029
+ opts.headers['Accept'] = '*';
369030
+ const patch = {
369031
+ op: 'replace',
369032
+ path: '/metadata/ownerReferences',
369033
+ value: ownerReferences,
369034
+ };
369035
+ const r = await fetch(url, {
369036
+ method: 'PATCH',
369037
+ headers: opts.headers,
369038
+ body: JSON.stringify([patch]),
369039
+ });
369040
+ if (!r.ok) {
369041
+ throw `Error on setOwnerReferences: ${namespace}/${kind}/${item['metadata']['name']}: ${r.statusText}`;
369042
+ }
369043
+ return r.json();
369044
+ }
369045
+
369046
+ ;// CONCATENATED MODULE: ../operator/fdummies/index.ts
369047
+
369048
+
369049
+
369050
+
369051
+
369052
+ function processFirestartrDummies(item, op, handler) {
369053
+ operator_src_logger.info(`FirestartrDummies Processor: ${op}`);
369054
+ try {
369055
+ switch (op) {
369056
+ case OperationType.UPDATED:
369057
+ return updated(item, op, handler);
369058
+ case OperationType.CREATED:
369059
+ return created(item, op, handler);
369060
+ case OperationType.RENAMED:
369061
+ return renamed();
369062
+ case OperationType.MARKED_TO_DELETION:
369063
+ return marked(item, op, handler);
369064
+ case OperationType.RETRY:
369065
+ return fdummies_retry();
369066
+ case OperationType.NOTHING:
369067
+ return nothing();
369068
+ default:
369069
+ throw new Error(`Operation ${op} not supported`);
369070
+ }
369071
+ }
369072
+ catch (e) {
369073
+ operator_src_logger.error(`The Dummy processor encountered an error during operation '${op}': '${e}'.`);
369074
+ throw e;
369075
+ }
369076
+ }
369077
+ async function* updated(item, op, handler) {
369078
+ operator_src_logger.info(`Updated op in ${item.kind}/${item.metadata.name}`);
369079
+ for await (const transition of doRun(item, op, handler)) {
369080
+ yield transition;
369081
+ }
369082
+ await handleOwnerReferences(item, handler);
369083
+ }
369084
+ async function* created(item, op, handler) {
369085
+ for await (const transition of doRun(item, op, handler)) {
369086
+ yield transition;
369087
+ }
369088
+ await handleOwnerReferences(item, handler);
369089
+ }
369090
+ async function handleOwnerReferences(item, handler) {
369091
+ if ('needs' in item.spec) {
369092
+ const needs = item.spec.needs;
369093
+ await setOwnerReference(handler.itemPath(), item.metadata.namespace, definitions_getPluralFromKind(needs.kind), needs.name);
369094
+ }
369095
+ }
369096
+ async function renamed() {
369097
+ throw new Error('Renamed operation not prepared');
369098
+ }
369099
+ async function* sync(item, op, handler) {
369100
+ for await (const transition of doRun(item, op, handler)) {
369101
+ yield transition;
369102
+ }
369103
+ }
369104
+ async function* marked(item, op, handler) {
369105
+ for await (const transition of markedToDeletion(item, op, handler)) {
369106
+ yield transition;
369107
+ }
369108
+ }
369109
+ async function* fdummies_retry() { }
369110
+ async function* nothing() { }
369111
+ async function* markedToDeletion(item, op, handler) {
369112
+ let error = false;
369113
+ try {
369114
+ const type = 'DELETING';
369115
+ yield {
369116
+ item,
369117
+ reason: op,
369118
+ type: 'PROVISIONING',
369119
+ status: 'False',
369120
+ message: 'markedToDeletion',
369121
+ };
369122
+ yield {
369123
+ item,
369124
+ reason: op,
369125
+ type: 'DELETED',
369126
+ status: 'False',
369127
+ message: 'markedToDeletion',
369128
+ };
369129
+ yield {
369130
+ item,
369131
+ reason: op,
369132
+ type: 'PLANNING',
369133
+ status: 'False',
369134
+ message: 'markedToDeletion',
369135
+ };
369136
+ yield {
369137
+ item,
369138
+ reason: op,
369139
+ type: 'OUT_OF_SYNC',
369140
+ status: 'False',
369141
+ message: 'markedToDeletion',
369142
+ };
369143
+ yield {
369144
+ item,
369145
+ reason: op,
369146
+ type: 'ERROR',
369147
+ status: 'False',
369148
+ message: 'doApply',
369149
+ };
369150
+ yield {
369151
+ item,
369152
+ reason: op,
369153
+ type: 'PROVISIONED',
369154
+ status: 'False',
369155
+ message: 'Synth CDKTF',
369156
+ };
369157
+ yield {
369158
+ item,
369159
+ reason: op,
369160
+ type,
369161
+ status: 'True',
369162
+ message: 'Destroying process started',
369163
+ };
369164
+ await handler.resolveReferences();
369165
+ await processDummy(item, op);
369166
+ yield {
369167
+ item,
369168
+ reason: op,
369169
+ type,
369170
+ status: 'False',
369171
+ message: 'Destroying process finished',
369172
+ };
369173
+ yield {
369174
+ item,
369175
+ reason: op,
369176
+ type: 'DELETED',
369177
+ status: 'True',
369178
+ message: 'destroyed',
369179
+ };
369180
+ await handler.finalize(handler.pluralKind, item.metadata.namespace, item, 'firestartr.dev/finalizer');
369181
+ void handler.success();
369182
+ }
369183
+ catch (e) {
369184
+ error = true;
369185
+ void handler.error();
369186
+ }
369187
+ finally {
369188
+ if (error) {
369189
+ yield {
369190
+ item,
369191
+ reason: op,
369192
+ type: 'ERROR',
369193
+ status: 'True',
369194
+ message: DESTROY_DEFAULT_ERROR_MESSAGE,
369195
+ };
369196
+ }
369197
+ }
369198
+ }
369199
+ async function* doRun(item, op, handler) {
369200
+ let error = false;
369201
+ try {
369202
+ yield {
369203
+ item,
369204
+ reason: op,
369205
+ type: 'DELETED',
369206
+ status: 'False',
369207
+ message: 'markedToDeletion',
369208
+ };
369209
+ yield {
369210
+ item,
369211
+ reason: op,
369212
+ type: 'ERROR',
369213
+ status: 'False',
369214
+ message: 'doRun',
369215
+ };
369216
+ yield {
369217
+ item,
369218
+ reason: op,
369219
+ type: 'PROVISIONED',
369220
+ status: 'False',
369221
+ message: 'Run processor',
369222
+ };
369223
+ //let output = '';
369224
+ const type = 'PROVISIONING';
369225
+ yield {
369226
+ item,
369227
+ reason: op,
369228
+ type,
369229
+ status: 'True',
369230
+ message: 'Provisioning process started',
369231
+ };
369232
+ const deps = await handler.resolveReferences();
369233
+ operator_src_logger.info(`The dummy processor is applying and assessing dependencies for item '${item.kind}/${item.metadata.name}' with dependencies: '${deps}'.`);
369234
+ await processDummy(item, op);
369235
+ yield {
369236
+ item,
369237
+ reason: op,
369238
+ type,
369239
+ status: 'False',
369240
+ message: 'Dummy Processor apply finished',
369241
+ };
369242
+ yield {
369243
+ item,
369244
+ reason: op,
369245
+ type: 'PROVISIONED',
369246
+ status: 'True',
369247
+ message: 'Dummy Processor apply finished',
369248
+ };
369249
+ yield {
369250
+ item,
369251
+ reason: op,
369252
+ type: 'ERROR',
369253
+ status: 'False',
369254
+ message: 'doApply',
369255
+ };
369256
+ await handler.success();
369257
+ }
369258
+ catch (e) {
369259
+ error = true;
369260
+ console.error(e);
369261
+ operator_src_logger.error(`The Dummy processor encountered an error during operation '${op}' for item '${item.kind}/${item.metadata.name}': '${e}'.`);
369262
+ await handler.error();
369263
+ }
369264
+ finally {
369265
+ if (error) {
369266
+ yield {
369267
+ item,
369268
+ reason: op,
369269
+ type: 'ERROR',
369270
+ status: 'True',
369271
+ message: APPLY_DEFAULT_ERROR_MESSAGE,
369272
+ };
369273
+ yield {
369274
+ item,
369275
+ reason: op,
369276
+ type: 'PROVISIONED',
369277
+ status: 'False',
369278
+ message: APPLY_DEFAULT_ERROR_MESSAGE,
369279
+ };
369280
+ yield {
369281
+ item,
369282
+ reason: op,
369283
+ type: 'PROVISIONING',
369284
+ status: 'False',
369285
+ message: APPLY_DEFAULT_ERROR_MESSAGE,
369286
+ };
369287
+ }
369288
+ }
369289
+ }
369290
+ async function processDummy(item, op) {
369291
+ const s = op === OperationType.MARKED_TO_DELETION
369292
+ ? item.spec?.computation?.numberOfSecondsToDestroy
369293
+ : item.spec?.computation?.numberOfSeconds;
369294
+ operator_src_logger.info(`Processing dummy (op = ${op}) ${item.kind}/${item.metadata.name}: computing for ${s} seconds`);
369295
+ if (!s)
369296
+ throw new Error('Unprocessable dummy: no seconds section');
369297
+ await fdummies_fWait(s * 1000);
369298
+ }
369299
+ function fdummies_fWait(ms) {
369300
+ return new Promise((resolve) => {
369301
+ setTimeout(() => {
369302
+ resolve();
369303
+ }, ms);
369304
+ });
369305
+ }
369306
+
368907
369307
  ;// CONCATENATED MODULE: ../operator/src/processItem.debug.ts
368908
369308
 
368909
369309
 
@@ -368926,7 +369326,8 @@ async function writeDownQueueStatus(queue) {
368926
369326
  let output = '';
368927
369327
  for (const workItem of queue) {
368928
369328
  const item = workItem.item;
368929
- output += `${item.kind}/${item.metadata.name} - ${workItem.workStatus} - ${workItem.operation} - (upsert ${formatElapsedTimeWithDate(workItem.upsertTime)})\n`;
369329
+ const blockedText = workItem.isBlocked ? '[BLOCKED]' : '';
369330
+ output += `${item.kind}/${item.metadata.name} - ${workItem.workStatus} - ${workItem.operation} ${blockedText} - (upsert ${formatElapsedTimeWithDate(workItem.upsertTime)})\n`;
368930
369331
  }
368931
369332
  return new Promise((ok, ko) => {
368932
369333
  external_fs_.writeFile('/tmp/queue', output, (err) => {
@@ -369119,7 +369520,9 @@ async function processItem(workItem) {
369119
369520
  * @returns {void}
369120
369521
  */
369121
369522
  async function processItem_loop() {
369122
- const nextWorkItem = () => sortQueue(queue).find((w) => w.workStatus === WorkStatus.PENDING);
369523
+ const nextWorkItem = () => sortQueue(queue)
369524
+ .filter((w) => !w.isBlocked)
369525
+ .find((w) => w.workStatus === WorkStatus.PENDING);
369123
369526
  loopWorkItemDebug(queue);
369124
369527
  while (1) {
369125
369528
  const w = nextWorkItem();
@@ -369183,6 +369586,14 @@ async function runWorkItem(workItem) {
369183
369586
  return;
369184
369587
  try {
369185
369588
  const item = await workItem.getItem();
369589
+ // we check if the workItem needs blocking
369590
+ // if it does need it we return because we cannot
369591
+ // process this item
369592
+ if ('needsBlocking' in workItem.handler &&
369593
+ workItem.handler.needsBlocking(item)) {
369594
+ operator_src_logger.debug(`Item ${item.kind}/${item.metadata.namespace} needs blocking`);
369595
+ return;
369596
+ }
369186
369597
  workItem.workStatus = WorkStatus.PROCESSING;
369187
369598
  for await (const condition of workItem.process(item, workItem.operation, workItem.handler)) {
369188
369599
  if (workItem.handler === undefined)
@@ -369469,7 +369880,7 @@ function provisionRepository(scope, fsGithubRepository) {
369469
369880
  allowAutoMerge: fsGithubRepository.spec.repo.allowAutoMerge,
369470
369881
  deleteBranchOnMerge: fsGithubRepository.spec.repo.deleteBranchOnMerge,
369471
369882
  autoInit: fsGithubRepository.spec.repo.autoInit,
369472
- archiveOnDestroy: true,
369883
+ archiveOnDestroy: fsGithubRepository.spec.repo.archiveOnDestroy,
369473
369884
  allowUpdateBranch: fsGithubRepository.spec.repo.allowUpdateBranch,
369474
369885
  hasIssues: fsGithubRepository.spec.repo.hasIssues,
369475
369886
  visibility: fsGithubRepository.spec.repo.visibility,
@@ -371392,6 +371803,33 @@ function helperCreateCheckRunName(cmd, item) {
371392
371803
  return `${item.kind} - ${cmd}`;
371393
371804
  }
371394
371805
 
371806
+ ;// CONCATENATED MODULE: ../operator/src/cdktf/ownership.ts
371807
+
371808
+
371809
+
371810
+ const kindsWithFirestartrGithubRepositoryDependence = [
371811
+ 'FirestartrGithubRepositorySecretsSection',
371812
+ 'FirestartrGithubRepositoryFeature',
371813
+ ];
371814
+ async function manageOwnershipReferences(item, handler, op) {
371815
+ if (kindsWithFirestartrGithubRepositoryDependence.indexOf(item.kind) !== -1) {
371816
+ await manageOwnershipReferencesForRepo(item, handler, op);
371817
+ }
371818
+ }
371819
+ async function manageOwnershipReferencesForRepo(item, handler, op) {
371820
+ try {
371821
+ const repositoryTarget = item.spec?.repositoryTarget?.ref;
371822
+ if (!repositoryTarget) {
371823
+ throw `Item ${item.kind}/${item.metadata.namespace} is not correct: it does not have a repositoryTarget`;
371824
+ }
371825
+ await setOwnerReference(handler.itemPath(), item.metadata.namespace, definitions_getPluralFromKind(repositoryTarget.kind), repositoryTarget.name);
371826
+ }
371827
+ catch (err) {
371828
+ operator_src_logger.error(`Handling ownership for ${item.kind}/${item.metadata.name}: ${err}`);
371829
+ throw new Error(`Handling ownership for ${item.kind}/${item.metadata.name}: ${err}`);
371830
+ }
371831
+ }
371832
+
371395
371833
  ;// CONCATENATED MODULE: ../operator/cdktf.ts
371396
371834
 
371397
371835
 
@@ -371402,24 +371840,25 @@ function helperCreateCheckRunName(cmd, item) {
371402
371840
 
371403
371841
 
371404
371842
 
371843
+
371405
371844
  function processOperation(item, op, handler) {
371406
371845
  operator_src_logger.info(`Processing operation ${op} on ${item.kind}/${item.metadata?.name}`);
371407
371846
  try {
371408
371847
  switch (op) {
371409
371848
  case OperationType.UPDATED:
371410
- return updated(item, op, handler);
371849
+ return cdktf_updated(item, op, handler);
371411
371850
  case OperationType.CREATED:
371412
- return created(item, op, handler);
371851
+ return cdktf_created(item, op, handler);
371413
371852
  case OperationType.RENAMED:
371414
- return renamed(item, op, handler);
371853
+ return cdktf_renamed(item, op, handler);
371415
371854
  case OperationType.SYNC:
371416
- return sync(item, op, handler);
371855
+ return cdktf_sync(item, op, handler);
371417
371856
  case OperationType.MARKED_TO_DELETION:
371418
- return markedToDeletion(item, op, handler);
371857
+ return cdktf_markedToDeletion(item, op, handler);
371419
371858
  case OperationType.RETRY:
371420
371859
  return cdktf_retry(item, op, handler);
371421
371860
  case OperationType.NOTHING:
371422
- return nothing(item, op, handler);
371861
+ return cdktf_nothing(item, op, handler);
371423
371862
  default:
371424
371863
  throw new Error(`Operation ${op} not supported`);
371425
371864
  }
@@ -371429,24 +371868,27 @@ function processOperation(item, op, handler) {
371429
371868
  throw e;
371430
371869
  }
371431
371870
  }
371432
- async function* created(item, op, handler) {
371871
+ async function* cdktf_created(item, op, handler) {
371433
371872
  for await (const transition of doApply(item, op, handler)) {
371434
371873
  yield transition;
371435
371874
  }
371875
+ await manageOwnershipReferences(item, handler, op);
371436
371876
  }
371437
- async function* renamed(item, op, handler) {
371877
+ async function* cdktf_renamed(item, op, handler) {
371438
371878
  for await (const transition of doApply(item, op, handler)) {
371439
371879
  yield transition;
371440
371880
  }
371881
+ await manageOwnershipReferences(item, handler, op);
371441
371882
  }
371442
- async function* updated(item, op, handler) {
371883
+ async function* cdktf_updated(item, op, handler) {
371443
371884
  for await (const transition of doApply(item, op, handler)) {
371444
371885
  yield transition;
371445
371886
  }
371887
+ await manageOwnershipReferences(item, handler, op);
371446
371888
  }
371447
371889
  async function* cdktf_retry(item, op, handler) {
371448
371890
  if ('deletionTimestamp' in item.metadata) {
371449
- for await (const transition of markedToDeletion(item, op, handler)) {
371891
+ for await (const transition of cdktf_markedToDeletion(item, op, handler)) {
371450
371892
  yield transition;
371451
371893
  }
371452
371894
  }
@@ -371456,7 +371898,7 @@ async function* cdktf_retry(item, op, handler) {
371456
371898
  }
371457
371899
  }
371458
371900
  }
371459
- async function* sync(item, op, handler) {
371901
+ async function* cdktf_sync(item, op, handler) {
371460
371902
  yield {
371461
371903
  item,
371462
371904
  reason: op,
@@ -371475,7 +371917,7 @@ async function* sync(item, op, handler) {
371475
371917
  message: 'terraform execution finished',
371476
371918
  };
371477
371919
  }
371478
- async function* markedToDeletion(item, op, handler) {
371920
+ async function* cdktf_markedToDeletion(item, op, handler) {
371479
371921
  // here we store the current callbacks that
371480
371922
  // are being used (synth|tf-apply...)
371481
371923
  let checkRunCtl;
@@ -371574,7 +372016,7 @@ async function* markedToDeletion(item, op, handler) {
371574
372016
  }
371575
372017
  }
371576
372018
  }
371577
- async function* nothing(item, op, handler) {
372019
+ async function* cdktf_nothing(item, op, handler) {
371578
372020
  yield {
371579
372021
  item,
371580
372022
  reason: op,
@@ -372383,8 +372825,7 @@ class WriterAdditionalFiles extends writer {
372383
372825
  super();
372384
372826
  this.files = files;
372385
372827
  }
372386
- // this writer does not "write" anything per se
372387
- // it just complies with the abstract class it inherits from
372828
+ // This writer complies with the abstract Writer class but does not render content in the traditional sense.
372388
372829
  async _render() {
372389
372830
  return '';
372390
372831
  }
@@ -374996,6 +375437,7 @@ async function tfLocal(cr, namespace, cmd = 'plan') {
374996
375437
 
374997
375438
 
374998
375439
 
375440
+
374999
375441
  let importModeActive = false;
375000
375442
  let withMetricsMode = false;
375001
375443
 
@@ -375070,6 +375512,11 @@ function getProvisionImplementation(plural) {
375070
375512
  case 'githubrepositorysecretssections':
375071
375513
  implementation = processOperation;
375072
375514
  break;
375515
+ case 'fsdummiesa':
375516
+ case 'fsdummiesb':
375517
+ case 'fsdummiesc':
375518
+ implementation = processFirestartrDummies;
375519
+ break;
375073
375520
  }
375074
375521
  if (!implementation)
375075
375522
  throw new Error(`No implementation found for ${plural}`);
@@ -489,10 +489,26 @@ declare const schemas: {
489
489
  type: string;
490
490
  description: string;
491
491
  };
492
+ name: {
493
+ type: string;
494
+ description: string;
495
+ };
496
+ orgPermissions: {
497
+ type: string;
498
+ description: string;
499
+ };
500
+ archiveOnDestroy: {
501
+ type: string;
502
+ description: string;
503
+ };
492
504
  visibility: {
493
505
  type: string;
494
506
  enum: string[];
495
507
  };
508
+ description: {
509
+ type: string;
510
+ description: string;
511
+ };
496
512
  features: {
497
513
  type: string;
498
514
  items: {
@@ -19,10 +19,26 @@ declare const _default: {
19
19
  type: string;
20
20
  description: string;
21
21
  };
22
+ name: {
23
+ type: string;
24
+ description: string;
25
+ };
26
+ orgPermissions: {
27
+ type: string;
28
+ description: string;
29
+ };
30
+ archiveOnDestroy: {
31
+ type: string;
32
+ description: string;
33
+ };
22
34
  visibility: {
23
35
  type: string;
24
36
  enum: string[];
25
37
  };
38
+ description: {
39
+ type: string;
40
+ description: string;
41
+ };
26
42
  features: {
27
43
  type: string;
28
44
  items: {
@@ -124,10 +124,26 @@ export declare const GithubSchemas: ({
124
124
  type: string;
125
125
  description: string;
126
126
  };
127
+ name: {
128
+ type: string;
129
+ description: string;
130
+ };
131
+ orgPermissions: {
132
+ type: string;
133
+ description: string;
134
+ };
135
+ archiveOnDestroy: {
136
+ type: string;
137
+ description: string;
138
+ };
127
139
  visibility: {
128
140
  type: string;
129
141
  enum: string[];
130
142
  };
143
+ description: {
144
+ type: string;
145
+ description: string;
146
+ };
131
147
  features: {
132
148
  type: string;
133
149
  items: {
@@ -1,3 +1,4 @@
1
1
  export default function render(featurePath: string, featureRenderPath: string, entity: any, firestartrConfig?: any, featureArgs?: any): any;
2
2
  export declare function buildContext(entity: any, args: any, firestartrConfig: any, featureArgs: any): any;
3
+ export declare function expandFiles(featurePath: string, configData: any, context: any): void;
3
4
  export declare function renderContent(template: string, ctx: any): string;
@@ -29,6 +29,13 @@ declare const _default: {
29
29
  };
30
30
  };
31
31
  };
32
+ filesTemplates: {
33
+ type: string;
34
+ description: string;
35
+ items: {
36
+ type: string;
37
+ };
38
+ };
32
39
  };
33
40
  required: string[];
34
41
  title: string;
@@ -48,7 +55,7 @@ declare const _default: {
48
55
  additionalProperties: boolean;
49
56
  properties: {
50
57
  $lit: {
51
- type: string;
58
+ type: string[];
52
59
  };
53
60
  $ref: {
54
61
  type: string;
@@ -0,0 +1,8 @@
1
+ import { OperationType } from '../src/informer';
2
+ export declare function processFirestartrDummies(item: any, op: string, handler: any): Promise<void> | AsyncGenerator<{
3
+ item: any;
4
+ reason: OperationType;
5
+ type: string;
6
+ status: string;
7
+ message: string;
8
+ }, void, unknown>;
@@ -0,0 +1,2 @@
1
+ import { OperationType } from '../informer';
2
+ export declare function manageOwnershipReferences(item: any, handler: any, op: OperationType): Promise<void>;
@@ -23,6 +23,8 @@ export type WorkItem = {
23
23
  process?: Function;
24
24
  upsertTime?: number;
25
25
  isDeadLetter?: boolean;
26
+ isBlocked?: boolean;
27
+ fUnblock?: Function;
26
28
  };
27
29
  type HandlerFinalizerFn = (kind: string, namespace: string, item: any | string, finalizer: string) => Promise<any>;
28
30
  type HandlerInformPlanFn = (prUrl: string, planText: string) => Promise<void>;
@@ -44,6 +46,9 @@ export type WorkItemHandler = {
44
46
  itemPath: ItemPathFn;
45
47
  error: ErrorFn;
46
48
  success: SuccessFn;
49
+ isBlocked?: boolean;
50
+ needsBlocking?: (item: any) => boolean;
51
+ fUnblock?: Function;
47
52
  };
48
53
  /**
49
54
  * Observe whenever a new item is added, modified or deleted in a given kind
@@ -0,0 +1,4 @@
1
+ import { OwnerReference } from './types';
2
+ export declare function getOwnerReferences(item: any): Promise<OwnerReference[]>;
3
+ export declare function setOwnerReference(itemPath: string, namespace: string, ownerKind: string, ownerName: string, blockOwnerDeletion?: boolean): Promise<void>;
4
+ export declare function writeOwnerReferences(kind: string, namespace: string, item: any, ownerReferences: OwnerReference[]): Promise<any>;
@@ -0,0 +1,8 @@
1
+ export interface OwnerReference {
2
+ apiVersion: string;
3
+ kind: string;
4
+ name: string;
5
+ uid: string;
6
+ controller?: boolean;
7
+ blockOwnerDeletion?: boolean;
8
+ }
@@ -1,6 +1,17 @@
1
1
  import Writer from './writer';
2
+ /**
3
+ * Represents a file to be written to the Terraform workspace.
4
+ * @property content The file contents, base64-encoded. This will be decoded before writing to disk.
5
+ * @property path The relative path (from the project root) where the file should be written.
6
+ */
2
7
  export interface FirestartrTerraformWorkspaceSpecFile {
8
+ /**
9
+ * The file contents, base64-encoded. This will be decoded before writing to disk.
10
+ */
3
11
  content: string;
12
+ /**
13
+ * The relative path (from the project root) where the file should be written.
14
+ */
4
15
  path: string;
5
16
  }
6
17
  type FirestartrTerraformWorkspaceSpecFiles = FirestartrTerraformWorkspaceSpecFile[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.54.0-snapshot-14",
3
+ "version": "1.55.0-snapshot-0",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",