@axway/axway-central-cli 2.20.0 → 2.22.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/dist/commands/install/agents.js +2 -0
- package/dist/commands/install/gitLabAgents.js +179 -0
- package/dist/commands/install/helpers/index.js +12 -0
- package/dist/commands/install/helpers/inputs.js +4 -4
- package/dist/commands/install/helpers/regex.js +13 -7
- package/dist/commands/install/helpers/templates/gitLabTemplates.js +71 -0
- package/dist/common/basicPrompts.js +1 -1
- package/dist/common/types.js +5 -1
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ var _types = require("../../common/types");
|
|
|
17
17
|
var _utils = require("../../common/utils");
|
|
18
18
|
var awsAgents = _interopRequireWildcard(require("./awsAgents"));
|
|
19
19
|
var gitHubAgents = _interopRequireWildcard(require("./gitHubSaasAgents"));
|
|
20
|
+
var gitLabAgents = _interopRequireWildcard(require("./gitLabAgents"));
|
|
20
21
|
var azureAgents = _interopRequireWildcard(require("./azureAgents"));
|
|
21
22
|
var edgeAgents = _interopRequireWildcard(require("./edgeAgents"));
|
|
22
23
|
var apigeeSaaSAgents = _interopRequireWildcard(require("./apigeexSaasAgents"));
|
|
@@ -40,6 +41,7 @@ const agentInstallFlows = {
|
|
|
40
41
|
[_types.GatewayTypes.EDGE_GATEWAY_ONLY]: edgeAgents.EdgeGWOnlyInstallMethods,
|
|
41
42
|
[_types.GatewayTypes.AWS_GATEWAY]: awsAgents.AWSInstallMethods,
|
|
42
43
|
[_types.GatewayTypes.GITHUB]: gitHubAgents.GitHubSaaSInstallMethods,
|
|
44
|
+
[_types.GatewayTypes.GITLAB]: gitLabAgents.GitLabInstallMethods,
|
|
43
45
|
[_types.GatewayTypes.APIGEEX_GATEWAY]: apigeeSaaSAgents.APIGEEXSaaSInstallMethods,
|
|
44
46
|
[_types.GatewayTypes.AZURE_GATEWAY]: azureAgents.AzureInstallMethods,
|
|
45
47
|
[_types.GatewayTypes.ISTIO]: istioAgents.IstioInstallMethods
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.testables = exports.installPreprocess = exports.gitLabPrompts = exports.gatewayConnectivity = exports.completeInstall = exports.askConfigType = exports.askBundleType = exports.GitLabInstallMethods = exports.ConfigFiles = void 0;
|
|
7
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
+
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
|
+
var _basicPrompts = require("../../common/basicPrompts");
|
|
10
|
+
var _types = require("../../common/types");
|
|
11
|
+
var _utils = require("../../common/utils");
|
|
12
|
+
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
13
|
+
var _gitLabTemplates = require("./helpers/templates/gitLabTemplates");
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
const {
|
|
19
|
+
log
|
|
20
|
+
} = (0, _snooplogg.default)('central: install: agents: gitLab:');
|
|
21
|
+
const daImage = `${_types.PublicDockerRepoBaseUrl}${_types.BasePaths.DockerAgentPublicRepo}/${_types.AgentNames.GITLAB_DA}`;
|
|
22
|
+
|
|
23
|
+
// ConfigFiles - all the config file that are used in the setup
|
|
24
|
+
const ConfigFiles = exports.ConfigFiles = {
|
|
25
|
+
DAEnvVars: `${helpers.configFiles.DA_ENV_VARS}`
|
|
26
|
+
};
|
|
27
|
+
const gitLabPrompts = exports.gitLabPrompts = {
|
|
28
|
+
ACCESS_TOKEN: 'Enter the GitLab Access Token the agent will use',
|
|
29
|
+
BASE_URL: 'Enter the GitLab base URL that the agent will use',
|
|
30
|
+
REPOSITORY_ID: 'Enter the GitLab Repository ID the agent will use',
|
|
31
|
+
REPOSITORY_BRANCH: 'Enter the Repository Branch the agent will use',
|
|
32
|
+
PATHS: 'Enter a Path within the repository that the agent will use',
|
|
33
|
+
FILTERS: 'Enter a filter that the agent will use (Optional)',
|
|
34
|
+
DA_FREQUENCY: 'How often should the discovery run, leave blank for integrating in CI/CD process',
|
|
35
|
+
QUEUE: 'Do you want to discover immediately after installation',
|
|
36
|
+
ENTER_MORE_PATHS: 'Do you want to enter another path ?',
|
|
37
|
+
ENTER_MORE_FILTERS: 'Do you want to enter another filter ?'
|
|
38
|
+
};
|
|
39
|
+
const askBundleType = async () => {
|
|
40
|
+
return _types.BundleType.DISCOVERY;
|
|
41
|
+
};
|
|
42
|
+
exports.askBundleType = askBundleType;
|
|
43
|
+
const askConfigType = async () => {
|
|
44
|
+
return _types.AgentConfigTypes.DOCKERIZED;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Questions for the gitLab configuration
|
|
48
|
+
exports.askConfigType = askConfigType;
|
|
49
|
+
const askForGitLabToken = async () => await (0, _basicPrompts.askInput)({
|
|
50
|
+
msg: gitLabPrompts.ACCESS_TOKEN,
|
|
51
|
+
validate: (0, _basicPrompts.validateRegex)(helpers.GitLabRegexPatterns.gitLabAccessTokenRegex, helpers.invalidValueExampleErrMsg('AccessToken', 'mockToken'))
|
|
52
|
+
});
|
|
53
|
+
const askForGitLabBaseURL = async () => await (0, _basicPrompts.askInput)({
|
|
54
|
+
msg: gitLabPrompts.BASE_URL,
|
|
55
|
+
validate: (0, _basicPrompts.validateRegex)(helpers.GitLabRegexPatterns.gitLabBaseURLRegex, helpers.invalidValueExampleErrMsg('BaseURL', 'htpps://www.testdomain.com'))
|
|
56
|
+
});
|
|
57
|
+
const askForGitLabRepositoryID = async () => await (0, _basicPrompts.askInput)({
|
|
58
|
+
msg: gitLabPrompts.REPOSITORY_ID,
|
|
59
|
+
validate: (0, _basicPrompts.validateRegex)(helpers.GitLabRegexPatterns.gitHubRepositoryIDRegex, helpers.invalidValueExampleErrMsg('RepositoryID', '12312'))
|
|
60
|
+
});
|
|
61
|
+
const askForGitLabRepositoryBranch = async () => await (0, _basicPrompts.askInput)({
|
|
62
|
+
msg: gitLabPrompts.REPOSITORY_BRANCH
|
|
63
|
+
});
|
|
64
|
+
const askForGitLabPaths = async () => {
|
|
65
|
+
let askPaths = true;
|
|
66
|
+
let paths = [];
|
|
67
|
+
console.log(_chalk.default.gray("An array of paths within the repository that the agent will gather files for looking for specs"));
|
|
68
|
+
while (askPaths) {
|
|
69
|
+
const path = await (0, _basicPrompts.askInput)({
|
|
70
|
+
msg: gitLabPrompts.PATHS,
|
|
71
|
+
allowEmptyInput: false,
|
|
72
|
+
validate: (0, _basicPrompts.validateRegex)(helpers.GitLabRegexPatterns.gitLabPathRegex, helpers.invalidValueExampleErrMsg('File Path', '/apis'))
|
|
73
|
+
});
|
|
74
|
+
paths.push(path);
|
|
75
|
+
askPaths = (await (0, _basicPrompts.askList)({
|
|
76
|
+
msg: gitLabPrompts.ENTER_MORE_PATHS,
|
|
77
|
+
default: _types.YesNo.No,
|
|
78
|
+
choices: _types.YesNoChoices
|
|
79
|
+
})) === _types.YesNo.Yes;
|
|
80
|
+
}
|
|
81
|
+
return paths;
|
|
82
|
+
};
|
|
83
|
+
const askForGitLabFilters = async () => {
|
|
84
|
+
let askFilters = true;
|
|
85
|
+
let filters = [];
|
|
86
|
+
console.log(_chalk.default.gray("An array of regular expressions that a file name must match to be discovered"));
|
|
87
|
+
while (askFilters) {
|
|
88
|
+
const filter = await (0, _basicPrompts.askInput)({
|
|
89
|
+
msg: gitLabPrompts.FILTERS,
|
|
90
|
+
allowEmptyInput: true
|
|
91
|
+
});
|
|
92
|
+
if (filter.trim() != '') {
|
|
93
|
+
filters.push(filter);
|
|
94
|
+
askFilters = (await (0, _basicPrompts.askList)({
|
|
95
|
+
msg: gitLabPrompts.ENTER_MORE_FILTERS,
|
|
96
|
+
default: _types.YesNo.No,
|
|
97
|
+
choices: _types.YesNoChoices
|
|
98
|
+
})) === _types.YesNo.Yes;
|
|
99
|
+
} else {
|
|
100
|
+
askFilters = false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return filters;
|
|
104
|
+
};
|
|
105
|
+
const gatewayConnectivity = async installConfig => {
|
|
106
|
+
let gitLabAgentValues = new _gitLabTemplates.GitLabAgentValues();
|
|
107
|
+
if (installConfig.switches.isDockerInstall) {
|
|
108
|
+
console.log('\nCONNECTION TO GitHub API GATEWAY:');
|
|
109
|
+
console.log(_chalk.default.gray("The Discovery Agent needs to connect to the GitHub API Gateway to discover API's for publishing to Amplify Central"));
|
|
110
|
+
gitLabAgentValues.token = await askForGitLabToken();
|
|
111
|
+
gitLabAgentValues.baseURL = await askForGitLabBaseURL();
|
|
112
|
+
gitLabAgentValues.repositoryID = await askForGitLabRepositoryID();
|
|
113
|
+
gitLabAgentValues.repositoryBranch = await askForGitLabRepositoryBranch();
|
|
114
|
+
gitLabAgentValues.paths = await askForGitLabPaths();
|
|
115
|
+
gitLabAgentValues.filters = await askForGitLabFilters();
|
|
116
|
+
}
|
|
117
|
+
return gitLabAgentValues;
|
|
118
|
+
};
|
|
119
|
+
exports.gatewayConnectivity = gatewayConnectivity;
|
|
120
|
+
const dockerSuccessMsg = installConfig => {
|
|
121
|
+
let dockerInfo;
|
|
122
|
+
const runDaLinuxMsg = `docker run -it --env-file ${helpers.pwd}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwd}:/keys ${helpers.eolChar}`;
|
|
123
|
+
const runDaWinMsg = `docker run -it --env-file ${helpers.pwdWin}/${helpers.configFiles.DA_ENV_VARS} -v ${helpers.pwdWin}:/keys ${helpers.eolCharWin}`;
|
|
124
|
+
const startDaLinuxMsg = `\nStart the Discovery Agent on a Linux based machine`;
|
|
125
|
+
const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
|
|
126
|
+
if (installConfig.switches.isDaEnabled) {
|
|
127
|
+
dockerInfo = `To utilize the discovery agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.DA_ENV_VARS}):`;
|
|
128
|
+
}
|
|
129
|
+
console.log(_chalk.default.whiteBright(dockerInfo), '\n');
|
|
130
|
+
if (installConfig.switches.isDaEnabled) {
|
|
131
|
+
const daImageVersion = `${daImage}:${installConfig.daVersion}`;
|
|
132
|
+
console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
|
|
133
|
+
console.log(_chalk.default.cyan(`docker pull ${daImageVersion}`));
|
|
134
|
+
console.log(_chalk.default.white(_utils.isWindows ? startDaWinMsg : startDaLinuxMsg));
|
|
135
|
+
console.log(_chalk.default.cyan(_utils.isWindows ? runDaWinMsg : runDaLinuxMsg));
|
|
136
|
+
console.log('\t', _chalk.default.cyan(`-v /data ${daImageVersion}`));
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const generateSuccessHelpMsg = installConfig => {
|
|
140
|
+
const configType = installConfig.deploymentType;
|
|
141
|
+
if (configType === _types.AgentConfigTypes.DOCKERIZED) {
|
|
142
|
+
dockerSuccessMsg(installConfig);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const installPreprocess = async installConfig => {
|
|
146
|
+
return installConfig;
|
|
147
|
+
};
|
|
148
|
+
exports.installPreprocess = installPreprocess;
|
|
149
|
+
const completeInstall = async installConfig => {
|
|
150
|
+
/**
|
|
151
|
+
* Create agent resources
|
|
152
|
+
*/
|
|
153
|
+
const gitLabAgentValues = installConfig.gatewayConfig;
|
|
154
|
+
|
|
155
|
+
// Add final settings to gitLabAgentValues
|
|
156
|
+
gitLabAgentValues.centralConfig = installConfig.centralConfig;
|
|
157
|
+
gitLabAgentValues.daVersion = installConfig.daVersion;
|
|
158
|
+
if (installConfig.switches.isDockerInstall) {
|
|
159
|
+
if (installConfig.switches.isDaEnabled) {
|
|
160
|
+
(0, _utils.writeTemplates)(ConfigFiles.DAEnvVars, gitLabAgentValues, helpers.gitLabDAEnvVarTemplate);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
console.log('Configuration file(s) have been successfully created.\n');
|
|
164
|
+
generateSuccessHelpMsg(installConfig);
|
|
165
|
+
};
|
|
166
|
+
exports.completeInstall = completeInstall;
|
|
167
|
+
const GitLabInstallMethods = exports.GitLabInstallMethods = {
|
|
168
|
+
GetBundleType: askBundleType,
|
|
169
|
+
GetDeploymentType: askConfigType,
|
|
170
|
+
AskGatewayQuestions: gatewayConnectivity,
|
|
171
|
+
InstallPreprocess: installPreprocess,
|
|
172
|
+
FinalizeGatewayInstall: completeInstall,
|
|
173
|
+
ConfigFiles: Object.values(ConfigFiles),
|
|
174
|
+
GatewayDisplay: _types.GatewayTypes.GITLAB
|
|
175
|
+
};
|
|
176
|
+
const testables = exports.testables = {
|
|
177
|
+
gitLabPrompts,
|
|
178
|
+
ConfigFiles
|
|
179
|
+
};
|
|
@@ -128,6 +128,18 @@ Object.keys(_istioTemplates).forEach(function (key) {
|
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
});
|
|
131
|
+
var _gitLabTemplates = require("./templates/gitLabTemplates");
|
|
132
|
+
Object.keys(_gitLabTemplates).forEach(function (key) {
|
|
133
|
+
if (key === "default" || key === "__esModule") return;
|
|
134
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
135
|
+
if (key in exports && exports[key] === _gitLabTemplates[key]) return;
|
|
136
|
+
Object.defineProperty(exports, key, {
|
|
137
|
+
enumerable: true,
|
|
138
|
+
get: function () {
|
|
139
|
+
return _gitLabTemplates[key];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
131
143
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
132
144
|
const streamPipeline = exports.streamPipeline = _util.default.promisify(_stream.default.pipeline);
|
|
133
145
|
const unzip = async filePath => {
|
|
@@ -38,8 +38,8 @@ const agentMessages = exports.agentMessages = {
|
|
|
38
38
|
const transactionLoggingMessages = exports.transactionLoggingMessages = {
|
|
39
39
|
askToEnableLogging: 'Would you like to enable transaction logging?',
|
|
40
40
|
transactionLoggingInfoMsg: 'Transaction logging is optional and not required for usage and metrics logging.\nTurning on transaction logging can have an impact on performance.',
|
|
41
|
-
enterSamplingPercentage: 'What sampling rate would you like to use? (1-
|
|
42
|
-
samplingPercentageInfoMsg: 'A sampling rate of 1 will log 1% of transactions, a sampling rate of
|
|
41
|
+
enterSamplingPercentage: 'What sampling rate would you like to use? (1-10)',
|
|
42
|
+
samplingPercentageInfoMsg: 'A sampling rate of 1 will log 1% of transactions, a sampling rate of 10 will log 10% of all transactions.\nWe recommend a sampling rate of 1% which can be increased if needed.',
|
|
43
43
|
askReportAllErrors: 'Would you like to report all errors?',
|
|
44
44
|
reportAllErrorsMsg: 'The agents can take out the error transactions from the sampling rate.'
|
|
45
45
|
};
|
|
@@ -373,11 +373,11 @@ const askToEnableTransactionLogging = async () => {
|
|
|
373
373
|
console.log(_chalk.default.gray(transactionLoggingMessages.samplingPercentageInfoMsg));
|
|
374
374
|
const samplingPercentage = await (0, _basicPrompts.askInput)({
|
|
375
375
|
msg: transactionLoggingMessages.enterSamplingPercentage,
|
|
376
|
-
defaultValue:
|
|
376
|
+
defaultValue: 1,
|
|
377
377
|
validate: (0, _basicPrompts.runValidations)((0, _basicPrompts.validateRegex)(_regex.percentageRegex, _regex.invalidPercentage))
|
|
378
378
|
});
|
|
379
379
|
let shouldReportAllErrors = _types.YesNo.Yes;
|
|
380
|
-
if (samplingPercentage <
|
|
380
|
+
if (samplingPercentage < 10) {
|
|
381
381
|
console.log(_chalk.default.gray(transactionLoggingMessages.reportAllErrorsMsg));
|
|
382
382
|
shouldReportAllErrors = await (0, _basicPrompts.askList)({
|
|
383
383
|
msg: transactionLoggingMessages.askReportAllErrors,
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.resourceRegex = exports.percentageRegex = exports.namespaceRegex = exports.maskingRegex = exports.invalidResourceMsg = exports.invalidPercentage = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.GitHubRegexPatterns = exports.AzureRegexPatterns = exports.AWSRegexPatterns = exports.APIGEEXRegexPatterns = void 0;
|
|
6
|
+
exports.resourceRegex = exports.percentageRegex = exports.namespaceRegex = exports.maskingRegex = exports.invalidResourceMsg = exports.invalidPercentage = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.GitLabRegexPatterns = exports.GitHubRegexPatterns = exports.AzureRegexPatterns = exports.AWSRegexPatterns = exports.APIGEEXRegexPatterns = void 0;
|
|
7
7
|
const resourceRegex = exports.resourceRegex = '^(?:[a-z0-9]*(?:\\.(?=[a-z0-9])|-+(?=[a-z0-9]))?)+[a-z0-9]$';
|
|
8
8
|
const namespaceRegex = exports.namespaceRegex = '^[a-z0-9]?(?:[-a-z0-9]*[a-z0-9]){1,100}?$';
|
|
9
9
|
const domainNameRegex = exports.domainNameRegex = '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)+([A-Za-z]){2,}$';
|
|
10
10
|
const dosaRegex = exports.dosaRegex = '^[\\w\\s-()[\\]]{1,100}$';
|
|
11
|
-
const percentageRegex = exports.percentageRegex = '^[1-9]
|
|
11
|
+
const percentageRegex = exports.percentageRegex = '^[1-9]$|10$';
|
|
12
12
|
const frequencyRegex = exports.frequencyRegex = '^(\\d*[d])?(\\d*[h])?(\\d*[m])?$|^$';
|
|
13
13
|
const maskingRegex = exports.maskingRegex = '^[a-zA-Z0-9-*#^~.{}]{0,5}$';
|
|
14
|
-
const invalidPercentage = exports.invalidPercentage = 'Percentage must be an integer between 1-
|
|
14
|
+
const invalidPercentage = exports.invalidPercentage = 'Percentage must be an integer between 1-10';
|
|
15
15
|
const invalidDosaName = exports.invalidDosaName = 'Account name can contain A-z 0-9 _ - ( ) [ ] and can include 1-100 characters.';
|
|
16
16
|
const invalidNamespace = exports.invalidNamespace = `Namespace must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character, and be fewer than 100 characters long.`;
|
|
17
17
|
const invalidDomainName = exports.invalidDomainName = 'The host must be valid according to RFC 1123 specification';
|
|
@@ -31,13 +31,13 @@ const AWSRegexPatterns = exports.AWSRegexPatterns = {
|
|
|
31
31
|
AWS_REGEXP_ACCESS_KEY_ID: '((?:ASIA|AKIA|AROA|AIDA)([A-Z0-7]{16}))',
|
|
32
32
|
AWS_REGEXP_SECRET_ACCESS_KEY: '[a-zA-Z0-9+/]{40}',
|
|
33
33
|
AWS_REGEXP_ROLE_ARN: '^arn:aws[a-zA-Z-]*:iam::\\d{12}:role\\/?[a-zA-Z0-9+=,.@\\-_\\/]{1,128}$',
|
|
34
|
-
AWS_ACCESS_LOG_ARN: '^arn:aws[a-zA-Z-]*:logs:[a-zA-Z0-9
|
|
34
|
+
AWS_ACCESS_LOG_ARN: '^arn:aws[a-zA-Z-]*:logs:[a-zA-Z0-9-]*:\\d{12}:log-group:[a-zA-Z0-9_\\-\\/\\.#]{1,512}$'
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
// APIGEEXRegexPatterns - regex patters to validate user inputs
|
|
38
38
|
const APIGEEXRegexPatterns = exports.APIGEEXRegexPatterns = {
|
|
39
39
|
APIGEEX_REGEXP_PROJECT_ID: '^[a-z][a-z0-9-]{4,28}[a-z0-9]$',
|
|
40
|
-
AWS_REGEXP_EMAIL_ADDRESS: '^(([^<>()[
|
|
40
|
+
AWS_REGEXP_EMAIL_ADDRESS: '^(([^<>()[]\\.,;:s@"]+(.[^<>()[]\\.,;:s@"]+)*)|.(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$'
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
// AzureRegexPatterns - regex patters to validate user inputs
|
|
@@ -49,6 +49,12 @@ const AzureRegexPatterns = exports.AzureRegexPatterns = {
|
|
|
49
49
|
const GitHubRegexPatterns = exports.GitHubRegexPatterns = {
|
|
50
50
|
gitHubAccessTokenRegex: '^ghp_[a-zA-Z0-9]{36}$',
|
|
51
51
|
gitHubRepositoryOwnerRegex: '^(?!-)(?!.*--)[a-zA-Z0-9-]{1,37}(?<!-)$',
|
|
52
|
-
gitHubRepositoryNameRegex: '^[
|
|
53
|
-
gitHubFilePathRegex: '
|
|
52
|
+
gitHubRepositoryNameRegex: '^[w-.]+$',
|
|
53
|
+
gitHubFilePathRegex: '^/.*$'
|
|
54
|
+
};
|
|
55
|
+
const GitLabRegexPatterns = exports.GitLabRegexPatterns = {
|
|
56
|
+
gitLabAccessTokenRegex: '^[0-9a-zA-Z-]{20}$',
|
|
57
|
+
gitLabBaseURLRegex: '^(http://|https://)[a-z0-9]+([-.]{1}[a-z0-9]+)*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?$',
|
|
58
|
+
gitHubRepositoryIDRegex: '^[0-9]*$',
|
|
59
|
+
gitLabPathRegex: '^/.*$'
|
|
54
60
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.gitLabDAEnvVarTemplate = exports.GitLabAgentValues = void 0;
|
|
7
|
+
var _types = require("../../../../common/types");
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
10
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
|
|
11
|
+
* @description Values to provide to the gitLab templates.
|
|
12
|
+
*/
|
|
13
|
+
class GitLabAgentValues {
|
|
14
|
+
constructor() {
|
|
15
|
+
_defineProperty(this, "token", void 0);
|
|
16
|
+
_defineProperty(this, "baseURL", void 0);
|
|
17
|
+
_defineProperty(this, "repositoryID", void 0);
|
|
18
|
+
_defineProperty(this, "repositoryBranch", void 0);
|
|
19
|
+
_defineProperty(this, "paths", void 0);
|
|
20
|
+
_defineProperty(this, "filters", void 0);
|
|
21
|
+
_defineProperty(this, "daQueueName", void 0);
|
|
22
|
+
_defineProperty(this, "daVersion", void 0);
|
|
23
|
+
_defineProperty(this, "centralConfig", void 0);
|
|
24
|
+
this.token = '';
|
|
25
|
+
this.baseURL = '';
|
|
26
|
+
this.repositoryID = '';
|
|
27
|
+
this.repositoryBranch = '';
|
|
28
|
+
this.daQueueName = '';
|
|
29
|
+
this.daVersion = '';
|
|
30
|
+
this.paths = [];
|
|
31
|
+
this.filters = [];
|
|
32
|
+
this.centralConfig = new _types.CentralAgentConfig();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.GitLabAgentValues = GitLabAgentValues;
|
|
36
|
+
const gitLabDAEnvVarTemplate = () => {
|
|
37
|
+
return `# GitLab configs
|
|
38
|
+
GITLAB_TOKEN={{token}}
|
|
39
|
+
GITLAB_BASE_URL={{baseURL}}
|
|
40
|
+
GITLAB_REPOSITORY_ID={{repositoryID}}
|
|
41
|
+
GITLAB_REPOSITORY_BRANCH={{repositoryBranch}}
|
|
42
|
+
GITLAB_REPOSITORY_SPEC_PATHS={{paths}}
|
|
43
|
+
GITLAB_REPOSITORY_SPEC_FILTERS={{filters}}
|
|
44
|
+
|
|
45
|
+
# Amplify Central configs
|
|
46
|
+
AGENTFEATURES_MARKETPLACEPROVISIONING=true
|
|
47
|
+
CENTRAL_AGENTNAME={{centralConfig.daAgentName}}
|
|
48
|
+
CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
|
|
49
|
+
CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
|
|
50
|
+
CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
|
|
51
|
+
CENTRAL_ENVIRONMENT={{centralConfig.environment}}
|
|
52
|
+
CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
|
|
53
|
+
CENTRAL_GRPC_ENABLED=true
|
|
54
|
+
{{#compare . centralConfig.ampcTeamName "" operator="!=" }}
|
|
55
|
+
CENTRAL_TEAM={{centralConfig.ampcTeamName}}
|
|
56
|
+
{{/compare}}
|
|
57
|
+
CENTRAL_SINGLEURL={{centralConfig.singleEntryPointUrl}}
|
|
58
|
+
{{#compare . centralConfig.region "US" operator="!="}}
|
|
59
|
+
CENTRAL_URL={{centralConfig.url}}
|
|
60
|
+
{{/compare}}
|
|
61
|
+
|
|
62
|
+
# Logging configs
|
|
63
|
+
# Define the logging level: info, debug, error
|
|
64
|
+
LOG_LEVEL=info
|
|
65
|
+
# Specify where to send the log: stdout, file, both
|
|
66
|
+
LOG_OUTPUT=stdout
|
|
67
|
+
# Define where the log files are written
|
|
68
|
+
LOG_FILE_PATH=logs
|
|
69
|
+
`;
|
|
70
|
+
};
|
|
71
|
+
exports.gitLabDAEnvVarTemplate = gitLabDAEnvVarTemplate;
|
|
@@ -69,7 +69,7 @@ const validateValueRange = (lowerLimit, upperLimit) => input => {
|
|
|
69
69
|
if (isNaN(inputNum)) {
|
|
70
70
|
return 'Please provide a number.';
|
|
71
71
|
}
|
|
72
|
-
let msg =
|
|
72
|
+
let msg = '';
|
|
73
73
|
if (typeof lowerLimit !== undefined && typeof upperLimit !== undefined) {
|
|
74
74
|
msg = `Please provide a number from ${lowerLimit} to ${upperLimit}`;
|
|
75
75
|
} else if (typeof lowerLimit !== undefined) {
|
package/dist/common/types.js
CHANGED
|
@@ -214,6 +214,7 @@ let AgentNames = exports.AgentNames = /*#__PURE__*/function (AgentNames) {
|
|
|
214
214
|
AgentNames["AWS_DA"] = "aws-apigw-discovery-agent";
|
|
215
215
|
AgentNames["AWS_TA"] = "aws-apigw-traceability-agent";
|
|
216
216
|
AgentNames["GITHUB_DA"] = "github-discovery-agent";
|
|
217
|
+
AgentNames["GITLAB_DA"] = "gitlab-discovery-agent";
|
|
217
218
|
AgentNames["APIGEEX_DA"] = "apigee-discovery-agent";
|
|
218
219
|
AgentNames["APIGEEX_TA"] = "apigee-traceability-agent";
|
|
219
220
|
AgentNames["AZURE_DA"] = "azure-discovery-agent";
|
|
@@ -228,6 +229,7 @@ let GatewayTypes = exports.GatewayTypes = /*#__PURE__*/function (GatewayTypes) {
|
|
|
228
229
|
GatewayTypes["APIGEEX_GATEWAY"] = "Apigee X Gateway";
|
|
229
230
|
GatewayTypes["AZURE_GATEWAY"] = "Azure API Gateway";
|
|
230
231
|
GatewayTypes["GITHUB"] = "GitHub";
|
|
232
|
+
GatewayTypes["GITLAB"] = "GitLab";
|
|
231
233
|
GatewayTypes["ISTIO"] = "Istio";
|
|
232
234
|
GatewayTypes["EDGE_GATEWAY_ONLY"] = "Amplify API Gateway only";
|
|
233
235
|
return GatewayTypes;
|
|
@@ -242,6 +244,7 @@ let DataPlaneNames = exports.DataPlaneNames = /*#__PURE__*/function (DataPlaneNa
|
|
|
242
244
|
DataPlaneNames["APIGEE"] = "Apigee";
|
|
243
245
|
DataPlaneNames["AWS"] = "AWS";
|
|
244
246
|
DataPlaneNames["GITHUB"] = "GitHub";
|
|
247
|
+
DataPlaneNames["GITLAB"] = "GitLab";
|
|
245
248
|
DataPlaneNames["AZURE"] = "Azure";
|
|
246
249
|
DataPlaneNames["EDGE"] = "Edge";
|
|
247
250
|
DataPlaneNames["KONG"] = "Kong";
|
|
@@ -255,6 +258,7 @@ const GatewayTypeToDataPlane = exports.GatewayTypeToDataPlane = {
|
|
|
255
258
|
[GatewayTypes.EDGE_GATEWAY_ONLY]: DataPlaneNames.EDGE,
|
|
256
259
|
[GatewayTypes.AWS_GATEWAY]: DataPlaneNames.AWS,
|
|
257
260
|
[GatewayTypes.GITHUB]: DataPlaneNames.GITHUB,
|
|
261
|
+
[GatewayTypes.GITLAB]: DataPlaneNames.GITLAB,
|
|
258
262
|
[GatewayTypes.AZURE_GATEWAY]: DataPlaneNames.AZURE,
|
|
259
263
|
[GatewayTypes.ISTIO]: 'Istio',
|
|
260
264
|
[GatewayTypes.APIGEEX_GATEWAY]: DataPlaneNames.APIGEE
|
|
@@ -439,7 +443,7 @@ class TraceabilityConfig {
|
|
|
439
443
|
_defineProperty(this, "usageReportingOffline", void 0);
|
|
440
444
|
this.host = IngestionHosts.US;
|
|
441
445
|
this.protocol = IngestionProtocol.Lumberjack;
|
|
442
|
-
this.samplingPercentage =
|
|
446
|
+
this.samplingPercentage = 10;
|
|
443
447
|
this.enabled = true;
|
|
444
448
|
this.samplingReportAllErrors = true;
|
|
445
449
|
this.usageReportingOffline = false;
|