@firestartr/cli 2.7.0 → 2.8.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
@@ -320683,6 +320683,13 @@ const GithubSchemas = [
320683
320683
  module: {
320684
320684
  type: 'string',
320685
320685
  },
320686
+ variants: {
320687
+ type: 'array',
320688
+ items: {
320689
+ $ref: 'firestartr.dev://terraform/TerraformProviderVariant',
320690
+ },
320691
+ description: 'variant clones of this workspace — stripped before parent claim validation',
320692
+ },
320686
320693
  context: {
320687
320694
  type: 'object',
320688
320695
  properties: {
@@ -320717,6 +320724,90 @@ const GithubSchemas = [
320717
320724
  },
320718
320725
  ],
320719
320726
  },
320727
+ TerraformProviderVariantOverride: {
320728
+ $id: 'firestartr.dev://terraform/TerraformProviderVariantOverride',
320729
+ description: 'Override fields for a variant of a TFWorkspaceClaim',
320730
+ type: 'object',
320731
+ properties: {
320732
+ name: {
320733
+ type: 'string',
320734
+ description: 'override the terraform provider name',
320735
+ },
320736
+ values: {
320737
+ type: 'object',
320738
+ additionalProperties: true,
320739
+ description: 'override values',
320740
+ },
320741
+ context: {
320742
+ type: 'object',
320743
+ properties: {
320744
+ providers: {
320745
+ type: 'array',
320746
+ items: {
320747
+ type: 'object',
320748
+ properties: { name: { type: 'string' } },
320749
+ additionalProperties: false,
320750
+ },
320751
+ },
320752
+ backend: {
320753
+ type: 'object',
320754
+ properties: { name: { type: 'string' } },
320755
+ additionalProperties: false,
320756
+ },
320757
+ },
320758
+ additionalProperties: false,
320759
+ description: 'override context',
320760
+ },
320761
+ files: {
320762
+ $ref: 'firestartr.dev://terraform/TerraformProviderFiles',
320763
+ },
320764
+ policy: {
320765
+ type: 'string',
320766
+ enum: [
320767
+ 'apply',
320768
+ 'create-only',
320769
+ 'create-update-only',
320770
+ 'full-control',
320771
+ 'observe',
320772
+ 'observe-only',
320773
+ ],
320774
+ },
320775
+ tfStateKey: {
320776
+ $ref: 'firestartr.dev://common/TerraformStateKey',
320777
+ },
320778
+ sync: {
320779
+ type: 'object',
320780
+ properties: {
320781
+ enabled: { type: 'boolean' },
320782
+ period: { type: 'string', pattern: '^[0-9]+[smhd]$' },
320783
+ schedule: { type: 'string' },
320784
+ schedule_timezone: { type: 'string' },
320785
+ policy: { type: 'string' },
320786
+ },
320787
+ additionalProperties: false,
320788
+ },
320789
+ valuesSchema: {
320790
+ type: 'string',
320791
+ },
320792
+ },
320793
+ additionalProperties: false,
320794
+ },
320795
+ TerraformProviderVariant: {
320796
+ $id: 'firestartr.dev://terraform/TerraformProviderVariant',
320797
+ description: 'A single variant of a TFWorkspace',
320798
+ type: 'object',
320799
+ properties: {
320800
+ name: {
320801
+ type: 'string',
320802
+ description: 'name of the variant — used as claim name and CR name base',
320803
+ },
320804
+ overrides: {
320805
+ $ref: 'firestartr.dev://terraform/TerraformProviderVariantOverride',
320806
+ },
320807
+ },
320808
+ additionalProperties: false,
320809
+ required: ['name', 'overrides'],
320810
+ },
320720
320811
  },
320721
320812
  });
320722
320813
 
