@docupace/pipeline 1.0.8-6.xray → 1.0.8

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.
Files changed (64) hide show
  1. package/eslint.config.js +2 -25
  2. package/next/execute.sh +2 -8
  3. package/package.json +8 -24
  4. package/src/changeset/cli.js +195 -151
  5. package/src/changeset/validate.js +1 -45
  6. package/src/jenkins/setParams.groovy +2 -1
  7. package/src/next/cli.js +15 -111
  8. package/src/next/config.js +7 -72
  9. package/src/next/copy.js +1 -32
  10. package/src/next/deploy.js +69 -520
  11. package/src/next/jenkins.js +2 -3
  12. package/src/next/pipline.js +1 -0
  13. package/src/next/publish.js +30 -53
  14. package/README.md +0 -136
  15. package/bin/azuread_update_callbacks_for_app.sh +0 -58
  16. package/bin/xray.sh +0 -273
  17. package/bitbucket-pipelines.yml +0 -142
  18. package/jest.config.js +0 -15
  19. package/src/auth0/alias.js +0 -79
  20. package/src/auth0/alias.test.js +0 -172
  21. package/src/auth0/cli.js +0 -82
  22. package/src/auth0/configure.js +0 -902
  23. package/src/auth0/configure.test.js +0 -167
  24. package/src/auth0/export.js +0 -48
  25. package/src/auth0/export.test.js +0 -103
  26. package/src/auth0/metadata.js +0 -141
  27. package/src/auth0/metadata.test.js +0 -186
  28. package/src/auth0/vault.js +0 -60
  29. package/src/auth0/vault.test.js +0 -134
  30. package/src/changeset/changelog-wiki.js +0 -328
  31. package/src/changeset/changeset-config.js +0 -34
  32. package/src/changeset/create.js +0 -215
  33. package/src/changeset/package-util.js +0 -87
  34. package/src/changeset/util.js +0 -43
  35. package/src/changeset/version.js +0 -102
  36. package/src/jfrog/xray-scan.yaml +0 -29
  37. package/src/lib/merge-driver.js +0 -204
  38. package/src/merge/cli-merge-all.js +0 -521
  39. package/src/merge/cli-merge.js +0 -572
  40. package/src/merge/cli-resolve.js +0 -399
  41. package/src/merge/cli.js +0 -38
  42. package/src/merge/common.js +0 -7
  43. package/src/merge/merge-changelog.js +0 -87
  44. package/src/merge/merge-package.js +0 -106
  45. package/src/merge/merge-types.js +0 -82
  46. package/src/merge/pr.js +0 -231
  47. package/src/micro/cli.js +0 -51
  48. package/src/micro/ms-deploy.js +0 -451
  49. package/src/micro/ms-publish.js +0 -186
  50. package/src/next/alias.js +0 -53
  51. package/src/next/apache.js +0 -81
  52. package/src/next/connect.js +0 -226
  53. package/src/next/git-to-semver.js +0 -79
  54. package/src/next/haproxy.js +0 -76
  55. package/src/next/jira.js +0 -84
  56. package/src/next/logger.js +0 -17
  57. package/src/next/test.js +0 -5
  58. package/src/next/util.js +0 -95
  59. package/src/next/vault.js +0 -45
  60. package/terraform/apply.sh +0 -41
  61. package/terraform/import.sh +0 -111
  62. package/terraform/init.sh +0 -78
  63. package/terraform/plan.sh +0 -95
  64. package/terraform/validate.sh +0 -17
