@firestartr/cli 2.3.0-snapshot → 2.3.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
|
@@ -284815,7 +284815,7 @@ async function getRepoIssuesLabels(owner, repo) {
|
|
|
284815
284815
|
});
|
|
284816
284816
|
const metadataLabels = res.data.map((label) => ({
|
|
284817
284817
|
name: label.name,
|
|
284818
|
-
description: label.description ||
|
|
284818
|
+
description: label.description || '',
|
|
284819
284819
|
color: label.color,
|
|
284820
284820
|
}));
|
|
284821
284821
|
return metadataLabels;
|
|
@@ -287947,7 +287947,7 @@ class ComponentLabelsInitializer extends InitializerPatches {
|
|
|
287947
287947
|
async __validate() {
|
|
287948
287948
|
return true;
|
|
287949
287949
|
}
|
|
287950
|
-
async __patches(
|
|
287950
|
+
async __patches(_claim, _previousCR) {
|
|
287951
287951
|
return [
|
|
287952
287952
|
{
|
|
287953
287953
|
validate(cr) {
|
|
@@ -289644,7 +289644,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
289644
289644
|
description: {
|
|
289645
289645
|
type: 'string',
|
|
289646
289646
|
maxLength: 100,
|
|
289647
|
-
description: 'Optional label description (
|
|
289647
|
+
description: 'Optional label description (max 100 chars)',
|
|
289648
289648
|
},
|
|
289649
289649
|
},
|
|
289650
289650
|
additionalProperties: false,
|
|
@@ -298153,6 +298153,17 @@ const TYPE_MAP = {
|
|
|
298153
298153
|
Team: 'group',
|
|
298154
298154
|
Organization: 'org',
|
|
298155
298155
|
};
|
|
298156
|
+
const DEFAULT_LABELS = [
|
|
298157
|
+
'bug',
|
|
298158
|
+
'documentation',
|
|
298159
|
+
'duplicate',
|
|
298160
|
+
'enhancement',
|
|
298161
|
+
'good first issue',
|
|
298162
|
+
'help wanted',
|
|
298163
|
+
'invalid',
|
|
298164
|
+
'question',
|
|
298165
|
+
'wontfix',
|
|
298166
|
+
];
|
|
298156
298167
|
class RepoGithubDecanter extends GithubDecanter {
|
|
298157
298168
|
constructor(data, org, githubTeams = {}) {
|
|
298158
298169
|
super(data, org);
|
|
@@ -298367,6 +298378,19 @@ class RepoGithubDecanter extends GithubDecanter {
|
|
|
298367
298378
|
}));
|
|
298368
298379
|
}
|
|
298369
298380
|
}
|
|
298381
|
+
async __decantRepoLabels() {
|
|
298382
|
+
let labels = this.data.labels || [];
|
|
298383
|
+
labels = labels.filter((label) => {
|
|
298384
|
+
return !DEFAULT_LABELS.includes(label.name);
|
|
298385
|
+
});
|
|
298386
|
+
if (labels && labels.length > 0) {
|
|
298387
|
+
this.__patchClaim({
|
|
298388
|
+
op: 'add',
|
|
298389
|
+
value: labels,
|
|
298390
|
+
path: '/providers/github/labels',
|
|
298391
|
+
});
|
|
298392
|
+
}
|
|
298393
|
+
}
|
|
298370
298394
|
async __gatherRepoTeamsAndMembers() {
|
|
298371
298395
|
this.data['teamsAndMembers'] = {};
|
|
298372
298396
|
const directMembers = (await github.repo.getCollaborators(this.data.repoDetails.owner.login, this.data.repoDetails.name, 'direct')).map((member) => {
|
|
@@ -298433,6 +298457,16 @@ class RepoGithubDecanter extends GithubDecanter {
|
|
|
298433
298457
|
}
|
|
298434
298458
|
importer_src_logger.info(`No CODEOWNERS file found for ${this.data.repoDetails.name}, skipping.`);
|
|
298435
298459
|
}
|
|
298460
|
+
async __gatherRepoLabels() {
|
|
298461
|
+
try {
|
|
298462
|
+
const labels = await github.repo.getRepoIssuesLabels(this.org, this.data.repoDetails.name);
|
|
298463
|
+
this.data['labels'] = labels;
|
|
298464
|
+
}
|
|
298465
|
+
catch (e) {
|
|
298466
|
+
importer_src_logger.error(`Error fetching labels for ${this.data.repoDetails.name}: ${e.message}`);
|
|
298467
|
+
throw new Error(`Error fetching labels for ${this.data.repoDetails.name}: ${e.message}`);
|
|
298468
|
+
}
|
|
298469
|
+
}
|
|
298436
298470
|
async __adaptInitializerBranchStrategies(_claim) {
|
|
298437
298471
|
const bpData = this.data.branchStrategy.data;
|
|
298438
298472
|
if (this.data.branchStrategy.kind === 'custom') {
|
|
@@ -306365,7 +306399,7 @@ function provisionPermissions(fsGithubRepository) {
|
|
|
306365
306399
|
;// CONCATENATED MODULE: ../gh_provisioner/src/entities/ghrepo/helpers/labels.ts
|
|
306366
306400
|
// if we are to provision labels using tofu and the label already
|
|
306367
306401
|
// exists, we should not attempt to re-create it. This function checks
|
|
306368
|
-
// if the label exists and if
|
|
306402
|
+
// if the label exists and if so, imports it into Terraform state. This is needed because
|
|
306369
306403
|
// tofu does not have an "upsert" operation for labels, so we need to check
|
|
306370
306404
|
// if the label exists before trying to create it, otherwise we will get an error.
|
|
306371
306405
|
|
|
@@ -306374,13 +306408,13 @@ function provisionPermissions(fsGithubRepository) {
|
|
|
306374
306408
|
async function provisionLabels(fsGithubRepository, repoAlreadyExists) {
|
|
306375
306409
|
try {
|
|
306376
306410
|
const cr = fsGithubRepository.cr;
|
|
306377
|
-
|
|
306411
|
+
const labels = cr.spec.repo.labels;
|
|
306412
|
+
if (!labels || labels.length === 0) {
|
|
306378
306413
|
return;
|
|
306379
306414
|
}
|
|
306380
306415
|
if (repoAlreadyExists) {
|
|
306381
306416
|
await importLabelsIfNeeded(fsGithubRepository);
|
|
306382
306417
|
}
|
|
306383
|
-
const labels = cr.spec.repo.labels;
|
|
306384
306418
|
for (const label of labels) {
|
|
306385
306419
|
gh_provisioner_src_logger.debug(`[gh-provisioner] ${fsGithubRepository.k8sId} provisioning label ${label.name}`);
|
|
306386
306420
|
fsGithubRepository.patchData({
|
|
@@ -306403,33 +306437,25 @@ async function importLabelsIfNeeded(fsGithubRepository) {
|
|
|
306403
306437
|
const cr = fsGithubRepository.cr;
|
|
306404
306438
|
try {
|
|
306405
306439
|
const labels = cr.spec.repo.labels;
|
|
306406
|
-
const labelsToImport = [];
|
|
306407
306440
|
gh_provisioner_src_logger.info(`[gh-provisioner] ${fsGithubRepository.k8sId} checking if labels need to be imported`);
|
|
306408
306441
|
const repoIssuesList = await fsGithubRepository.runWithGithubProvider(async () => {
|
|
306409
306442
|
return await github.repo.getRepoIssuesLabels(cr.spec.org, cr.name);
|
|
306410
306443
|
});
|
|
306411
|
-
//
|
|
306444
|
+
// labels that already exist in GitHub must be imported into Terraform state
|
|
306445
|
+
// so that Terraform manages them rather than trying to create them (which would fail)
|
|
306412
306446
|
for (const label of labels) {
|
|
306413
|
-
if (checkIfLabelExists(label.name, repoIssuesList)) {
|
|
306447
|
+
if (!checkIfLabelExists(label.name, repoIssuesList)) {
|
|
306414
306448
|
continue;
|
|
306415
306449
|
}
|
|
306416
|
-
|
|
306417
|
-
name: label.name,
|
|
306418
|
-
color: label.color,
|
|
306419
|
-
description: label.description,
|
|
306420
|
-
});
|
|
306421
|
-
}
|
|
306422
|
-
for (const label of labelsToImport) {
|
|
306423
|
-
this.patchImportData({
|
|
306450
|
+
fsGithubRepository.patchImportData({
|
|
306424
306451
|
op: PatchOperations.add,
|
|
306425
306452
|
path: '/imports/-',
|
|
306426
306453
|
value: {
|
|
306427
306454
|
to: 'github_issue_label.this["' + label.name + '"]',
|
|
306428
|
-
id: `${
|
|
306455
|
+
id: `${cr.name}:${label.name}`,
|
|
306429
306456
|
},
|
|
306430
306457
|
});
|
|
306431
306458
|
}
|
|
306432
|
-
return labelsToImport;
|
|
306433
306459
|
}
|
|
306434
306460
|
catch (err) {
|
|
306435
306461
|
gh_provisioner_src_logger.error(`[gh-provisioner] ${fsGithubRepository.k8sId} error on importLabelsIfNeeded: ${err}`);
|
|
@@ -308737,7 +308763,7 @@ const crs_analyzerSubcommand = {
|
|
|
308737
308763
|
};
|
|
308738
308764
|
|
|
308739
308765
|
;// CONCATENATED MODULE: ./package.json
|
|
308740
|
-
const package_namespaceObject = JSON.parse('{"i8":"2.3.0-snapshot"}');
|
|
308766
|
+
const package_namespaceObject = JSON.parse('{"i8":"2.3.0-snapshot-2"}');
|
|
308741
308767
|
;// CONCATENATED MODULE: ../../package.json
|
|
308742
308768
|
const package_namespaceObject_1 = {"i8":"2.2.0"};
|
|
308743
308769
|
;// CONCATENATED MODULE: ./src/subcommands/index.ts
|
|
@@ -3,7 +3,7 @@ export declare class ComponentLabelsInitializer extends InitializerPatches {
|
|
|
3
3
|
applicableProviders: string[];
|
|
4
4
|
static applicableKinds: string[];
|
|
5
5
|
__validate(): Promise<boolean>;
|
|
6
|
-
__patches(
|
|
6
|
+
__patches(_claim: any, _previousCR: any): Promise<{
|
|
7
7
|
validate(cr: any): boolean;
|
|
8
8
|
apply(cr: any): any;
|
|
9
9
|
identify(): string;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { EntityGHRepo } from '../';
|
|
2
|
+
export declare function provisionLabels(fsGithubRepository: EntityGHRepo, repoAlreadyExists: boolean): Promise<void>;
|
|
@@ -10,11 +10,13 @@ export default class RepoGithubDecanter extends GithubDecanter {
|
|
|
10
10
|
__decantOIDC(): void;
|
|
11
11
|
__decantValidateCodeowners(): void;
|
|
12
12
|
__decantRelations(): void;
|
|
13
|
+
__decantRepoLabels(): Promise<void>;
|
|
13
14
|
__gatherRepoTeamsAndMembers(): Promise<void>;
|
|
14
15
|
__gatherPages(): Promise<void>;
|
|
15
16
|
__gatherOIDCSubjectClaim(): Promise<void>;
|
|
16
17
|
__gatherBranchStrategy(): Promise<void>;
|
|
17
18
|
__gatherCodeowners(): Promise<void>;
|
|
19
|
+
__gatherRepoLabels(): Promise<void>;
|
|
18
20
|
__adaptInitializerBranchStrategies(_claim: any): Promise<BranchStrategiesInitializer>;
|
|
19
21
|
__adaptInitializerBase(_claim: any): Promise<InitializerDefault>;
|
|
20
22
|
__adaptOverriderRepo(_claim: any): Promise<GithubRepositoryOverrider>;
|