@backstage/integration 0.6.10 → 0.7.0
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 +18 -0
- package/config.d.ts +15 -2
- package/dist/index.cjs.js +82 -55
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +70 -46
- package/dist/index.esm.js +76 -49
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @backstage/integration
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7d4b4e937c: Create an interface for the GitHub credentials provider in order to support providing implementations.
|
|
8
|
+
|
|
9
|
+
We have changed the name of the `GithubCredentialsProvider` to `SingleInstanceGithubCredentialsProvider`.
|
|
10
|
+
|
|
11
|
+
`GithubCredentialsProvider` is now an interface that maybe implemented to provide a custom mechanism to retrieve GitHub credentials.
|
|
12
|
+
|
|
13
|
+
In a later release we will support configuring URL readers, scaffolder tasks, and processors with customer GitHub credentials providers.
|
|
14
|
+
|
|
15
|
+
If you want to uptake this release, you will need to replace all references to `GithubCredentialsProvider.create` with `SingleInstanceGithubCredentialsProvider.create`.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- cf2e20a792: Added `endpoint` and `s3ForcePathStyle` as optional configuration for AWS S3 integrations.
|
|
20
|
+
|
|
3
21
|
## 0.6.10
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -167,10 +167,23 @@ export interface Config {
|
|
|
167
167
|
/** Integration configuration for AWS S3 Service */
|
|
168
168
|
awsS3?: Array<{
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
170
|
+
* AWS Endpoint.
|
|
171
|
+
* The endpoint URI to send requests to. The default endpoint is built from the configured region.
|
|
172
|
+
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property
|
|
173
|
+
*
|
|
174
|
+
* Supports non-AWS providers, e.g. for LocalStack, endpoint may look like http://localhost:4566
|
|
171
175
|
* @visibility frontend
|
|
172
176
|
*/
|
|
173
|
-
|
|
177
|
+
endpoint?: string;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Whether to use path style URLs when communicating with S3.
|
|
181
|
+
* Defaults to false.
|
|
182
|
+
* This allows providers like LocalStack, Minio and Wasabi (and possibly others) to be used.
|
|
183
|
+
* @visibility frontend
|
|
184
|
+
*/
|
|
185
|
+
s3ForcePathStyle?: boolean;
|
|
186
|
+
|
|
174
187
|
/**
|
|
175
188
|
* Account access key used to authenticate requests.
|
|
176
189
|
* @visibility backend
|
package/dist/index.cjs.js
CHANGED
|
@@ -46,7 +46,7 @@ function basicIntegrations(integrations, getHost) {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
function defaultScmResolveUrl(options) {
|
|
49
|
-
const {url, base, lineNumber} = options;
|
|
49
|
+
const { url, base, lineNumber } = options;
|
|
50
50
|
try {
|
|
51
51
|
new URL(url);
|
|
52
52
|
return url;
|
|
@@ -54,7 +54,7 @@ function defaultScmResolveUrl(options) {
|
|
|
54
54
|
}
|
|
55
55
|
let updated;
|
|
56
56
|
if (url.startsWith("/")) {
|
|
57
|
-
const {filepath} = parseGitUrl__default[
|
|
57
|
+
const { filepath } = parseGitUrl__default["default"](base);
|
|
58
58
|
updated = new URL(base);
|
|
59
59
|
const repoRootPath = lodash.trimEnd(updated.pathname.substring(0, updated.pathname.length - filepath.length), "/");
|
|
60
60
|
updated.pathname = `${repoRootPath}${url}`;
|
|
@@ -76,6 +76,11 @@ var __privateGet = (obj, member, getter) => {
|
|
|
76
76
|
__accessCheck(obj, member, "read from private field");
|
|
77
77
|
return getter ? getter.call(obj) : member.get(obj);
|
|
78
78
|
};
|
|
79
|
+
var __privateAdd = (obj, member, value) => {
|
|
80
|
+
if (member.has(obj))
|
|
81
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
82
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
83
|
+
};
|
|
79
84
|
var __privateSet = (obj, member, value, setter) => {
|
|
80
85
|
__accessCheck(obj, member, "write to private field");
|
|
81
86
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
@@ -85,13 +90,13 @@ var _origin, _owner, _project, _repo, _path, _ref, _baseUrl;
|
|
|
85
90
|
const VERSION_PREFIX_GIT_BRANCH = "GB";
|
|
86
91
|
const _AzureUrl = class {
|
|
87
92
|
constructor(origin, owner, project, repo, path, ref) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
__privateAdd(this, _origin, void 0);
|
|
94
|
+
__privateAdd(this, _owner, void 0);
|
|
95
|
+
__privateAdd(this, _project, void 0);
|
|
96
|
+
__privateAdd(this, _repo, void 0);
|
|
97
|
+
__privateAdd(this, _path, void 0);
|
|
98
|
+
__privateAdd(this, _ref, void 0);
|
|
99
|
+
__privateAdd(this, _baseUrl, (...parts) => {
|
|
95
100
|
const url = new URL(__privateGet(this, _origin));
|
|
96
101
|
url.pathname = parts.map((part) => encodeURIComponent(part)).join("/");
|
|
97
102
|
return url;
|
|
@@ -214,12 +219,12 @@ function readAzureIntegrationConfig(config) {
|
|
|
214
219
|
if (!isValidHost(host)) {
|
|
215
220
|
throw new Error(`Invalid Azure integration config, '${host}' is not a valid host`);
|
|
216
221
|
}
|
|
217
|
-
return {host, token};
|
|
222
|
+
return { host, token };
|
|
218
223
|
}
|
|
219
224
|
function readAzureIntegrationConfigs(configs) {
|
|
220
225
|
const result = configs.map(readAzureIntegrationConfig);
|
|
221
226
|
if (!result.some((c) => c.host === AZURE_HOST)) {
|
|
222
|
-
result.push({host: AZURE_HOST});
|
|
227
|
+
result.push({ host: AZURE_HOST });
|
|
223
228
|
}
|
|
224
229
|
return result;
|
|
225
230
|
}
|
|
@@ -239,7 +244,7 @@ const _AzureIntegration = class {
|
|
|
239
244
|
}
|
|
240
245
|
resolveUrl(options) {
|
|
241
246
|
var _a;
|
|
242
|
-
const {url, base} = options;
|
|
247
|
+
const { url, base } = options;
|
|
243
248
|
if (isValidUrl(url)) {
|
|
244
249
|
return url;
|
|
245
250
|
}
|
|
@@ -265,7 +270,7 @@ const _AzureIntegration = class {
|
|
|
265
270
|
}
|
|
266
271
|
};
|
|
267
272
|
let AzureIntegration = _AzureIntegration;
|
|
268
|
-
AzureIntegration.factory = ({config}) => {
|
|
273
|
+
AzureIntegration.factory = ({ config }) => {
|
|
269
274
|
var _a;
|
|
270
275
|
const configs = readAzureIntegrationConfigs((_a = config.getOptionalConfigArray("integrations.azure")) != null ? _a : []);
|
|
271
276
|
return basicIntegrations(configs.map((c) => new _AzureIntegration(c)), (i) => i.config.host);
|
|
@@ -281,12 +286,12 @@ function getAzureCommitsUrl(url) {
|
|
|
281
286
|
return AzureUrl.fromRepoUrl(url).toCommitsUrl();
|
|
282
287
|
}
|
|
283
288
|
function getAzureRequestOptions(config, additionalHeaders) {
|
|
284
|
-
const headers = additionalHeaders ? {...additionalHeaders} : {};
|
|
289
|
+
const headers = additionalHeaders ? { ...additionalHeaders } : {};
|
|
285
290
|
if (config.token) {
|
|
286
291
|
const buffer = Buffer.from(`:${config.token}`, "utf8");
|
|
287
292
|
headers.Authorization = `Basic ${buffer.toString("base64")}`;
|
|
288
293
|
}
|
|
289
|
-
return {headers};
|
|
294
|
+
return { headers };
|
|
290
295
|
}
|
|
291
296
|
|
|
292
297
|
const BITBUCKET_HOST = "bitbucket.org";
|
|
@@ -349,7 +354,7 @@ const _BitbucketIntegration = class {
|
|
|
349
354
|
return resolved;
|
|
350
355
|
}
|
|
351
356
|
resolveEditUrl(url) {
|
|
352
|
-
const urlData = parseGitUrl__default[
|
|
357
|
+
const urlData = parseGitUrl__default["default"](url);
|
|
353
358
|
const editUrl = new URL(url);
|
|
354
359
|
editUrl.searchParams.set("mode", "edit");
|
|
355
360
|
editUrl.searchParams.set("spa", "0");
|
|
@@ -367,13 +372,13 @@ BitbucketIntegration.factory = ({
|
|
|
367
372
|
};
|
|
368
373
|
|
|
369
374
|
async function getBitbucketDefaultBranch(url, config) {
|
|
370
|
-
const {name: repoName, owner: project, resource} = parseGitUrl__default[
|
|
375
|
+
const { name: repoName, owner: project, resource } = parseGitUrl__default["default"](url);
|
|
371
376
|
const isHosted = resource === "bitbucket.org";
|
|
372
377
|
let branchUrl = isHosted ? `${config.apiBaseUrl}/repositories/${project}/${repoName}` : `${config.apiBaseUrl}/projects/${project}/repos/${repoName}/default-branch`;
|
|
373
|
-
let response = await fetch__default[
|
|
378
|
+
let response = await fetch__default["default"](branchUrl, getBitbucketRequestOptions(config));
|
|
374
379
|
if (response.status === 404 && !isHosted) {
|
|
375
380
|
branchUrl = `${config.apiBaseUrl}/projects/${project}/repos/${repoName}/branches/default`;
|
|
376
|
-
response = await fetch__default[
|
|
381
|
+
response = await fetch__default["default"](branchUrl, getBitbucketRequestOptions(config));
|
|
377
382
|
}
|
|
378
383
|
if (!response.ok) {
|
|
379
384
|
const message = `Failed to retrieve default branch from ${branchUrl}, ${response.status} ${response.statusText}`;
|
|
@@ -384,7 +389,7 @@ async function getBitbucketDefaultBranch(url, config) {
|
|
|
384
389
|
const repoInfo = await response.json();
|
|
385
390
|
defaultBranch = repoInfo.mainbranch.name;
|
|
386
391
|
} else {
|
|
387
|
-
const {displayId} = await response.json();
|
|
392
|
+
const { displayId } = await response.json();
|
|
388
393
|
defaultBranch = displayId;
|
|
389
394
|
}
|
|
390
395
|
if (!defaultBranch) {
|
|
@@ -400,7 +405,7 @@ async function getBitbucketDownloadUrl(url, config) {
|
|
|
400
405
|
protocol,
|
|
401
406
|
resource,
|
|
402
407
|
filepath
|
|
403
|
-
} = parseGitUrl__default[
|
|
408
|
+
} = parseGitUrl__default["default"](url);
|
|
404
409
|
const isHosted = resource === "bitbucket.org";
|
|
405
410
|
let branch = ref;
|
|
406
411
|
if (!branch) {
|
|
@@ -412,7 +417,7 @@ async function getBitbucketDownloadUrl(url, config) {
|
|
|
412
417
|
}
|
|
413
418
|
function getBitbucketFileFetchUrl(url, config) {
|
|
414
419
|
try {
|
|
415
|
-
const {owner, name, ref, filepathtype, filepath} = parseGitUrl__default[
|
|
420
|
+
const { owner, name, ref, filepathtype, filepath } = parseGitUrl__default["default"](url);
|
|
416
421
|
if (!owner || !name || filepathtype !== "browse" && filepathtype !== "raw" && filepathtype !== "src") {
|
|
417
422
|
throw new Error("Invalid Bitbucket URL or file path");
|
|
418
423
|
}
|
|
@@ -471,7 +476,7 @@ function readGitHubIntegrationConfig(config) {
|
|
|
471
476
|
} else if (host === GITHUB_HOST) {
|
|
472
477
|
rawBaseUrl = GITHUB_RAW_BASE_URL;
|
|
473
478
|
}
|
|
474
|
-
return {host, apiBaseUrl, rawBaseUrl, token, apps};
|
|
479
|
+
return { host, apiBaseUrl, rawBaseUrl, token, apps };
|
|
475
480
|
}
|
|
476
481
|
function readGitHubIntegrationConfigs(configs) {
|
|
477
482
|
const result = configs.map(readGitHubIntegrationConfig);
|
|
@@ -487,7 +492,7 @@ function readGitHubIntegrationConfigs(configs) {
|
|
|
487
492
|
|
|
488
493
|
function getGitHubFileFetchUrl(url, config, credentials) {
|
|
489
494
|
try {
|
|
490
|
-
const {owner, name, ref, filepathtype, filepath} = parseGitUrl__default[
|
|
495
|
+
const { owner, name, ref, filepathtype, filepath } = parseGitUrl__default["default"](url);
|
|
491
496
|
if (!owner || !name || !ref || filepathtype !== "blob" && filepathtype !== "raw" && filepathtype !== "tree") {
|
|
492
497
|
throw new Error("Invalid GitHub URL or file path");
|
|
493
498
|
}
|
|
@@ -508,7 +513,7 @@ function getGitHubRequestOptions(config, credentials) {
|
|
|
508
513
|
if (credentials.token) {
|
|
509
514
|
headers.Authorization = `token ${credentials.token}`;
|
|
510
515
|
}
|
|
511
|
-
return {headers};
|
|
516
|
+
return { headers };
|
|
512
517
|
}
|
|
513
518
|
function chooseEndpoint(config, credentials) {
|
|
514
519
|
if (config.apiBaseUrl && (credentials.token || !config.rawBaseUrl)) {
|
|
@@ -519,17 +524,17 @@ function chooseEndpoint(config, credentials) {
|
|
|
519
524
|
|
|
520
525
|
class Cache {
|
|
521
526
|
constructor() {
|
|
522
|
-
this.tokenCache = new Map();
|
|
527
|
+
this.tokenCache = /* @__PURE__ */ new Map();
|
|
523
528
|
this.isNotExpired = (date) => date.diff(luxon.DateTime.local(), "minutes").minutes > 50;
|
|
524
529
|
}
|
|
525
530
|
async getOrCreateToken(key, supplier) {
|
|
526
531
|
const item = this.tokenCache.get(key);
|
|
527
532
|
if (item && this.isNotExpired(item.expiresAt)) {
|
|
528
|
-
return {accessToken: item.token};
|
|
533
|
+
return { accessToken: item.token };
|
|
529
534
|
}
|
|
530
535
|
const result = await supplier();
|
|
531
536
|
this.tokenCache.set(key, result);
|
|
532
|
-
return {accessToken: result.token};
|
|
537
|
+
return { accessToken: result.token };
|
|
533
538
|
}
|
|
534
539
|
}
|
|
535
540
|
const HEADERS = {
|
|
@@ -553,7 +558,7 @@ class GithubAppManager {
|
|
|
553
558
|
}
|
|
554
559
|
async getInstallationCredentials(owner, repo) {
|
|
555
560
|
var _a;
|
|
556
|
-
const {installationId, suspended} = await this.getInstallationData(owner);
|
|
561
|
+
const { installationId, suspended } = await this.getInstallationData(owner);
|
|
557
562
|
if (this.allowedInstallationOwners) {
|
|
558
563
|
if (!((_a = this.allowedInstallationOwners) == null ? void 0 : _a.includes(owner))) {
|
|
559
564
|
throw new Error(`The GitHub application for ${owner} is not included in the allowed installation list (${installationId}).`);
|
|
@@ -623,7 +628,7 @@ class GithubAppCredentialsMux {
|
|
|
623
628
|
if (this.apps.length === 0) {
|
|
624
629
|
return void 0;
|
|
625
630
|
}
|
|
626
|
-
const results = await Promise.all(this.apps.map((app) => app.getInstallationCredentials(owner, repo).then((credentials) => ({credentials, error: void 0}), (error) => ({credentials: void 0, error}))));
|
|
631
|
+
const results = await Promise.all(this.apps.map((app) => app.getInstallationCredentials(owner, repo).then((credentials) => ({ credentials, error: void 0 }), (error) => ({ credentials: void 0, error }))));
|
|
627
632
|
const result = results.find((resultItem) => resultItem.credentials);
|
|
628
633
|
if (result) {
|
|
629
634
|
return result.credentials.accessToken;
|
|
@@ -636,16 +641,13 @@ class GithubAppCredentialsMux {
|
|
|
636
641
|
return void 0;
|
|
637
642
|
}
|
|
638
643
|
}
|
|
639
|
-
class
|
|
644
|
+
const _SingleInstanceGithubCredentialsProvider = class {
|
|
640
645
|
constructor(githubAppCredentialsMux, token) {
|
|
641
646
|
this.githubAppCredentialsMux = githubAppCredentialsMux;
|
|
642
647
|
this.token = token;
|
|
643
648
|
}
|
|
644
|
-
static create(config) {
|
|
645
|
-
return new GithubCredentialsProvider(new GithubAppCredentialsMux(config), config.token);
|
|
646
|
-
}
|
|
647
649
|
async getCredentials(opts) {
|
|
648
|
-
const parsed = parseGitUrl__default[
|
|
650
|
+
const parsed = parseGitUrl__default["default"](opts.url);
|
|
649
651
|
const owner = parsed.owner || parsed.name;
|
|
650
652
|
const repo = parsed.owner ? parsed.name : void 0;
|
|
651
653
|
let type = "app";
|
|
@@ -655,12 +657,16 @@ class GithubCredentialsProvider {
|
|
|
655
657
|
token = this.token;
|
|
656
658
|
}
|
|
657
659
|
return {
|
|
658
|
-
headers: token ? {Authorization: `Bearer ${token}`} : void 0,
|
|
660
|
+
headers: token ? { Authorization: `Bearer ${token}` } : void 0,
|
|
659
661
|
token,
|
|
660
662
|
type
|
|
661
663
|
};
|
|
662
664
|
}
|
|
663
|
-
}
|
|
665
|
+
};
|
|
666
|
+
let SingleInstanceGithubCredentialsProvider = _SingleInstanceGithubCredentialsProvider;
|
|
667
|
+
SingleInstanceGithubCredentialsProvider.create = (config) => {
|
|
668
|
+
return new _SingleInstanceGithubCredentialsProvider(new GithubAppCredentialsMux(config), config.token);
|
|
669
|
+
};
|
|
664
670
|
|
|
665
671
|
const _GitHubIntegration = class {
|
|
666
672
|
constructor(integrationConfig) {
|
|
@@ -683,7 +689,7 @@ const _GitHubIntegration = class {
|
|
|
683
689
|
}
|
|
684
690
|
};
|
|
685
691
|
let GitHubIntegration = _GitHubIntegration;
|
|
686
|
-
GitHubIntegration.factory = ({config}) => {
|
|
692
|
+
GitHubIntegration.factory = ({ config }) => {
|
|
687
693
|
var _a;
|
|
688
694
|
const configs = readGitHubIntegrationConfigs((_a = config.getOptionalConfigArray("integrations.github")) != null ? _a : []);
|
|
689
695
|
return basicIntegrations(configs.map((c) => new _GitHubIntegration(c)), (i) => i.config.host);
|
|
@@ -720,7 +726,7 @@ function readGitLabIntegrationConfig(config) {
|
|
|
720
726
|
} else if (!isValidUrl(baseUrl)) {
|
|
721
727
|
throw new Error(`Invalid GitLab integration config, '${baseUrl}' is not a valid baseUrl`);
|
|
722
728
|
}
|
|
723
|
-
return {host, token, apiBaseUrl, baseUrl};
|
|
729
|
+
return { host, token, apiBaseUrl, baseUrl };
|
|
724
730
|
}
|
|
725
731
|
function readGitLabIntegrationConfigs(configs) {
|
|
726
732
|
const result = configs.map(readGitLabIntegrationConfig);
|
|
@@ -742,7 +748,7 @@ async function getGitLabFileFetchUrl(url, config) {
|
|
|
742
748
|
return buildRawUrl(url).toString();
|
|
743
749
|
}
|
|
744
750
|
function getGitLabRequestOptions(config) {
|
|
745
|
-
const {token = ""} = config;
|
|
751
|
+
const { token = "" } = config;
|
|
746
752
|
return {
|
|
747
753
|
headers: {
|
|
748
754
|
"PRIVATE-TOKEN": token
|
|
@@ -788,7 +794,7 @@ async function getProjectId(target, config) {
|
|
|
788
794
|
try {
|
|
789
795
|
const repo = url.pathname.split("/-/blob/")[0];
|
|
790
796
|
const repoIDLookup = new URL(`${url.protocol + url.hostname}/api/v4/projects/${encodeURIComponent(repo.replace(/^\//, ""))}`);
|
|
791
|
-
const response = await fetch__default[
|
|
797
|
+
const response = await fetch__default["default"](repoIDLookup.toString(), getGitLabRequestOptions(config));
|
|
792
798
|
const data = await response.json();
|
|
793
799
|
if (!response.ok) {
|
|
794
800
|
throw new Error(`GitLab Error '${data.error}', ${data.error_description}`);
|
|
@@ -820,7 +826,7 @@ const _GitLabIntegration = class {
|
|
|
820
826
|
}
|
|
821
827
|
};
|
|
822
828
|
let GitLabIntegration = _GitLabIntegration;
|
|
823
|
-
GitLabIntegration.factory = ({config}) => {
|
|
829
|
+
GitLabIntegration.factory = ({ config }) => {
|
|
824
830
|
var _a;
|
|
825
831
|
const configs = readGitLabIntegrationConfigs((_a = config.getOptionalConfigArray("integrations.gitlab")) != null ? _a : []);
|
|
826
832
|
return basicIntegrations(configs.map((c) => new _GitLabIntegration(c)), (i) => i.config.host);
|
|
@@ -838,20 +844,41 @@ function readGoogleGcsIntegrationConfig(config) {
|
|
|
838
844
|
}
|
|
839
845
|
const privateKey = config.getString("privateKey").split("\\n").join("\n");
|
|
840
846
|
const clientEmail = config.getString("clientEmail");
|
|
841
|
-
return {clientEmail, privateKey};
|
|
847
|
+
return { clientEmail, privateKey };
|
|
842
848
|
}
|
|
843
849
|
|
|
844
850
|
const AMAZON_AWS_HOST = "amazonaws.com";
|
|
845
851
|
function readAwsS3IntegrationConfig(config) {
|
|
846
852
|
var _a;
|
|
847
|
-
const
|
|
853
|
+
const endpoint = config.getOptionalString("endpoint");
|
|
854
|
+
const s3ForcePathStyle = (_a = config.getOptionalBoolean("s3ForcePathStyle")) != null ? _a : false;
|
|
855
|
+
let host;
|
|
856
|
+
let pathname;
|
|
857
|
+
if (endpoint) {
|
|
858
|
+
try {
|
|
859
|
+
const url = new URL(endpoint);
|
|
860
|
+
host = url.host;
|
|
861
|
+
pathname = url.pathname;
|
|
862
|
+
} catch {
|
|
863
|
+
throw new Error(`invalid awsS3 integration config, endpoint '${endpoint}' is not a valid URL`);
|
|
864
|
+
}
|
|
865
|
+
if (pathname !== "/") {
|
|
866
|
+
throw new Error(`invalid awsS3 integration config, endpoints cannot contain path, got '${endpoint}'`);
|
|
867
|
+
}
|
|
868
|
+
} else {
|
|
869
|
+
host = AMAZON_AWS_HOST;
|
|
870
|
+
}
|
|
848
871
|
const accessKeyId = config.getOptionalString("accessKeyId");
|
|
849
872
|
const secretAccessKey = config.getOptionalString("secretAccessKey");
|
|
850
873
|
const roleArn = config.getOptionalString("roleArn");
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
874
|
+
return {
|
|
875
|
+
host,
|
|
876
|
+
endpoint,
|
|
877
|
+
s3ForcePathStyle,
|
|
878
|
+
accessKeyId,
|
|
879
|
+
secretAccessKey,
|
|
880
|
+
roleArn
|
|
881
|
+
};
|
|
855
882
|
}
|
|
856
883
|
function readAwsS3IntegrationConfigs(configs) {
|
|
857
884
|
const result = configs.map(readAwsS3IntegrationConfig);
|
|
@@ -885,7 +912,7 @@ const _AwsS3Integration = class {
|
|
|
885
912
|
}
|
|
886
913
|
};
|
|
887
914
|
let AwsS3Integration = _AwsS3Integration;
|
|
888
|
-
AwsS3Integration.factory = ({config}) => {
|
|
915
|
+
AwsS3Integration.factory = ({ config }) => {
|
|
889
916
|
var _a;
|
|
890
917
|
const configs = readAwsS3IntegrationConfigs((_a = config.getOptionalConfigArray("integrations.awsS3")) != null ? _a : []);
|
|
891
918
|
return basicIntegrations(configs.map((c) => new _AwsS3Integration(c)), (i) => i.config.host);
|
|
@@ -894,11 +921,11 @@ AwsS3Integration.factory = ({config}) => {
|
|
|
894
921
|
class ScmIntegrations {
|
|
895
922
|
static fromConfig(config) {
|
|
896
923
|
return new ScmIntegrations({
|
|
897
|
-
awsS3: AwsS3Integration.factory({config}),
|
|
898
|
-
azure: AzureIntegration.factory({config}),
|
|
899
|
-
bitbucket: BitbucketIntegration.factory({config}),
|
|
900
|
-
github: GitHubIntegration.factory({config}),
|
|
901
|
-
gitlab: GitLabIntegration.factory({config})
|
|
924
|
+
awsS3: AwsS3Integration.factory({ config }),
|
|
925
|
+
azure: AzureIntegration.factory({ config }),
|
|
926
|
+
bitbucket: BitbucketIntegration.factory({ config }),
|
|
927
|
+
github: GitHubIntegration.factory({ config }),
|
|
928
|
+
gitlab: GitLabIntegration.factory({ config })
|
|
902
929
|
});
|
|
903
930
|
}
|
|
904
931
|
constructor(integrationsByType) {
|
|
@@ -950,8 +977,8 @@ exports.BitbucketIntegration = BitbucketIntegration;
|
|
|
950
977
|
exports.GitHubIntegration = GitHubIntegration;
|
|
951
978
|
exports.GitLabIntegration = GitLabIntegration;
|
|
952
979
|
exports.GithubAppCredentialsMux = GithubAppCredentialsMux;
|
|
953
|
-
exports.GithubCredentialsProvider = GithubCredentialsProvider;
|
|
954
980
|
exports.ScmIntegrations = ScmIntegrations;
|
|
981
|
+
exports.SingleInstanceGithubCredentialsProvider = SingleInstanceGithubCredentialsProvider;
|
|
955
982
|
exports.defaultScmResolveUrl = defaultScmResolveUrl;
|
|
956
983
|
exports.getAzureCommitsUrl = getAzureCommitsUrl;
|
|
957
984
|
exports.getAzureDownloadUrl = getAzureDownloadUrl;
|