@eui/tools 6.15.1 → 6.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 6.15.1
1
+ 6.15.2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 6.15.2 (2023-12-16)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * remove app-history metadata storage - adapt pipeline config location to root - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([0b05424a](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/0b05424a61740d383afb052b887895b59080e7f6))
7
+
8
+ * * *
9
+ * * *
1
10
  ## 6.15.1 (2023-12-15)
2
11
 
3
12
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.15.1",
3
+ "version": "6.15.2",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
package/sandbox.js CHANGED
@@ -1469,11 +1469,11 @@ const publishUtils = require('./scripts/utils/publish/publish-utils');
1469
1469
  // .then(() => {
1470
1470
  // const dPath = path.join(process.cwd(), 'packages', 'devops-metadata');
1471
1471
  // let files = tools.getFiles(dPath);
1472
- // files = files.filter(f => f.indexOf('-lib-') > -1);
1472
+ // files = files.filter(f => f.indexOf('-ui-history-metadata.json') > -1);
1473
1473
  // console.log(files.length);
1474
1474
  // files.forEach(f => {
1475
1475
  // console.log(f);
1476
- // // tools.remove(path.join(dPath, f));
1476
+ // tools.remove(path.join(dPath, f));
1477
1477
  // });
1478
1478
  // })
1479
1479
 
@@ -1488,16 +1488,25 @@ const publishUtils = require('./scripts/utils/publish/publish-utils');
1488
1488
  // })
1489
1489
 
1490
1490
 
1491
+ // Promise.resolve()
1492
+ // .then(() => {
1493
+ // const remote = configUtils.remotes.getRemote('cc-pmm-participants-eui15-remote-el-ui');
1494
+ // return metadataUtils.remoteHistory.generateDiffCommitsMetadataReport(remote, 'TRN');
1495
+ // })
1496
+
1497
+ // .then((finalOutput) => {
1498
+ // console.log(finalOutput);
1499
+ // })
1500
+
1501
+ // .catch((e) => {
1502
+ // console.log(e);
1503
+ // })
1504
+
1491
1505
  Promise.resolve()
1492
1506
  .then(() => {
1493
- const remote = configUtils.remotes.getRemote('cc-pmm-participants-eui15-remote-el-ui');
1494
- return metadataUtils.remoteHistory.generateDiffCommitsMetadataReport(remote, 'TRN');
1495
- })
1496
-
1497
- .then((finalOutput) => {
1498
- console.log(finalOutput);
1499
- })
1507
+ const config = configUtils.global.getConfig();
1508
+ console.log(config);
1500
1509
 
1501
- .catch((e) => {
1502
- console.log(e);
1510
+ const isSonarEnabled = metadataUtils.common.isSonarEnabled();
1511
+ console.log(isSonarEnabled);
1503
1512
  })
@@ -143,7 +143,7 @@ const getGeneratedConfig = (euircBaseFile) => {
143
143
  }
144
144
 
145
145
 
