@docupace/pipeline 1.0.77-alpha.2 → 1.0.77
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/.prettierrc.cjs +12 -12
- package/README.md +135 -135
- package/bin/azuread_update_callbacks_for_app.sh +58 -58
- package/bin/next-changeset-validate.sh +8 -8
- package/bitbucket-pipelines.yml +59 -59
- package/eslint.config.js +49 -49
- package/jest.config.js +15 -15
- package/next/changeset.sh +75 -75
- package/next/copy.sh +34 -34
- package/next/deploy.sh +40 -40
- package/next/execute.sh +123 -123
- package/next/sonar.sh +23 -23
- package/package.json +1 -1
- package/src/auth0/alias.js +79 -79
- package/src/auth0/alias.test.js +172 -172
- package/src/auth0/cli.js +82 -82
- package/src/auth0/configure.js +902 -902
- package/src/auth0/configure.test.js +167 -167
- package/src/auth0/export.js +48 -48
- package/src/auth0/export.test.js +103 -103
- package/src/auth0/metadata.js +141 -141
- package/src/auth0/metadata.test.js +186 -186
- package/src/auth0/vault.js +60 -60
- package/src/auth0/vault.test.js +134 -134
- package/src/changeset/changelog-wiki.js +328 -328
- package/src/changeset/changeset-config.js +34 -34
- package/src/changeset/cli.js +237 -237
- package/src/changeset/create.js +215 -215
- package/src/changeset/package-util.js +87 -87
- package/src/changeset/util.js +43 -43
- package/src/changeset/validate.js +91 -91
- package/src/changeset/version.js +102 -102
- package/src/jenkins/setParams.groovy +58 -58
- package/src/lib/merge-driver.js +204 -204
- package/src/merge/cli-merge-all.js +507 -507
- package/src/merge/cli-merge.js +492 -492
- package/src/merge/cli-resolve.js +399 -399
- package/src/merge/cli.js +38 -38
- package/src/merge/merge-changelog.js +87 -87
- package/src/merge/merge-package.js +106 -106
- package/src/merge/merge-types.js +82 -82
- package/src/merge/pr.js +231 -231
- package/src/micro/cli.js +71 -0
- package/src/micro/ms-deploy.js +271 -0
- package/src/micro/{publish-ms.js → ms-publish.js} +6 -8
- package/src/next/alias.js +53 -53
- package/src/next/apache.js +81 -81
- package/src/next/cli.js +1 -10
- package/src/next/config.js +137 -137
- package/src/next/connect.js +226 -226
- package/src/next/copy.js +61 -61
- package/src/next/deploy.js +633 -633
- package/src/next/git-to-semver.js +79 -79
- package/src/next/haproxy.js +76 -76
- package/src/next/jenkins.js +123 -123
- package/src/next/jira.js +84 -84
- package/src/next/logger.js +17 -17
- package/src/next/pipline.js +114 -114
- package/src/next/publish.js +71 -71
- package/src/next/pull.js +7 -7
- package/src/next/sonar.js +23 -23
- package/src/next/test.js +5 -5
- package/src/next/util.js +93 -95
- package/src/next/vault.js +45 -45
- package/terraform/apply.sh +37 -37
- package/terraform/init.sh +72 -72
- package/terraform/plan.sh +76 -76
- package/terraform/validate.sh +17 -17
- package/src/micro/deploy-microservice.js +0 -153
package/terraform/validate.sh
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
set -e
|
|
3
|
-
|
|
4
|
-
PROJECT=$1
|
|
5
|
-
|
|
6
|
-
if [[ -z "$PROJECT" ]]; then
|
|
7
|
-
echo "Error: Project name is required."
|
|
8
|
-
echo "Usage: $0 <project-name>"
|
|
9
|
-
exit 1
|
|
10
|
-
fi
|
|
11
|
-
|
|
12
|
-
cd "$BITBUCKET_CLONE_DIR/${PROJECT}"
|
|
13
|
-
|
|
14
|
-
terraform version
|
|
15
|
-
terraform init -backend=false
|
|
16
|
-
terraform validate
|
|
17
|
-
terraform fmt -check -recursive --diff || exit 0
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
PROJECT=$1
|
|
5
|
+
|
|
6
|
+
if [[ -z "$PROJECT" ]]; then
|
|
7
|
+
echo "Error: Project name is required."
|
|
8
|
+
echo "Usage: $0 <project-name>"
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
cd "$BITBUCKET_CLONE_DIR/${PROJECT}"
|
|
13
|
+
|
|
14
|
+
terraform version
|
|
15
|
+
terraform init -backend=false
|
|
16
|
+
terraform validate
|
|
17
|
+
terraform fmt -check -recursive --diff || exit 0
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { $ } from '../next/logger.js';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import axios from 'axios';
|
|
5
|
-
|
|
6
|
-
export async function deployMicroservice(
|
|
7
|
-
appName,
|
|
8
|
-
helmPath,
|
|
9
|
-
environment = 'dev',
|
|
10
|
-
tag = null,
|
|
11
|
-
) {
|
|
12
|
-
if (!appName || !helmPath) {
|
|
13
|
-
throw new Error(
|
|
14
|
-
'Missing required parameters. Usage: deployMicroservice(appName, helmPath, [environment], [tag])',
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let deployTag = tag;
|
|
19
|
-
if (!deployTag) {
|
|
20
|
-
deployTag =
|
|
21
|
-
process.env.VERSION_TAG ||
|
|
22
|
-
process.env.BITBUCKET_TAG ||
|
|
23
|
-
(process.env.BITBUCKET_BUILD_NUMBER
|
|
24
|
-
? `build-${process.env.BITBUCKET_BUILD_NUMBER}`
|
|
25
|
-
: null);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!deployTag) {
|
|
29
|
-
throw new Error(
|
|
30
|
-
'No tag specified and no default tag available from environment variables',
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const repoName = `gitops-${environment}`;
|
|
35
|
-
const filePath = `dp/${helmPath}/${appName}.values.yaml`;
|
|
36
|
-
|
|
37
|
-
const gitopsBranch =
|
|
38
|
-
environment === 'dev' || environment === 'uat'
|
|
39
|
-
? process.env.GITOPS_BRANCH || 'master'
|
|
40
|
-
: process.env.GITOPS_BRANCH || 'main';
|
|
41
|
-
|
|
42
|
-
let repoUrl;
|
|
43
|
-
if (environment === 'dev' && process.env.GITOPS_REP_TOKEN) {
|
|
44
|
-
repoUrl = `https://x-token-auth:${process.env.GITOPS_REP_TOKEN}@bitbucket.org/dp-cloud/${repoName}.git`;
|
|
45
|
-
} else if (
|
|
46
|
-
process.env.BITBUCKET_USERNAME &&
|
|
47
|
-
process.env.BITBUCKET_APP_PASSWORD
|
|
48
|
-
) {
|
|
49
|
-
repoUrl = `https://${process.env.BITBUCKET_USERNAME}:${process.env.BITBUCKET_APP_PASSWORD}@bitbucket.org/dp-cloud/${repoName}.git`;
|
|
50
|
-
} else {
|
|
51
|
-
throw new Error(
|
|
52
|
-
'No authentication credentials found for GitOps repository',
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
console.log('=========================================');
|
|
57
|
-
console.log('Microservice Deployment Configuration');
|
|
58
|
-
console.log('=========================================');
|
|
59
|
-
console.log(`Application: ${appName}`);
|
|
60
|
-
console.log(`Environment: ${environment}`);
|
|
61
|
-
console.log(`Tag: ${deployTag}`);
|
|
62
|
-
console.log(`GitOps Repo: ${repoName}`);
|
|
63
|
-
console.log(`Values File: ${filePath}`);
|
|
64
|
-
console.log(`Branch: ${gitopsBranch}`);
|
|
65
|
-
console.log('=========================================');
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
console.log('Cloning GitOps repository...');
|
|
69
|
-
await $`git clone --depth 1 ${repoUrl} ${repoName}`;
|
|
70
|
-
|
|
71
|
-
console.log('Checking if directory exists...');
|
|
72
|
-
await $`ls -la ${repoName}`;
|
|
73
|
-
|
|
74
|
-
console.log(`Changing to directory: ${repoName}`);
|
|
75
|
-
const originalDir = process.cwd();
|
|
76
|
-
process.chdir(repoName);
|
|
77
|
-
|
|
78
|
-
console.log('Verifying directory change...');
|
|
79
|
-
const newDir = process.cwd();
|
|
80
|
-
console.log(`Original: ${originalDir}`);
|
|
81
|
-
console.log(`New: ${newDir}`);
|
|
82
|
-
|
|
83
|
-
await $`cd ${repoName} && git config user.email "pipeline@bitbucket.org"`;
|
|
84
|
-
|
|
85
|
-
if (process.env.BITBUCKET_STEP_TRIGGERER_UUID) {
|
|
86
|
-
try {
|
|
87
|
-
const response = await axios.get(
|
|
88
|
-
`https://api.bitbucket.org/2.0/users/${process.env.BITBUCKET_STEP_TRIGGERER_UUID}`,
|
|
89
|
-
);
|
|
90
|
-
const triggererUsername = response.data.display_name;
|
|
91
|
-
console.log(`📌 Run triggered by: ${triggererUsername}`);
|
|
92
|
-
await $`cd ${repoName} && git config user.name ${triggererUsername}`;
|
|
93
|
-
} catch (error) {
|
|
94
|
-
console.warn('Failed to fetch Bitbucket user info:', error.message);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
console.log(`Attempting to checkout branch: ${gitopsBranch}`);
|
|
99
|
-
await $`cd ${repoName} && git checkout ${gitopsBranch}`;
|
|
100
|
-
|
|
101
|
-
const fullFilePath = path.resolve(filePath);
|
|
102
|
-
console.log(`Looking for file at: ${fullFilePath}`);
|
|
103
|
-
if (!fs.existsSync(fullFilePath)) {
|
|
104
|
-
throw new Error(
|
|
105
|
-
`Values file ${filePath} does not exist in ${repoName} on branch ${gitopsBranch}`,
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
console.log(`Updating image tag to ${deployTag}...`);
|
|
110
|
-
|
|
111
|
-
let fileContent = fs.readFileSync(fullFilePath, 'utf8');
|
|
112
|
-
|
|
113
|
-
const tagRegex = /^ {2}tag: .*/gm;
|
|
114
|
-
const newContent = fileContent.replace(tagRegex, ` tag: ${deployTag}`);
|
|
115
|
-
|
|
116
|
-
if (fileContent === newContent) {
|
|
117
|
-
console.log(`No changes detected - tag is already ${deployTag}`);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
fs.writeFileSync(fullFilePath, newContent, 'utf8');
|
|
122
|
-
|
|
123
|
-
console.log('Changes to be committed:');
|
|
124
|
-
await $`cd ${repoName} && git diff ${filePath}`;
|
|
125
|
-
|
|
126
|
-
await $`cd ${repoName} && git add ${filePath}`;
|
|
127
|
-
await $`cd ${repoName} && git commit -m "Update ${appName} image tag to ${deployTag} in ${environment} environment"`;
|
|
128
|
-
|
|
129
|
-
console.log('Pushing changes to GitOps repository...');
|
|
130
|
-
await $`cd ${repoName} && git push origin ${gitopsBranch}`;
|
|
131
|
-
|
|
132
|
-
console.log('=========================================');
|
|
133
|
-
console.log(
|
|
134
|
-
`✅ Successfully deployed ${appName}:${deployTag} to ${environment}`,
|
|
135
|
-
);
|
|
136
|
-
console.log('=========================================');
|
|
137
|
-
} catch (error) {
|
|
138
|
-
console.error('Error during microservice deployment:', error.message);
|
|
139
|
-
throw error;
|
|
140
|
-
} finally {
|
|
141
|
-
try {
|
|
142
|
-
process.chdir('..');
|
|
143
|
-
await $`rm -rf ${repoName}`;
|
|
144
|
-
} catch (cleanupError) {
|
|
145
|
-
console.warn(
|
|
146
|
-
'Warning: Failed to clean up temporary directory:',
|
|
147
|
-
cleanupError.message,
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export default deployMicroservice;
|