@pulumi/pulumi 3.102.0 → 3.103.1
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/automation/cmd.d.ts +27 -1
- package/automation/cmd.js +188 -7
- package/automation/cmd.js.map +1 -1
- package/automation/localWorkspace.d.ts +12 -2
- package/automation/localWorkspace.js +23 -34
- package/automation/localWorkspace.js.map +1 -1
- package/automation/stack.js +1 -2
- package/automation/stack.js.map +1 -1
- package/automation/workspace.d.ts +5 -0
- package/package.json +5 -2
- package/proto/converter_pb.d.ts +9 -0
- package/proto/converter_pb.js +91 -1
- package/tests/automation/cmd.spec.js +139 -1
- package/tests/automation/cmd.spec.js.map +1 -1
- package/tests/automation/localWorkspace.spec.js +54 -92
- package/tests/automation/localWorkspace.spec.js.map +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulumi/pulumi",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.103.1",
|
|
4
4
|
"description": "Pulumi's Node.js SDK",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
"@opentelemetry/semantic-conventions": "^1.6.0",
|
|
22
22
|
"@pulumi/query": "^0.3.0",
|
|
23
23
|
"@types/google-protobuf": "^3.15.5",
|
|
24
|
+
"@types/semver": "^7.5.6",
|
|
25
|
+
"@types/tmp": "^0.2.6",
|
|
24
26
|
"execa": "^5.1.0",
|
|
25
27
|
"google-protobuf": "^3.5.0",
|
|
28
|
+
"got": "^11.8.6",
|
|
26
29
|
"ini": "^2.0.0",
|
|
27
30
|
"js-yaml": "^3.14.0",
|
|
28
31
|
"minimist": "^1.2.6",
|
|
@@ -32,6 +35,7 @@
|
|
|
32
35
|
"require-from-string": "^2.0.1",
|
|
33
36
|
"semver": "^7.5.2",
|
|
34
37
|
"source-map-support": "^0.5.6",
|
|
38
|
+
"tmp": "^0.2.1",
|
|
35
39
|
"ts-node": "^7.0.1",
|
|
36
40
|
"typescript": "~3.8.3",
|
|
37
41
|
"upath": "^1.1.0"
|
|
@@ -44,7 +48,6 @@
|
|
|
44
48
|
"@types/node": "14.18.3",
|
|
45
49
|
"@types/normalize-package-data": "^2.4.0",
|
|
46
50
|
"@types/read-package-tree": "^5.2.0",
|
|
47
|
-
"@types/semver": "^5.5.0",
|
|
48
51
|
"@types/sinon": "^10.0.13",
|
|
49
52
|
"@types/split2": "^2.1.6",
|
|
50
53
|
"@types/uuid": "^9.0.7",
|
package/proto/converter_pb.d.ts
CHANGED
|
@@ -46,6 +46,12 @@ export class ResourceImport extends jspb.Message {
|
|
|
46
46
|
setVersion(value: string): ResourceImport;
|
|
47
47
|
getPlugindownloadurl(): string;
|
|
48
48
|
setPlugindownloadurl(value: string): ResourceImport;
|
|
49
|
+
getLogicalName(): string;
|
|
50
|
+
setLogicalName(value: string): ResourceImport;
|
|
51
|
+
getIsComponent(): boolean;
|
|
52
|
+
setIsComponent(value: boolean): ResourceImport;
|
|
53
|
+
getIsRemote(): boolean;
|
|
54
|
+
setIsRemote(value: boolean): ResourceImport;
|
|
49
55
|
|
|
50
56
|
serializeBinary(): Uint8Array;
|
|
51
57
|
toObject(includeInstance?: boolean): ResourceImport.AsObject;
|
|
@@ -64,6 +70,9 @@ export namespace ResourceImport {
|
|
|
64
70
|
id: string,
|
|
65
71
|
version: string,
|
|
66
72
|
plugindownloadurl: string,
|
|
73
|
+
logicalName: string,
|
|
74
|
+
isComponent: boolean,
|
|
75
|
+
isRemote: boolean,
|
|
67
76
|
}
|
|
68
77
|
}
|
|
69
78
|
|
package/proto/converter_pb.js
CHANGED
|
@@ -355,7 +355,10 @@ proto.pulumirpc.ResourceImport.toObject = function(includeInstance, msg) {
|
|
|
355
355
|
name: jspb.Message.getFieldWithDefault(msg, 2, ""),
|
|
356
356
|
id: jspb.Message.getFieldWithDefault(msg, 3, ""),
|
|
357
357
|
version: jspb.Message.getFieldWithDefault(msg, 4, ""),
|
|
358
|
-
plugindownloadurl: jspb.Message.getFieldWithDefault(msg, 5, "")
|
|
358
|
+
plugindownloadurl: jspb.Message.getFieldWithDefault(msg, 5, ""),
|
|
359
|
+
logicalName: jspb.Message.getFieldWithDefault(msg, 6, ""),
|
|
360
|
+
isComponent: jspb.Message.getBooleanFieldWithDefault(msg, 7, false),
|
|
361
|
+
isRemote: jspb.Message.getBooleanFieldWithDefault(msg, 8, false)
|
|
359
362
|
};
|
|
360
363
|
|
|
361
364
|
if (includeInstance) {
|
|
@@ -412,6 +415,18 @@ proto.pulumirpc.ResourceImport.deserializeBinaryFromReader = function(msg, reade
|
|
|
412
415
|
var value = /** @type {string} */ (reader.readString());
|
|
413
416
|
msg.setPlugindownloadurl(value);
|
|
414
417
|
break;
|
|
418
|
+
case 6:
|
|
419
|
+
var value = /** @type {string} */ (reader.readString());
|
|
420
|
+
msg.setLogicalName(value);
|
|
421
|
+
break;
|
|
422
|
+
case 7:
|
|
423
|
+
var value = /** @type {boolean} */ (reader.readBool());
|
|
424
|
+
msg.setIsComponent(value);
|
|
425
|
+
break;
|
|
426
|
+
case 8:
|
|
427
|
+
var value = /** @type {boolean} */ (reader.readBool());
|
|
428
|
+
msg.setIsRemote(value);
|
|
429
|
+
break;
|
|
415
430
|
default:
|
|
416
431
|
reader.skipField();
|
|
417
432
|
break;
|
|
@@ -476,6 +491,27 @@ proto.pulumirpc.ResourceImport.serializeBinaryToWriter = function(message, write
|
|
|
476
491
|
f
|
|
477
492
|
);
|
|
478
493
|
}
|
|
494
|
+
f = message.getLogicalName();
|
|
495
|
+
if (f.length > 0) {
|
|
496
|
+
writer.writeString(
|
|
497
|
+
6,
|
|
498
|
+
f
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
f = message.getIsComponent();
|
|
502
|
+
if (f) {
|
|
503
|
+
writer.writeBool(
|
|
504
|
+
7,
|
|
505
|
+
f
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
f = message.getIsRemote();
|
|
509
|
+
if (f) {
|
|
510
|
+
writer.writeBool(
|
|
511
|
+
8,
|
|
512
|
+
f
|
|
513
|
+
);
|
|
514
|
+
}
|
|
479
515
|
};
|
|
480
516
|
|
|
481
517
|
|
|
@@ -569,6 +605,60 @@ proto.pulumirpc.ResourceImport.prototype.setPlugindownloadurl = function(value)
|
|
|
569
605
|
};
|
|
570
606
|
|
|
571
607
|
|
|
608
|
+
/**
|
|
609
|
+
* optional string logical_name = 6;
|
|
610
|
+
* @return {string}
|
|
611
|
+
*/
|
|
612
|
+
proto.pulumirpc.ResourceImport.prototype.getLogicalName = function() {
|
|
613
|
+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, ""));
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* @param {string} value
|
|
619
|
+
* @return {!proto.pulumirpc.ResourceImport} returns this
|
|
620
|
+
*/
|
|
621
|
+
proto.pulumirpc.ResourceImport.prototype.setLogicalName = function(value) {
|
|
622
|
+
return jspb.Message.setProto3StringField(this, 6, value);
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* optional bool is_component = 7;
|
|
628
|
+
* @return {boolean}
|
|
629
|
+
*/
|
|
630
|
+
proto.pulumirpc.ResourceImport.prototype.getIsComponent = function() {
|
|
631
|
+
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false));
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* @param {boolean} value
|
|
637
|
+
* @return {!proto.pulumirpc.ResourceImport} returns this
|
|
638
|
+
*/
|
|
639
|
+
proto.pulumirpc.ResourceImport.prototype.setIsComponent = function(value) {
|
|
640
|
+
return jspb.Message.setProto3BooleanField(this, 7, value);
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* optional bool is_remote = 8;
|
|
646
|
+
* @return {boolean}
|
|
647
|
+
*/
|
|
648
|
+
proto.pulumirpc.ResourceImport.prototype.getIsRemote = function() {
|
|
649
|
+
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false));
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* @param {boolean} value
|
|
655
|
+
* @return {!proto.pulumirpc.ResourceImport} returns this
|
|
656
|
+
*/
|
|
657
|
+
proto.pulumirpc.ResourceImport.prototype.setIsRemote = function(value) {
|
|
658
|
+
return jspb.Message.setProto3BooleanField(this, 8, value);
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
|
|
572
662
|
|
|
573
663
|
/**
|
|
574
664
|
* List of repeated fields within this message type.
|
|
@@ -30,12 +30,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
const assert = __importStar(require("assert"));
|
|
33
|
+
const fs = __importStar(require("fs"));
|
|
34
|
+
const semver = __importStar(require("semver"));
|
|
35
|
+
const os = __importStar(require("os"));
|
|
36
|
+
const tmp = __importStar(require("tmp"));
|
|
37
|
+
const upath = __importStar(require("upath"));
|
|
33
38
|
const automation_1 = require("../../automation");
|
|
34
39
|
describe("automation/cmd", () => {
|
|
35
40
|
it("calls onOutput when provided to runPulumiCmd", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
41
|
let output = "";
|
|
37
42
|
let numCalls = 0;
|
|
38
|
-
yield automation_1.
|
|
43
|
+
const pulumi = yield automation_1.PulumiCommand.get();
|
|
44
|
+
yield pulumi.run(["--help"], ".", {}, (data) => {
|
|
39
45
|
output += data;
|
|
40
46
|
numCalls += 1;
|
|
41
47
|
});
|
|
@@ -43,5 +49,137 @@ describe("automation/cmd", () => {
|
|
|
43
49
|
assert.match(output, new RegExp("Usage[:]"));
|
|
44
50
|
assert.match(output, new RegExp("[-][-]verbose"));
|
|
45
51
|
}));
|
|
52
|
+
describe("CLI installation", () => {
|
|
53
|
+
it("installs the requested version", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
const tmpDir = tmp.dirSync({ prefix: "automation-test-", unsafeCleanup: true });
|
|
55
|
+
try {
|
|
56
|
+
const cmd = yield automation_1.PulumiCommand.install({ root: tmpDir.name, version: new semver.SemVer("3.97.0") });
|
|
57
|
+
assert.doesNotThrow(() => fs.statSync(upath.join(tmpDir.name, "bin", "pulumi")));
|
|
58
|
+
const { stdout } = yield cmd.run(["version"], ".", {});
|
|
59
|
+
assert.strictEqual(stdout.trim(), "3.97.0");
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
tmpDir.removeCallback();
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
it("does not re-install the version if it already exists", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
const tmpDir = tmp.dirSync({ prefix: "automation-test-", unsafeCleanup: true });
|
|
67
|
+
try {
|
|
68
|
+
yield automation_1.PulumiCommand.install({ root: tmpDir.name, version: new semver.SemVer("3.97.0") });
|
|
69
|
+
const binary1 = fs.statSync(upath.join(tmpDir.name, "bin", "pulumi"));
|
|
70
|
+
yield automation_1.PulumiCommand.install({ root: tmpDir.name, version: new semver.SemVer("3.97.0") });
|
|
71
|
+
const binary2 = fs.statSync(upath.join(tmpDir.name, "bin", "pulumi"));
|
|
72
|
+
assert.strictEqual(binary1.ino, binary2.ino);
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
tmpDir.removeCallback();
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
it("defaults to $HOME/.pulumi/versions/$VERSION if no root is provided", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
|
+
const version = new semver.SemVer("3.97.0");
|
|
80
|
+
const cmd = yield automation_1.PulumiCommand.install({ version });
|
|
81
|
+
assert.doesNotThrow(() => fs.statSync(upath.join(os.homedir(), ".pulumi", "versions", `${version}`, "bin", "pulumi")));
|
|
82
|
+
const { stdout } = yield cmd.run(["version"], ".", {});
|
|
83
|
+
assert.strictEqual(stdout.trim(), `${version}`);
|
|
84
|
+
}));
|
|
85
|
+
it("throws if the found version is not compatible with the requested version", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
const installedVersion = new semver.SemVer("3.97.0");
|
|
87
|
+
yield automation_1.PulumiCommand.install({ version: installedVersion });
|
|
88
|
+
const requestedVersion = new semver.SemVer("3.98.0");
|
|
89
|
+
assert.rejects(automation_1.PulumiCommand.get({ version: requestedVersion }));
|
|
90
|
+
}));
|
|
91
|
+
});
|
|
92
|
+
describe(`checkVersionIsValid`, () => {
|
|
93
|
+
const MAJOR = /Major version mismatch./;
|
|
94
|
+
const MINIMUM = /Minimum version requirement failed./;
|
|
95
|
+
const PARSE = /Failed to parse/;
|
|
96
|
+
const versionTests = [
|
|
97
|
+
{
|
|
98
|
+
name: "higher_major",
|
|
99
|
+
currentVersion: "100.0.0",
|
|
100
|
+
expectError: MAJOR,
|
|
101
|
+
optOut: false,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "lower_major",
|
|
105
|
+
currentVersion: "1.0.0",
|
|
106
|
+
expectError: MINIMUM,
|
|
107
|
+
optOut: false,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "higher_minor",
|
|
111
|
+
currentVersion: "v2.22.0",
|
|
112
|
+
expectError: null,
|
|
113
|
+
optOut: false,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "lower_minor",
|
|
117
|
+
currentVersion: "v2.1.0",
|
|
118
|
+
expectError: MINIMUM,
|
|
119
|
+
optOut: false,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "equal_minor_higher_patch",
|
|
123
|
+
currentVersion: "v2.21.2",
|
|
124
|
+
expectError: null,
|
|
125
|
+
optOut: false,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "equal_minor_equal_patch",
|
|
129
|
+
currentVersion: "v2.21.1",
|
|
130
|
+
expectError: null,
|
|
131
|
+
optOut: false,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: "equal_minor_lower_patch",
|
|
135
|
+
currentVersion: "v2.21.0",
|
|
136
|
+
expectError: MINIMUM,
|
|
137
|
+
optOut: false,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "equal_minor_equal_patch_prerelease",
|
|
141
|
+
// Note that prerelease < release so this case will error
|
|
142
|
+
currentVersion: "v2.21.1-alpha.1234",
|
|
143
|
+
expectError: MINIMUM,
|
|
144
|
+
optOut: false,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "opt_out_of_check_would_fail_otherwise",
|
|
148
|
+
currentVersion: "v2.20.0",
|
|
149
|
+
expectError: null,
|
|
150
|
+
optOut: true,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "opt_out_of_check_would_succeed_otherwise",
|
|
154
|
+
currentVersion: "v2.22.0",
|
|
155
|
+
expectError: null,
|
|
156
|
+
optOut: true,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "invalid_version",
|
|
160
|
+
currentVersion: "invalid",
|
|
161
|
+
expectError: PARSE,
|
|
162
|
+
optOut: false,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "invalid_version_opt_out",
|
|
166
|
+
currentVersion: "invalid",
|
|
167
|
+
expectError: null,
|
|
168
|
+
optOut: true,
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
const minVersion = new semver.SemVer("v2.21.1");
|
|
172
|
+
versionTests.forEach((test) => {
|
|
173
|
+
it(`validates ${test.name} (${test.currentVersion})`, () => {
|
|
174
|
+
const validate = () => automation_1.parseAndValidatePulumiVersion(minVersion, test.currentVersion, test.optOut);
|
|
175
|
+
if (test.expectError) {
|
|
176
|
+
assert.throws(validate, test.expectError);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
assert.doesNotThrow(validate);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
});
|
|
46
184
|
});
|
|
47
185
|
//# sourceMappingURL=cmd.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd.spec.js","sourceRoot":"","sources":["../../../tests/automation/cmd.spec.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;;;;;;;;;;;;;AAEjC,+CAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"cmd.spec.js","sourceRoot":"","sources":["../../../tests/automation/cmd.spec.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;;;;;;;;;;;;;AAEjC,+CAAiC;AACjC,uCAAyB;AACzB,+CAAiC;AACjC,uCAAyB;AACzB,yCAA2B;AAC3B,6CAA+B;AAC/B,iDAAgF;AAEhF,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,8CAA8C,EAAE,GAAS,EAAE;QAC1D,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,MAAM,MAAM,GAAG,MAAM,0BAAa,CAAC,GAAG,EAAE,CAAC;QACzC,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,IAAY,EAAE,EAAE;YACnD,MAAM,IAAI,IAAI,C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AC,aAAa,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,cAAc,GAAG,EAAE,GAAG,EAAE;gBACvD,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,0CAA6B,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;gBACnG,IAAI,IAAI,CAAC,WAAW,EAAE;oBAClB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;iBAC7C;qBAAM;oBACH,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;iBACjC;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
const assert_1 = __importDefault(require("assert"));
|
|
36
36
|
const semver = __importStar(require("semver"));
|
|
37
|
+
const tmp = __importStar(require("tmp"));
|
|
37
38
|
const upath = __importStar(require("upath"));
|
|
38
39
|
const automation_1 = require("../../automation");
|
|
39
40
|
const index_1 = require("../../index");
|
|
@@ -929,6 +930,59 @@ describe("LocalWorkspace", () => {
|
|
|
929
930
|
assert_1.default(ws.pulumiVersion);
|
|
930
931
|
assert_1.default.strictEqual(versionRegex.test(ws.pulumiVersion), true);
|
|
931
932
|
}));
|
|
933
|
+
it("sets pulumi version when using a custom CLI instance", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
934
|
+
const tmpDir = tmp.dirSync({ prefix: "automation-test-", unsafeCleanup: true });
|
|
935
|
+
try {
|
|
936
|
+
const cmd = yield automation_1.PulumiCommand.get();
|
|
937
|
+
const ws = yield automation_1.LocalWorkspace.create({ pulumiCommand: cmd });
|
|
938
|
+
assert_1.default.strictEqual(versionRegex.test(ws.pulumiVersion), true);
|
|
939
|
+
}
|
|
940
|
+
finally {
|
|
941
|
+
tmpDir.removeCallback();
|
|
942
|
+
}
|
|
943
|
+
}));
|
|
944
|
+
it("throws when attempting to retrieve an invalid pulumi version", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
945
|
+
const mockWithNoVersion = {
|
|
946
|
+
command: "pulumi",
|
|
947
|
+
version: null,
|
|
948
|
+
run: () => __awaiter(void 0, void 0, void 0, function* () { return new automation_1.CommandResult("some output", "", 0); }),
|
|
949
|
+
};
|
|
950
|
+
const ws = yield automation_1.LocalWorkspace.create({
|
|
951
|
+
pulumiCommand: mockWithNoVersion,
|
|
952
|
+
envVars: {
|
|
953
|
+
PULUMI_AUTOMATION_API_SKIP_VERSION_CHECK: "true",
|
|
954
|
+
},
|
|
955
|
+
});
|
|
956
|
+
assert_1.default.throws(() => ws.pulumiVersion);
|
|
957
|
+
}));
|
|
958
|
+
it("fails creation if remote operation is not supported", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
959
|
+
const mockWithNoRemoteSupport = {
|
|
960
|
+
command: "pulumi",
|
|
961
|
+
version: new semver.SemVer("2.0.0"),
|
|
962
|
+
// We inspect the output of `pulumi preview --help` to determine
|
|
963
|
+
// if the CLI supports remote operations, see
|
|
964
|
+
// `LocalWorkspace.checkRemoteSupport`.
|
|
965
|
+
run: () => __awaiter(void 0, void 0, void 0, function* () { return new automation_1.CommandResult("some output", "", 0); }),
|
|
966
|
+
};
|
|
967
|
+
yield assert_1.default.rejects(automation_1.LocalWorkspace.create({ pulumiCommand: mockWithNoRemoteSupport, remote: true }));
|
|
968
|
+
}));
|
|
969
|
+
it("bypasses remote support check", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
970
|
+
const mockWithNoRemoteSupport = {
|
|
971
|
+
command: "pulumi",
|
|
972
|
+
version: new semver.SemVer("2.0.0"),
|
|
973
|
+
// We inspect the output of `pulumi preview --help` to determine
|
|
974
|
+
// if the CLI supports remote operations, see
|
|
975
|
+
// `LocalWorkspace.checkRemoteSupport`.
|
|
976
|
+
run: () => __awaiter(void 0, void 0, void 0, function* () { return new automation_1.CommandResult("some output", "", 0); }),
|
|
977
|
+
};
|
|
978
|
+
yield assert_1.default.doesNotReject(automation_1.LocalWorkspace.create({
|
|
979
|
+
pulumiCommand: mockWithNoRemoteSupport,
|
|
980
|
+
remote: true,
|
|
981
|
+
envVars: {
|
|
982
|
+
PULUMI_AUTOMATION_API_SKIP_VERSION_CHECK: "true",
|
|
983
|
+
},
|
|
984
|
+
}));
|
|
985
|
+
}));
|
|
932
986
|
it(`respects existing project settings`, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
933
987
|
const projectName = "correct_project";
|
|
934
988
|
const stackName = automation_1.fullyQualifiedStackName(util_1.getTestOrg(), projectName, `int_test${util_1.getTestSuffix()}`);
|
|
@@ -984,98 +1038,6 @@ describe("LocalWorkspace", () => {
|
|
|
984
1038
|
}
|
|
985
1039
|
}));
|
|
986
1040
|
});
|
|
987
|
-
const MAJOR = /Major version mismatch./;
|
|
988
|
-
const MINIMUM = /Minimum version requirement failed./;
|
|
989
|
-
const PARSE = /Failed to parse/;
|
|
990
|
-
describe(`checkVersionIsValid`, () => {
|
|
991
|
-
const versionTests = [
|
|
992
|
-
{
|
|
993
|
-
name: "higher_major",
|
|
994
|
-
currentVersion: "100.0.0",
|
|
995
|
-
expectError: MAJOR,
|
|
996
|
-
optOut: false,
|
|
997
|
-
},
|
|
998
|
-
{
|
|
999
|
-
name: "lower_major",
|
|
1000
|
-
currentVersion: "1.0.0",
|
|
1001
|
-
expectError: MINIMUM,
|
|
1002
|
-
optOut: false,
|
|
1003
|
-
},
|
|
1004
|
-
{
|
|
1005
|
-
name: "higher_minor",
|
|
1006
|
-
currentVersion: "v2.22.0",
|
|
1007
|
-
expectError: null,
|
|
1008
|
-
optOut: false,
|
|
1009
|
-
},
|
|
1010
|
-
{
|
|
1011
|
-
name: "lower_minor",
|
|
1012
|
-
currentVersion: "v2.1.0",
|
|
1013
|
-
expectError: MINIMUM,
|
|
1014
|
-
optOut: false,
|
|
1015
|
-
},
|
|
1016
|
-
{
|
|
1017
|
-
name: "equal_minor_higher_patch",
|
|
1018
|
-
currentVersion: "v2.21.2",
|
|
1019
|
-
expectError: null,
|
|
1020
|
-
optOut: false,
|
|
1021
|
-
},
|
|
1022
|
-
{
|
|
1023
|
-
name: "equal_minor_equal_patch",
|
|
1024
|
-
currentVersion: "v2.21.1",
|
|
1025
|
-
expectError: null,
|
|
1026
|
-
optOut: false,
|
|
1027
|
-
},
|
|
1028
|
-
{
|
|
1029
|
-
name: "equal_minor_lower_patch",
|
|
1030
|
-
currentVersion: "v2.21.0",
|
|
1031
|
-
expectError: MINIMUM,
|
|
1032
|
-
optOut: false,
|
|
1033
|
-
},
|
|
1034
|
-
{
|
|
1035
|
-
name: "equal_minor_equal_patch_prerelease",
|
|
1036
|
-
// Note that prerelease < release so this case will error
|
|
1037
|
-
currentVersion: "v2.21.1-alpha.1234",
|
|
1038
|
-
expectError: MINIMUM,
|
|
1039
|
-
optOut: false,
|
|
1040
|
-
},
|
|
1041
|
-
{
|
|
1042
|
-
name: "opt_out_of_check_would_fail_otherwise",
|
|
1043
|
-
currentVersion: "v2.20.0",
|
|
1044
|
-
expectError: null,
|
|
1045
|
-
optOut: true,
|
|
1046
|
-
},
|
|
1047
|
-
{
|
|
1048
|
-
name: "opt_out_of_check_would_succeed_otherwise",
|
|
1049
|
-
currentVersion: "v2.22.0",
|
|
1050
|
-
expectError: null,
|
|
1051
|
-
optOut: true,
|
|
1052
|
-
},
|
|
1053
|
-
{
|
|
1054
|
-
name: "invalid_version",
|
|
1055
|
-
currentVersion: "invalid",
|
|
1056
|
-
expectError: PARSE,
|
|
1057
|
-
optOut: false,
|
|
1058
|
-
},
|
|
1059
|
-
{
|
|
1060
|
-
name: "invalid_version_opt_out",
|
|
1061
|
-
currentVersion: "invalid",
|
|
1062
|
-
expectError: null,
|
|
1063
|
-
optOut: true,
|
|
1064
|
-
},
|
|
1065
|
-
];
|
|
1066
|
-
const minVersion = new semver.SemVer("v2.21.1");
|
|
1067
|
-
versionTests.forEach((test) => {
|
|
1068
|
-
it(`validates ${test.name} (${test.currentVersion})`, () => {
|
|
1069
|
-
const validate = () => automation_1.parseAndValidatePulumiVersion(minVersion, test.currentVersion, test.optOut);
|
|
1070
|
-
if (test.expectError) {
|
|
1071
|
-
assert_1.default.throws(validate, test.expectError);
|
|
1072
|
-
}
|
|
1073
|
-
else {
|
|
1074
|
-
assert_1.default.doesNotThrow(validate);
|
|
1075
|
-
}
|
|
1076
|
-
});
|
|
1077
|
-
});
|
|
1078
|
-
});
|
|
1079
1041
|
const normalizeConfigKey = (key, projectName) => {
|
|
1080
1042
|
const parts = key.split(":");
|
|
1081
1043
|
if (parts.length < 2) {
|