146
- module.exports.getConfig = () => {
146
+ const getConfig = module.exports.getConfig = () => {
147
147
  let configFile;
148
148
  let isCsdr;
149
149
 
@@ -157,7 +157,7 @@ module.exports.getConfig = () => {
157
157
 
158
158
  if (!tools.isFileExists(configFile)) {
159
159
  tools.logError('ERROR!!! .euirc file missing - use npm run init to generate it ');
160
- throw 'CONFIG_FILE_NOT_FOUND';
160
+ throw new Error('CONFIG_FILE_NOT_FOUND');
161
161
  }
162
162
 
163
163
  if (isCsdr) {
@@ -241,7 +241,6 @@ module.exports.getConfigOptions = () => {
241
241
  DEVOPS_METADATA_LOCKS_REPOSITORY: null,
242
242
  DEVOPS_METADATA_PATH: null,
243
243
  DEVOPS_METADATA_LOCKS_PATH: null,
244
- DEVOPS_CONFIG_JSON: '.devops-config.json',
245
244
  CSDR_REMOTES_CONFIG_REPOSITORY: null,
246
245
  CSDR_REMOTES_CONFIG_PATH: null,
247
246
  ISSUES_MANAGER_HOST: null,
@@ -489,3 +488,48 @@ module.exports.getCustomConfig = () => {
489
488
  return null;
490
489
  }
491
490
  }
491
+
492
+
493
+
494
+ const checkPipelineEnabled = (assetName, pipelineType) => {
495
+ tools.logTitle(`Checking pipeline enabled flags for - ${pipelineType}`);
496
+ const pipelineConfig = getConfig().pipeline;
497
+ console.log(pipelineConfig);
498
+
499
+ if (pipelineConfig && pipelineConfig.enabledFlags && pipelineConfig.enabledFlags[pipelineType]) {
500
+ return;
501
+ } else {
502
+ if (assetName && pipelineConfig.enabledFlags.bypassPackages && pipelineConfig.enabledFlags.bypassPackages[assetName]) {
503
+ tools.logInfo(`Package : [${assetName}] enabled bypass activated`);
504
+ return;
505
+ } else {
506
+ throw new Error('GLOBAL_PIPELINE_DISABLED');
507
+ }
508
+ }
509
+ }
510
+
511
+ module.exports.isPipelineEnabled = (pkg) => {
512
+ if (pkg) {
513
+ if (pkg.backend) {
514
+ return checkPipelineEnabled(pkg.name, 'backend');
515
+ } else {
516
+ return checkPipelineEnabled(pkg.name, 'frontend');
517
+ }
518
+
519
+ } else {
520
+ return checkPipelineEnabled(null, 'app');
521
+ }
522
+ }
523
+
524
+
525
+ module.exports.isSonarEnabled = () => {
526
+ tools.logTitle(`Checking sonar enabled flag`);
527
+ const pipelineConfig = getConfig().pipeline;
528
+ console.log(pipelineConfig);
529
+
530
+ if (pipelineConfig && pipelineConfig.sonarEnabled) {
531
+ return true;
532
+ }
533
+
534
+ return false;
535
+ }
@@ -3,7 +3,6 @@
3
3
  // GLOBAL
4
4
  const path = require('path');
5
5
  const moment = require('moment');
6
- // const sanitizeHtml = require('sanitize-html');
7
6
 
8
7
  // LOCAL
9
8
  const tools = require('../../utils/tools');
@@ -43,7 +42,8 @@ const storeMetadata = (project, newVersion, metadata, envTarget) => {
43
42
 
44
43
  const metadataFile = path.join(DEVOPS_METADATA_PATH, project.devopsEnvsMetadataFile);
45
44
 
46
- var generatedMetadata;
45
+ let generatedMetadata;
46
+
47
47
  if (tools.isFileExists(metadataFile)) {
48
48
  generatedMetadata = require(metadataFile);
49
49
  } else {
@@ -3,7 +3,6 @@
3
3
  // GLOBAL
4
4
  const path = require('path');
5
5
  const execa = require('execa');
6
- // const sanitizeHtml = require('sanitize-html');
7
6
  const moment = require('moment');
8
7
  const semver = require('semver');
9
8
 
@@ -55,24 +54,24 @@ const storeMetadata = (project, diffMetadata, newVersion, envTarget) => {
55
54
 
56
55
  return Promise.resolve()
57
56
 
58
- // flatten jira key list from diffMetadata extracted
59
- .then(() => {
60
- diffMetadata.forEach((pkg) => {
61
- pkg.gitMetadata.forEach((gitMetadata) => {
62
- gitMetadata.forEach((v) => {
63
- if (v.issue) flatJiraList.push(v.issue);
64
- })
65
- })
66
- })
57
+ // // flatten jira key list from diffMetadata extracted
58
+ // .then(() => {
59
+ // diffMetadata.forEach((pkg) => {
60
+ // pkg.gitMetadata.forEach((gitMetadata) => {
61
+ // gitMetadata.forEach((v) => {
62
+ // if (v.issue) flatJiraList.push(v.issue);
63
+ // })
64
+ // })
65
+ // })
67
66
 
68
- flatJiraList = tools.removeArrayDuplicates(flatJiraList);
69
- })
67
+ // flatJiraList = tools.removeArrayDuplicates(flatJiraList);
68
+ // })
70
69
 
71
70
  // store the history file
72
71
  .then(() => {
73
72
  const historyFile = path.join(DEVOPS_METADATA_PATH, project.devopsHistoryMetadataFile);
74
73
 
75
- var versions = [];
74
+ let versions = [];
76
75
 
77
76
  if (tools.isFileExists(historyFile)) {
78
77
  historyMetadata = require(historyFile);
@@ -84,14 +83,14 @@ const storeMetadata = (project, diffMetadata, newVersion, envTarget) => {
84
83
  name: newVersion,
85
84
  diffs: diffMetadata,
86
85
  envTarget: envTarget,
87
- issues: flatJiraList
86
+ // issues: flatJiraList
88
87
  });
89
88
 
90
89
  } else {
91
90
  versions.push({
92
91
  name: newVersion,
93
92
  diffs: diffMetadata,
94
- issues: flatJiraList
93
+ // issues: flatJiraList
95
94
  });
96
95
  }
97
96
 
@@ -103,20 +102,20 @@ const storeMetadata = (project, diffMetadata, newVersion, envTarget) => {
103
102
 
104
103
  })
105
104
 
106
- // storing issuesList gathered into gitlab variables for post CI processing
107
- .then(() => {
108
- if (!flatJiraList) {
109
- tools.logWarning('No issues found for this release');
105
+ // // storing issuesList gathered into gitlab variables for post CI processing
106
+ // .then(() => {
107
+ // if (!flatJiraList) {
108
+ // tools.logWarning('No issues found for this release');
110
109
 
111
- } else {
112
- const issuesList = flatJiraList.join(',');
113
- tools.logInfo(`Unique issues found for this version : ${issuesList}`);
110
+ // } else {
111
+ // const issuesList = flatJiraList.join(',');
112
+ // tools.logInfo(`Unique issues found for this version : ${issuesList}`);
114
113
 
115
- if (!dryRun) {
116
- return pipelineUtils.setVariables(project.paths.rootPath, `export ISSUES_LIST=${issuesList}\n`);
117
- }
118
- }
119
- })
114
+ // if (!dryRun) {
115
+ // return pipelineUtils.setVariables(project.paths.rootPath, `export ISSUES_LIST=${issuesList}\n`);
116
+ // }
117
+ // }
118
+ // })
120
119
 
121
120
 
122
121
  .then(() => {
@@ -140,8 +139,6 @@ const getDiffBetweenBuildVersions = (fromBuildMetadata, toBuildMetadata, hasHist
140
139
 
141
140
  tools.logInfo(`Fetching diffs between ${fromBuildMetadata.name} and ${toBuildMetadata.name}`);
142
141
 
143
- const DEVOPS_METADATA_PATH = configUtils.global.getConfigOptions().DEVOPS_METADATA_PATH;
144
-
145
142
  return Promise.resolve()
146
143
  .then(() => {
147
144
  // get differences from old in previous major release to new currently generated
@@ -159,48 +156,7 @@ const getDiffBetweenBuildVersions = (fromBuildMetadata, toBuildMetadata, hasHist
159
156
  item.package.indexOf('@eui') === -1;
160
157
  })
161
158
 
162
- // Iterate over the
163
- const mappedPkg = cleanDiffs.map((item) => {
164
-
165
- tools.logInfo(`parsing item : ${item.package}`);
166
-
167
- // getting the package name from the devops central metadata
168
- const pkg = configUtils.packages.getPackageByNpmPkg(item.package, true);
169
- let pkgName;
170
- if (pkg) {
171
- pkgName = pkg.name;
172
- }
173
-
174
- tools.logInfo('checking package : ' + pkgName);
175
-
176
- // getting package file metadata
177
- const packageMetadataFile = path.join(DEVOPS_METADATA_PATH, pkgName + '-build-metadata.json');
178
-
179
- if (tools.isFileExists(packageMetadataFile)) {
180
-
181
- const packageMetadata = require(packageMetadataFile);
182
-
183
- // extracting versions history arry
184
- const fromVersionIdx = packageMetadata.versions.findIndex(v => v.name === item.old);
185
- const toVersionIdx = packageMetadata.versions.findIndex(v => v.name === item.new);
186
-
187
- // slice the array with only the versions changed
188
- const diffVersions = packageMetadata.versions.slice(fromVersionIdx + 1, toVersionIdx + 1);
189
-
190
- // accumulate git metadata for the versions found for the release
191
- var accGitMetadata = diffVersions.reduce((acc, k) => {
192
- const gitCommits = k.gitMetadata.commits.map((item) => {
193
- return { issue: item.issue, subject: item.subject }
194
- })
195
- acc.push(gitCommits);
196
- return acc;
197
- }, []);
198
-
199
- return { name: pkgName, old: item.old, new: item.new, gitMetadata: accGitMetadata };
200
- }
201
- })
202
-
203
- return mappedPkg;
159
+ return cleanDiffs;
204
160
  })
205
161
 
206
162
  .catch((e) => {
@@ -227,7 +183,6 @@ const getDiffByEnvTarget = (project, envTarget) => {
227
183
 
228
184
  if (!fromVersion || !toVersion) {
229
185
  tools.logWarning('WARNING: could not find versions matching for generating diff report');
230
- return;
231
186
  } else {
232
187
  return getDiffBetweenBuildVersions(fromVersion, toVersion, hasHistory);
233
188
  }
@@ -264,8 +219,8 @@ const getDiffBetweenMajors = (project, fromVersion, toVersion, isSupportBranch)
264
219
  })
265
220
 
266
221
  // Getting the version objects, by default if not provided take the latest previous
267
- var fromMajorVersionIdx;
268
- var toMajorVersionIdx;
222
+ let fromMajorVersionIdx;
223
+ let toMajorVersionIdx;
269
224
 
270
225
  if (fromVersion) {
271
226
  fromMajorVersionIdx = appMajorVersions.findIndex(v => v.name === fromVersion);
@@ -332,7 +287,7 @@ const flattenDiffMetadata = (metadata) => {
332
287
  return Promise.resolve()
333
288
  .then(() => {
334
289
  return metadata.map((item) => {
335
- return { package: item.name, fromVersion: item.old, toVersion: item.new };
290
+ return { package: item.package, fromVersion: item.old, toVersion: item.new };
336
291
  });
337
292
  })
338
293
 
@@ -33,18 +33,17 @@ module.exports.getMetadata = (project) => {
33
33
 
34
34
  module.exports.storeMetadata = (project, newVersion, envTarget) => {
35
35
  const appReleaseDate = moment(new Date()).format("DD/MM/YYYY HH:mm");
36
- const appInfos = `${newVersion} - ${appReleaseDate}`;
37
36
  const DEVOPS_METADATA_PATH = configUtils.global.getConfigOptions().DEVOPS_METADATA_PATH;
38
37
 
39
38
  return Promise.resolve()
40
39
  .then(() => {
41
40
  tools.logTitle('Storing application versions metadata...');
42
41
 
43
-
44
42
  const metadataFile = path.join(DEVOPS_METADATA_PATH, project.devopsVersionsMetadataFile);
45
43
 
46
- var generatedMetadata;
47
- var versions;
44
+ let generatedMetadata;
45
+ let versions;
46
+
48
47
  if (tools.isFileExists(metadataFile)) {
49
48
  generatedMetadata = require(metadataFile);
50
49
  versions = generatedMetadata.versions;
@@ -41,8 +41,8 @@ const storeMetadata = (project, newVersion, metadata, envTarget) => {
41
41
  .then(() => {
42
42
  tools.logTitle('Storing application metadata...');
43
43
 
44
- var generatedMetadata;
45
- var versions;
44
+ let generatedMetadata;
45
+ let versions;
46
46
 
47
47
  const metadataFile = path.join(DEVOPS_METADATA_PATH, project.devopsMetadataFile);
48
48
 
@@ -25,10 +25,6 @@ const getMetadata = (pkg, opts) => {
25
25
  buildMetadata.commits = commits;
26
26
 
27
27
  if (commits.length !== 0) {
28
- // tools.logInfo('Extracted commits : ');
29
- // commits.forEach((commit) => {
30
- // tools.logInfo('commit : ' + JSON.stringify(commit));
31
- // });
32
28
  tools.logSuccess();
33
29
  } else {
34
30
  tools.logInfo('No valid commit found');
@@ -94,7 +90,7 @@ const extractCommits = (pkg, opts) => {
94
90
 
95
91
  return Promise.resolve()
96
92
  .then(() => {
97
- var tag;
93
+ let tag;
98
94
 
99
95
  if (opts.fromTag) {
100
96
  tag = opts.fromTag;
@@ -108,7 +104,7 @@ const extractCommits = (pkg, opts) => {
108
104
  return tag;
109
105
  })
110
106
  .then((tag) => {
111
- var revisions;
107
+ let revisions;
112
108
 
113
109
  if (tag) {
114
110
  tag = tag.toString().trim();
@@ -130,9 +126,8 @@ const extractCommits = (pkg, opts) => {
130
126
  return null;
131
127
  }
132
128
 
133
- var lines = raw.split('\n');
134
- var commit = {};
135
- var parsedMessage;
129
+ let lines = raw.split('\n');
130
+ let commit = {};
136
131
 
137
132
  commit.hash = lines[0];
138
133
  commit.subject = lines[1];
@@ -143,7 +138,7 @@ const extractCommits = (pkg, opts) => {
143
138
  commit.breakingChange = false;
144
139
 
145
140
  if (commit.body) {
146
- var parsedIssueBody = commit.body.match(ISSUE_PATTERN);
141
+ let parsedIssueBody = commit.body.match(ISSUE_PATTERN);
147
142
  if (parsedIssueBody) {
148
143
  commit.issue = parsedIssueBody[0];
149
144
  }
@@ -156,8 +151,8 @@ const extractCommits = (pkg, opts) => {
156
151
 
157
152
  commit.originalSubject = commit.subject;
158
153
 
159
- var parsed = commit.subject.match(COMMIT_PATTERN);
160
- var parsedIssue = commit.subject.match(ISSUE_PATTERN);
154
+ let parsed = commit.subject.match(COMMIT_PATTERN);
155
+ let parsedIssue = commit.subject.match(ISSUE_PATTERN);
161
156
 
162
157
  if (!parsed || !parsed[1]) {
163
158
  if (commit.subject.indexOf('Merge pull request') === -1 &&
@@ -239,7 +234,7 @@ const checkCommitsMetadata = (metadata) => {
239
234
  if (!metadata.commits || metadata.commits.length === 0) {
240
235
  tools.logError('ERROR : no valid commit found since last release');
241
236
  if (!skipCommitChecks) {
242
- throw 'NO_VALID_COMMIT_FOUND';
237
+ throw new Error('NO_VALID_COMMIT_FOUND');
243
238
  }
244
239
  }
245
240
 
@@ -247,7 +242,7 @@ const checkCommitsMetadata = (metadata) => {
247
242
  if (!metadata.issues || metadata.issues.length === 0) {
248
243
  tools.logError('ERROR : no issue found since last release');
249
244
  if (!skipCommitChecks) {
250
- throw 'NO_ISSUE_FOUND';
245
+ throw new Error('NO_ISSUE_FOUND');
251
246
  }
252
247
  }
253
248
 
@@ -52,89 +52,3 @@ module.exports.cloneMetadataLocksRepo = () => {
52
52
  })
53
53
  }
54
54
  }
55
-
56
-
57
- const getDevopsConfig = () => {
58
- const configOptions = configUtils.global.getConfigOptions();
59
- const DEVOPS_METADATA_PATH = configOptions.DEVOPS_METADATA_PATH;
60
- const DEVOPS_CONFIG_JSON = configOptions.DEVOPS_CONFIG_JSON;
61
-
62
- return Promise.resolve()
63
- .then(() => {
64
- if (!DEVOPS_METADATA_PATH) {
65
- throw new Error(`Devops metadata folder ${DEVOPS_METADATA_PATH} NOT FOUND`);
66
- }
67
-
68
- return tools.getJsonFileContent(
69
- path.join(DEVOPS_METADATA_PATH, DEVOPS_CONFIG_JSON)
70
- );
71
- })
72
- .catch((e) => {
73
- throw e;
74
- })
75
- }
76
-
77
-
78
- const checkPipelineEnabled = (assetName, pipelineType) => {
79
- return Promise.resolve()
80
- .then(() => {
81
- return getDevopsConfig();
82
- })
83
-
84
- .then((config) => {
85
- tools.logTitle(`Checking pipeline enabled flags for - ${pipelineType}`);
86
- console.log(config);
87
-
88
- if (config && config.enabledFlags && config.enabledFlags[pipelineType]) {
89
- return;
90
- } else {
91
- if (assetName && config.enabledFlags.bypassPackages && config.enabledFlags.bypassPackages[assetName]) {
92
- tools.logInfo(`Package : [${assetName}] enabled bypass activated`);
93
- return;
94
- } else {
95
- throw 'GLOBAL_PIPELINE_DISABLED';
96
- }
97
- }
98
- })
99
-
100
- .catch((e) => {
101
- throw e;
102
- })
103
- }
104
-
105
-
106
- module.exports.isPipelineEnabled = (pkg) => {
107
- if (pkg) {
108
- if (pkg.backend) {
109
- return checkPipelineEnabled(pkg.name, 'backend');
110
- } else {
111
- return checkPipelineEnabled(pkg.name, 'frontend');
112
- }
113
-
114
- } else {
115
- return checkPipelineEnabled(null, 'app');
116
- }
117
- }
118
-
119
-
120
- module.exports.isSonarEnabled = () => {
121
- return Promise.resolve()
122
- .then(() => {
123
- return getDevopsConfig();
124
- })
125
-
126
- .then((config) => {
127
- tools.logTitle(`Checking sonar enabled flag`);
128
- console.log(config);
129
-
130
- if (config && config.sonarEnabled) {
131
- return true;
132
- } else {
133
- return false;
134
- }
135
- })
136
-
137
- .catch((e) => {
138
- throw e;
139
- })
140
- }
@@ -309,7 +309,7 @@ module.exports.storeMetadataHistory = (pkg, metadata, newVersion) => {
309
309
  .then(() => {
310
310
  const historyFile = path.join(DEVOPS_METADATA_PATH, pkg.devopsHistoryMetadataFile);
311
311
 
312
- var versions = [];
312
+ let versions = [];
313
313
 
314
314
  if (tools.isFileExists(historyFile)) {
315
315
  historyMetadata = require(historyFile);
@@ -76,7 +76,7 @@ module.exports.run = () => {
76
76
  // *****************************************************************
77
77
  .then(() => {
78
78
  // check if global flag is enabled, if not enabled, this will throw a GLOBAL_PIPELINE_DISABLED exception
79
- return metadataUtils.common.isPipelineEnabled();
79
+ return configUtils.global.isPipelineEnabled();
80
80
  })
81
81
 
82
82
  // *****************************************************************
@@ -107,7 +107,7 @@ module.exports.run = () => {
107
107
  // *****************************************************************
108
108
  .then(() => {
109
109
  // check if global flag is enabled, if not enabled, this will throw a GLOBAL_PIPELINE_DISABLED exception
110
- return metadataUtils.common.isPipelineEnabled();
110
+ return configUtils.global.isPipelineEnabled();
111
111
  })
112
112
 
113
113
  // *****************************************************************
@@ -199,18 +199,6 @@ module.exports.run = () => {
199
199
  .then((flatDiffMetadata) => {
200
200
  return utils.notification.project.sendProjectDiffReportMessage(project, flatDiffMetadata);
201
201
  })
202
-
203
- .then(() => {
204
- // process v1
205
- if (!isSnapshot && !envTarget) {
206
- return metadataUtils.appHistory.storeMetadata(project, diffMetadata, newVersion);
207
- }
208
-
209
- // process v2
210
- if (envTarget && envTarget !== 'DEV') {
211
- return metadataUtils.appHistory.storeMetadata(project, diffMetadata, newVersion, envTarget);
212
- }
213
- });
214
202
  }
215
203
  })
216
204
 
@@ -164,6 +164,25 @@ module.exports.cloneMetadataRepos = (pkg) => {
164
164
  }
165
165
 
166
166
 
167
+ module.exports.cloneMetadataLocksRepos = (pkg) => {
168
+ utils.tools.logBanner('CLONE METADATA LOCKS REPOS');
169
+
170
+ return Promise.resolve()
171
+ // CLONE METADATA LOCKS REPO
172
+ .then(() => {
173
+ if (pkg.build && pkg.build.skipLock) {
174
+ utils.tools.logInfo('Package has lock de-activated...skipping cloning of devops-metadata-locks repository');
175
+
176
+ } else {
177
+ return metadataUtils.common.cloneMetadataLocksRepo();
178
+ }
179
+ })
180
+ .catch((e) => {
181
+ throw e;
182
+ })
183
+ }
184
+
185
+
167
186
  module.exports.preReleaseChecks = (pkg) => {
168
187
  if (dryRun) {
169
188
  return;
@@ -176,7 +195,7 @@ module.exports.preReleaseChecks = (pkg) => {
176
195
  // GET AND CHECK DEVOPS CONFIG
177
196
  .then(() => {
178
197
  // check if global flag is enabled, if not enabled, this will throw a GLOBAL_PIPELINE_DISABLED exception
179
- return metadataUtils.common.isPipelineEnabled(pkg);
198
+ return configUtils.global.isPipelineEnabled(pkg);
180
199
  })
181
200
 
182
201
  // CHECK BRANCH VALIDITY
@@ -48,9 +48,10 @@ module.exports.run = () => {
48
48
  return innerCommon.init(pkg, envTarget);
49
49
  })
50
50
 
51
- // FOR UI and REMOTES clone metadata repositories
51
+ // TODO for UI PKG, to store and avoid race-conditions between similar pkg build, find a better way to handle this avoiding this repo
52
+ // clone metadata locks repo repositories
52
53
  .then(() => {
53
- return innerCommon.cloneMetadataRepos(pkg);
54
+ return innerCommon.cloneMetadataLocksRepos(pkg);
54
55
  })
55
56
 
56
57
  // PRE-RELEASE & COMMON CHECKS
@@ -12,7 +12,6 @@ const notificationUtils = require('../notification/notification-utils');
12
12
  // CSDR RELATED
13
13
  const templateUtils = require('../../csdr/templates/template-utils');
14
14
  const configUtils = require('../../csdr/config/config-utils');
15
- const metadataUtils = require('../../csdr/metadata/metadata-utils');
16
15
 
17
16
  // FETCH ARGS
18
17
  const { branch, dryRun, sonarQubeToken } = tools.getArgs();
@@ -22,7 +21,7 @@ const { branch, dryRun, sonarQubeToken } = tools.getArgs();
22
21
  const runCore = (pkg, isMaster) => {
23
22
 
24
23
  // check at metadata global flag level if enabled
25
- if (!metadataUtils.common.isSonarEnabled) {
24
+ if (!configUtils.global.isSonarEnabled()) {
26
25
  tools.logInfo('Sonar scanner globally disabled');
27
26
  return Promise.resolve();
28
27
  }