@firestartr/cli 1.54.0-snapshot-3 → 1.54.0-snapshot-5

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
@@ -356921,6 +356921,49 @@ class PolicyInitializer extends InitializerPatches {
356921
356921
  PolicyInitializer.applicableKinds = ['TFWorkspaceClaim'];
356922
356922
 
356923
356923
 
356924
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/initializers/metadata.ts
356925
+
356926
+ class MetadataInitializer extends InitializerPatches {
356927
+ constructor() {
356928
+ super(...arguments);
356929
+ this.applicableProviders = ['^catalog'];
356930
+ }
356931
+ async __validate() {
356932
+ return true;
356933
+ }
356934
+ async __patches(claim, _previousCR) {
356935
+ return [
356936
+ {
356937
+ validate(cr) {
356938
+ return true;
356939
+ },
356940
+ apply(cr) {
356941
+ if ('annotations' in claim && typeof claim.annotations === 'object') {
356942
+ cr.metadata = cr.metadata || {};
356943
+ const crAnnotations = cr.metadata.annotations ?? {};
356944
+ cr.metadata.annotations = {
356945
+ ...claim.annotations,
356946
+ ...crAnnotations,
356947
+ };
356948
+ }
356949
+ return cr;
356950
+ },
356951
+ identify() {
356952
+ return 'initializers/MetadataInitializer';
356953
+ },
356954
+ },
356955
+ ];
356956
+ }
356957
+ }
356958
+ MetadataInitializer.applicableKinds = [
356959
+ 'ComponentClaim',
356960
+ 'GroupClaim',
356961
+ 'UserClaim',
356962
+ 'TFWorkspaceClaim',
356963
+ 'OrgWebhookClaim',
356964
+ ];
356965
+
356966
+
356924
356967
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/initializers/index.ts
356925
356968
 
356926
356969
 
@@ -356931,12 +356974,14 @@ PolicyInitializer.applicableKinds = ['TFWorkspaceClaim'];
356931
356974
 
356932
356975
 
356933
356976
 
356977
+
356934
356978
  const INITIALIZERS = [
356935
356979
  UUIDInitializer,
356936
356980
  InitializerClaimRef,
356937
356981
  BackstageInitializer,
356938
356982
  PolicyInitializer,
356939
356983
  SyncerInitializer,
356984
+ MetadataInitializer,
356940
356985
  ];
356941
356986
  const INITIALIZERS_BY_FILE_NAME = {
356942
356987
  [TechnologyInitializer.FILE_NAME()]: TechnologyInitializer,
@@ -358075,14 +358120,6 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
358075
358120
  secrets: {
358076
358121
  $ref: 'firestartr.dev://github/GithubComponentClaimSecrets',
358077
358122
  },
358078
- topics: {
358079
- type: 'array',
358080
- items: {
358081
- type: 'string',
358082
- maxLength: 50,
358083
- pattern: '^[a-z0-9][a-z0-9-]*$',
358084
- },
358085
- },
358086
358123
  },
358087
358124
  required: ['visibility', 'org'],
358088
358125
  },
