@axway/axway-central-cli 4.12.0 → 4.13.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -203,8 +203,8 @@ const agents = exports.agents = {
203
203
  installConfig.switches.isDockerInstall = installConfig.deploymentType === _types.AgentConfigTypes.DOCKERIZED;
204
204
  installConfig.switches.isBinaryInstall = installConfig.deploymentType === _types.AgentConfigTypes.BINARIES;
205
205
 
206
- // Get the version of the agents from jfrog, not needed in hosted install
207
- await getAgentVersions(agentInstallFlow, installConfig);
206
+ // Get the version of the agents from Engage, not needed in hosted install
207
+ await getAgentVersions(agentInstallFlow, installConfig, apiServerClient);
208
208
 
209
209
  // if EDGE_GATEWAY or EDGE_GATEWAY_ONLY and isDaEnabled, ask if the organization structure should replicate
210
210
  if ((gatewayType === _types.GatewayTypes.EDGE_GATEWAY || gatewayType === _types.GatewayTypes.EDGE_GATEWAY_ONLY) && installConfig.switches.isDaEnabled) {
@@ -251,12 +251,12 @@ const agents = exports.agents = {
251
251
  ..._types.commonCmdArgsDescription
252
252
  }
253
253
  };
254
- async function getAgentVersions(agentInstallFlow, installConfig) {
254
+ async function getAgentVersions(agentInstallFlow, installConfig, apiServerClient) {
255
255
  if (agentInstallFlow.AgentNameMap && !installConfig.switches.isHostedInstall && installConfig.switches.isDaEnabled) {
256
- installConfig.daVersion = await helpers.getLatestAgentVersion(agentInstallFlow.AgentNameMap[_types.AgentTypes.da]);
256
+ installConfig.daVersion = await helpers.getLatestAgentVersion(apiServerClient, agentInstallFlow.AgentNameMap[_types.AgentTypes.da]);
257
257
  }
258
258
  if (agentInstallFlow.AgentNameMap && !installConfig.switches.isHostedInstall && installConfig.switches.isTaEnabled) {
259
- installConfig.taVersion = await helpers.getLatestAgentVersion(agentInstallFlow.AgentNameMap[_types.AgentTypes.ta]);
259
+ installConfig.taVersion = await helpers.getLatestAgentVersion(apiServerClient, agentInstallFlow.AgentNameMap[_types.AgentTypes.ta]);
260
260
  }
261
261
  }
262
262
  async function finishInstall(agentInstallFlow, installConfig, apiServerClient, platformClient, defsManager) {
@@ -163,6 +163,7 @@ const dockerSuccessMsg = installConfig => {
163
163
  dockerInfo = `To utilize the agent, pull the latest Docker image and run it using the appropriate supplied environment file, (${helpers.configFiles.AGENT_ENV_VARS}):`;
164
164
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
165
165
  const caImageVersion = `${caImage}:${installConfig.caVersion}`;
166
+ helpers.dockerLoginInfo();
166
167
  console.log(_chalk.default.white('Pull the latest image of the Agent:'));
167
168
  console.log(_chalk.default.cyan(`docker pull ${caImageVersion}`));
168
169
  console.log(_chalk.default.white(_utils.isWindows ? startAgentWinMsg : startAgentLinuxMsg));
@@ -152,6 +152,7 @@ const dockerSuccessMsg = installConfig => {
152
152
  dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
153
153
  }
154
154
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
155
+ helpers.dockerLoginInfo();
155
156
  if (installConfig.switches.isDaEnabled) {
156
157
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
157
158
  console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
@@ -3,12 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.testables = exports.installPreprocess = exports.gatewayConnectivity = exports.completeInstall = exports.askConfigType = exports.askBundleType = exports.DeploymentTypes = exports.ConfigFiles = exports.AWSPrompts = exports.AWSInstallMethods = void 0;
6
+ exports.testables = exports.gatewayConnectivity = exports.completeInstall = exports.askConfigType = exports.askBundleType = exports.DeploymentTypes = exports.ConfigFiles = exports.AWSPrompts = exports.AWSInstallMethods = void 0;
7
7
  var _chalk = _interopRequireDefault(require("chalk"));
8
- var _fs = _interopRequireDefault(require("fs"));
9
8
  var _snooplogg = _interopRequireDefault(require("snooplogg"));
10
9
  var _basicPrompts = require("../../common/basicPrompts");
11
- var _dataService = require("../../common/dataService");
12
10
  var _types = require("../../common/types");
13
11
  var _utils = require("../../common/utils");
14
12
  var helpers = _interopRequireWildcard(require("./helpers"));
@@ -340,8 +338,6 @@ const generateOutput = async installConfig => {
340
338
  additionalSteps = ` - Create the SSM parameter:
341
339
  ${_chalk.default.cyan(` aws ssm put-parameter --type SecureString --name ${awsAgentValues.cloudFormationConfig.SSMPrivateKeyParameter} --value "file:\/\/private_key.pem"`)}
342
340
  ${_chalk.default.cyan(` aws ssm put-parameter --type SecureString --name ${awsAgentValues.cloudFormationConfig.SSMPublicKeyParameter} --value "file:\/\/public_key.pem"`)}`;
343
- // Cleanup EC2 file
344
- _fs.default.unlinkSync(ConfigFiles.EC2DeployYAML);
345
341
  break;
346
342
  }
347
343
  case DeploymentTypes.OTHER:
@@ -350,11 +346,6 @@ ${_chalk.default.cyan(` aws ssm put-parameter --type SecureString --name ${aw
350
346
  // These files need to be put in a resources dir on S3
351
347
  let s3ResourcesIncludes = '';
352
348
  [ConfigFiles.DAEnvVars, ConfigFiles.TAEnvVars].forEach(value => s3ResourcesIncludes += `--include "${value}" `);
353
-
354
- // Cleanup EC2 file
355
- _fs.default.unlinkSync(ConfigFiles.EC2DeployYAML);
356
- // Cleanup ECS Fargate file
357
- _fs.default.unlinkSync(ConfigFiles.FargateDeployYAML);
358
349
  const info = `To utilize the agents, pull the latest Docker images and run them using the appropriate supplied environment files, (${helpers.configFiles.DA_ENV_VARS} & ${helpers.configFiles.TA_ENV_VARS}):`;
359
350
  dockerEnvConfig = `Wait for the CloudFormation Stack to complete.
360
351
  - Create AWS Access and Secret Keys and copy resulting ${_chalk.default.yellow(`"AccessKeyId"`)} & ${_chalk.default.yellow(`"SecretAccessKey"`)}:
@@ -365,6 +356,7 @@ ${_chalk.default.cyan(` aws iam create-access-key --user-name AxwayAmplifyAg
365
356
  AWS_AUTH_SECRETKEY=${_chalk.default.yellow(`Your_SecretAccessKey`)}`;
366
357
  runCommands = `${_chalk.default.whiteBright(info)}
367
358
 
359
+ ${helpers.dockerLoginMsg()}
368
360
  Pull the latest image of the Discovery Agent:
369
361
  ${_chalk.default.cyan(`docker pull ${daImage}:${installConfig.daVersion}`)}
370
362
 
@@ -399,8 +391,6 @@ ${_chalk.default.cyan(` aws ec2 create-key-pair --key-name ${awsAgentValues.c
399
391
  - Create the SSM parameter:
400
392
  ${_chalk.default.cyan(` aws ssm put-parameter --type SecureString --name ${awsAgentValues.cloudFormationConfig.SSMPrivateKeyParameter} --value "file:\/\/private_key.pem"`)}
401
393
  ${_chalk.default.cyan(` aws ssm put-parameter --type SecureString --name ${awsAgentValues.cloudFormationConfig.SSMPublicKeyParameter} --value "file:\/\/public_key.pem"`)}`;
402
- // Cleanup Fargate file
403
- _fs.default.unlinkSync(ConfigFiles.FargateDeployYAML);
404
394
  break;
405
395
  }
406
396
  }
@@ -409,7 +399,13 @@ ${_chalk.default.cyan(` aws ssm put-parameter --type SecureString --name ${aw
409
399
  // if region is AWS default, 'us-east-1', region unnecessary in cloudformation template url
410
400
  const s3Region = awsAgentValues.region === _types.AWSRegions.US_EAST_1 ? `s3` : `s3.${awsAgentValues.region}`;
411
401
  return `
412
- To complete the install, run the following AWS CLI command:
402
+ To complete the install, first download and extract the CloudFormation templates:
403
+ - Download the CloudFormation package:
404
+ ${_chalk.default.cyan(` curl -O https://repository.axway.com/artifactory/ampc-public-generic-release/aws-agents/aws_apigw_agent_config/latest/${ConfigFiles.AgentConfigZip}`)}
405
+ - Extract the package:
406
+ ${_chalk.default.cyan(` unzip ${ConfigFiles.AgentConfigZip}`)}
407
+
408
+ Then run the following AWS CLI commands:
413
409
  - Create, if necessary, and upload all files to your S3 bucket
414
410
  ${_chalk.default.cyan(` aws s3api create-bucket --bucket ${awsAgentValues.cloudFormationConfig.AgentResourcesBucket} --create-bucket-configuration LocationConstraint=${awsAgentValues.region}`)}
415
411
  ${_chalk.default.cyan(` aws s3 sync --exclude "*" ${s3BaseIncludes} ./ s3://${awsAgentValues.cloudFormationConfig.AgentResourcesBucket}`)}
@@ -428,47 +424,6 @@ ${runCommands}
428
424
  ${_chalk.default.gray(`Additional information about agent features can be found here:\n${helpers.agentsDocsUrl.AWS}`)}\n
429
425
  `;
430
426
  };
431
-
432
- // Download latest aws apigw config zip
433
- const downloadAPIGWAgentConfigZip = async () => {
434
- const url = `/aws_apigw_agent_config/latest/${ConfigFiles.AgentConfigZip}`;
435
- const service = await (0, _dataService.dataService)({
436
- baseUrl: _types.PublicRepoUrl,
437
- basePath: _types.BasePaths.AWSAgents
438
- });
439
- try {
440
- const {
441
- stream
442
- } = await service.download(url);
443
- await helpers.streamPipeline(stream, _fs.default.createWriteStream(ConfigFiles.AgentConfigZip));
444
- return ConfigFiles.AgentConfigZip;
445
- } catch (err) {
446
- throw new Error(`Failed to download the agent: ${err.message}`);
447
- }
448
- };
449
-
450
- // Unzip latest aws apigw config zip
451
- const unzipAPIGWAgentConfigZip = async zipFile => {
452
- await helpers.unzip(zipFile);
453
- _fs.default.unlinkSync(zipFile);
454
- const isCloudFormation = _fs.default.existsSync(ConfigFiles.DeployAllYAML);
455
- if (!isCloudFormation) {
456
- console.log(`${ConfigFiles.DeployAllYAML} was not extracted from ${ConfigFiles.AgentConfigZip}`);
457
- return false;
458
- }
459
- return true;
460
- };
461
- const installPreprocess = async installConfig => {
462
- // attempt to download the cloud formation files
463
- console.log(_chalk.default.gray(`Downloading the latest Cloud formation template...`));
464
- let apigwAgentConfigZipFile = await downloadAPIGWAgentConfigZip();
465
- if (apigwAgentConfigZipFile !== '') {
466
- console.log(_chalk.default.gray(`\nSuccess`));
467
- }
468
- installConfig.gatewayConfig.apigwAgentConfigZipFile = apigwAgentConfigZipFile;
469
- return installConfig;
470
- };
471
- exports.installPreprocess = installPreprocess;
472
427
  const completeInstall = async installConfig => {
473
428
  /**
474
429
  * Create agent resources
@@ -478,10 +433,7 @@ const completeInstall = async installConfig => {
478
433
  // Add final settings to awsAgentsValues
479
434
  awsAgentValues.centralConfig = installConfig.centralConfig;
480
435
  awsAgentValues.traceabilityConfig = installConfig.traceabilityConfig;
481
- const unpackZip = await unzipAPIGWAgentConfigZip(awsAgentValues.apigwAgentConfigZipFile);
482
- if (unpackZip) {
483
- console.log('\nCreating the agent environment files for AWS...');
484
- }
436
+ console.log('\nCreating the agent environment files for AWS...');
485
437
  console.log('Generating the configuration file(s)...');
486
438
  console.log('Generating the cloud formation parameters file...');
487
439
  let paramStrings = [];
@@ -506,9 +458,8 @@ const AWSInstallMethods = exports.AWSInstallMethods = {
506
458
  GetBundleType: askBundleType,
507
459
  GetDeploymentType: askConfigType,
508
460
  AskGatewayQuestions: gatewayConnectivity,
509
- InstallPreprocess: installPreprocess,
510
461
  FinalizeGatewayInstall: completeInstall,
511
- ConfigFiles: Object.values(ConfigFiles),
462
+ ConfigFiles: [ConfigFiles.DAEnvVars, ConfigFiles.TAEnvVars, ConfigFiles.CFProperties],
512
463
  AgentNameMap: {
513
464
  [_types.AgentTypes.da]: _types.AgentNames.AWS_DA,
514
465
  [_types.AgentTypes.ta]: _types.AgentNames.AWS_TA
@@ -155,6 +155,7 @@ const dockerSuccessMsg = installConfig => {
155
155
  dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
156
156
  }
157
157
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
158
+ helpers.dockerLoginInfo();
158
159
  if (installConfig.switches.isDaEnabled) {
159
160
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
160
161
  console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
@@ -106,6 +106,7 @@ const dockerSuccessMsg = installConfig => {
106
106
  const startDaWinMsg = `\nStart the Discovery Agent on a Windows machine`;
107
107
  dockerInfo = `To utilize the agents, pull the latest Docker images and run them using the appropriate supplied environment files, (${helpers.configFiles.DA_ENV_VARS}:`;
108
108
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
109
+ helpers.dockerLoginInfo();
109
110
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
110
111
  console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
111
112
  console.log(_chalk.default.cyan(`docker pull ${daImageVersion}`));
@@ -5,10 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.testables = exports.prompts = exports.installPreprocess = exports.gatewayConnectivity = exports.dockerPublicKey = exports.dockerPrivateKey = exports.completeInstall = exports.askOrganizationReplication = exports.askIsGatewayOnlyMode = exports.askConfigType = exports.askBundleTypeGWOnly = exports.askBundleType = exports.EdgeInstallMethods = exports.EdgeGWOnlyInstallMethods = exports.ConfigFiles = void 0;
7
7
  var _cliKit = require("cli-kit");
8
- var _fs = _interopRequireDefault(require("fs"));
9
8
  var _snooplogg = _interopRequireDefault(require("snooplogg"));
10
9
  var _basicPrompts = require("../../common/basicPrompts");
11
- var _dataService = require("../../common/dataService");
12
10
  var _Kubectl = require("../../common/Kubectl");
13
11
  var _types = require("../../common/types");
14
12
  var _utils = require("../../common/utils");
@@ -54,38 +52,6 @@ const prompts = exports.prompts = {
54
52
  enterGatewayManagerMode: 'Do you want to use API Manager with the API Gateway',
55
53
  askIfOrgReplication: 'Do you want to replicate your original organization structure for your newly discovered APIs? If yes, make sure the organization names match the team names that are created in Amplify platform'
56
54
  };
57
- const downloadV7AgentBundle = async (type, version) => {
58
- const fileName = type === _types.BundleType.DISCOVERY ? `discovery_agent-${version}.zip` : `traceability_agent-${version}.zip`;
59
- const url = type === _types.BundleType.DISCOVERY ? `/v7_discovery_agent/${version}/discovery_agent-${version}.zip` : `/v7_traceability_agent/${version}/traceability_agent-${version}.zip`;
60
- const service = await (0, _dataService.dataService)({
61
- baseUrl: _types.PublicRepoUrl,
62
- basePath: _types.BasePaths.V7Agents
63
- });
64
- try {
65
- const {
66
- stream
67
- } = await service.download(url);
68
- await helpers.streamPipeline(stream, _fs.default.createWriteStream(fileName));
69
- return fileName;
70
- } catch (err) {
71
- throw new Error(`Failed to download the agent: ${err.message}`);
72
- }
73
- };
74
- const downloadBinary = async (bundleType, version) => {
75
- const fileName = await downloadV7AgentBundle(bundleType, version);
76
- await helpers.unzip(fileName);
77
- _fs.default.unlinkSync(fileName);
78
- };
79
- const downloadBinaries = async installConfig => {
80
- console.log('Downloading and unpacking binary files...');
81
- if (installConfig.switches.isDaEnabled) {
82
- await downloadBinary(_types.BundleType.DISCOVERY, installConfig.daVersion);
83
- }
84
- if (installConfig.switches.isTaEnabled) {
85
- await downloadBinary(_types.BundleType.TRACEABILITY, installConfig.taVersion);
86
- }
87
- console.log('Downloading and unpacking is complete.');
88
- };
89
55
  const askIsGatewayOnlyMode = async () => {
90
56
  const mode = await (0, _basicPrompts.askList)({
91
57
  msg: prompts.enterGatewayManagerMode,
@@ -225,7 +191,7 @@ const generateSuccessHelpMsg = installConfig => {
225
191
  console.log(_cliKit.chalk.yellow(_agents.svcAccMsg));
226
192
  }
227
193
  if (configType === _types.AgentConfigTypes.BINARIES) {
228
- binarySuccessMsg(installConfig.centralConfig.ampcDosaInfo.isNew, installConfig.switches.isDaEnabled, installConfig.switches.isTaEnabled);
194
+ binarySuccessMsg(installConfig.centralConfig.ampcDosaInfo.isNew, installConfig.switches.isDaEnabled, installConfig.switches.isTaEnabled, installConfig.daVersion, installConfig.taVersion);
229
195
  } else if (configType === _types.AgentConfigTypes.DOCKERIZED) {
230
196
  dockerSuccessMsg(installConfig, verifiedEventsPath);
231
197
  } else if (installConfig.switches.isHelmInstall) {
@@ -238,11 +204,6 @@ const installPreprocess = async installConfig => {
238
204
  if (installConfig.deploymentType === _types.AgentConfigTypes.HELM && !installConfig.centralConfig.ampcDosaInfo.isNew) {
239
205
  [installConfig.centralConfig.dosaAccount.publicKey, installConfig.centralConfig.dosaAccount.privateKey] = await helpers.askPublicAndPrivateKeysPath();
240
206
  }
241
-
242
- // attempt to download the binaries prior to creating resources
243
- if (installConfig.switches.isBinaryInstall) {
244
- await downloadBinaries(installConfig);
245
- }
246
207
  return installConfig;
247
208
  };
248
209
  exports.installPreprocess = installPreprocess;
@@ -310,6 +271,7 @@ const dockerSuccessMsg = (installConfig, eventLogPath) => {
310
271
  dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
311
272
  }
312
273
  console.log(_cliKit.chalk.whiteBright(dockerInfo), '\n');
274
+ helpers.dockerLoginInfo();
313
275
  if (installConfig.switches.isDaEnabled) {
314
276
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
315
277
  console.log(_cliKit.chalk.white('Pull the latest image of the Discovery Agent:'));
@@ -327,7 +289,18 @@ const dockerSuccessMsg = (installConfig, eventLogPath) => {
327
289
  console.log('\t', _cliKit.chalk.cyan(`-v ${eventLogPath} -v /data ${taImageVersion}`));
328
290
  }
329
291
  };
330
- const binarySuccessMsg = (isNewDosa, isDaEnabled, isTaEnabled) => {
292
+ const binarySuccessMsg = (isNewDosa, isDaEnabled, isTaEnabled, daVersion, taVersion) => {
293
+ const baseUrl = 'https://repository.axway.com/artifactory/ampc-public-generic-release/v7-agents';
294
+ if (isDaEnabled) {
295
+ log(_cliKit.chalk.whiteBright('\nDownload the Discovery Agent binary:'));
296
+ log(_cliKit.chalk.cyan(`curl -O ${baseUrl}/v7_discovery_agent/${daVersion}/discovery_agent-${daVersion}.zip`));
297
+ log(_cliKit.chalk.cyan(`unzip discovery_agent-${daVersion}.zip`));
298
+ }
299
+ if (isTaEnabled) {
300
+ log(_cliKit.chalk.whiteBright('\nDownload the Traceability Agent binary:'));
301
+ log(_cliKit.chalk.cyan(`curl -O ${baseUrl}/v7_traceability_agent/${taVersion}/traceability_agent-${taVersion}.zip`));
302
+ log(_cliKit.chalk.cyan(`unzip traceability_agent-${taVersion}.zip`));
303
+ }
331
304
  const daFiles = [ConfigFiles.DAEnvVars, ConfigFiles.EdgeDABinaryFile, ConfigFiles.EdgeDAYaml];
332
305
  const taFiles = [ConfigFiles.TAEnvVars, ConfigFiles.EdgeTABinaryFile, ConfigFiles.EdgeTAYaml];
333
306
  const keys = ['private_key.pem', 'public_key.pem'];
@@ -126,6 +126,7 @@ const dockerSuccessMsg = installConfig => {
126
126
  dockerInfo = `To utilize the discovery agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.DA_ENV_VARS}):`;
127
127
  }
128
128
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
129
+ helpers.dockerLoginInfo();
129
130
  if (installConfig.switches.isDaEnabled) {
130
131
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
131
132
  console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getListByResource = exports.getLatestAgentVersion = exports.getEnvironmentId = exports.getCurrentUserOrgId = void 0;
7
7
  var _snooplogg = _interopRequireDefault(require("snooplogg"));
8
8
  var _CoreConfigController = require("../../../common/CoreConfigController");
9
- var _dataService = require("../../../common/dataService");
10
- var _types = require("../../../common/types");
11
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
10
  const {
13
11
  log
@@ -49,45 +47,18 @@ const getEnvironmentId = async (client, defsManager, environmentName, scopeName)
49
47
  return (_resource$data = resource.data) !== null && _resource$data !== void 0 && _resource$data.metadata ? resource.data.metadata.id || '' : '';
50
48
  };
51
49
  exports.getEnvironmentId = getEnvironmentId;
52
- const getLatestAgentVersion = async agent => {
50
+ const getLatestAgentVersion = async (client, agentName) => {
53
51
  try {
54
- const service = await (0, _dataService.dataService)({
55
- baseUrl: _types.PublicRepoUrl,
56
- basePath: _types.BasePaths.DockerAgentAPIRepoPath
57
- });
58
- const response = await service.get(`/${agent}/tags/list`, {
59
- // docker api requires auth, even if its just anonymous
60
- Authorization: `Basic ${Buffer.from('anonymous:').toString('base64')}`
61
- }, true);
62
- if (response.tags.length === 0) {
63
- return 'latest';
52
+ var _componentDef$spec, _componentDef$spec$la;
53
+ const componentDef = await client.getComponentDefinitionsByName(agentName);
54
+ const version = (_componentDef$spec = componentDef.spec) === null || _componentDef$spec === void 0 ? void 0 : (_componentDef$spec$la = _componentDef$spec.latest) === null || _componentDef$spec$la === void 0 ? void 0 : _componentDef$spec$la.version;
55
+ if (version) {
56
+ log(`Latest Version (${agentName}): ${version}`);
57
+ return version;
64
58
  }
65
- const latestVersion = response.tags.reduce((prev, current) => {
66
- // skip any tags that are latest
67
- if (prev === 'latest') {
68
- return current;
69
- } else if (current === 'latest') {
70
- return prev;
71
- }
72
-
73
- // find the largest tag
74
- const [pMajor, pMinor, pPatch] = prev.split('.').map(Number);
75
- const [cMajor, cMinor, cPatch] = current.split('.').map(Number);
76
- if (cMajor > pMajor) {
77
- return current;
78
- }
79
- if (cMajor == pMajor && cMinor > pMinor) {
80
- return current;
81
- }
82
- if (cMajor == pMajor && cMinor == pMinor && cPatch > pPatch) {
83
- return current;
84
- }
85
- return prev;
86
- });
87
- log(`Latest Version (${agent}): ${latestVersion}`);
88
- return latestVersion;
59
+ return 'latest';
89
60
  } catch (e) {
90
- log('Error hit retrieving latest version of agent, setting tag to latest');
61
+ log('Error retrieving latest version, setting tag to latest');
91
62
  log(e);
92
63
  return 'latest';
93
64
  }
@@ -3,9 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.helmInstallInfo = exports.helmImageSecretInfo = void 0;
6
+ exports.helmInstallInfo = exports.helmImageSecretInfo = exports.dockerLoginMsg = exports.dockerLoginInfo = void 0;
7
7
  var _chalk = _interopRequireDefault(require("chalk"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ const dockerLoginMsg = () => {
10
+ return `${_chalk.default.white('Login to the Axway Docker repository:')}
11
+ ${_chalk.default.cyan('docker login docker.repository.axway.com --username <client_id> --password <client_secret>')}
12
+ ${_chalk.default.white('* client_id - service account id for your Amplify Platform organization')}
13
+ ${_chalk.default.white('* client_secret - service account secret for your Amplify Platform organization')}
14
+ `;
15
+ };
16
+ exports.dockerLoginMsg = dockerLoginMsg;
17
+ const dockerLoginInfo = () => {
18
+ console.log(dockerLoginMsg());
19
+ };
20
+ exports.dockerLoginInfo = dockerLoginInfo;
9
21
  const helmImageSecretInfo = async namespace => {
10
22
  let dockerSecretCmd = `kubectl create secret docker-registry <image-pull-secret-name> --namespace ${namespace} \\`;
11
23
  dockerSecretCmd += `\n --docker-server=docker.repository.axway.com \\`;
@@ -132,6 +132,7 @@ const dockerSuccessMsg = installConfig => {
132
132
  dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
133
133
  }
134
134
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
135
+ helpers.dockerLoginInfo();
135
136
  if (installConfig.switches.isDaEnabled) {
136
137
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
137
138
  console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
@@ -253,6 +253,7 @@ const dockerSuccessMsg = installConfig => {
253
253
  dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
254
254
  }
255
255
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
256
+ helpers.dockerLoginInfo();
256
257
  if (installConfig.switches.isDaEnabled) {
257
258
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
258
259
  console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
@@ -128,6 +128,7 @@ const dockerSuccessMsg = installConfig => {
128
128
  dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
129
129
  }
130
130
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
131
+ helpers.dockerLoginInfo();
131
132
  if (installConfig.switches.isDaEnabled) {
132
133
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
133
134
  console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
@@ -149,6 +149,7 @@ const dockerSuccessMsg = installConfig => {
149
149
  dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
150
150
  }
151
151
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
152
+ helpers.dockerLoginInfo();
152
153
  if (installConfig.switches.isDaEnabled) {
153
154
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
154
155
  console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
@@ -111,6 +111,7 @@ const dockerSuccessMsg = installConfig => {
111
111
  dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
112
112
  }
113
113
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
114
+ helpers.dockerLoginInfo();
114
115
  if (installConfig.switches.isDaEnabled) {
115
116
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
116
117
  console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
@@ -162,6 +162,7 @@ const dockerSuccessMsg = installConfig => {
162
162
  if (installConfig.switches.isTaEnabled) {
163
163
  dockerInfo = `To utilize the agent, pull the latest Docker image and run it using the appropriate supplied environment file, (${helpers.configFiles.AGENT_ENV_VARS}):`;
164
164
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
165
+ helpers.dockerLoginInfo();
165
166
  const caImageVersion = `${caImage}:${installConfig.taVersion}`;
166
167
  console.log(_chalk.default.white('Pull the latest image of the Agent:'));
167
168
  console.log(_chalk.default.cyan(`docker pull ${caImageVersion}`));
@@ -101,6 +101,7 @@ const dockerSuccessMsg = installConfig => {
101
101
  dockerInfo = `To utilize the traceability agent, pull the latest Docker image and run it using the supplied environment file, (${helpers.configFiles.TA_ENV_VARS}):`;
102
102
  }
103
103
  console.log(_chalk.default.whiteBright(dockerInfo), '\n');
104
+ helpers.dockerLoginInfo();
104
105
  if (installConfig.switches.isDaEnabled) {
105
106
  const daImageVersion = `${daImage}:${installConfig.daVersion}`;
106
107
  console.log(_chalk.default.white('Pull the latest image of the Discovery Agent:'));
@@ -777,6 +777,22 @@ class ApiServerClient {
777
777
  throw e;
778
778
  }
779
779
  }
780
+ async getComponentDefinitionsByName(componentName, version = ApiServerVersions.v1alpha1) {
781
+ log('ApiServerClient.getComponentDefinitionsByName');
782
+ log('get component definitions');
783
+ try {
784
+ const service = await (0, _dataService.dataService)({
785
+ baseUrl: this.baseUrl,
786
+ region: this.region,
787
+ account: this.account
788
+ });
789
+ const component = await service.get(`/definitions/${version}/components/${componentName}`);
790
+ return component;
791
+ } catch (e) {
792
+ log('get component definitions, error: ', e);
793
+ throw e;
794
+ }
795
+ }
780
796
 
781
797
  /**
782
798
  * BULK CALLS
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.docsUrl = exports.commonCmdArgsDescription = exports.cliVersionHeader = exports.YesNoChoices = exports.YesNo = exports.WAIT_TIMEOUT = exports.TrueFalseChoices = exports.TrueFalse = exports.TraceableRegionType = exports.TraceabilityConfig = exports.SaaSGatewayTypes = exports.Regions = exports.PublicRepoUrl = exports.PublicDockerRepoBaseUrl = exports.Protocol = exports.ProdBaseUrls = exports.PreprodRegions = exports.PreprodBaseUrls = exports.Platforms = exports.OutputTypes = exports.MAX_TABLE_STRING_LENGTH = exports.MAX_FILE_SIZE = exports.MAX_CACHE_FILE_SIZE = exports.LoggingSource = exports.LanguageTypes = exports.KindTypes = exports.Kind = exports.IstioProfileChoices = exports.IstioInstallValues = exports.IstioAgentValues = exports.IDPType = exports.IDPConfiguration = exports.IDPClientSecretAuthMethod = exports.IDPAuthType = exports.IDPAuthConfiguration = exports.IDPAuthClientSecret = exports.IDPAuthAccessToken = exports.GatewayTypes = exports.GatewayTypeToDataPlane = exports.GatewayMode = exports.EnvironmentConfigInfo = exports.DosaAccount = exports.DataPlaneNames = exports.DOSAConfigInfo = exports.ConfigTypes = exports.CloudFormationConfig = exports.Certificate = exports.CentralAgentConfig = exports.CACHE_FILE_TTL_MILLISECONDS = exports.BundleType = exports.BasePaths = exports.AzureDataplaneMode = exports.AuthUrls = exports.ApigeeMetricsFilterConfig = exports.AgentTypes = exports.AgentResourceKind = exports.AgentNames = exports.AgentInstallSwitches = exports.AgentInstallConfig = exports.AgentConfigTypes = exports.AWSRegions = exports.APIGEEXDISCOVERYMODES = exports.APIGEEXAuthType = exports.APICDeployments = exports.ABORT_TIMEOUT = void 0;
6
+ exports.docsUrl = exports.commonCmdArgsDescription = exports.cliVersionHeader = exports.YesNoChoices = exports.YesNo = exports.WAIT_TIMEOUT = exports.TrueFalseChoices = exports.TrueFalse = exports.TraceableRegionType = exports.TraceabilityConfig = exports.SaaSGatewayTypes = exports.Regions = exports.PublicDockerRepoBaseUrl = exports.Protocol = exports.ProdBaseUrls = exports.PreprodRegions = exports.PreprodBaseUrls = exports.Platforms = exports.OutputTypes = exports.MAX_TABLE_STRING_LENGTH = exports.MAX_FILE_SIZE = exports.MAX_CACHE_FILE_SIZE = exports.LoggingSource = exports.LanguageTypes = exports.KindTypes = exports.Kind = exports.IstioProfileChoices = exports.IstioInstallValues = exports.IstioAgentValues = exports.IDPType = exports.IDPConfiguration = exports.IDPClientSecretAuthMethod = exports.IDPAuthType = exports.IDPAuthConfiguration = exports.IDPAuthClientSecret = exports.IDPAuthAccessToken = exports.GatewayTypes = exports.GatewayTypeToDataPlane = exports.GatewayMode = exports.EnvironmentConfigInfo = exports.DosaAccount = exports.DataPlaneNames = exports.DOSAConfigInfo = exports.ConfigTypes = exports.ComponentType = exports.CloudFormationConfig = exports.Certificate = exports.CentralAgentConfig = exports.CACHE_FILE_TTL_MILLISECONDS = exports.BundleType = exports.BasePaths = exports.AzureDataplaneMode = exports.AuthUrls = exports.ApigeeMetricsFilterConfig = exports.AgentTypes = exports.AgentResourceKind = exports.AgentNames = exports.AgentInstallSwitches = exports.AgentInstallConfig = exports.AgentConfigTypes = exports.AWSRegions = exports.APIGEEXDISCOVERYMODES = exports.APIGEEXAuthType = exports.APICDeployments = exports.ABORT_TIMEOUT = void 0;
7
7
  var _utils = require("./utils");
8
8
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
9
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -38,16 +38,14 @@ let Kind = exports.Kind = /*#__PURE__*/function (Kind) {
38
38
  * NOTE: order of this array is used to orchestrate bulk api calls (see utils/compareDocsByKind)
39
39
  */
40
40
  const KindTypes = exports.KindTypes = [Kind.Environment, Kind.APIService, Kind.APIServiceRevision, Kind.APIServiceInstance, Kind.Secret, Kind.Webhook, Kind.ConsumerSubscriptionDefinition, Kind.ConsumerInstance];
41
- const PublicRepoUrl = exports.PublicRepoUrl = 'https://axway.jfrog.io';
42
- const PublicDockerRepoBaseUrl = exports.PublicDockerRepoBaseUrl = 'axway.jfrog.io/ampc-public-docker-release';
41
+ const PublicDockerRepoBaseUrl = exports.PublicDockerRepoBaseUrl = 'docker.repository.axway.com';
43
42
  let BasePaths = exports.BasePaths = /*#__PURE__*/function (BasePaths) {
44
43
  BasePaths["ApiServer"] = "/apis";
45
44
  BasePaths["ApiCentral"] = "/api/v1";
46
45
  BasePaths["Platform"] = "/platform/api/v1";
47
46
  BasePaths["V7Agents"] = "/artifactory/ampc-public-generic-release/v7-agents";
48
47
  BasePaths["AWSAgents"] = "/artifactory/ampc-public-generic-release/aws-agents";
49
- BasePaths["DockerAgentPublicRepo"] = "/agent";
50
- BasePaths["DockerAgentAPIRepoPath"] = "/artifactory/api/docker/ampc-public-docker-release/v2/agent";
48
+ BasePaths["DockerAgentPublicRepo"] = "/ampc-docker-prod/1.2";
51
49
  return BasePaths;
52
50
  }({});
53
51
  let ConfigTypes = exports.ConfigTypes = /*#__PURE__*/function (ConfigTypes) {
@@ -175,6 +173,13 @@ const IstioProfileChoices = exports.IstioProfileChoices = [{
175
173
  name: 'preview',
176
174
  value: 'preview'
177
175
  }];
176
+ let ComponentType = exports.ComponentType = /*#__PURE__*/function (ComponentType) {
177
+ ComponentType["Agent"] = "agent";
178
+ ComponentType["DA"] = "DiscoveryAgent";
179
+ ComponentType["TA"] = "TraceabilityAgent";
180
+ ComponentType["CA"] = "ComplianceAgent";
181
+ return ComponentType;
182
+ }({});
178
183
  // exporting for tests
179
184
  let AgentConfigTypes = exports.AgentConfigTypes = /*#__PURE__*/function (AgentConfigTypes) {
180
185
  AgentConfigTypes["HOSTED"] = "Hosted";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axway/axway-central-cli",
3
- "version": "4.12.0",
3
+ "version": "4.13.0-rc.1",
4
4
  "description": "Manage APIs, services and publish to the Amplify Marketplace",
5
5
  "homepage": "https://platform.axway.com",
6
6
  "author": {