@@ -321187,6 +321278,12 @@ async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchCla
321187
321278
  try {
321188
321279
  const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
321189
321280
  const claim = patchClaim(catalog_common/* default.io.fromYaml */.Z.io.fromYaml(claimData), defaults);
321281
+ let variants = [];
321282
+ if (claim.kind === 'TFWorkspaceClaim' &&
321283
+ claim.providers?.terraform?.variants) {
321284
+ variants = claim.providers.terraform.variants;
321285
+ delete claim.providers.terraform.variants;
321286
+ }
321190
321287
  logger.silly(`Patched claim is:
321191
321288
  ---
321192
321289
  ${catalog_common/* default.io.toYaml */.Z.io.toYaml(claim)}`);
@@ -321224,6 +321321,44 @@ async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchCla
321224
321321
  result = lodash_default().merge(result, resolvedReferences);
321225
321322
  }
321226
321323
  }
321324
+ if (variants.length > 0) {
321325
+ const parentClaimPath = VisitedClaims[claimRef];
321326
+ for (const variant of variants) {
321327
+ if (!variant.name || !variant.overrides) {
321328
+ throw new Error(`Variant in claim ${claimRef} is missing required field 'name' or 'overrides'`);
321329
+ }
321330
+ const prohibitedOverrideFields = ['source', 'module'];
321331
+ for (const field of prohibitedOverrideFields) {
321332
+ if (field in variant.overrides) {
321333
+ throw new Error(`Variant '${variant.name}' in claim ${claimRef} cannot override '${field}'`);
321334
+ }
321335
+ }
321336
+ const variantClaim = lodash_default().cloneDeep(claim);
321337
+ variantClaim.name = variant.name;
321338
+ variantClaim.providers.terraform = lodash_default().merge({}, claim.providers.terraform, variant.overrides);
321339
+ if (!variantClaim.annotations) {
321340
+ variantClaim.annotations = {};
321341
+ }
321342
+ variantClaim.annotations['firestartr.dev/variant-of'] =
321343
+ claim.providers.terraform.name;
321344
+ const variantRef = `TFWorkspaceClaim-${variant.name}`;
321345
+ if (result[variantRef]) {
321346
+ throw new Error(`Variant name '${variant.name}' from claim '${claimRef}' conflicts with existing claim '${variantRef}'`);
321347
+ }
321348
+ logger.info(`Creating synthetic variant claim ${variantRef}`);
321349
+ result[variantRef] = {};
321350
+ result[variantRef]['claim'] = variantClaim;
321351
+ result[variantRef]['claimPath'] = parentClaimPath;
321352
+ result = await setNonVirtualClaimAdditionalData(result, variantClaim, variantRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers);
321353
+ const variantReferences = extractAllRefs(catalog_common/* default.io.toYaml */.Z.io.toYaml(variantClaim));
321354
+ for (const ref of variantReferences) {
321355
+ if (!result[ref]) {
321356
+ const [resolvedReferences] = await loadClaim(ref, org, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result, postValidations);
321357
+ result = lodash_default().merge(result, resolvedReferences);
321358
+ }
321359
+ }
321360
+ }
321361
+ }
321227
321362
  }
