@firestartr/cli 1.55.1-snapshot-0 → 1.55.1-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
@@ -358037,7 +358037,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
358037
358037
  },
358038
358038
  owner: {
358039
358039
  type: 'string',
358040
- pattern: '^(user|group):[a-zA-Z0-9_-]+$',
358040
+ pattern: '^(user|group):[a-zA-Z0-9_&-]+$',
358041
358041
  },
358042
358042
  },
358043
358043
  required: ['description', 'owner'],
@@ -368827,6 +368827,7 @@ var WorkStatus;
368827
368827
 
368828
368828
 
368829
368829
 
368830
+
368830
368831
  const kindsWithFinalizer = [
368831
368832
  'FirestartrDummyA',
368832
368833
  'FirestartrDummyB',
@@ -368951,6 +368952,9 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
368951
368952
  writeTerraformOutputInTfResult: writeTerraformOuputInTFResult,
368952
368953
  writeConnectionSecret: writeConnectionSecret,
368953
368954
  resolveReferences: () => resolve(workItem.item, getItemByItemPath, getSecret),
368955
+ resolveOwnOutputs: () => {
368956
+ return resolveSecretRef(workItem.item.metadata.namespace, workItem.item, getSecret);
368957
+ },
368954
368958
  deleteSecret: () => deleteSecret(workItem.item.spec.writeConnectionSecretToRef.name, workItem.item.metadata.namespace),
368955
368959
  itemPath: () => informer_itemPath(pluralKind, workItem.item),
368956
368960
  error: () => retryCtl.errorReconciling(informer_itemPath(pluralKind, workItem.item)),
@@ -369964,10 +369968,13 @@ var lib_provider = __nccwpck_require__(85791);
369964
369968
  ;// CONCATENATED MODULE: ../provisioner/src/entities/base/Entity.ts
369965
369969
 
369966
369970
  const EXTERNAL_NAME_ANNOTATION = 'firestartr.dev/external-name';
369971
+ const IMPORT_SLUG_ANNOTATION = 'firestartr.dev/github-slug';
369972
+ const IMPORT_ID_ANNOTATION = 'firestartr.dev/github-id';
369967
369973
 
369968
369974
  class Metadata {
369969
- constructor(metadata) {
369975
+ constructor(metadata, resolveOutputs) {
369970
369976
  this._metadata = metadata;
369977
+ this._resolveOutputs = resolveOutputs;
369971
369978
  }
369972
369979
  get name() {
369973
369980
  if (EXTERNAL_NAME_ANNOTATION in this.annotations) {
@@ -369977,19 +369984,56 @@ class Metadata {
369977
369984
  return this._metadata.name;
369978
369985
  }
369979
369986
  }
369987
+ get slug() {
369988
+ // buscar el slug en los outputs
369989
+ const slug = this._resolveOutputs('slug');
369990
+ if (IMPORT_SLUG_ANNOTATION in this.annotations) {
369991
+ return this.annotations[IMPORT_SLUG_ANNOTATION];
369992
+ }
369993
+ else if (slug) {
369994
+ // hay outputs?
369995
+ return slug;
369996
+ }
369997
+ else {
369998
+ return undefined;
369999
+ }
370000
+ }
369980
370001
  get annotations() {
369981
370002
  return this._metadata.annotations || {};
369982
370003
  }
369983
370004
  get labels() {
369984
370005
  return this._metadata.labels || {};
369985
370006
  }
370007
+ get id() {
370008
+ // buscar el id en los outputs
370009
+ const id = this._resolveOutputs('id');
370010
+ if (IMPORT_ID_ANNOTATION in this.annotations) {
370011
+ return this.annotations[IMPORT_ID_ANNOTATION];
370012
+ }
370013
+ else if (id) {
370014
+ // hay outputs?
370015
+ return id;
370016
+ }
370017
+ else {
370018
+ return undefined;
370019
+ }
370020
+ }
369986
370021
  }
369987
370022
  class Entity {
369988
370023
  constructor(artifact, deps) {
369989
370024
  this.importStack = [];
369990
370025
  this.kind = artifact.kind;
369991
370026
  this.apiVersion = artifact.apiVersion;
369992
- this.metadata = new Metadata(artifact.metadata);
370027
+ this.metadata = new Metadata(artifact.metadata, (key) => {
370028
+ if (this.deps && 'self-outputs' in this.deps) {
370029
+ const cr = this.deps['self-outputs'].cr;
370030
+ if (cr && typeof cr.data === 'object') {
370031
+ if (key in cr.data) {
370032
+ return Buffer.from(cr.data[key], 'base64').toString('utf-8');
370033
+ }
370034
+ }
370035
+ }
370036
+ });
369993
370037
  this.spec = artifact.spec;
369994
370038
  if (deps) {
369995
370039
  this.deps = deps;
@@ -370139,14 +370183,14 @@ function provisionPermissions(scope, repo, fsGithubRepository) {
370139
370183
  if ('ref' in permission) {
370140
370184
  const tfStateKey = `_${fsGithubRepository.getTfStateKey()}-${permission.ref.kind}-${permission.ref.name}-tr`;
370141
370185
  if (permission.ref.kind === 'FirestartrGithubGroup') {
370142
- const teamId = fsGithubRepository.resolveRef(permission.ref, 'id');
370186
+ const teamSlug = fsGithubRepository.resolveRef(permission.ref, 'slug');
370143
370187
  const config = {
370144
370188
  repository: repo.name,
370145
- teamId,
370189
+ teamId: teamSlug,
370146
370190
  permission: permission.role,
370147
370191
  };
370148
370192
  const teamsRepository = new team_repository/* TeamRepository */.C(scope, tfStateKey, config);
370149
- fsGithubRepository.addResourceToStack(`${teamId}:${fsGithubRepository.metadata.name}`, teamsRepository);
370193
+ fsGithubRepository.addResourceToStack(`${teamSlug}:${fsGithubRepository.metadata.name}`, teamsRepository);
370150
370194
  }
370151
370195
  else if (permission.ref.kind === 'FirestartrGithubMembership') {
370152
370196
  const username = fsGithubRepository.resolveRef(permission.ref);
@@ -370506,7 +370550,7 @@ function provisionGroup(scope, fsGithubGroup) {
370506
370550
  };
370507
370551
  const tfStateKey = `_${fsGithubGroup.getTfStateKey()}`;
370508
370552
  const group = new lib_team/* Team */.S(scope, tfStateKey, config);
370509
- fsGithubGroup.addResourceToStack(fsGithubGroup.metadata.name, group);
370553
+ fsGithubGroup.addResourceToStack(fsGithubGroup.metadata.id || fsGithubGroup.metadata.name, group);
370510
370554
  return group;
370511
370555
  }
370512
370556
 
@@ -370523,11 +370567,11 @@ function provisionMembers(scope, team, fsGithubGroup) {
370523
370567
  const config = {
370524
370568
  dependsOn: [team],
370525
370569
  username,
370526
- teamId: team.id,
370570
+ teamId: fsGithubGroup.metadata.slug || team.id,
370527
370571
  role: member.role,
370528
370572
  };
370529
370573
  const membership = new team_membership/* TeamMembership */.E(scope, tfStateKey, config);
370530
- fsGithubGroup.addResourceToStack(`${team.id}:${username}`, membership);
370574
+ fsGithubGroup.addResourceToStack(`${fsGithubGroup.metadata.slug || team.id}:${username}`, membership);
370531
370575
  }
370532
370576
  }
370533
370577
  }
@@ -372403,7 +372447,10 @@ async function* doApply(item, op, handler) {
372403
372447
  opts['create'] = true;
372404
372448
  }
372405
372449
  const deps = await handler.resolveReferences();
372406
- operator_src_logger.info(`Item ${item.metadata.name} has the following dependencies: ${deps}`);
372450
+ deps['self-outputs'] = {
372451
+ cr: await handler.resolveOwnOutputs(),
372452
+ };
372453
+ operator_src_logger.info(`Item ${item.metadata.name} has the following dependencies: ${Object.keys(deps)}`);
372407
372454
  const annotation = 'firestartr.dev/last-state-pr';
372408
372455
  const statePr = item?.metadata?.annotations?.[annotation];
372409
372456
  const hasStatePr = typeof statePr === 'string' && statePr.trim().length > 0;
@@ -376319,7 +376366,7 @@ const crs_analyzerSubcommand = {
376319
376366
  };
376320
376367
 
376321
376368
  ;// CONCATENATED MODULE: ./package.json
376322
- const package_namespaceObject = JSON.parse('{"i8":"1.55.1-snapshot-0"}');
376369
+ const package_namespaceObject = JSON.parse('{"i8":"1.55.1-snapshot-2"}');
376323
376370
  ;// CONCATENATED MODULE: ../../package.json
376324
376371
  const package_namespaceObject_1 = {"i8":"1.55.0"};
376325
376372
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts
@@ -42,6 +42,7 @@ export type WorkItemHandler = {
42
42
  writeTerraformOutputInTfResult: WriteTerraformOutputInTfResultFn;
43
43
  writeConnectionSecret: WriteConnectionSecretFn;
44
44
  resolveReferences: ResolveReferencesFn;
45
+ resolveOwnOutputs: Function;
45
46
  deleteSecret: DeleteSecretFn;
46
47
  itemPath: ItemPathFn;
47
48
  error: ErrorFn;
@@ -2,10 +2,13 @@ import { Construct } from 'constructs';
2
2
  import { TerraformModule, TerraformResource } from 'cdktf';
3
3
  declare class Metadata {
4
4
  _metadata: any;
5
- constructor(metadata: any);
5
+ _resolveOutputs: Function;
6
+ constructor(metadata: any, resolveOutputs: Function);
6
7
  get name(): any;
8
+ get slug(): any;
7
9
  get annotations(): any;
8
10
  get labels(): any;
11
+ get id(): any;
9
12
  }
10
13
  export declare abstract class Entity {
11
14
  kind: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.55.1-snapshot-0",
3
+ "version": "1.55.1-snapshot-2",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",