buildnator-personal 0.0.5 → 0.0.6
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/buildnator.client.ts +29 -1
- package/dist/buildnator.client.js +58 -6
- package/package.json +1 -1
- package/types.ts +2 -1
package/buildnator.client.ts
CHANGED
|
@@ -15,7 +15,8 @@ const DEFAULT_JOBS: JobsConfig = {
|
|
|
15
15
|
publicarDllsNuget: "/job/GCS-AGB-Publicar-dlls-NuGet",
|
|
16
16
|
testeTaVersaoEvolutiva: "/job/QA%20-%20TA%20-%20AGB%20-%20TESTES%20AUTOMATIZADOS%20VERSAO%20EVOLUTIVA%20(GCS)",
|
|
17
17
|
unificarCommits: "/job/GCS-Unificar-commits",
|
|
18
|
-
criarbackup: "job/GCS-CriarBackup"
|
|
18
|
+
criarbackup: "job/GCS-CriarBackup",
|
|
19
|
+
recriarBranch: "view/Ger%C3%AAncia%20de%20Configura%C3%A7%C3%A3o/job/GCS-RecriarBranch/"
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
function normalizeBaseUrl(url: string): string {
|
|
@@ -500,4 +501,31 @@ export class BuildnatorClient {
|
|
|
500
501
|
return { terminado: true, resultado: false, tipo: "criarbackup", retorno: "erro interno", parou: "" };
|
|
501
502
|
}
|
|
502
503
|
}
|
|
504
|
+
|
|
505
|
+
async RecriarBranch(branch: string, sistema: string, branchBackup: string): Promise<any> {
|
|
506
|
+
await this.jenkinsPost(`${this.jobs.recriarBranch}/buildWithParameters`, {
|
|
507
|
+
branch: branch,
|
|
508
|
+
repositorio: sistema,
|
|
509
|
+
branchBackup: branchBackup
|
|
510
|
+
|
|
511
|
+
});
|
|
512
|
+
await this.sleep(this.buildDelayMs);
|
|
513
|
+
const numbuild = await this.jenkinsPost(`${this.jobs.recriarBranch}/api/json`);
|
|
514
|
+
return numbuild.builds[0].number;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
async consultarRecriarBranch(id: any): Promise<any> {
|
|
518
|
+
try {
|
|
519
|
+
const numbuild = await this.jenkinsPost(`${this.jobs.recriarBranch}/${id}/api/json`);
|
|
520
|
+
if (numbuild && numbuild.inProgress === false) {
|
|
521
|
+
if (numbuild.result === "SUCCESS") {
|
|
522
|
+
return { terminado: true, resultado: true, tipo: "recriarBranch", retorno: numbuild.result};
|
|
523
|
+
}
|
|
524
|
+
return { terminado: true, resultado: false, tipo: "recriarBranch", retorno: numbuild.result };
|
|
525
|
+
}
|
|
526
|
+
return { terminado: false, resultado: false, tipo: "recriarBranch", retorno: numbuild?.result};
|
|
527
|
+
} catch {
|
|
528
|
+
return { terminado: true, resultado: false, tipo: "recriarBranch", retorno: "erro interno"};
|
|
529
|
+
}
|
|
530
|
+
}
|
|
503
531
|
}
|
|
@@ -62,7 +62,8 @@ var DEFAULT_JOBS = {
|
|
|
62
62
|
publicarDllsNuget: "/job/GCS-AGB-Publicar-dlls-NuGet",
|
|
63
63
|
testeTaVersaoEvolutiva: "/job/QA%20-%20TA%20-%20AGB%20-%20TESTES%20AUTOMATIZADOS%20VERSAO%20EVOLUTIVA%20(GCS)",
|
|
64
64
|
unificarCommits: "/job/GCS-Unificar-commits",
|
|
65
|
-
criarbackup: "job/GCS-CriarBackup"
|
|
65
|
+
criarbackup: "job/GCS-CriarBackup",
|
|
66
|
+
recriarBranch: "view/Ger%C3%AAncia%20de%20Configura%C3%A7%C3%A3o/job/GCS-RecriarBranch/"
|
|
66
67
|
};
|
|
67
68
|
function normalizeBaseUrl(url) {
|
|
68
69
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
@@ -754,25 +755,76 @@ var BuildnatorClient = /** @class */ (function () {
|
|
|
754
755
|
});
|
|
755
756
|
};
|
|
756
757
|
BuildnatorClient.prototype.consultarCriarBCK = function (id) {
|
|
758
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
759
|
+
var numbuild, consoleText, match, branch, _a;
|
|
760
|
+
return __generator(this, function (_b) {
|
|
761
|
+
switch (_b.label) {
|
|
762
|
+
case 0:
|
|
763
|
+
_b.trys.push([0, 5, , 6]);
|
|
764
|
+
return [4 /*yield*/, this.jenkinsPost("".concat(this.jobs.criarbackup, "/").concat(id, "/api/json"))];
|
|
765
|
+
case 1:
|
|
766
|
+
numbuild = _b.sent();
|
|
767
|
+
if (!(numbuild && numbuild.inProgress === false)) return [3 /*break*/, 4];
|
|
768
|
+
if (!(numbuild.result === "SUCCESS")) return [3 /*break*/, 3];
|
|
769
|
+
return [4 /*yield*/, this.jenkinsGet("".concat(this.jobs.criarbackup, "/").concat(id, "/consoleText"))];
|
|
770
|
+
case 2:
|
|
771
|
+
consoleText = _b.sent();
|
|
772
|
+
match = consoleText.match(/([a-zA-Z0-9._-]+_bck_\d{8}_\d{6})/);
|
|
773
|
+
branch = match ? match[1] : null;
|
|
774
|
+
return [2 /*return*/, { terminado: true, resultado: true, tipo: "criarbackup", retorno: numbuild.result, parou: branch }];
|
|
775
|
+
case 3: return [2 /*return*/, { terminado: true, resultado: false, tipo: "criarbackup", retorno: numbuild.result, parou: "" }];
|
|
776
|
+
case 4: return [2 /*return*/, { terminado: false, resultado: false, tipo: "criarbackup", retorno: numbuild === null || numbuild === void 0 ? void 0 : numbuild.result, parou: "" }];
|
|
777
|
+
case 5:
|
|
778
|
+
_a = _b.sent();
|
|
779
|
+
return [2 /*return*/, { terminado: true, resultado: false, tipo: "criarbackup", retorno: "erro interno", parou: "" }];
|
|
780
|
+
case 6: return [2 /*return*/];
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
});
|
|
784
|
+
};
|
|
785
|
+
BuildnatorClient.prototype.RecriarBranch = function (branch, sistema, branchBackup) {
|
|
786
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
787
|
+
var numbuild;
|
|
788
|
+
return __generator(this, function (_a) {
|
|
789
|
+
switch (_a.label) {
|
|
790
|
+
case 0: return [4 /*yield*/, this.jenkinsPost("".concat(this.jobs.recriarBranch, "/buildWithParameters"), {
|
|
791
|
+
branch: branch,
|
|
792
|
+
repositorio: sistema,
|
|
793
|
+
branchBackup: branchBackup
|
|
794
|
+
})];
|
|
795
|
+
case 1:
|
|
796
|
+
_a.sent();
|
|
797
|
+
return [4 /*yield*/, this.sleep(this.buildDelayMs)];
|
|
798
|
+
case 2:
|
|
799
|
+
_a.sent();
|
|
800
|
+
return [4 /*yield*/, this.jenkinsPost("".concat(this.jobs.recriarBranch, "/api/json"))];
|
|
801
|
+
case 3:
|
|
802
|
+
numbuild = _a.sent();
|
|
803
|
+
return [2 /*return*/, numbuild.builds[0].number];
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
});
|
|
807
|
+
};
|
|
808
|
+
BuildnatorClient.prototype.consultarRecriarBranch = function (id) {
|
|
757
809
|
return __awaiter(this, void 0, void 0, function () {
|
|
758
810
|
var numbuild, _a;
|
|
759
811
|
return __generator(this, function (_b) {
|
|
760
812
|
switch (_b.label) {
|
|
761
813
|
case 0:
|
|
762
814
|
_b.trys.push([0, 2, , 3]);
|
|
763
|
-
return [4 /*yield*/, this.jenkinsPost("".concat(this.jobs.
|
|
815
|
+
return [4 /*yield*/, this.jenkinsPost("".concat(this.jobs.recriarBranch, "/").concat(id, "/api/json"))];
|
|
764
816
|
case 1:
|
|
765
817
|
numbuild = _b.sent();
|
|
766
818
|
if (numbuild && numbuild.inProgress === false) {
|
|
767
819
|
if (numbuild.result === "SUCCESS") {
|
|
768
|
-
return [2 /*return*/, { terminado: true, resultado: true, tipo: "
|
|
820
|
+
return [2 /*return*/, { terminado: true, resultado: true, tipo: "recriarBranch", retorno: numbuild.result }];
|
|
769
821
|
}
|
|
770
|
-
return [2 /*return*/, { terminado: true, resultado: false, tipo: "
|
|
822
|
+
return [2 /*return*/, { terminado: true, resultado: false, tipo: "recriarBranch", retorno: numbuild.result }];
|
|
771
823
|
}
|
|
772
|
-
return [2 /*return*/, { terminado: false, resultado: false, tipo: "
|
|
824
|
+
return [2 /*return*/, { terminado: false, resultado: false, tipo: "recriarBranch", retorno: numbuild === null || numbuild === void 0 ? void 0 : numbuild.result }];
|
|
773
825
|
case 2:
|
|
774
826
|
_a = _b.sent();
|
|
775
|
-
return [2 /*return*/, { terminado: true, resultado: false, tipo: "
|
|
827
|
+
return [2 /*return*/, { terminado: true, resultado: false, tipo: "recriarBranch", retorno: "erro interno" }];
|
|
776
828
|
case 3: return [2 /*return*/];
|
|
777
829
|
}
|
|
778
830
|
});
|
package/package.json
CHANGED
package/types.ts
CHANGED