@@ -362209,7 +362246,6 @@ function toJson_FirestartrGithubRepositorySpecRepo(obj) {
362209
362246
  'hasIssues': obj.hasIssues,
362210
362247
  'hasWiki': obj.hasWiki,
362211
362248
  'pages': obj.pages,
362212
- 'topics': obj.topics?.map(y => y),
362213
362249
  'visibility': obj.visibility,
362214
362250
  'defaultBranch': obj.defaultBranch,
362215
362251
  'additionalBranches': obj.additionalBranches?.map(y => toJson_FirestartrGithubRepositorySpecRepoAdditionalBranches(y)),
@@ -364335,7 +364371,6 @@ class GithubRepositoryChart extends BaseGithubChart {
364335
364371
  defaultBranch: claim.providers.github?.branchStrategy?.defaultBranch,
364336
364372
  codeowners: createCodeOwnersData(claim),
364337
364373
  additionalBranches: claim.providers.github.additionalBranches || [],
364338
- topics: claim.providers.github.topics || [],
364339
364374
  },
364340
364375
  actions,
364341
364376
  permissions: this.createPermissions(claim),
@@ -371931,25 +371966,36 @@ class WriterBackend extends writer {
371931
371966
  class WriterProvider extends writer {
371932
371967
  constructor(providers) {
371933
371968
  super();
371969
+ this.jsonOutput = {};
371934
371970
  this.providers = providers;
371935
371971
  }
371972
+ async render(renderType = 'tf') {
371973
+ await this._render();
371974
+ if (renderType === 'tf') {
371975
+ return this.output.trim();
371976
+ }
371977
+ else if (renderType === 'json') {
371978
+ return JSON.stringify(this.jsonOutput, null, 2);
371979
+ }
371980
+ else {
371981
+ throw new Error(`Unsupported render type: ${renderType}`);
371982
+ }
371983
+ }
371936
371984
  async _render() {
371937
371985
  for (const provider of this.providers) {
371938
- this.output += this.__renderProvider(provider);
371986
+ if (provider.inline) {
371987
+ this.output += provider.inline + '\n';
371988
+ }
371989
+ else {
371990
+ this.__populateJsonOutput(provider);
371991
+ }
371939
371992
  }
371940
371993
  }
371941
- __renderProvider(provider) {
371942
- let configString = '';
371943
- if (provider.inline)
371944
- return provider.inline;
371945
- for (const key in provider.config) {
371946
- configString += `${key} = "${provider.config[key]}"\n`;
371994
+ __populateJsonOutput(provider) {
371995
+ if (this.jsonOutput[provider.name] === undefined) {
371996
+ this.jsonOutput[provider.name] = [];
371947
371997
  }
371948
- return `
371949
- provider "${provider.name}" {
371950
-
371951
- ${configString}
371952
- }`;
371998
+ this.jsonOutput[provider.name].push(provider.config);
371953
371999
  }
371954
372000
  }
371955
372001
 
@@ -371985,6 +372031,26 @@ class WriterTerraform extends writer {
371985
372031
  this.tfStateKey = tfStateKey;
371986
372032
  this.writeRequiredProvidersBlock = writeRequiredProvidersBlock;
371987
372033
  }
372034
+ async render(renderType = 'tf') {
372035
+ if (renderType === 'tf') {
372036
+ return super.render();
372037
+ }
372038
+ else {
372039
+ await this._renderJson();
372040
+ return this.output.trim();
372041
+ }
372042
+ }
372043
+ async _renderJson() {
372044
+ const providersString = await new WriterProvider(this.requiredProviders).render('json');
372045
+ if (providersString.trim() !== '{}') {
372046
+ this.output = `{
372047
+ "provider": ${providersString}
372048
+ }`; // providersString is already a JSON object string
372049
+ }
372050
+ else {
372051
+ this.output = ''; // No providers to include
372052
+ }
372053
+ }
371988
372054
  async _render() {
371989
372055
  const providersString = await new WriterProvider(this.requiredProviders).render();
371990
372056
  let backend = '';
@@ -372193,17 +372259,44 @@ function fCheckString(keys, refs) {
372193
372259
  return true;
372194
372260
  }
372195
372261
 
372262
+ ;// CONCATENATED MODULE: ../terraform_provisioner/src/writer_provider_tf_json.ts
372263
+
372264
+
372265
+
372266
+ class WriterProviderJson extends writer {
372267
+ constructor(mainBlock, providers, backend, tfStateKey) {
372268
+ super();
372269
+ this.mainBlock = mainBlock;
372270
+ this.providers = providers;
372271
+ this.backend = backend;
372272
+ this.tfStateKey = tfStateKey;
372273
+ }
372274
+ async _render() {
372275
+ this.output = await new WriterTerraform(this.providers, this.backend, this.tfStateKey, false).render('json');
372276
+ }
372277
+ writeToTerraformProject(mainTfPath) {
372278
+ if (this.output.trim() === '') {
372279
+ terraform_provisioner_src_logger.info(`Skipping writing ${mainTfPath} as there is no provider to write.`);
372280
+ }
372281
+ else {
372282
+ super.writeToTerraformProject(mainTfPath);
372283
+ }
372284
+ }
372285
+ }
372286
+
372196
372287
  ;// CONCATENATED MODULE: ../terraform_provisioner/src/project_tf.ts
372197
372288
 
372198
372289
 
372199
372290
 
372200
372291
 
372201
372292
 
372293
+
372202
372294
  class project_tf_TFProjectManager {
372203
372295
  constructor(ctx) {
372204
372296
  this.tfOutput = '';
372205
372297
  this.projectPath = ctx.projectPath;
372206
372298
  this.mainTfWriter = new WriterMainTf(ctx.inline, ctx.requiredProviders, ctx.backend, ctx.tfStateKey);
372299
+ this.providerJsonWriter = new WriterProviderJson(ctx.inline, ctx.requiredProviders, ctx.backend, ctx.tfStateKey);
372207
372300
  this.tfVarsJsonWriter = new WriterTfVarsJson(ctx.values, ctx.references);
372208
372301
  this.secrets = ctx.secrets;
372209
372302
  }
@@ -372220,7 +372313,9 @@ class project_tf_TFProjectManager {
372220
372313
  }
372221
372314
  async build() {
372222
372315
  await this.mainTfWriter.render();
372223
- this.mainTfWriter.writeToTerraformProject(external_path_.join(this.projectPath, 'main.tf'));
372316
+ this.mainTfWriter.writeToTerraformProject(external_path_.join(this.projectPath, 'firestartr-main.tf'));
372317
+ await this.providerJsonWriter.render();
372318
+ this.providerJsonWriter.writeToTerraformProject(external_path_.join(this.projectPath, 'firestartr-providers.tf.json'));
372224
372319
  await this.tfVarsJsonWriter.render();
372225
372320
  this.tfVarsJsonWriter.writeToTerraformProject(external_path_.join(this.projectPath, 'terraform.tfvars.json'));
372226
372321
  }
@@ -372353,14 +372448,16 @@ var lib_ajv_default = /*#__PURE__*/__nccwpck_require__.n(lib_ajv);
372353
372448
 
372354
372449
 
372355
372450
 
372451
+
372356
372452
  class TFProjectManagerRemote {
372357
372453
  constructor(ctx) {
372358
372454
  this.tfOutput = '';
372359
372455
  this.ctx = ctx;
372360
372456
  this.projectPath = ctx.projectPath;
372457
+ this.secrets = ctx.secrets;
372361
372458
  this.writerTerraform = new WriterTerraform(ctx.requiredProviders, ctx.backend, ctx.tfStateKey, false);
372459
+ this.providerJsonWriter = new WriterProviderJson(ctx.inline, ctx.requiredProviders, ctx.backend, ctx.tfStateKey);
372362
372460
  this.tfVarsJsonWriter = new WriterTfVarsJson(ctx.values, ctx.references);
372363
- this.secrets = ctx.secrets;
372364
372461
  }
372365
372462
  getOutput() {
372366
372463
  return this.tfOutput;
@@ -372378,7 +372475,9 @@ class TFProjectManagerRemote {
372378
372475
  await this.__configGit();
372379
372476
  await this.__initFromModule();
372380
372477
  await this.writerTerraform.render();
372381
- this.writerTerraform.writeToTerraformProject(external_path_.join(this.projectPath, 'terraform.tf'));
372478
+ this.writerTerraform.writeToTerraformProject(external_path_.join(this.projectPath, 'firestartr-terraform.tf'));
372479
+ await this.providerJsonWriter.render();
372480
+ this.providerJsonWriter.writeToTerraformProject(external_path_.join(this.projectPath, 'firestartr-providers.tf.json'));
372382
372481
  await this.tfVarsJsonWriter.render();
372383
372482
  this.tfVarsJsonWriter.writeToTerraformProject(external_path_.join(this.projectPath, 'terraform.tfvars.json'));
372384
372483
  }
@@ -374281,7 +374380,7 @@ async function tfWorkspacePlan(opts) {
374281
374380
  fDebug('Context built');
374282
374381
  const command = getCommandByStatus(status);
374283
374382
  fDebug('Running terraform provisioner');
374284
- const tfOutput = await runTerraformProvisioner(ctx, command);
374383
+ const tfOutput = await runTerraformProvisioner(ctx, command, undefined);
374285
374384
  fDebug('Terraform provisioner finished');
374286
374385
  fDebug('Publishing plan');
374287
374386
  await publishPlan(cr, tfOutput, prNumber, repo, owner);
@@ -1014,10 +1014,6 @@ export interface FirestartrGithubRepositorySpecRepo {
1014
1014
  * @schema FirestartrGithubRepositorySpecRepo#pages
1015
1015
  */
1016
1016
  readonly pages?: any;
1017
- /**
1018
- * @schema FirestartrGithubRepositorySpecRepo#topics
1019
- */
1020
- readonly topics?: string[];
1021
1017
  /**
1022
1018
  * @schema FirestartrGithubRepositorySpecRepo#visibility
1023
1019
  */
@@ -505,14 +505,6 @@ declare const schemas: {
505
505
  secrets: {
506
506
  $ref: string;
507
507
  };
508
- topics: {
509
- type: string;
510
- items: {
511
- type: string;
512
- maxLength: number;
513
- pattern: string;
514
- };
515
- };
516
508
  };
517
509
  required: string[];
518
510
  $ref?: undefined;
@@ -35,14 +35,6 @@ declare const _default: {
35
35
  secrets: {
36
36
  $ref: string;
37
37
  };
38
- topics: {
39
- type: string;
40
- items: {
41
- type: string;
42
- maxLength: number;
43
- pattern: string;
44
- };
45
- };
46
38
  };
47
39
  required: string[];
48
40
  $ref?: undefined;
@@ -140,14 +140,6 @@ export declare const GithubSchemas: ({
140
140
  secrets: {
141
141
  $ref: string;
142
142
  };
143
- topics: {
144
- type: string;
145
- items: {
146
- type: string;
147
- maxLength: number;
148
- pattern: string;
149
- };
150
- };
151
143
  };
152
144
  required: string[];
153
145
  $ref?: undefined;
@@ -28,7 +28,6 @@ export interface IGithubRepositoryClaim extends IComponentClaim {
28
28
  name: string;
29
29
  orphan: boolean;
30
30
  }[];
31
- topics?: string[];
32
31
  };
33
32
  };
34
33
  }
@@ -0,0 +1,11 @@
1
+ import { InitializerPatches } from './base';
2
+ export declare class MetadataInitializer extends InitializerPatches {
3
+ applicableProviders: string[];
4
+ static applicableKinds: string[];
5
+ __validate(): Promise<boolean>;
6
+ __patches(claim: any, _previousCR: any): Promise<{
7
+ validate(cr: any): boolean;
8
+ apply(cr: any): any;
9
+ identify(): string;
10
+ }[]>;
11
+ }
@@ -1,9 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { WriterMainTf } from './writer_main_tf';
3
3
  import { WriterTfVarsJson } from './writer_tfvars_json';
4
+ import { WriterProviderJson } from './writer_provider_tf_json';
4
5
  import { PassThrough } from 'stream';
5
6
  export declare class TFProjectManager {
6
7
  mainTfWriter: WriterMainTf;
8
+ providerJsonWriter: WriterProviderJson;
7
9
  tfVarsJsonWriter: WriterTfVarsJson;
8
10
  secrets: any[];
9
11
  projectPath: string;
@@ -1,9 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { WriterTerraform } from './writer_terraform';
3
3
  import { WriterTfVarsJson } from './writer_tfvars_json';
4
+ import { WriterProviderJson } from './writer_provider_tf_json';
4
5
  import { PassThrough } from 'stream';
5
6
  export declare class TFProjectManagerRemote {
6
7
  writerTerraform: WriterTerraform;
8
+ providerJsonWriter: WriterProviderJson;
7
9
  tfVarsJsonWriter: WriterTfVarsJson;
8
10
  ctx: any;
9
11
  secrets: any[];
@@ -1,7 +1,9 @@
1
1
  import Writer from './writer';
2
2
  export declare class WriterProvider extends Writer {
3
3
  providers: any[];
4
+ jsonOutput: {};
4
5
  constructor(providers: any[]);
6
+ render(renderType?: string): Promise<string>;
5
7
  _render(): Promise<void>;
6
- __renderProvider(provider: any): any;
8
+ __populateJsonOutput(provider: any): void;
7
9
  }
@@ -0,0 +1,10 @@
1
+ import Writer from './writer';
2
+ export declare class WriterProviderJson extends Writer {
3
+ providers: Array<any>;
4
+ mainBlock: string;
5
+ tfStateKey: string;
6
+ backend: any;
7
+ constructor(mainBlock: string, providers: Array<any>, backend: any, tfStateKey: string);
8
+ _render(): Promise<void>;
9
+ writeToTerraformProject(mainTfPath: string): void;
10
+ }
@@ -5,5 +5,7 @@ export declare class WriterTerraform extends Writer {
5
5
  backend: any;
6
6
  tfStateKey: string;
7
7
  constructor(requiredProviders: Array<any>, backend: any, tfStateKey: string, writeRequiredProvidersBlock?: boolean);
8
+ render(renderType?: string): Promise<string>;
9
+ _renderJson(): Promise<void>;
8
10
  _render(): Promise<void>;
9
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.54.0-snapshot-3",
3
+ "version": "1.54.0-snapshot-5",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",