@docupace/pipeline 1.0.7-7.micro-cli12 → 1.0.7-alpha.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.
Files changed (68) hide show
  1. package/.prettierrc.cjs +12 -12
  2. package/bin/next-changeset-validate.sh +8 -8
  3. package/eslint.config.js +26 -49
  4. package/next/changeset.sh +75 -75
  5. package/next/copy.sh +34 -34
  6. package/next/deploy.sh +40 -40
  7. package/next/execute.sh +117 -123
  8. package/next/sonar.sh +23 -23
  9. package/package.json +7 -23
  10. package/src/changeset/cli.js +281 -237
  11. package/src/changeset/validate.js +47 -91
  12. package/src/jenkins/setParams.groovy +59 -58
  13. package/src/next/cli.js +15 -111
  14. package/src/next/config.js +72 -137
  15. package/src/next/copy.js +30 -61
  16. package/src/next/deploy.js +314 -633
  17. package/src/next/jenkins.js +88 -123
  18. package/src/next/pipline.js +115 -114
  19. package/src/next/publish.js +48 -71
  20. package/src/next/pull.js +7 -7
  21. package/src/next/sonar.js +23 -23
  22. package/README.md +0 -136
  23. package/bin/azuread_update_callbacks_for_app.sh +0 -58
  24. package/bitbucket-pipelines.yml +0 -60
  25. package/jest.config.js +0 -15
  26. package/src/auth0/alias.js +0 -79
  27. package/src/auth0/alias.test.js +0 -172
  28. package/src/auth0/cli.js +0 -82
  29. package/src/auth0/configure.js +0 -902
  30. package/src/auth0/configure.test.js +0 -167
  31. package/src/auth0/export.js +0 -48
  32. package/src/auth0/export.test.js +0 -103
  33. package/src/auth0/metadata.js +0 -141
  34. package/src/auth0/metadata.test.js +0 -186
  35. package/src/auth0/vault.js +0 -60
  36. package/src/auth0/vault.test.js +0 -134
  37. package/src/changeset/changelog-wiki.js +0 -328
  38. package/src/changeset/changeset-config.js +0 -34
  39. package/src/changeset/create.js +0 -215
  40. package/src/changeset/package-util.js +0 -87
  41. package/src/changeset/util.js +0 -43
  42. package/src/changeset/version.js +0 -102
  43. package/src/lib/merge-driver.js +0 -204
  44. package/src/merge/cli-merge-all.js +0 -507
  45. package/src/merge/cli-merge.js +0 -492
  46. package/src/merge/cli-resolve.js +0 -399
  47. package/src/merge/cli.js +0 -38
  48. package/src/merge/merge-changelog.js +0 -87
  49. package/src/merge/merge-package.js +0 -106
  50. package/src/merge/merge-types.js +0 -82
  51. package/src/merge/pr.js +0 -231
  52. package/src/micro/cli.js +0 -51
  53. package/src/micro/ms-deploy.js +0 -451
  54. package/src/micro/ms-publish.js +0 -186
  55. package/src/next/alias.js +0 -53
  56. package/src/next/apache.js +0 -81
  57. package/src/next/connect.js +0 -226
  58. package/src/next/git-to-semver.js +0 -79
  59. package/src/next/haproxy.js +0 -76
  60. package/src/next/jira.js +0 -84
  61. package/src/next/logger.js +0 -17
  62. package/src/next/test.js +0 -5
  63. package/src/next/util.js +0 -93
  64. package/src/next/vault.js +0 -45
  65. package/terraform/apply.sh +0 -37
  66. package/terraform/init.sh +0 -72
  67. package/terraform/plan.sh +0 -76
  68. package/terraform/validate.sh +0 -17
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);