@pagopa/dx-cli 0.18.11 → 0.18.13
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/dist/adapters/commander/commands/init.js +1 -0
- package/dist/adapters/pagopa-technology/__tests__/authorization.test.js +5 -4
- package/dist/adapters/pagopa-technology/authorization.js +2 -2
- package/dist/domain/authorization.d.ts +1 -0
- package/dist/domain/authorization.js +1 -0
- package/dist/use-cases/__tests__/request-authorization.test.js +1 -0
- package/package.json +3 -3
|
@@ -144,6 +144,7 @@ export const authorizeCloudAccounts = (authorizationService) => (envPayload) =>
|
|
|
144
144
|
const locShort = locationShort[account.defaultLocation];
|
|
145
145
|
const input = requestAuthorizationInputSchema.safeParse({
|
|
146
146
|
bootstrapIdentityId: `${prefix}-${envShort}-${locShort}-bootstrap-id-01`,
|
|
147
|
+
repoName: envPayload.github.repo,
|
|
147
148
|
subscriptionName: account.displayName,
|
|
148
149
|
});
|
|
149
150
|
if (!input.success) {
|
|
@@ -16,6 +16,7 @@ const makeEnv = () => {
|
|
|
16
16
|
};
|
|
17
17
|
const makeSampleInput = () => requestAuthorizationInputSchema.parse({
|
|
18
18
|
bootstrapIdentityId: "test-bootstrap-identity-id",
|
|
19
|
+
repoName: "test-repo",
|
|
19
20
|
subscriptionName: "test-subscription",
|
|
20
21
|
});
|
|
21
22
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -42,7 +43,7 @@ directory_readers = {
|
|
|
42
43
|
expect(authResult).toBeInstanceOf(AuthorizationResult);
|
|
43
44
|
expect(authResult.url).toBe("https://github.com/pagopa/eng-azure-authorization/pull/42");
|
|
44
45
|
expect(gitHubService.createBranch).toHaveBeenCalledWith({
|
|
45
|
-
branchName: "feats/add-test-subscription-bootstrap-identity",
|
|
46
|
+
branchName: "feats/add-test-repo-test-subscription-bootstrap-identity",
|
|
46
47
|
fromRef: "main",
|
|
47
48
|
owner: "pagopa",
|
|
48
49
|
repo: "eng-azure-authorization",
|
|
@@ -50,11 +51,11 @@ directory_readers = {
|
|
|
50
51
|
expect(gitHubService.getFileContent).toHaveBeenCalledWith({
|
|
51
52
|
owner: "pagopa",
|
|
52
53
|
path: "src/azure-subscriptions/subscriptions/test-subscription/terraform.tfvars",
|
|
53
|
-
ref: "feats/add-test-subscription-bootstrap-identity",
|
|
54
|
+
ref: "feats/add-test-repo-test-subscription-bootstrap-identity",
|
|
54
55
|
repo: "eng-azure-authorization",
|
|
55
56
|
});
|
|
56
57
|
expect(gitHubService.updateFile).toHaveBeenCalledWith(expect.objectContaining({
|
|
57
|
-
branch: "feats/add-test-subscription-bootstrap-identity",
|
|
58
|
+
branch: "feats/add-test-repo-test-subscription-bootstrap-identity",
|
|
58
59
|
message: "Add directory reader for test-subscription",
|
|
59
60
|
owner: "pagopa",
|
|
60
61
|
path: "src/azure-subscriptions/subscriptions/test-subscription/terraform.tfvars",
|
|
@@ -64,7 +65,7 @@ directory_readers = {
|
|
|
64
65
|
expect(gitHubService.createPullRequest).toHaveBeenCalledWith({
|
|
65
66
|
base: "main",
|
|
66
67
|
body: "This PR adds the bootstrap identity `test-bootstrap-identity-id` to the directory readers for subscription `test-subscription`.",
|
|
67
|
-
head: "feats/add-test-subscription-bootstrap-identity",
|
|
68
|
+
head: "feats/add-test-repo-test-subscription-bootstrap-identity",
|
|
68
69
|
owner: "pagopa",
|
|
69
70
|
repo: "eng-azure-authorization",
|
|
70
71
|
title: "Add directory reader for test-subscription",
|
|
@@ -33,9 +33,9 @@ const BASE_BRANCH = "main";
|
|
|
33
33
|
export const makeAuthorizationService = (gitHubService) => ({
|
|
34
34
|
requestAuthorization(input) {
|
|
35
35
|
const logger = getLogger(["dx-cli", "pagopa-authorization"]);
|
|
36
|
-
const { bootstrapIdentityId, subscriptionName } = input;
|
|
36
|
+
const { bootstrapIdentityId, repoName, subscriptionName } = input;
|
|
37
37
|
const filePath = `src/azure-subscriptions/subscriptions/${subscriptionName}/terraform.tfvars`;
|
|
38
|
-
const branchName = `feats/add-${subscriptionName}-bootstrap-identity`;
|
|
38
|
+
const branchName = `feats/add-${repoName}-${subscriptionName}-bootstrap-identity`;
|
|
39
39
|
return (
|
|
40
40
|
// Step 1: Create branch first to avoid race condition with main branch updates
|
|
41
41
|
ResultAsync.fromPromise(gitHubService.createBranch({
|
|
@@ -12,6 +12,7 @@ import { z } from "zod/v4";
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const requestAuthorizationInputSchema: z.ZodObject<{
|
|
14
14
|
bootstrapIdentityId: z.core.$ZodBranded<z.ZodString, "BootstrapIdentityId", "out">;
|
|
15
|
+
repoName: z.ZodString;
|
|
15
16
|
subscriptionName: z.core.$ZodBranded<z.ZodString, "SubscriptionName", "out">;
|
|
16
17
|
}, z.core.$strip>;
|
|
17
18
|
/**
|
|
@@ -8,6 +8,7 @@ import { AuthorizationError, AuthorizationResult, IdentityAlreadyExistsError, re
|
|
|
8
8
|
import { requestAuthorization } from "../request-authorization.js";
|
|
9
9
|
const makeSampleInput = () => requestAuthorizationInputSchema.parse({
|
|
10
10
|
bootstrapIdentityId: "test-bootstrap-identity-id",
|
|
11
|
+
repoName: "test-repo",
|
|
11
12
|
subscriptionName: "test-subscription",
|
|
12
13
|
});
|
|
13
14
|
describe("requestAuthorization", () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagopa/dx-cli",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A CLI useful to manage DX tools.",
|
|
6
6
|
"repository": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"semver": "^7.7.4",
|
|
48
48
|
"yaml": "^2.8.2",
|
|
49
49
|
"zod": "^4.3.6",
|
|
50
|
-
"@pagopa/dx-savemoney": "^0.2.
|
|
50
|
+
"@pagopa/dx-savemoney": "^0.2.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@tsconfig/node24": "24.0.4",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"typescript": "~5.9.3",
|
|
63
63
|
"vitest": "^3.2.4",
|
|
64
64
|
"vitest-mock-extended": "^3.1.0",
|
|
65
|
-
"@pagopa/eslint-config": "^6.0.
|
|
65
|
+
"@pagopa/eslint-config": "^6.0.2"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=22.0.0"
|