@rushstack/rush-redis-cobuild-plugin 5.97.1-pr3949.0 → 5.97.1-pr3949.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/dist/rush-redis-cobuild-plugin.d.ts +69 -0
- package/lib/RedisCobuildLockProvider.d.ts +44 -0
- package/lib/RedisCobuildLockProvider.d.ts.map +1 -0
- package/lib/RedisCobuildLockProvider.js +154 -0
- package/lib/RedisCobuildLockProvider.js.map +1 -0
- package/lib/RushRedisCobuildPlugin.d.ts +16 -0
- package/lib/RushRedisCobuildPlugin.d.ts.map +1 -0
- package/lib/RushRedisCobuildPlugin.js +27 -0
- package/lib/RushRedisCobuildPlugin.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/lib/schemas/redis-config.schema.json +70 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/package.json +3 -3
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import type { ICobuildCompletedState } from '@rushstack/rush-sdk';
|
|
4
|
+
import type { ICobuildContext } from '@rushstack/rush-sdk';
|
|
5
|
+
import type { ICobuildLockProvider } from '@rushstack/rush-sdk';
|
|
6
|
+
import type { IRushPlugin } from '@rushstack/rush-sdk';
|
|
7
|
+
import type { RedisClientOptions } from '@redis/client';
|
|
8
|
+
import type { RushConfiguration } from '@rushstack/rush-sdk';
|
|
9
|
+
import type { RushSession } from '@rushstack/rush-sdk';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The redis client options
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export declare interface IRedisCobuildLockProviderOptions extends RedisClientOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The environment variable name for the redis password
|
|
18
|
+
*/
|
|
19
|
+
passwordEnvironmentVariable?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
declare type IRushRedisCobuildPluginOptions = IRedisCobuildLockProviderOptions;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @beta
|
|
29
|
+
*/
|
|
30
|
+
export declare class RedisCobuildLockProvider implements ICobuildLockProvider {
|
|
31
|
+
private readonly _options;
|
|
32
|
+
private readonly _terminal;
|
|
33
|
+
private readonly _redisClient;
|
|
34
|
+
private readonly _lockKeyMap;
|
|
35
|
+
private readonly _completedKeyMap;
|
|
36
|
+
constructor(options: IRedisCobuildLockProviderOptions, rushSession: RushSession);
|
|
37
|
+
static expandOptionsWithEnvironmentVariables(options: IRedisCobuildLockProviderOptions, environment?: NodeJS.ProcessEnv): IRedisCobuildLockProviderOptions;
|
|
38
|
+
connectAsync(): Promise<void>;
|
|
39
|
+
disconnectAsync(): Promise<void>;
|
|
40
|
+
acquireLockAsync(context: ICobuildContext): Promise<boolean>;
|
|
41
|
+
renewLockAsync(context: ICobuildContext): Promise<void>;
|
|
42
|
+
setCompletedStateAsync(context: ICobuildContext, state: ICobuildCompletedState): Promise<void>;
|
|
43
|
+
getCompletedStateAsync(context: ICobuildContext): Promise<ICobuildCompletedState | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the lock key for the given context
|
|
46
|
+
* Example: cobuild:v1:<contextId>:<cacheId>:lock
|
|
47
|
+
*/
|
|
48
|
+
getLockKey(context: ICobuildContext): string;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the completed key for the given context
|
|
51
|
+
* Example: cobuild:v1:<contextId>:<cacheId>:completed
|
|
52
|
+
*/
|
|
53
|
+
getCompletedStateKey(context: ICobuildContext): string;
|
|
54
|
+
private _serializeCompletedState;
|
|
55
|
+
private _deserializeCompletedState;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
declare class RushRedisCobuildPlugin implements IRushPlugin {
|
|
62
|
+
pluginName: string;
|
|
63
|
+
private _options;
|
|
64
|
+
constructor(options: IRushRedisCobuildPluginOptions);
|
|
65
|
+
apply(rushSession: RushSession, rushConfiguration: RushConfiguration): void;
|
|
66
|
+
}
|
|
67
|
+
export default RushRedisCobuildPlugin;
|
|
68
|
+
|
|
69
|
+
export { }
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { ICobuildLockProvider, ICobuildContext, ICobuildCompletedState, RushSession } from '@rushstack/rush-sdk';
|
|
3
|
+
import type { RedisClientOptions } from '@redis/client';
|
|
4
|
+
/**
|
|
5
|
+
* The redis client options
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export interface IRedisCobuildLockProviderOptions extends RedisClientOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The environment variable name for the redis password
|
|
11
|
+
*/
|
|
12
|
+
passwordEnvironmentVariable?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
export declare class RedisCobuildLockProvider implements ICobuildLockProvider {
|
|
18
|
+
private readonly _options;
|
|
19
|
+
private readonly _terminal;
|
|
20
|
+
private readonly _redisClient;
|
|
21
|
+
private readonly _lockKeyMap;
|
|
22
|
+
private readonly _completedKeyMap;
|
|
23
|
+
constructor(options: IRedisCobuildLockProviderOptions, rushSession: RushSession);
|
|
24
|
+
static expandOptionsWithEnvironmentVariables(options: IRedisCobuildLockProviderOptions, environment?: NodeJS.ProcessEnv): IRedisCobuildLockProviderOptions;
|
|
25
|
+
connectAsync(): Promise<void>;
|
|
26
|
+
disconnectAsync(): Promise<void>;
|
|
27
|
+
acquireLockAsync(context: ICobuildContext): Promise<boolean>;
|
|
28
|
+
renewLockAsync(context: ICobuildContext): Promise<void>;
|
|
29
|
+
setCompletedStateAsync(context: ICobuildContext, state: ICobuildCompletedState): Promise<void>;
|
|
30
|
+
getCompletedStateAsync(context: ICobuildContext): Promise<ICobuildCompletedState | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the lock key for the given context
|
|
33
|
+
* Example: cobuild:v1:<contextId>:<cacheId>:lock
|
|
34
|
+
*/
|
|
35
|
+
getLockKey(context: ICobuildContext): string;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the completed key for the given context
|
|
38
|
+
* Example: cobuild:v1:<contextId>:<cacheId>:completed
|
|
39
|
+
*/
|
|
40
|
+
getCompletedStateKey(context: ICobuildContext): string;
|
|
41
|
+
private _serializeCompletedState;
|
|
42
|
+
private _deserializeCompletedState;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=RedisCobuildLockProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisCobuildLockProvider.d.ts","sourceRoot":"","sources":["../src/RedisCobuildLockProvider.ts"],"names":[],"mappings":";AAKA,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,kBAAkB,EAKnB,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AACH,MAAM,WAAW,gCAAiC,SAAQ,kBAAkB;IAC1E;;OAEG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC;AAKD;;GAEG;AACH,qBAAa,wBAAyB,YAAW,oBAAoB;IACnE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmC;IAC5D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IAEtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA8D;IAC3F,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4E;IACxG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAG7B;gBAEe,OAAO,EAAE,gCAAgC,EAAE,WAAW,EAAE,WAAW;WAUxE,qCAAqC,CACjD,OAAO,EAAE,gCAAgC,EACzC,WAAW,GAAE,MAAM,CAAC,UAAwB,GAC3C,gCAAgC;IA0BtB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAU7B,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAQhC,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IAiB5D,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAWvD,sBAAsB,CACjC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,IAAI,CAAC;IAYH,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC;IAgB1G;;;OAGG;IACI,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM;IAUnD;;;OAGG;IACI,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM;IAU7D,OAAO,CAAC,wBAAwB;IAMhC,OAAO,CAAC,0BAA0B;CAInC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
3
|
+
// See LICENSE in the project root for license information.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.RedisCobuildLockProvider = void 0;
|
|
6
|
+
const client_1 = require("@redis/client");
|
|
7
|
+
const KEY_SEPARATOR = ':';
|
|
8
|
+
const COMPLETED_STATE_SEPARATOR = ';';
|
|
9
|
+
/**
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
class RedisCobuildLockProvider {
|
|
13
|
+
constructor(options, rushSession) {
|
|
14
|
+
this._lockKeyMap = new WeakMap();
|
|
15
|
+
this._completedKeyMap = new WeakMap();
|
|
16
|
+
this._options = RedisCobuildLockProvider.expandOptionsWithEnvironmentVariables(options);
|
|
17
|
+
this._terminal = rushSession.getLogger('RedisCobuildLockProvider').terminal;
|
|
18
|
+
try {
|
|
19
|
+
this._redisClient = (0, client_1.createClient)(this._options);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
throw new Error(`Failed to create redis client: ${e.message}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
static expandOptionsWithEnvironmentVariables(options, environment = process.env) {
|
|
26
|
+
const finalOptions = Object.assign({}, options);
|
|
27
|
+
const missingEnvironmentVariables = new Set();
|
|
28
|
+
if (finalOptions.passwordEnvironmentVariable) {
|
|
29
|
+
const password = environment[finalOptions.passwordEnvironmentVariable];
|
|
30
|
+
if (password !== undefined) {
|
|
31
|
+
finalOptions.password = password;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
missingEnvironmentVariables.add(finalOptions.passwordEnvironmentVariable);
|
|
35
|
+
}
|
|
36
|
+
finalOptions.passwordEnvironmentVariable = undefined;
|
|
37
|
+
}
|
|
38
|
+
if (missingEnvironmentVariables.size) {
|
|
39
|
+
throw new Error(`The "RedisCobuildLockProvider" tries to access missing environment variable${missingEnvironmentVariables.size > 1 ? 's' : ''}: ${Array.from(missingEnvironmentVariables).join(', ')}\nPlease check the configuration in rush-redis-cobuild-plugin.json file`);
|
|
40
|
+
}
|
|
41
|
+
return finalOptions;
|
|
42
|
+
}
|
|
43
|
+
async connectAsync() {
|
|
44
|
+
try {
|
|
45
|
+
await this._redisClient.connect();
|
|
46
|
+
// Check the connection works at early stage
|
|
47
|
+
await this._redisClient.ping();
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
throw new Error(`Failed to connect to redis server: ${e.message}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async disconnectAsync() {
|
|
54
|
+
try {
|
|
55
|
+
await this._redisClient.disconnect();
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
throw new Error(`Failed to disconnect to redis server: ${e.message}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async acquireLockAsync(context) {
|
|
62
|
+
const { _terminal: terminal } = this;
|
|
63
|
+
const lockKey = this.getLockKey(context);
|
|
64
|
+
let result = false;
|
|
65
|
+
try {
|
|
66
|
+
const incrResult = await this._redisClient.incr(lockKey);
|
|
67
|
+
result = incrResult === 1;
|
|
68
|
+
terminal.writeDebugLine(`Acquired lock for ${lockKey}: ${incrResult}, 1 is success`);
|
|
69
|
+
if (result) {
|
|
70
|
+
await this.renewLockAsync(context);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
throw new Error(`Failed to acquire lock for ${lockKey}: ${e.message}`);
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
async renewLockAsync(context) {
|
|
79
|
+
const { _terminal: terminal } = this;
|
|
80
|
+
const lockKey = this.getLockKey(context);
|
|
81
|
+
try {
|
|
82
|
+
await this._redisClient.expire(lockKey, 30);
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
throw new Error(`Failed to renew lock for ${lockKey}: ${e.message}`);
|
|
86
|
+
}
|
|
87
|
+
terminal.writeDebugLine(`Renewed lock for ${lockKey}`);
|
|
88
|
+
}
|
|
89
|
+
async setCompletedStateAsync(context, state) {
|
|
90
|
+
const { _terminal: terminal } = this;
|
|
91
|
+
const key = this.getCompletedStateKey(context);
|
|
92
|
+
const value = this._serializeCompletedState(state);
|
|
93
|
+
try {
|
|
94
|
+
await this._redisClient.set(key, value);
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
throw new Error(`Failed to set completed state for ${key}: ${e.message}`);
|
|
98
|
+
}
|
|
99
|
+
terminal.writeDebugLine(`Set completed state for ${key}: ${value}`);
|
|
100
|
+
}
|
|
101
|
+
async getCompletedStateAsync(context) {
|
|
102
|
+
const { _terminal: terminal } = this;
|
|
103
|
+
const key = this.getCompletedStateKey(context);
|
|
104
|
+
let state;
|
|
105
|
+
try {
|
|
106
|
+
const value = await this._redisClient.get(key);
|
|
107
|
+
if (value) {
|
|
108
|
+
state = this._deserializeCompletedState(value);
|
|
109
|
+
}
|
|
110
|
+
terminal.writeDebugLine(`Get completed state for ${key}: ${value}`);
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
throw new Error(`Failed to get completed state for ${key}: ${e.message}`);
|
|
114
|
+
}
|
|
115
|
+
return state;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns the lock key for the given context
|
|
119
|
+
* Example: cobuild:v1:<contextId>:<cacheId>:lock
|
|
120
|
+
*/
|
|
121
|
+
getLockKey(context) {
|
|
122
|
+
const { version, contextId, cacheId } = context;
|
|
123
|
+
let lockKey = this._lockKeyMap.get(context);
|
|
124
|
+
if (!lockKey) {
|
|
125
|
+
lockKey = ['cobuild', `v${version}`, contextId, cacheId, 'lock'].join(KEY_SEPARATOR);
|
|
126
|
+
this._lockKeyMap.set(context, lockKey);
|
|
127
|
+
}
|
|
128
|
+
return lockKey;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Returns the completed key for the given context
|
|
132
|
+
* Example: cobuild:v1:<contextId>:<cacheId>:completed
|
|
133
|
+
*/
|
|
134
|
+
getCompletedStateKey(context) {
|
|
135
|
+
const { version, contextId, cacheId } = context;
|
|
136
|
+
let completedKey = this._completedKeyMap.get(context);
|
|
137
|
+
if (!completedKey) {
|
|
138
|
+
completedKey = ['cobuild', `v${version}`, contextId, cacheId, 'completed'].join(KEY_SEPARATOR);
|
|
139
|
+
this._completedKeyMap.set(context, completedKey);
|
|
140
|
+
}
|
|
141
|
+
return completedKey;
|
|
142
|
+
}
|
|
143
|
+
_serializeCompletedState(state) {
|
|
144
|
+
// Example: SUCCESS;1234567890
|
|
145
|
+
// Example: FAILURE;1234567890
|
|
146
|
+
return `${state.status}${COMPLETED_STATE_SEPARATOR}${state.cacheId}`;
|
|
147
|
+
}
|
|
148
|
+
_deserializeCompletedState(state) {
|
|
149
|
+
const [status, cacheId] = state.split(COMPLETED_STATE_SEPARATOR);
|
|
150
|
+
return { status: status, cacheId };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.RedisCobuildLockProvider = RedisCobuildLockProvider;
|
|
154
|
+
//# sourceMappingURL=RedisCobuildLockProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisCobuildLockProvider.js","sourceRoot":"","sources":["../src/RedisCobuildLockProvider.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,0CAA6C;AA4B7C,MAAM,aAAa,GAAQ,GAAG,CAAC;AAC/B,MAAM,yBAAyB,GAAQ,GAAG,CAAC;AAE3C;;GAEG;AACH,MAAa,wBAAwB;IAWnC,YAAmB,OAAyC,EAAE,WAAwB;QANrE,gBAAW,GAAqC,IAAI,OAAO,EAA2B,CAAC;QACvF,qBAAgB,GAAqC,IAAI,OAAO,EAG9E,CAAC;QAGF,IAAI,CAAC,QAAQ,GAAG,wBAAwB,CAAC,qCAAqC,CAAC,OAAO,CAAC,CAAC;QACxF,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC,QAAQ,CAAC;QAC5E,IAAI;YACF,IAAI,CAAC,YAAY,GAAG,IAAA,qBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACjD;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;SAChE;IACH,CAAC;IAEM,MAAM,CAAC,qCAAqC,CACjD,OAAyC,EACzC,cAAiC,OAAO,CAAC,GAAG;QAE5C,MAAM,YAAY,qBAA0C,OAAO,CAAE,CAAC;QACtE,MAAM,2BAA2B,GAAgB,IAAI,GAAG,EAAU,CAAC;QAEnE,IAAI,YAAY,CAAC,2BAA2B,EAAE;YAC5C,MAAM,QAAQ,GAAuB,WAAW,CAAC,YAAY,CAAC,2BAA2B,CAAC,CAAC;YAC3F,IAAI,QAAQ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D,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAAC,OAAwB;QAClD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAChD,IAAI,YAAY,GAAuB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1E,IAAI,CAAC,YAAY,EAAE;YACjB,YAAY,GAAG,CAAC,SAAS,EAAE,IAAI,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC/F,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;SAClD;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAEO,wBAAwB,CAAC,KAA6B;QAC5D,8BAA8B;QAC9B,8BAA8B;QAC9B,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,yBAAyB,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;IACvE,CAAC;IAEO,0BAA0B,CAAC,KAAa;QAC9C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACjE,OAAO,EAAE,MAAM,EAAE,MAA0C,EAAE,OAAO,EAAE,CAAC;IACzE,CAAC;CACF;AArKD,4DAqKC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { createClient } from '@redis/client';\n\nimport type {\n ICobuildLockProvider,\n ICobuildContext,\n ICobuildCompletedState,\n RushSession\n} from '@rushstack/rush-sdk';\nimport type {\n RedisClientOptions,\n RedisClientType,\n RedisFunctions,\n RedisModules,\n RedisScripts\n} from '@redis/client';\nimport type { ITerminal } from '@rushstack/node-core-library';\n\n/**\n * The redis client options\n * @beta\n */\nexport interface IRedisCobuildLockProviderOptions extends RedisClientOptions {\n /**\n * The environment variable name for the redis password\n */\n passwordEnvironmentVariable?: string;\n}\n\nconst KEY_SEPARATOR: ':' = ':';\nconst COMPLETED_STATE_SEPARATOR: ';' = ';';\n\n/**\n * @beta\n */\nexport class RedisCobuildLockProvider implements ICobuildLockProvider {\n private readonly _options: IRedisCobuildLockProviderOptions;\n private readonly _terminal: ITerminal;\n\n private readonly _redisClient: RedisClientType<RedisModules, RedisFunctions, RedisScripts>;\n private readonly _lockKeyMap: WeakMap<ICobuildContext, string> = new WeakMap<ICobuildContext, string>();\n private readonly _completedKeyMap: WeakMap<ICobuildContext, string> = new WeakMap<\n ICobuildContext,\n string\n >();\n\n public constructor(options: IRedisCobuildLockProviderOptions, rushSession: RushSession) {\n this._options = RedisCobuildLockProvider.expandOptionsWithEnvironmentVariables(options);\n this._terminal = rushSession.getLogger('RedisCobuildLockProvider').terminal;\n try {\n this._redisClient = createClient(this._options);\n } catch (e) {\n throw new Error(`Failed to create redis client: ${e.message}`);\n }\n }\n\n public static expandOptionsWithEnvironmentVariables(\n options: IRedisCobuildLockProviderOptions,\n environment: NodeJS.ProcessEnv = process.env\n ): IRedisCobuildLockProviderOptions {\n const finalOptions: IRedisCobuildLockProviderOptions = { ...options };\n const missingEnvironmentVariables: Set<string> = new Set<string>();\n\n if (finalOptions.passwordEnvironmentVariable) {\n const password: string | undefined = environment[finalOptions.passwordEnvironmentVariable];\n if (password !== undefined) {\n finalOptions.password = password;\n } else {\n missingEnvironmentVariables.add(finalOptions.passwordEnvironmentVariable);\n }\n finalOptions.passwordEnvironmentVariable = undefined;\n }\n\n if (missingEnvironmentVariables.size) {\n throw new Error(\n `The \"RedisCobuildLockProvider\" tries to access missing environment variable${\n missingEnvironmentVariables.size > 1 ? 's' : ''\n }: ${Array.from(missingEnvironmentVariables).join(\n ', '\n )}\\nPlease check the configuration in rush-redis-cobuild-plugin.json file`\n );\n }\n return finalOptions;\n }\n\n public async connectAsync(): Promise<void> {\n try {\n await this._redisClient.connect();\n // Check the connection works at early stage\n await this._redisClient.ping();\n } catch (e) {\n throw new Error(`Failed to connect to redis server: ${e.message}`);\n }\n }\n\n public async disconnectAsync(): Promise<void> {\n try {\n await this._redisClient.disconnect();\n } catch (e) {\n throw new Error(`Failed to disconnect to redis server: ${e.message}`);\n }\n }\n\n public async acquireLockAsync(context: ICobuildContext): Promise<boolean> {\n const { _terminal: terminal } = this;\n const lockKey: string = this.getLockKey(context);\n let result: boolean = false;\n try {\n const incrResult: number = await this._redisClient.incr(lockKey);\n result = incrResult === 1;\n terminal.writeDebugLine(`Acquired lock for ${lockKey}: ${incrResult}, 1 is success`);\n if (result) {\n await this.renewLockAsync(context);\n }\n } catch (e) {\n throw new Error(`Failed to acquire lock for ${lockKey}: ${e.message}`);\n }\n return result;\n }\n\n public async renewLockAsync(context: ICobuildContext): Promise<void> {\n const { _terminal: terminal } = this;\n const lockKey: string = this.getLockKey(context);\n try {\n await this._redisClient.expire(lockKey, 30);\n } catch (e) {\n throw new Error(`Failed to renew lock for ${lockKey}: ${e.message}`);\n }\n terminal.writeDebugLine(`Renewed lock for ${lockKey}`);\n }\n\n public async setCompletedStateAsync(\n context: ICobuildContext,\n state: ICobuildCompletedState\n ): Promise<void> {\n const { _terminal: terminal } = this;\n const key: string = this.getCompletedStateKey(context);\n const value: string = this._serializeCompletedState(state);\n try {\n await this._redisClient.set(key, value);\n } catch (e) {\n throw new Error(`Failed to set completed state for ${key}: ${e.message}`);\n }\n terminal.writeDebugLine(`Set completed state for ${key}: ${value}`);\n }\n\n public async getCompletedStateAsync(context: ICobuildContext): Promise<ICobuildCompletedState | undefined> {\n const { _terminal: terminal } = this;\n const key: string = this.getCompletedStateKey(context);\n let state: ICobuildCompletedState | undefined;\n try {\n const value: string | null = await this._redisClient.get(key);\n if (value) {\n state = this._deserializeCompletedState(value);\n }\n terminal.writeDebugLine(`Get completed state for ${key}: ${value}`);\n } catch (e) {\n throw new Error(`Failed to get completed state for ${key}: ${e.message}`);\n }\n return state;\n }\n\n /**\n * Returns the lock key for the given context\n * Example: cobuild:v1:<contextId>:<cacheId>:lock\n */\n public getLockKey(context: ICobuildContext): string {\n const { version, contextId, cacheId } = context;\n let lockKey: string | undefined = this._lockKeyMap.get(context);\n if (!lockKey) {\n lockKey = ['cobuild', `v${version}`, contextId, cacheId, 'lock'].join(KEY_SEPARATOR);\n this._lockKeyMap.set(context, lockKey);\n }\n return lockKey;\n }\n\n /**\n * Returns the completed key for the given context\n * Example: cobuild:v1:<contextId>:<cacheId>:completed\n */\n public getCompletedStateKey(context: ICobuildContext): string {\n const { version, contextId, cacheId } = context;\n let completedKey: string | undefined = this._completedKeyMap.get(context);\n if (!completedKey) {\n completedKey = ['cobuild', `v${version}`, contextId, cacheId, 'completed'].join(KEY_SEPARATOR);\n this._completedKeyMap.set(context, completedKey);\n }\n return completedKey;\n }\n\n private _serializeCompletedState(state: ICobuildCompletedState): string {\n // Example: SUCCESS;1234567890\n // Example: FAILURE;1234567890\n return `${state.status}${COMPLETED_STATE_SEPARATOR}${state.cacheId}`;\n }\n\n private _deserializeCompletedState(state: string): ICobuildCompletedState | undefined {\n const [status, cacheId] = state.split(COMPLETED_STATE_SEPARATOR);\n return { status: status as ICobuildCompletedState['status'], cacheId };\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IRushPlugin, RushSession, RushConfiguration } from '@rushstack/rush-sdk';
|
|
2
|
+
import type { IRedisCobuildLockProviderOptions } from './RedisCobuildLockProvider';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare type IRushRedisCobuildPluginOptions = IRedisCobuildLockProviderOptions;
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class RushRedisCobuildPlugin implements IRushPlugin {
|
|
11
|
+
pluginName: string;
|
|
12
|
+
private _options;
|
|
13
|
+
constructor(options: IRushRedisCobuildPluginOptions);
|
|
14
|
+
apply(rushSession: RushSession, rushConfiguration: RushConfiguration): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=RushRedisCobuildPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RushRedisCobuildPlugin.d.ts","sourceRoot":"","sources":["../src/RushRedisCobuildPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,KAAK,EAAE,gCAAgC,EAA4B,MAAM,4BAA4B,CAAC;AAS7G;;GAEG;AACH,oBAAY,8BAA8B,GAAG,gCAAgC,CAAC;AAE9E;;GAEG;AACH,qBAAa,sBAAuB,YAAW,WAAW;IACjD,UAAU,EAAE,MAAM,CAAe;IAExC,OAAO,CAAC,QAAQ,CAAiC;gBAE9B,OAAO,EAAE,8BAA8B;IAInD,KAAK,CAAC,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,IAAI;CAQnF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
3
|
+
// See LICENSE in the project root for license information.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.RushRedisCobuildPlugin = void 0;
|
|
6
|
+
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
7
|
+
const RedisCobuildLockProviderModule = node_core_library_1.Import.lazy('./RedisCobuildLockProvider', require);
|
|
8
|
+
const PLUGIN_NAME = 'RedisCobuildPlugin';
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
class RushRedisCobuildPlugin {
|
|
13
|
+
constructor(options) {
|
|
14
|
+
this.pluginName = PLUGIN_NAME;
|
|
15
|
+
this._options = options;
|
|
16
|
+
}
|
|
17
|
+
apply(rushSession, rushConfiguration) {
|
|
18
|
+
rushSession.hooks.initialize.tap(PLUGIN_NAME, () => {
|
|
19
|
+
rushSession.registerCobuildLockProviderFactory('redis', () => {
|
|
20
|
+
const options = this._options;
|
|
21
|
+
return new RedisCobuildLockProviderModule.RedisCobuildLockProvider(options, rushSession);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.RushRedisCobuildPlugin = RushRedisCobuildPlugin;
|
|
27
|
+
//# sourceMappingURL=RushRedisCobuildPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RushRedisCobuildPlugin.js","sourceRoot":"","sources":["../src/RushRedisCobuildPlugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAsD;AAItD,MAAM,8BAA8B,GAAgD,0BAAM,CAAC,IAAI,CAC7F,4BAA4B,EAC5B,OAAO,CACR,CAAC;AAEF,MAAM,WAAW,GAAW,oBAAoB,CAAC;AAOjD;;GAEG;AACH,MAAa,sBAAsB;IAKjC,YAAmB,OAAuC;QAJnD,eAAU,GAAW,WAAW,CAAC;QAKtC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,WAAwB,EAAE,iBAAoC;QACzE,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,EAAE;YACjD,WAAW,CAAC,kCAAkC,CAAC,OAAO,EAAE,GAA6B,EAAE;gBACrF,MAAM,OAAO,GAAmC,IAAI,CAAC,QAAQ,CAAC;gBAC9D,OAAO,IAAI,8BAA8B,CAAC,wBAAwB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC3F,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAjBD,wDAiBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { Import } from '@rushstack/node-core-library';\nimport type { IRushPlugin, RushSession, RushConfiguration } from '@rushstack/rush-sdk';\nimport type { IRedisCobuildLockProviderOptions, RedisCobuildLockProvider } from './RedisCobuildLockProvider';\n\nconst RedisCobuildLockProviderModule: typeof import('./RedisCobuildLockProvider') = Import.lazy(\n './RedisCobuildLockProvider',\n require\n);\n\nconst PLUGIN_NAME: string = 'RedisCobuildPlugin';\n\n/**\n * @public\n */\nexport type IRushRedisCobuildPluginOptions = IRedisCobuildLockProviderOptions;\n\n/**\n * @public\n */\nexport class RushRedisCobuildPlugin implements IRushPlugin {\n public pluginName: string = PLUGIN_NAME;\n\n private _options: IRushRedisCobuildPluginOptions;\n\n public constructor(options: IRushRedisCobuildPluginOptions) {\n this._options = options;\n }\n\n public apply(rushSession: RushSession, rushConfiguration: RushConfiguration): void {\n rushSession.hooks.initialize.tap(PLUGIN_NAME, () => {\n rushSession.registerCobuildLockProviderFactory('redis', (): RedisCobuildLockProvider => {\n const options: IRushRedisCobuildPluginOptions = this._options;\n return new RedisCobuildLockProviderModule.RedisCobuildLockProvider(options, rushSession);\n });\n });\n }\n}\n"]}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RushRedisCobuildPlugin } from './RushRedisCobuildPlugin';
|
|
2
|
+
export default RushRedisCobuildPlugin;
|
|
3
|
+
export { RedisCobuildLockProvider } from './RedisCobuildLockProvider';
|
|
4
|
+
export { IRedisCobuildLockProviderOptions } from './RedisCobuildLockProvider';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,eAAe,sBAAsB,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
3
|
+
// See LICENSE in the project root for license information.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.RedisCobuildLockProvider = void 0;
|
|
6
|
+
const RushRedisCobuildPlugin_1 = require("./RushRedisCobuildPlugin");
|
|
7
|
+
exports.default = RushRedisCobuildPlugin_1.RushRedisCobuildPlugin;
|
|
8
|
+
var RedisCobuildLockProvider_1 = require("./RedisCobuildLockProvider");
|
|
9
|
+
Object.defineProperty(exports, "RedisCobuildLockProvider", { enumerable: true, get: function () { return RedisCobuildLockProvider_1.RedisCobuildLockProvider; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,qEAAkE;AAElE,kBAAe,+CAAsB,CAAC;AACtC,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { RushRedisCobuildPlugin } from './RushRedisCobuildPlugin';\n\nexport default RushRedisCobuildPlugin;\nexport { RedisCobuildLockProvider } from './RedisCobuildLockProvider';\nexport { IRedisCobuildLockProviderOptions } from './RedisCobuildLockProvider';\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
3
|
+
"title": "Configuration for cobuild lock with Redis configuration\n\nhttps://github.com/redis/node-redis/blob/master/docs/client-configuration.md",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"url": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "redis[s]://[[username][:password]@][host][:port][/db-number]\n\n See the following links for more information:\n\nredis: https://www.iana.org/assignments/uri-schemes/prov/redis\n\nrediss: https://www.iana.org/assignments/uri-schemes/prov/rediss"
|
|
10
|
+
},
|
|
11
|
+
"socket": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"description": "Socket connection properties. Unlisted net.connect properties (and tls.connect) are also supported",
|
|
14
|
+
"properties": {
|
|
15
|
+
"port": {
|
|
16
|
+
"description": "Redis server port. Default value is 6379",
|
|
17
|
+
"type": "number"
|
|
18
|
+
},
|
|
19
|
+
"host": {
|
|
20
|
+
"description": "Redis server host. Default value is localhost",
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"family": {
|
|
24
|
+
"description": "IP Stack version (one of 4 | 6 | 0). Default value is 0",
|
|
25
|
+
"type": "number"
|
|
26
|
+
},
|
|
27
|
+
"path": {
|
|
28
|
+
"description": "path to the UNIX Socket",
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"connectTimeout": {
|
|
32
|
+
"description": "Connection timeout in milliseconds. Default value is 5000",
|
|
33
|
+
"type": "number"
|
|
34
|
+
},
|
|
35
|
+
"noDelay": {
|
|
36
|
+
"description": "Toggle Nagle's algorithm. Default value is true",
|
|
37
|
+
"type": "boolean"
|
|
38
|
+
},
|
|
39
|
+
"keepAlive": {
|
|
40
|
+
"description": "Toggle keep alive on the socket",
|
|
41
|
+
"type": "boolean"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"username": {
|
|
46
|
+
"description": "ACL username",
|
|
47
|
+
"type": "string"
|
|
48
|
+
},
|
|
49
|
+
"passwordEnvironmentVariable": {
|
|
50
|
+
"description": "The environment variable used to get the ACL password",
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"name": {
|
|
54
|
+
"description": "Redis client name",
|
|
55
|
+
"type": "string"
|
|
56
|
+
},
|
|
57
|
+
"database": {
|
|
58
|
+
"description": "Redis database number",
|
|
59
|
+
"type": "number"
|
|
60
|
+
},
|
|
61
|
+
"legacyMode": {
|
|
62
|
+
"description": "Maintain some backwards compatibility",
|
|
63
|
+
"type": "boolean"
|
|
64
|
+
},
|
|
65
|
+
"pingInterval": {
|
|
66
|
+
"description": "Send PING command at interval (in ms). Useful with \"Azure Cache for Redis\".",
|
|
67
|
+
"type": "number"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.34.4"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/rush-redis-cobuild-plugin",
|
|
3
|
-
"version": "5.97.1-pr3949.
|
|
3
|
+
"version": "5.97.1-pr3949.2",
|
|
4
4
|
"description": "Rush plugin for Redis cobuild lock",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@redis/client": "~1.5.5",
|
|
16
16
|
"@rushstack/node-core-library": "3.55.2",
|
|
17
|
-
"@rushstack/rush-sdk": "5.97.1-pr3949.
|
|
17
|
+
"@rushstack/rush-sdk": "5.97.1-pr3949.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/heft-jest": "1.0.1",
|
|
21
21
|
"@types/node": "14.18.36",
|
|
22
|
-
"@microsoft/rush-lib": "5.97.1-pr3949.
|
|
22
|
+
"@microsoft/rush-lib": "5.97.1-pr3949.2",
|
|
23
23
|
"@rushstack/eslint-config": "3.2.0",
|
|
24
24
|
"@rushstack/heft": "0.50.0",
|
|
25
25
|
"@rushstack/heft-node-rig": "1.12.6"
|