Skip to content

Commit 16dc7b0

Browse files
committed
[rush-amazon-s3-build-cache-plugin] Add option to specify s3Endpoint to enable using the S3 plugin with e.g. min.io
1 parent 4acef65 commit 16dc7b0

File tree

28 files changed

+1080
-234
lines changed

28 files changed

+1080
-234
lines changed

apps/rush-lib/assets/rush-init/common/config/rush/build-cache.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,23 @@
6262
*/
6363
"amazonS3Configuration": {
6464
/**
65-
* (Required) The Amazon S3 region of the bucket to use for build cache (e.g. "us-east-1").
65+
* (Required unless s3Endpoint is specified) The name of the bucket to use for build cache (e.g. "my-bucket").
6666
*/
67-
// "s3Region": "us-east-1",
67+
// "s3Bucket": "my-bucket",
6868

6969
/**
70-
* The name of the bucket in Amazon S3 to use for build cache.
70+
* (Required unless s3Bucket is specified) The Amazon S3 endpoint of the bucket to use for build cache (e.g. "my-bucket.s3.us-east-2.amazonaws.com" or "http://localhost:9000").
71+
* This shold not include any path, use the s3Prefix to set the path.
7172
*/
72-
// (Required) "s3Bucket": "my-bucket",
73+
// "s3Endpoint": "https://my-bucket.s3.us-east-2.amazonaws.com",
74+
75+
/**
76+
* (Required) The Amazon S3 region of the bucket to use for build cache (e.g. "us-east-1").
77+
*/
78+
// "s3Region": "us-east-1",
7379

7480
/**
75-
* An optional prefix ("folder") for cache items.
81+
* An optional prefix ("folder") for cache items. Should not start with /
7682
*/
7783
// "s3Prefix": "my-prefix",
7884

apps/rush-lib/src/schemas/build-cache.schema.json

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,92 +2,83 @@
22
"$schema": "http://json-schema.org/draft-04/schema#",
33
"title": "Configuration for Rush's build cache.",
44
"description": "For use with the Rush tool, this file provides configuration options for cached project build output. See http://rushjs.io for details.",
5-
65
"definitions": {
76
"anything": {
87
"type": ["array", "boolean", "integer", "number", "object", "string"],
9-
"items": { "$ref": "#/definitions/anything" }
8+
"items": {
9+
"$ref": "#/definitions/anything"
10+
}
1011
}
1112
},
12-
1313
"type": "object",
14-
1514
"allOf": [
1615
{
1716
"type": "object",
18-
1917
"additionalProperties": false,
2018
"required": ["buildCacheEnabled", "cacheProvider"],
2119
"properties": {
2220
"$schema": {
2321
"description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
2422
"type": "string"
2523
},
26-
2724
"buildCacheEnabled": {
2825
"description": "Set this to true to enable the build cache feature.",
2926
"type": "boolean"
3027
},
31-
3228
"cacheProvider": {
3329
"description": "Specify the cache provider to use",
3430
"type": "string"
3531
},
36-
3732
"cacheEntryNamePattern": {
3833
"type": "string",
3934
"description": "Setting this property overrides the cache entry ID. If this property is set, it must contain a [hash] token. It may also contain a [projectName] or a [projectName:normalize] token."
4035
},
41-
4236
"azureBlobStorageConfiguration": {
4337
"type": "object",
44-
4538
"additionalProperties": false,
4639
"properties": {
4740
"storageAccountName": {
4841
"type": "string",
4942
"description": "(Required) The name of the the Azure storage account to use for build cache."
5043
},
51-
5244
"storageContainerName": {
5345
"type": "string",
5446
"description": "(Required) The name of the container in the Azure storage account to use for build cache."
5547
},
56-
5748
"azureEnvironment": {
5849
"type": "string",
5950
"description": "The Azure environment the storage account exists in. Defaults to AzurePublicCloud.",
6051
"enum": ["AzurePublicCloud", "AzureChina", "AzureGermany", "AzureGovernment"]
6152
},
62-
6353
"blobPrefix": {
6454
"type": "string",
6555
"description": "An optional prefix for cache item blob names."
6656
},
67-
6857
"isCacheWriteAllowed": {
6958
"type": "boolean",
7059
"description": "If set to true, allow writing to the cache. Defaults to false."
7160
}
7261
}
7362
},
74-
7563
"amazonS3Configuration": {
7664
"type": "object",
77-
7865
"additionalProperties": false,
7966
"properties": {
80-
"s3Region": {
67+
"s3Bucket": {
8168
"type": "string",
82-
"description": "(Required) The Amazon S3 region of the bucket to use for build cache (e.g. \"us-east-1\")."
69+
"description": "(Required unless s3Endpoint is specified) The name of the bucket to use for build cache (e.g. \"my-bucket\")."
8370
},
84-
"s3Bucket": {
71+
"s3Endpoint": {
72+
"type": "string",
73+
"description": "(Required unless s3Bucket is specified) The Amazon S3 endpoint of the bucket to use for build cache (e.g. \"my-bucket.s3.us-east-2.amazonaws.com\" or \"http://localhost:9000\").\nThis shold not include any path, use the s3Prefix to set the path."
74+
},
75+
"s3Region": {
8576
"type": "string",
86-
"description": "(Required) The name of the bucket in Amazon S3 to use for build cache."
77+
"description": "(Required) The Amazon S3 region of the bucket to use for build cache (e.g. \"us-east-1\")."
8778
},
8879
"s3Prefix": {
8980
"type": "string",
90-
"description": "An optional prefix (\"folder\") for cache items."
81+
"description": "An optional prefix (\"folder\") for cache items. Should not start with /"
9182
},
9283
"isCacheWriteAllowed": {
9384
"type": "boolean",
@@ -96,11 +87,9 @@
9687
}
9788
}
9889
},
99-
10090
"oneOf": [
10191
{
10292
"type": "object",
103-
10493
"additionalProperties": true,
10594
"properties": {
10695
"cacheProvider": {
@@ -109,49 +98,66 @@
10998
}
11099
}
111100
},
112-
113101
{
114102
"type": "object",
115-
116103
"additionalProperties": true,
117104
"properties": {
118105
"cacheProvider": {
119106
"type": "string",
120107
"enum": ["azure-blob-storage"]
121108
},
122-
123109
"azureBlobStorageConfiguration": {
124110
"type": "object",
125-
126111
"additionalProperties": true,
127112
"required": ["storageAccountName", "storageContainerName"],
128113
"properties": {
129-
"storageAccountName": { "$ref": "#/definitions/anything" },
130-
"storageContainerName": { "$ref": "#/definitions/anything" }
114+
"storageAccountName": {
115+
"$ref": "#/definitions/anything"
116+
},
117+
"storageContainerName": {
118+
"$ref": "#/definitions/anything"
119+
}
131120
}
132121
}
133122
}
134123
},
135-
136124
{
137125
"type": "object",
138-
139126
"additionalProperties": true,
140127
"properties": {
141128
"cacheProvider": {
142129
"type": "string",
143130
"enum": ["amazon-s3"]
144131
},
145-
146132
"amazonS3Configuration": {
147133
"type": "object",
148-
149134
"additionalProperties": true,
150-
"required": ["s3Region", "s3Bucket"],
151-
"properties": {
152-
"s3Region": { "$ref": "#/definitions/anything" },
153-
"s3Bucket": { "$ref": "#/definitions/anything" }
154-
}
135+
"oneOf": [
136+
{
137+
"type": "object",
138+
"required": ["s3Region", "s3Endpoint"],
139+
"properties": {
140+
"s3Endpoint": {
141+
"$ref": "#/definitions/anything"
142+
},
143+
"s3Region": {
144+
"$ref": "#/definitions/anything"
145+
}
146+
}
147+
},
148+
{
149+
"type": "object",
150+
"required": ["s3Region", "s3Bucket"],
151+
"properties": {
152+
"s3Bucket": {
153+
"$ref": "#/definitions/anything"
154+
},
155+
"s3Region": {
156+
"$ref": "#/definitions/anything"
157+
}
158+
}
159+
}
160+
]
155161
}
156162
}
157163
}

build-cache.schema.json

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "Configuration for Rush's build cache.",
4+
"description": "For use with the Rush tool, this file provides configuration options for cached project build output. See http://rushjs.io for details.",
5+
"definitions": {
6+
"anything": {
7+
"type": ["array", "boolean", "integer", "number", "object", "string"],
8+
"items": {
9+
"$ref": "#/definitions/anything"
10+
}
11+
}
12+
},
13+
"type": "object",
14+
"allOf": [
15+
{
16+
"type": "object",
17+
"additionalProperties": false,
18+
"required": ["buildCacheEnabled", "cacheProvider"],
19+
"properties": {
20+
"$schema": {
21+
"description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
22+
"type": "string"
23+
},
24+
"buildCacheEnabled": {
25+
"description": "Set this to true to enable the build cache feature.",
26+
"type": "boolean"
27+
},
28+
"cacheProvider": {
29+
"description": "Specify the cache provider to use",
30+
"type": "string"
31+
},
32+
"cacheEntryNamePattern": {
33+
"type": "string",
34+
"description": "Setting this property overrides the cache entry ID. If this property is set, it must contain a [hash] token. It may also contain a [projectName] or a [projectName:normalize] token."
35+
},
36+
"azureBlobStorageConfiguration": {
37+
"type": "object",
38+
"additionalProperties": false,
39+
"properties": {
40+
"storageAccountName": {
41+
"type": "string",
42+
"description": "(Required) The name of the the Azure storage account to use for build cache."
43+
},
44+
"storageContainerName": {
45+
"type": "string",
46+
"description": "(Required) The name of the container in the Azure storage account to use for build cache."
47+
},
48+
"azureEnvironment": {
49+
"type": "string",
50+
"description": "The Azure environment the storage account exists in. Defaults to AzurePublicCloud.",
51+
"enum": ["AzurePublicCloud", "AzureChina", "AzureGermany", "AzureGovernment"]
52+
},
53+
"blobPrefix": {
54+
"type": "string",
55+
"description": "An optional prefix for cache item blob names."
56+
},
57+
"isCacheWriteAllowed": {
58+
"type": "boolean",
59+
"description": "If set to true, allow writing to the cache. Defaults to false."
60+
}
61+
}
62+
},
63+
"amazonS3Configuration": {
64+
"type": "object",
65+
"additionalProperties": false,
66+
"properties": {
67+
"s3Bucket": {
68+
"type": "string",
69+
"description": "(Required unless s3Endpoint is specified) The name of the bucket to use for build cache (e.g. \"my-bucket\")."
70+
},
71+
"s3Endpoint": {
72+
"type": "string",
73+
"description": "(Required unless s3Bucket is specified) The Amazon S3 endpoint of the bucket to use for build cache (e.g. \"my-bucket.s3.us-east-2.amazonaws.com\" or \"http://localhost:9000\").\nThis shold not include any path, use the s3Prefix to set the path."
74+
},
75+
"s3Region": {
76+
"type": "string",
77+
"description": "(Required) The Amazon S3 region of the bucket to use for build cache (e.g. \"us-east-1\")."
78+
},
79+
"s3Prefix": {
80+
"type": "string",
81+
"description": "An optional prefix (\"folder\") for cache items. Should not start with /"
82+
},
83+
"isCacheWriteAllowed": {
84+
"type": "boolean",
85+
"description": "If set to true, allow writing to the cache. Defaults to false."
86+
}
87+
}
88+
}
89+
},
90+
"oneOf": [
91+
{
92+
"type": "object",
93+
"additionalProperties": true,
94+
"properties": {
95+
"cacheProvider": {
96+
"type": "string",
97+
"pattern": "^(?:(?!azure-blob-storage|amazon-s3).)*$"
98+
}
99+
}
100+
},
101+
{
102+
"type": "object",
103+
"additionalProperties": true,
104+
"properties": {
105+
"cacheProvider": {
106+
"type": "string",
107+
"enum": ["azure-blob-storage"]
108+
},
109+
"azureBlobStorageConfiguration": {
110+
"type": "object",
111+
"additionalProperties": true,
112+
"required": ["storageAccountName", "storageContainerName"],
113+
"properties": {
114+
"storageAccountName": {
115+
"$ref": "#/definitions/anything"
116+
},
117+
"storageContainerName": {
118+
"$ref": "#/definitions/anything"
119+
}
120+
}
121+
}
122+
}
123+
},
124+
{
125+
"type": "object",
126+
"additionalProperties": true,
127+
"properties": {
128+
"cacheProvider": {
129+
"type": "string",
130+
"enum": ["amazon-s3"]
131+
},
132+
"amazonS3Configuration": {
133+
"type": "object",
134+
"additionalProperties": true,
135+
"oneOf": [
136+
{
137+
"type": "object",
138+
"required": ["s3Region", "s3Endpoint"],
139+
"properties": {
140+
"s3Endpoint": {
141+
"$ref": "#/definitions/anything"
142+
},
143+
"s3Region": {
144+
"$ref": "#/definitions/anything"
145+
}
146+
}
147+
},
148+
{
149+
"type": "object",
150+
"required": ["s3Region", "s3Bucket"],
151+
"properties": {
152+
"s3Bucket": {
153+
"$ref": "#/definitions/anything"
154+
},
155+
"s3Region": {
156+
"$ref": "#/definitions/anything"
157+
}
158+
}
159+
}
160+
]
161+
}
162+
}
163+
}
164+
]
165+
}
166+
]
167+
}

0 commit comments

Comments
 (0)