@speedkit/cli 4.52.2 → 4.52.3
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/CHANGELOG.md +7 -0
- package/dist/build-info.json +3 -3
- package/dist/services/deploy/mr/merge-request-deploy-service-build-context.js +7 -3
- package/dist/services/deploy/policy/auto-deploy-policy.d.ts +11 -5
- package/dist/services/deploy/policy/auto-deploy-policy.js +25 -7
- package/dist/services/deploy/spec/policy/auto-deploy-policy.spec.js +34 -0
- package/oclif.manifest.json +554 -554
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [4.52.3](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.52.2...v4.52.3) (2026-11-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deploy:** ask for the customer approval in a single --mr deploy ([537c66a](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/537c66a0f2a4c9bcd3b0ade514018efd2c28161f))
|
|
7
|
+
|
|
1
8
|
## [4.52.2](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.52.1...v4.52.2) (2026-11-12)
|
|
2
9
|
|
|
3
10
|
|
package/dist/build-info.json
CHANGED
|
@@ -4,17 +4,21 @@ import { ApprovalAnswer } from "../policy/auto-deploy-policy.js";
|
|
|
4
4
|
export class MergeRequestDeployServiceBuildContext extends Context() {
|
|
5
5
|
/** The `--mr` deploy of `sk deploy`, from that command's args and flags. */
|
|
6
6
|
static create(parsedArgs, parsedFlags, environment) {
|
|
7
|
+
// A person at the keyboard reviews the change in their diff tool.
|
|
8
|
+
const interactive = Boolean(process.stdout.isTTY);
|
|
7
9
|
return new MergeRequestDeployServiceBuildContext({
|
|
8
10
|
environment,
|
|
9
11
|
customerPath: parsedArgs.customerPath,
|
|
10
12
|
configName: parsedFlags.configName,
|
|
11
13
|
iid: parsedFlags.mr,
|
|
12
|
-
approval: (parsedFlags.approval ??
|
|
14
|
+
approval: (parsedFlags.approval ??
|
|
15
|
+
(interactive
|
|
16
|
+
? ApprovalAnswer.Ask
|
|
17
|
+
: ApprovalAnswer.Skip)),
|
|
13
18
|
description: parsedFlags.description,
|
|
14
19
|
dryRun: parsedFlags.dryRun,
|
|
15
20
|
skipPostDeployChecks: false,
|
|
16
|
-
|
|
17
|
-
interactive: Boolean(process.stdout.isTTY),
|
|
21
|
+
interactive,
|
|
18
22
|
});
|
|
19
23
|
}
|
|
20
24
|
}
|
|
@@ -7,16 +7,22 @@ export declare enum ApprovalAnswer {
|
|
|
7
7
|
/** The installation goes live under the debug parameter only. */
|
|
8
8
|
Testing = "testing",
|
|
9
9
|
/** The configurations that need an approval are not deployed at all. */
|
|
10
|
-
Skip = "skip"
|
|
10
|
+
Skip = "skip",
|
|
11
|
+
/**
|
|
12
|
+
* The person who watches the deploy answers both questions themselves.
|
|
13
|
+
* Without such a person, both questions are declined.
|
|
14
|
+
*/
|
|
15
|
+
Ask = "ask"
|
|
11
16
|
}
|
|
12
17
|
/**
|
|
13
|
-
* The policy of a deploy that
|
|
18
|
+
* The policy of a deploy that applies a merged merge request.
|
|
14
19
|
*
|
|
15
20
|
* Every question that the merge request already answers is confirmed: the live
|
|
16
21
|
* installation was compared with the state before the merge request, so the
|
|
17
22
|
* deploy applies exactly the reviewed change. Every question that the merge
|
|
18
|
-
* request cannot answer
|
|
19
|
-
*
|
|
23
|
+
* request cannot answer goes to the person who watches the deploy. Without a
|
|
24
|
+
* person, such a question is declined, which stops this configuration and
|
|
25
|
+
* leaves it to a developer.
|
|
20
26
|
*/
|
|
21
27
|
export declare class AutoDeployPolicy implements DeployPolicyInterface {
|
|
22
28
|
private readonly description;
|
|
@@ -45,6 +51,6 @@ export declare class AutoDeployPolicy implements DeployPolicyInterface {
|
|
|
45
51
|
* the merge request already answers it.
|
|
46
52
|
*/
|
|
47
53
|
cli?: CliServiceInterface);
|
|
48
|
-
confirm(question: DeployQuestion, message?: string): Promise<boolean>;
|
|
54
|
+
confirm(question: DeployQuestion, message?: string, defaultAnswer?: boolean): Promise<boolean>;
|
|
49
55
|
text(question: DeployQuestion): Promise<string>;
|
|
50
56
|
}
|
|
@@ -8,15 +8,21 @@ export var ApprovalAnswer;
|
|
|
8
8
|
ApprovalAnswer["Testing"] = "testing";
|
|
9
9
|
/** The configurations that need an approval are not deployed at all. */
|
|
10
10
|
ApprovalAnswer["Skip"] = "skip";
|
|
11
|
+
/**
|
|
12
|
+
* The person who watches the deploy answers both questions themselves.
|
|
13
|
+
* Without such a person, both questions are declined.
|
|
14
|
+
*/
|
|
15
|
+
ApprovalAnswer["Ask"] = "ask";
|
|
11
16
|
})(ApprovalAnswer || (ApprovalAnswer = {}));
|
|
12
17
|
/**
|
|
13
|
-
* The policy of a deploy that
|
|
18
|
+
* The policy of a deploy that applies a merged merge request.
|
|
14
19
|
*
|
|
15
20
|
* Every question that the merge request already answers is confirmed: the live
|
|
16
21
|
* installation was compared with the state before the merge request, so the
|
|
17
22
|
* deploy applies exactly the reviewed change. Every question that the merge
|
|
18
|
-
* request cannot answer
|
|
19
|
-
*
|
|
23
|
+
* request cannot answer goes to the person who watches the deploy. Without a
|
|
24
|
+
* person, such a question is declined, which stops this configuration and
|
|
25
|
+
* leaves it to a developer.
|
|
20
26
|
*/
|
|
21
27
|
export class AutoDeployPolicy {
|
|
22
28
|
description;
|
|
@@ -42,7 +48,7 @@ export class AutoDeployPolicy {
|
|
|
42
48
|
this.approval = approval;
|
|
43
49
|
this.cli = cli;
|
|
44
50
|
}
|
|
45
|
-
async confirm(question, message) {
|
|
51
|
+
async confirm(question, message, defaultAnswer) {
|
|
46
52
|
switch (question) {
|
|
47
53
|
// The one question a watching person answers, after the diffs.
|
|
48
54
|
case DeployQuestion.UploadInstallResource: {
|
|
@@ -66,17 +72,29 @@ export class AutoDeployPolicy {
|
|
|
66
72
|
return true;
|
|
67
73
|
}
|
|
68
74
|
case DeployQuestion.CustomerApproval: {
|
|
75
|
+
if (this.approval === ApprovalAnswer.Ask) {
|
|
76
|
+
return this.cli ? this.cli.confirm(message, false) : false;
|
|
77
|
+
}
|
|
69
78
|
return this.approval === ApprovalAnswer.Approved;
|
|
70
79
|
}
|
|
71
80
|
case DeployQuestion.ActivateAsTesting: {
|
|
81
|
+
if (this.approval === ApprovalAnswer.Ask) {
|
|
82
|
+
return this.cli ? this.cli.confirm(message, true) : false;
|
|
83
|
+
}
|
|
72
84
|
return this.approval === ApprovalAnswer.Testing;
|
|
73
85
|
}
|
|
86
|
+
// A bulk run confirms it after its plan. Otherwise the watching person
|
|
87
|
+
// is asked, and without a person it is declined.
|
|
74
88
|
case DeployQuestion.DeviceDetectionChange: {
|
|
75
|
-
return this.confirmsDeviceDetection
|
|
89
|
+
return (this.confirmsDeviceDetection ||
|
|
90
|
+
(this.cli ? this.cli.confirm(message, defaultAnswer ?? false) : false));
|
|
76
91
|
}
|
|
77
|
-
// Decisions a merge request never carries
|
|
92
|
+
// Decisions a merge request never carries: the watching person is
|
|
93
|
+
// asked, and without a person they are declined.
|
|
78
94
|
default: {
|
|
79
|
-
return
|
|
95
|
+
return this.cli
|
|
96
|
+
? this.cli.confirm(message, defaultAnswer ?? true)
|
|
97
|
+
: false;
|
|
80
98
|
}
|
|
81
99
|
}
|
|
82
100
|
}
|
|
@@ -63,6 +63,21 @@ describe("AutoDeployPolicy", () => {
|
|
|
63
63
|
expect(await skip.confirm(DeployQuestion.CustomerApproval)).to.equal(false);
|
|
64
64
|
expect(await skip.confirm(DeployQuestion.ActivateAsTesting)).to.equal(false);
|
|
65
65
|
});
|
|
66
|
+
it("asks the watching person about such a customer", async () => {
|
|
67
|
+
const { cli, questions } = personAnswering(true);
|
|
68
|
+
const ask = new AutoDeployPolicy("a change", ApprovalAnswer.Ask, cli);
|
|
69
|
+
expect(await ask.confirm(DeployQuestion.CustomerApproval, "Was this change approved by customer?")).to.equal(true);
|
|
70
|
+
expect(await ask.confirm(DeployQuestion.ActivateAsTesting, "Activate as testing installation?")).to.equal(true);
|
|
71
|
+
expect(questions).to.deep.equal([
|
|
72
|
+
"Was this change approved by customer?",
|
|
73
|
+
"Activate as testing installation?",
|
|
74
|
+
]);
|
|
75
|
+
});
|
|
76
|
+
it("activates nothing of such a customer when nobody watches to answer", async () => {
|
|
77
|
+
const ask = policy(ApprovalAnswer.Ask);
|
|
78
|
+
expect(await ask.confirm(DeployQuestion.CustomerApproval)).to.equal(false);
|
|
79
|
+
expect(await ask.confirm(DeployQuestion.ActivateAsTesting)).to.equal(false);
|
|
80
|
+
});
|
|
66
81
|
it("leaves the upload to the person who watches the deploy", async () => {
|
|
67
82
|
const { cli, questions } = personAnswering(false);
|
|
68
83
|
const policy = new AutoDeployPolicy("a change", ApprovalAnswer.Approved, cli);
|
|
@@ -77,6 +92,25 @@ describe("AutoDeployPolicy", () => {
|
|
|
77
92
|
expect(await policy.confirm(DeployQuestion.UpdateFile, "Update config?")).to.equal(true);
|
|
78
93
|
expect(questions).to.deep.equal([]);
|
|
79
94
|
});
|
|
95
|
+
it("asks the watching person every decision a merge request does not carry", async () => {
|
|
96
|
+
for (const answer of [true, false]) {
|
|
97
|
+
const { cli, questions } = personAnswering(answer);
|
|
98
|
+
const watched = new AutoDeployPolicy("a change", ApprovalAnswer.Approved, cli);
|
|
99
|
+
expect(await watched.confirm(DeployQuestion.SplitChange, "Change the split?")).to.equal(answer);
|
|
100
|
+
expect(await watched.confirm(DeployQuestion.DeviceDetectionChange, "Change the device detection?")).to.equal(answer);
|
|
101
|
+
expect(questions).to.deep.equal([
|
|
102
|
+
"Change the split?",
|
|
103
|
+
"Change the device detection?",
|
|
104
|
+
]);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
it("asks nobody about a device detection change a person already confirmed", async () => {
|
|
108
|
+
const { cli, questions } = personAnswering(false);
|
|
109
|
+
const watched = new AutoDeployPolicy("a change", ApprovalAnswer.Approved, cli);
|
|
110
|
+
watched.confirmsDeviceDetection = true;
|
|
111
|
+
expect(await watched.confirm(DeployQuestion.DeviceDetectionChange)).to.equal(true);
|
|
112
|
+
expect(questions).to.deep.equal([]);
|
|
113
|
+
});
|
|
80
114
|
it("describes the installation with the merge request", async () => {
|
|
81
115
|
expect(await policy(ApprovalAnswer.Approved).text(DeployQuestion.Description)).to.equal("!42 a reviewed change");
|
|
82
116
|
});
|