@@ -1,82 +0,0 @@
1
- import { mergeDriver } from '../lib/merge-driver.js';
2
-
3
- /**
4
- * Codegen-specific merge logic for handling balanced braces and removing duplicates
5
- * @param {string} headContent - Content from HEAD (current branch)
6
- * @param {string} branchContent - Content from the incoming branch
7
- * @returns {string} - Merged content
8
- * @throws {Error} - If conflicts cannot be automatically merged
9
- */
10
- function codegenMergeLogic(headContent, branchContent) {
11
- // Check if braces are balanced in both head and branch content
12
- const headOpenBraces = (headContent.match(/\{/g) || []).length;
13
- const headCloseBraces = (headContent.match(/\}/g) || []).length;
14
- const branchOpenBraces = (branchContent.match(/\{/g) || []).length;
15
- const branchCloseBraces = (branchContent.match(/\}/g) || []).length;
16
-
17
- // Check if head content has balanced braces
18
- const headHasBraces = headOpenBraces > 0 || headCloseBraces > 0;
19
- const headBalanced = headOpenBraces === headCloseBraces;
20
-
21
- // Check if branch content has balanced braces
22
- const branchHasBraces = branchOpenBraces > 0 || branchCloseBraces > 0;
23
- const branchBalanced = branchOpenBraces === branchCloseBraces;
24
-
25
- // If either has braces and they're not balanced, we can't merge
26
- if (
27
- (headHasBraces && !headBalanced) ||
28
- (branchHasBraces && !branchBalanced)
29
- ) {
30
- throw new Error('Unbalanced braces detected - cannot merge automatically');
31
- }
32
-
33
- // If both have balanced braces, combine them as-is
34
- if (headHasBraces && branchHasBraces && headBalanced && branchBalanced) {
35
- return headContent + '\n' + branchContent;
36
- }
37
-
38
- // If neither has braces, combine and remove duplicates
39
- if (!headHasBraces && !branchHasBraces) {
40
- const headLines = headContent.split('\n').filter((line) => line);
41
- const branchLines = branchContent.split('\n').filter((line) => line);
42
-
43
- // Use Set to remove duplicates while preserving order
44
- const uniqueLines = [...new Set([...headLines, ...branchLines])];
45
-
46
- return uniqueLines.join('\n');
47
- }
48
-
49
- // Mixed case: one has braces, one doesn't - combine as-is
50
- return headContent + '\n' + branchContent;
51
- }
52
-
53
- /**
54
- * Main function to merge codegen conflicts in a types file
55
- * @param {string} filePath - Path to the file with conflicts
56
- * @returns {Promise<Object>} - Result object with merge details
57
- */
58
- export async function mergeTypesFile(filePath) {
59
- try {
60
- console.log('Starting codegen merge for types file...');
61
-
62
- // Use the merge driver with our custom codegen logic
63
- const result = await mergeDriver(filePath, codegenMergeLogic);
64
-
65
- if (result.success) {
66
- console.log('✅ Codegen merge completed successfully');
67
- } else {
68
- console.log('⚠️ Codegen merge completed with unresolved conflicts');
69
- }
70
-
71
- return result;
72
- } catch (error) {
73
- console.error(`Codegen merge failed: ${error.message}`);
74
- throw error;
75
- }
76
- }
77
-
78
- // Export the merge logic function for direct use if needed
79
- export { codegenMergeLogic };
80
-
81
- // Default export
82
- export default mergeTypesFile;
package/src/merge/pr.js DELETED
@@ -1,231 +0,0 @@
1
- /**
2
- * Create a Bitbucket pull request
3
- * @param {string} sourceBranch - Source branch name
4
- * @param {string} targetBranch - Target branch name
5
- * @param {string} title - PR title
6
- * @param {string} description - PR description
7
- * @returns {Promise<Object>} - PR creation result
8
- */
9
- import { execSync } from 'child_process';
10
-
11
- /**
12
- * Check for existing pull requests with specific description pattern
13
- * @param {string} descriptionPattern - Pattern to match in PR descriptions
14
- * @returns {Promise<Object[]>} - Array of matching PRs
15
- */
16
- export async function getExistingPRsWithDescription(
17
- descriptionPattern,
18
- repositories,
19
- ) {
20
- // If no repositories provided, fall back to current repo behavior for backward compatibility
21
- if (!repositories || !Array.isArray(repositories)) {
22
- return getExistingPRsFromCurrentRepo(descriptionPattern);
23
- }
24
-
25
- try {
26
- // Check for Bitbucket credentials
27
- const username = process.env.BITBUCKET_USERNAME;
28
- const password = process.env.BITBUCKET_APP_PASSWORD;
29
-
30
- if (!username || !password) {
31
- console.log(
32
- `\n⚠️ Bitbucket credentials not found. Cannot check existing PRs.`,
33
- );
34
- return [];
35
- }
36
-
37
- const auth = Buffer.from(`${username}:${password}`).toString('base64');
38
- const allMatchingPRs = [];
39
-
40
- // Check each repository for matching PRs
41
- for (const repo of repositories) {
42
- try {
43
- const match = repo.url.match(/bitbucket\.org[\/:]([^\/]+)\/([^\/\.]+)/);
44
-
45
- if (!match) {
46
- console.warn(`Could not parse repository URL: ${repo.url}`);
47
- continue;
48
- }
49
-
50
- const [, workspace, repoSlug] = match;
51
-
52
- const response = await fetch(
53
- `https://api.bitbucket.org/2.0/repositories/${workspace}/${repoSlug}/pullrequests?state=OPEN`,
54
- {
55
- method: 'GET',
56
- headers: {
57
- Authorization: `Basic ${auth}`,
58
- 'Content-Type': 'application/json',
59
- },
60
- },
61
- );
62
-
63
- if (!response.ok) {
64
- const error = await response.text();
65
- console.warn(
66
- `Bitbucket API error for ${repo.name}: ${response.status} - ${error}`,
67
- );
68
- continue;
69
- }
70
-
71
- const data = await response.json();
72
- const matchingPRs = data.values.filter(
73
- (pr) =>
74
- pr.description && pr.description.startsWith(descriptionPattern),
75
- );
76
-
77
- // Add repository info to each PR for context
78
- matchingPRs.forEach((pr) => {
79
- pr.repositoryName = repo.name;
80
- pr.repositoryUrl = repo.url;
81
- });
82
-
83
- allMatchingPRs.push(...matchingPRs);
84
- } catch (error) {
85
- console.warn(
86
- `Failed to check PRs for repository ${repo.name}: ${error.message}`,
87
- );
88
- }
89
- }
90
-
91
- return allMatchingPRs;
92
- } catch (error) {
93
- console.error(`Failed to get existing PRs: ${error.message}`);
94
- return [];
95
- }
96
- }
97
-
98
- /**
99
- * Legacy function for backward compatibility - checks PRs in current repo only
100
- */
101
- export async function getExistingPRsFromCurrentRepo(descriptionPattern) {
102
- try {
103
- // Get Bitbucket workspace and repo from git remote
104
- const remoteUrl = execSync('git config --get remote.origin.url', {
105
- encoding: 'utf-8',
106
- }).trim();
107
- const match = remoteUrl.match(/bitbucket\.org[\/:]([^\/]+)\/([^\/\.]+)/);
108
-
109
- if (!match) {
110
- throw new Error(
111
- 'Could not parse Bitbucket workspace and repository from remote URL',
112
- );
113
- }
114
-
115
- const [, workspace, repoSlug] = match;
116
-
117
- // Check for Bitbucket credentials
118
- const username = process.env.BITBUCKET_USERNAME;
119
- const password = process.env.BITBUCKET_APP_PASSWORD;
120
-
121
- if (!username || !password) {
122
- console.log(
123
- `\n⚠️ Bitbucket credentials not found. Cannot check existing PRs.`,
124
- );
125
- return [];
126
- }
127
-
128
- const auth = Buffer.from(`${username}:${password}`).toString('base64');
129
- const response = await fetch(
130
- `https://api.bitbucket.org/2.0/repositories/${workspace}/${repoSlug}/pullrequests?state=OPEN`,
131
- {
132
- method: 'GET',
133
- headers: {
134
- Authorization: `Basic ${auth}`,
135
- 'Content-Type': 'application/json',
136
- },
137
- },
138
- );
139
-
140
- if (!response.ok) {
141
- const error = await response.text();
142
- throw new Error(`Bitbucket API error: ${response.status} - ${error}`);
143
- }
144
-
145
- const data = await response.json();
146
- const matchingPRs = data.values.filter(
147
- (pr) => pr.description && pr.description.startsWith(descriptionPattern),
148
- );
149
-
150
- return matchingPRs;
151
- } catch (error) {
152
- console.error(`Failed to get existing PRs: ${error.message}`);
153
- return [];
154
- }
155
- }
156
-
157
- export async function createBitbucketPR(
158
- sourceBranch,
159
- targetBranch,
160
- title,
161
- description,
162
- ) {
163
- try {
164
- // Get Bitbucket workspace and repo from git remote
165
- const remoteUrl = execSync('git config --get remote.origin.url', {
166
- encoding: 'utf-8',
167
- }).trim();
168
- const match = remoteUrl.match(/bitbucket\.org[\/:]([^\/]+)\/([^\/\.]+)/);
169
-
170
- if (!match) {
171
- throw new Error(
172
- 'Could not parse Bitbucket workspace and repository from remote URL',
173
- );
174
- }
175
-
176
- const [, workspace, repoSlug] = match;
177
-
178
- // Check for Bitbucket credentials
179
- const username = process.env.BITBUCKET_USERNAME;
180
- const password = process.env.BITBUCKET_APP_PASSWORD;
181
-
182
- if (!username || !password) {
183
- console.log(
184
- `\n⚠️ Bitbucket credentials not found in environment variables.`,
185
- );
186
- console.log(
187
- 'Please set BITBUCKET_USERNAME and BITBUCKET_APP_PASSWORD to auto-create PR.',
188
- );
189
- console.log(
190
- `Manual PR creation URL: https://bitbucket.org/${workspace}/${repoSlug}/pull-requests/new?source=${sourceBranch}&dest=${targetBranch}`,
191
- );
192
- return {
193
- success: false,
194
- manual: true,
195
- url: `https://bitbucket.org/${workspace}/${repoSlug}/pull-requests/new?source=${sourceBranch}&dest=${targetBranch}`,
196
- };
197
- }
198
-
199
- // Create PR via Bitbucket API
200
- const prData = {
201
- title,
202
- description,
203
- source: { branch: { name: sourceBranch } },
204
- destination: { branch: { name: targetBranch } },
205
- };
206
-
207
- const auth = Buffer.from(`${username}:${password}`).toString('base64');
208
- const response = await fetch(
209
- `https://api.bitbucket.org/2.0/repositories/${workspace}/${repoSlug}/pullrequests`,
210
- {
211
- method: 'POST',
212
- headers: {
213
- Authorization: `Basic ${auth}`,
214
- 'Content-Type': 'application/json',
215
- },
216
- body: JSON.stringify(prData),
217
- },
218
- );
219
-
220
- if (!response.ok) {
221
- const error = await response.text();
222
- throw new Error(`Bitbucket API error: ${response.status} - ${error}`);
223
- }
224
-
225
- const pr = await response.json();
226
- return { success: true, pr, url: pr.links.html.href };
227
- } catch (error) {
228
- console.error(`Failed to create Bitbucket PR: ${error.message}`);
229
- return { success: false, error: error.message };
230
- }
231
- }
package/src/micro/cli.js DELETED
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from 'commander';
4
- //import { publishMicroservice } from './ms-publish.js';
5
-
6
- import dotenv from 'dotenv';
7
- import {
8
- microserviceDeployTagVersion,
9
- microserviceCopyImageToEnv,
10
- microserviceBuildPushImage,
11
- } from './ms-deploy.js';
12
-
13
- dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
14
-
15
- const program = new Command();
16
-
17
- //const GIT_SHA = (await $`git log --pretty=format:'%h' -n 1`).stdout.trim();
18
-
19
- program
20
- .command('publish-microservice <serviceName>')
21
- .description('Publish a microservice Docker image with version tags')
22
- .option('-t, --tag <tag>', 'Version tag (defaults to BITBUCKET_TAG)')
23
- .action(async (repoName, options) => {
24
- await microserviceBuildPushImage(repoName, options);
25
- });
26
-
27
- program
28
- .command('deploy-microservice <repoName>')
29
- .description('Deploy microservice end-to-end (build + publish + deploy)')
30
- .option('-e, --env <environment>', 'Target environment', 'dev')
31
- .option('-t, --tag <tag>', 'Version tag (defaults to BITBUCKET_TAG)')
32
- .action(async (repoName, options) => {
33
- await microserviceDeployTagVersion(repoName, options.env, options.tag);
34
- });
35
-
36
- program
37
- .command('promote-microservice <repoName>')
38
- .description('Promote microservice image between environments')
39
- .requiredOption('-f, --from <fromEnv>', 'Source environment')
40
- .requiredOption('-t, --to <toEnv>', 'Target environment')
41
- .requiredOption('-g, --tag <tag>', 'Image tag to promote')
42
- .action(async (repoName, options) => {
43
- await microserviceCopyImageToEnv(
44
- repoName,
45
- options.from,
46
- options.to,
47
- options.tag,
48
- );
49
- });
50
-
51
- program.parse(process.argv);