321228
321363
  catch (err) {
321229
321364
  throw `Lazy Loading: ${err}`;
@@ -327672,6 +327807,9 @@ class TFWorkspaceChart extends BaseWorkspaceChart {
327672
327807
  return {
327673
327808
  metadata: {
327674
327809
  name: claim.providers.terraform.name,
327810
+ ...(claim.annotations && Object.keys(claim.annotations).length > 0
327811
+ ? { annotations: claim.annotations }
327812
+ : {}),
327675
327813
  },
327676
327814
  spec: {
327677
327815
  firestartr: {
@@ -328095,7 +328233,10 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
328095
328233
  let catalogEntity = undefined;
328096
328234
  let firestartrEntity = undefined;
328097
328235
  const extraCharts = [];
328098
- const chartId = `${claim.kind}-${claim.name}`.toLowerCase();
328236
+ const isVariant = claim.annotations?.['firestartr.dev/variant-of'] !== undefined;
328237
+ const chartId = isVariant
328238
+ ? `${claim.kind}-${claim.name}.variant`.toLowerCase()
328239
+ : `${claim.kind}-${claim.name}`.toLowerCase();
328099
328240
  let firestartrId = null;
328100
328241
  if (previousCR) {
328101
328242
  firestartrId = previousCR?.spec?.firestartr?.tfStateKey || null;
@@ -341876,6 +342017,7 @@ function gh_checkrun_helperCreateCheckRunName(cmd, item) {
341876
342017
 
341877
342018
 
341878
342019
 
342020
+
341879
342021
  const process_operation_TF_CACHES_PATH = '/tmp/tfcaches';
341880
342022
  function process_operation_processOperation(item, op, handler) {
341881
342023
  operator_src_logger.info(`Processing operation ${op} on ${item.kind}/${item.metadata?.name}`);
@@ -342039,19 +342181,13 @@ async function* gh_process_operation_markedToDeletion(item, op, handler) {
342039
342181
  }
342040
342182
  catch (e) {
342041
342183
  error = true;
342042
- let errorMsg;
342043
- if (typeof e === 'object' && 'output' in e) {
342044
- errorMsg = e.output;
342045
- }
342046
- else {
342047
- errorMsg = e;
342048
- }
342184
+ const { output: errorMsg, exitCode: errCode } = extractErrorDetails(e);
342049
342185
  // if there is a current checkRun working
342050
342186
  // we close it with an error
342051
342187
  if (checkRunCtl)
342052
342188
  checkRunCtl.fnOnError(errorMsg);
342053
342189
  await tryPublishDestroy(item, errorMsg, false);
342054
- await handler.writeTerraformOutputInTfResult(item, errorMsg, 1);
342190
+ await handler.writeTerraformOutputInTfResult(item, errorMsg, errCode ?? 1);
342055
342191
  void handler.error();
342056
342192
  }
342057
342193
  finally {
@@ -342202,15 +342338,9 @@ async function* process_operation_doApply(item, op, handler) {
342202
342338
  }
342203
342339
  catch (e) {
342204
342340
  error = true;
342205
- let errorMsg;
342206
- if (typeof e === 'object' && 'output' in e) {
342207
- errorMsg = e.output;
342208
- }
342209
- else {
342210
- errorMsg = e;
342211
- }
342341
+ const { output: errorMsg, exitCode: errCode } = extractErrorDetails(e);
342212
342342
  // being one the exitCode
342213
- await tryPublishApply(item, errorMsg, false, 1);
342343
+ await tryPublishApply(item, errorMsg, false, errCode ?? 1);
342214
342344
  // if there is a current checkRun working
342215
342345
  // we close it with an error
342216
342346
  if (checkRunCtl)
@@ -342220,7 +342350,7 @@ async function* process_operation_doApply(item, op, handler) {
342220
342350
  operator_src_logger.error(`Error applying item ${item.metadata.name}: ${errorMsg}`);
342221
342351
  handler.error();
342222
342352
  if (errorMsg) {
342223
- await handler.writeTerraformOutputInTfResult(item, errorMsg, 1);
342353
+ await handler.writeTerraformOutputInTfResult(item, errorMsg, errCode ?? 1);
342224
342354
  }
342225
342355
  }
342226
342356
  finally {
@@ -521369,7 +521499,7 @@ const crsStatusSubcommand = {
521369
521499
  };
521370
521500
 
521371
521501
  ;// CONCATENATED MODULE: ./package.json
521372
- const package_namespaceObject = {"i8":"2.7.0"};
521502
+ const package_namespaceObject = JSON.parse('{"i8":"2.8.0-snapshot-2"}');
521373
521503
  ;// CONCATENATED MODULE: ../../package.json
521374
521504
  const package_namespaceObject_1 = {"i8":"2.7.0"};
521375
521505
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts
@@ -1192,6 +1192,13 @@ declare const schemas: {
1192
1192
  module: {
1193
1193
  type: string;
1194
1194
  };
1195
+ variants: {
1196
+ type: string;
1197
+ items: {
1198
+ $ref: string;
1199
+ };
1200
+ description: string;
1201
+ };
1195
1202
  context: {
1196
1203
  type: string;
1197
1204
  properties: {
@@ -1226,6 +1233,102 @@ declare const schemas: {
1226
1233
  $ref?: undefined;
1227
1234
  })[];
1228
1235
  };
1236
+ TerraformProviderVariantOverride: {
1237
+ $id: string;
1238
+ description: string;
1239
+ type: string;
1240
+ properties: {
1241
+ name: {
1242
+ type: string;
1243
+ description: string;
1244
+ };
1245
+ values: {
1246
+ type: string;
1247
+ additionalProperties: boolean;
1248
+ description: string;
1249
+ };
1250
+ context: {
1251
+ type: string;
1252
+ properties: {
1253
+ providers: {
1254
+ type: string;
1255
+ items: {
1256
+ type: string;
1257
+ properties: {
1258
+ name: {
1259
+ type: string;
1260
+ };
1261
+ };
1262
+ additionalProperties: boolean;
1263
+ };
1264
+ };
1265
+ backend: {
1266
+ type: string;
1267
+ properties: {
1268
+ name: {
1269
+ type: string;
1270
+ };
1271
+ };
1272
+ additionalProperties: boolean;
1273
+ };
1274
+ };
1275
+ additionalProperties: boolean;
1276
+ description: string;
1277
+ };
1278
+ files: {
1279
+ $ref: string;
1280
+ };
1281
+ policy: {
1282
+ type: string;
1283
+ enum: string[];
1284
+ };
1285
+ tfStateKey: {
1286
+ $ref: string;
1287
+ };
1288
+ sync: {
1289
+ type: string;
1290
+ properties: {
1291
+ enabled: {
1292
+ type: string;
1293
+ };
1294
+ period: {
1295
+ type: string;
1296
+ pattern: string;
1297
+ };
1298
+ schedule: {
1299
+ type: string;
1300
+ };
1301
+ schedule_timezone: {
1302
+ type: string;
1303
+ };
1304
+ policy: {
1305
+ type: string;
1306
+ };
1307
+ };
1308
+ additionalProperties: boolean;
1309
+ };
1310
+ valuesSchema: {
1311
+ type: string;
1312
+ };
1313
+ };
1314
+ additionalProperties: boolean;
1315
+ };
1316
+ TerraformProviderVariant: {
1317
+ $id: string;
1318
+ description: string;
1319
+ type: string;
1320
+ properties: {
1321
+ name: {
1322
+ type: string;
1323
+ description: string;
1324
+ };
1325
+ overrides: {
1326
+ $ref: string;
1327
+ };
1328
+ };
1329
+ additionalProperties: boolean;
1330
+ required: string[];
1331
+ };
1229
1332
  };
1230
1333
  }[] | {
1231
1334
  $schema: string;
@@ -97,6 +97,13 @@ export declare const TerraformSchemas: {
97
97
  module: {
98
98
  type: string;
99
99
  };
100
+ variants: {
101
+ type: string;
102
+ items: {
103
+ $ref: string;
104
+ };
105
+ description: string;
106
+ };
100
107
  context: {
101
108
  type: string;
102
109
  properties: {
@@ -131,5 +138,101 @@ export declare const TerraformSchemas: {
131
138
  $ref?: undefined;
132
139
  })[];
133
140
  };
141
+ TerraformProviderVariantOverride: {
142
+ $id: string;
143
+ description: string;
144
+ type: string;
145
+ properties: {
146
+ name: {
147
+ type: string;
148
+ description: string;
149
+ };
150
+ values: {
151
+ type: string;
152
+ additionalProperties: boolean;
153
+ description: string;
154
+ };
155
+ context: {
156
+ type: string;
157
+ properties: {
158
+ providers: {
159
+ type: string;
160
+ items: {
161
+ type: string;
162
+ properties: {
163
+ name: {
164
+ type: string;
165
+ };
166
+ };
167
+ additionalProperties: boolean;
168
+ };
169
+ };
170
+ backend: {
171
+ type: string;
172
+ properties: {
173
+ name: {
174
+ type: string;
175
+ };
176
+ };
177
+ additionalProperties: boolean;
178
+ };
179
+ };
180
+ additionalProperties: boolean;
181
+ description: string;
182
+ };
183
+ files: {
184
+ $ref: string;
185
+ };
186
+ policy: {
187
+ type: string;
188
+ enum: string[];
189
+ };
190
+ tfStateKey: {
191
+ $ref: string;
192
+ };
193
+ sync: {
194
+ type: string;
195
+ properties: {
196
+ enabled: {
197
+ type: string;
198
+ };
199
+ period: {
200
+ type: string;
201
+ pattern: string;
202
+ };
203
+ schedule: {
204
+ type: string;
205
+ };
206
+ schedule_timezone: {
207
+ type: string;
208
+ };
209
+ policy: {
210
+ type: string;
211
+ };
212
+ };
213
+ additionalProperties: boolean;
214
+ };
215
+ valuesSchema: {
216
+ type: string;
217
+ };
218
+ };
219
+ additionalProperties: boolean;
220
+ };
221
+ TerraformProviderVariant: {
222
+ $id: string;
223
+ description: string;
224
+ type: string;
225
+ properties: {
226
+ name: {
227
+ type: string;
228
+ description: string;
229
+ };
230
+ overrides: {
231
+ $ref: string;
232
+ };
233
+ };
234
+ additionalProperties: boolean;
235
+ required: string[];
236
+ };
134
237
  };
135
238
  }[];
@@ -97,6 +97,13 @@ declare const _default: {
97
97
  module: {
98
98
  type: string;
99
99
  };
100
+ variants: {
101
+ type: string;
102
+ items: {
103
+ $ref: string;
104
+ };
105
+ description: string;
106
+ };
100
107
  context: {
101
108
  type: string;
102
109
  properties: {
@@ -131,6 +138,102 @@ declare const _default: {
131
138
  $ref?: undefined;
132
139
  })[];
133
140
  };
141
+ TerraformProviderVariantOverride: {
142
+ $id: string;
143
+ description: string;
144
+ type: string;
145
+ properties: {
146
+ name: {
147
+ type: string;
148
+ description: string;
149
+ };
150
+ values: {
151
+ type: string;
152
+ additionalProperties: boolean;
153
+ description: string;
154
+ };
155
+ context: {
156
+ type: string;
157
+ properties: {
158
+ providers: {
159
+ type: string;
160
+ items: {
161
+ type: string;
162
+ properties: {
163
+ name: {
164
+ type: string;
165
+ };
166
+ };
167
+ additionalProperties: boolean;
168
+ };
169
+ };
170
+ backend: {
171
+ type: string;
172
+ properties: {
173
+ name: {
174
+ type: string;
175
+ };
176
+ };
177
+ additionalProperties: boolean;
178
+ };
179
+ };
180
+ additionalProperties: boolean;
181
+ description: string;
182
+ };
183
+ files: {
184
+ $ref: string;
185
+ };
186
+ policy: {
187
+ type: string;
188
+ enum: string[];
189
+ };
190
+ tfStateKey: {
191
+ $ref: string;
192
+ };
193
+ sync: {
194
+ type: string;
195
+ properties: {
196
+ enabled: {
197
+ type: string;
198
+ };
199
+ period: {
200
+ type: string;
201
+ pattern: string;
202
+ };
203
+ schedule: {
204
+ type: string;
205
+ };
206
+ schedule_timezone: {
207
+ type: string;
208
+ };
209
+ policy: {
210
+ type: string;
211
+ };
212
+ };
213
+ additionalProperties: boolean;
214
+ };
215
+ valuesSchema: {
216
+ type: string;
217
+ };
218
+ };
219
+ additionalProperties: boolean;
220
+ };
221
+ TerraformProviderVariant: {
222
+ $id: string;
223
+ description: string;
224
+ type: string;
225
+ properties: {
226
+ name: {
227
+ type: string;
228
+ description: string;
229
+ };
230
+ overrides: {
231
+ $ref: string;
232
+ };
233
+ };
234
+ additionalProperties: boolean;
235
+ required: string[];
236
+ };
134
237
  };
135
238
  };
136
239
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "2.7.0",
3
+ "version": "2.8.0-snapshot-2",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",