@docupace/pipeline 1.0.4-6.0.1 → 1.0.4
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/bin/next-changeset-validate.sh +8 -8
- package/next/changeset.sh +75 -75
- package/next/copy.sh +34 -34
- package/next/deploy.sh +40 -40
- package/next/execute.sh +117 -117
- package/next/sonar.sh +23 -23
- package/package.json +4 -21
- package/src/changeset/cli.js +245 -334
- package/src/changeset/validate.js +44 -47
- package/src/next/cli.js +31 -182
- package/src/next/copy.js +27 -55
- package/src/next/deploy.js +72 -484
- package/src/next/publish.js +46 -48
- package/src/next/pull.js +7 -7
- package/src/next/sonar.js +23 -23
- package/.prettierrc.cjs +0 -12
- package/bin/azuread_update_callbacks_for_app.sh +0 -58
- package/eslint.config.js +0 -26
- package/src/auth0/alias.js +0 -72
- package/src/auth0/cli.js +0 -76
- package/src/auth0/configure.js +0 -783
- package/src/auth0/export.js +0 -43
- package/src/auth0/metadata.js +0 -133
- package/src/auth0/vault.js +0 -107
- package/src/jenkins/setParams.groovy +0 -59
- package/src/next/alias.js +0 -53
- package/src/next/apache.js +0 -73
- package/src/next/config.js +0 -100
- package/src/next/connect.js +0 -227
- package/src/next/haproxy.js +0 -71
- package/src/next/jenkins.js +0 -123
- package/src/next/jira.js +0 -83
- package/src/next/pipline.js +0 -114
- package/src/next/vault.js +0 -43
- package/terraform/apply.sh +0 -37
- package/terraform/init.sh +0 -72
- package/terraform/plan.sh +0 -76
- package/terraform/validate.sh +0 -17
|
@@ -1,47 +1,44 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
export async function validateChangesets(directoryPath) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
export async function validateChangesets(directoryPath) {
|
|
5
|
+
try {
|
|
6
|
+
// Step 1: Read the directory for md files excluding README.md
|
|
7
|
+
const allFiles = fs.readdirSync(directoryPath);
|
|
8
|
+
const mdFiles = allFiles.filter(file => file.endsWith('.md') && file !== 'README.md');
|
|
9
|
+
|
|
10
|
+
// Step 2: Check for pre.json and parse it
|
|
11
|
+
const preJsonPath = path.join(directoryPath, 'pre.json');
|
|
12
|
+
let preJson;
|
|
13
|
+
|
|
14
|
+
if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
|
|
15
|
+
throw new Error("Error: No pre.json and no md files found.")
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (fs.existsSync(preJsonPath)) {
|
|
19
|
+
preJson = JSON.parse(fs.readFileSync(preJsonPath, 'utf-8'));
|
|
20
|
+
|
|
21
|
+
if(preJson.mode == 'pre') {
|
|
22
|
+
// Step 4a: Get list of changesets from pre.json
|
|
23
|
+
const changesets = preJson.changesets || [];
|
|
24
|
+
const changesetNames = changesets.map(change => change);
|
|
25
|
+
|
|
26
|
+
// Step 4b: Match files with the list of changesets
|
|
27
|
+
const mdFileNamesWithoutExt = mdFiles.map(file => path.basename(file, '.md'));
|
|
28
|
+
const unmatchedFiles = mdFileNamesWithoutExt.filter(fileName => !changesetNames.includes(fileName));
|
|
29
|
+
|
|
30
|
+
if (unmatchedFiles.length == 0) {
|
|
31
|
+
throw new Error("Error: No new MD files found:");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
console.log("Validation successful.");
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.log(error.message);
|
|
39
|
+
throw(error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
package/src/next/cli.js
CHANGED
|
@@ -4,207 +4,56 @@ import { Command } from 'commander';
|
|
|
4
4
|
import { pull } from './pull.js';
|
|
5
5
|
import { sonar } from './sonar.js';
|
|
6
6
|
import { publish } from './publish.js';
|
|
7
|
-
import {
|
|
8
|
-
deployAppWithTag,
|
|
9
|
-
deployFromSite,
|
|
10
|
-
getDefaultDeploySite,
|
|
11
|
-
getDeployTag,
|
|
12
|
-
} from './deploy.js';
|
|
7
|
+
import { deploy } from './deploy.js';
|
|
13
8
|
import { deployTemplate } from './deploy.js';
|
|
14
9
|
import { copy } from './copy.js';
|
|
15
|
-
import { vaultAddSiteData } from './vault.js';
|
|
16
|
-
import { addApacheSite } from './apache.js';
|
|
17
|
-
import { haproxySync } from './haproxy.js';
|
|
18
|
-
import { connectClone } from './connect.js';
|
|
19
|
-
import dotenv from 'dotenv';
|
|
20
|
-
|
|
21
|
-
dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
|
|
22
10
|
|
|
23
11
|
const program = new Command();
|
|
24
12
|
|
|
13
|
+
// GIT SHA computation
|
|
25
14
|
import { $ } from 'zx';
|
|
26
|
-
import { deployConnect, deployCore } from './jenkins.js';
|
|
27
|
-
import { runPipeline } from './pipline.js';
|
|
28
|
-
|
|
29
15
|
const GIT_SHA = (await $`git log --pretty=format:'%h' -n 1`).stdout.trim();
|
|
30
16
|
|
|
31
17
|
program
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
program
|
|
39
|
-
.command('sonar')
|
|
40
|
-
.description('Run Sonar analysis')
|
|
41
|
-
.action(async () => {
|
|
42
|
-
await sonar(GIT_SHA);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
program
|
|
46
|
-
.command('addApacheSite')
|
|
47
|
-
.description('Add site to apache')
|
|
48
|
-
.action(async () => {
|
|
49
|
-
await addApacheSite();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
program
|
|
53
|
-
.command('connectClone')
|
|
54
|
-
.description('Clone connect site')
|
|
55
|
-
.action(async () => {
|
|
56
|
-
await connectClone();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
program
|
|
60
|
-
.command('haproxySync')
|
|
61
|
-
.description('Sync haproxy config')
|
|
62
|
-
.action(async () => {
|
|
63
|
-
await haproxySync();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
program
|
|
67
|
-
.command('vaultAddSiteData')
|
|
68
|
-
.description('Add m2m auth0 data to vault')
|
|
69
|
-
.requiredOption('-s, --site-name <siteName>', 'Site name')
|
|
70
|
-
.requiredOption(
|
|
71
|
-
'-p, --site-config-remote-path <siteConfigRemotePath>',
|
|
72
|
-
'Site Config Remote Path',
|
|
73
|
-
)
|
|
74
|
-
.action(async (options) => {
|
|
75
|
-
const { siteName, siteConfigRemotePath } = options;
|
|
76
|
-
await vaultAddSiteData(siteName, siteConfigRemotePath);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
program
|
|
80
|
-
.command('publish')
|
|
81
|
-
.description('Publish a Docker image')
|
|
82
|
-
.action(async () => {
|
|
83
|
-
await publish(GIT_SHA);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
program
|
|
87
|
-
.command('deploy-from-site')
|
|
88
|
-
.description('Deploy an application for a specific site')
|
|
89
|
-
.requiredOption('-f, --from-env <fromEnv>', 'Source environment')
|
|
90
|
-
.requiredOption('-t, --to-env <toEnv>', 'Target environment')
|
|
91
|
-
.requiredOption('-F, --from-site <fromSite>', 'Source site')
|
|
92
|
-
.requiredOption('-T, --to-site <toSite>', 'Target site')
|
|
93
|
-
.option('-c, --deploy-core <deployCore>', 'Deploy Core', 'false')
|
|
94
|
-
.option('-C, --deploy-connect <deployConnect>', 'Deploy Connect', 'false')
|
|
95
|
-
.action(async (options) => {
|
|
96
|
-
const { fromEnv, fromSite, toEnv, toSite, deployCore, deployConnect } =
|
|
97
|
-
options;
|
|
98
|
-
await deployFromSite(
|
|
99
|
-
fromEnv,
|
|
100
|
-
fromSite,
|
|
101
|
-
toEnv,
|
|
102
|
-
toSite,
|
|
103
|
-
deployCore,
|
|
104
|
-
deployConnect,
|
|
105
|
-
);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
program
|
|
109
|
-
.command('deploy-template')
|
|
110
|
-
.description('Deploy an application for a specific site')
|
|
111
|
-
.action(async () => {
|
|
112
|
-
const deployTag = await getDeployTag();
|
|
113
|
-
const { env, site } = await getDefaultDeploySite(deployTag);
|
|
114
|
-
await deployTemplate(env, site, deployTag);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
program
|
|
118
|
-
.command('deployTemplate')
|
|
119
|
-
.description('Deploy an application for a specific site')
|
|
120
|
-
.action(async () => {
|
|
121
|
-
const deployTag = await getDeployTag();
|
|
122
|
-
const { env, site } = await getDefaultDeploySite(deployTag);
|
|
123
|
-
await deployTemplate(env, site, deployTag);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
program
|
|
127
|
-
.command('deploy-app <application>')
|
|
128
|
-
.description('Deploy an application for a specific site')
|
|
129
|
-
.action(async (application) => {
|
|
130
|
-
const deployTag = await getDeployTag();
|
|
131
|
-
const { env, site } = await getDefaultDeploySite(deployTag);
|
|
132
|
-
await deployAppWithTag(application, env, site, deployTag);
|
|
133
|
-
});
|
|
18
|
+
.command('pull <imageName>')
|
|
19
|
+
.description('Pull a Docker image from the registry')
|
|
20
|
+
.action(async (imageName) => {
|
|
21
|
+
await pull(imageName);
|
|
22
|
+
});
|
|
134
23
|
|
|
135
24
|
program
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
await deployCore(env, site, options.liquibase, options.branch);
|
|
142
|
-
});
|
|
25
|
+
.command('sonar')
|
|
26
|
+
.description('Run Sonar analysis')
|
|
27
|
+
.action(async () => {
|
|
28
|
+
await sonar(GIT_SHA);
|
|
29
|
+
});
|
|
143
30
|
|
|
144
31
|
program
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
await deployConnect(env, site, options.liquibase, options.branch);
|
|
151
|
-
});
|
|
32
|
+
.command('publish')
|
|
33
|
+
.description('Publish a Docker image')
|
|
34
|
+
.action(async () => {
|
|
35
|
+
await publish(GIT_SHA);
|
|
36
|
+
});
|
|
152
37
|
|
|
153
38
|
program
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
.action(async (env, site, options) => {
|
|
159
|
-
await runPipeline('site-deploy', 'deploy-core', 'main', {
|
|
160
|
-
ENV: env,
|
|
161
|
-
SITE: site,
|
|
162
|
-
LIQUIBASE: options.liquibase,
|
|
163
|
-
BRANCH: options.branch,
|
|
39
|
+
.command('deploy <application> <site>')
|
|
40
|
+
.description('Deploy an application for a specific site')
|
|
41
|
+
.action(async (application, site) => {
|
|
42
|
+
await deploy(application, site);
|
|
164
43
|
});
|
|
165
|
-
});
|
|
166
44
|
|
|
167
45
|
program
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
.requiredOption('-g, --tag <tag>', 'Image tag')
|
|
174
|
-
.action(async (options) => {
|
|
175
|
-
const { application, fromEnv, toEnv, tag } = options;
|
|
176
|
-
await copy(application, fromEnv, toEnv, tag);
|
|
177
|
-
});
|
|
46
|
+
.command('deployTemplate <site>')
|
|
47
|
+
.description('Deploy an application for a specific site')
|
|
48
|
+
.action(async (site) => {
|
|
49
|
+
await deployTemplate(site);
|
|
50
|
+
});
|
|
178
51
|
|
|
179
52
|
program
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
.option(
|
|
186
|
-
'-v, --variables <key=value>',
|
|
187
|
-
'Pipeline variable as key=value pair',
|
|
188
|
-
(value, previous) => {
|
|
189
|
-
const [key, val] = value.split('=');
|
|
190
|
-
if (!key || val === undefined) {
|
|
191
|
-
throw new Error(`Invalid variable format: ${value}. Use key=value.`);
|
|
192
|
-
}
|
|
193
|
-
return { ...previous, [key]: val };
|
|
194
|
-
},
|
|
195
|
-
{},
|
|
196
|
-
)
|
|
197
|
-
.option('-w, --wait', 'Wait for the pipeline to complete', false) // Defaults to false
|
|
198
|
-
.action(async (cmdObj) => {
|
|
199
|
-
try {
|
|
200
|
-
const { repository, pipelineName, branch, variables, wait } = cmdObj;
|
|
201
|
-
|
|
202
|
-
// Call the triggerPipelineByName function
|
|
203
|
-
await runPipeline(repository, pipelineName, branch, variables, wait);
|
|
204
|
-
} catch (error) {
|
|
205
|
-
console.error('Error triggering pipeline:', error.message);
|
|
206
|
-
process.exit(1);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
53
|
+
.command('copy')
|
|
54
|
+
.description('Copy a Docker image between registries')
|
|
55
|
+
.action(async () => {
|
|
56
|
+
await copy();
|
|
57
|
+
});
|
|
209
58
|
|
|
210
59
|
program.parse(process.argv);
|
package/src/next/copy.js
CHANGED
|
@@ -1,55 +1,27 @@
|
|
|
1
|
-
import { $ } from 'zx';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
TARGET_ENV
|
|
6
|
-
PUBLISH_TAG
|
|
7
|
-
REPOSITORY_NAME
|
|
8
|
-
*/
|
|
9
|
-
export async function copy(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
29
|
-
await $`docker push ${toFullImageName}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function copy2(repositoryName, fromEnv, toEnv, tag) {
|
|
33
|
-
console.log(
|
|
34
|
-
`Copying repository ${repositoryName} from ${fromEnv} to ${toEnv} for tag ${tag}`,
|
|
35
|
-
);
|
|
36
|
-
const envInfo = getEnvInfo();
|
|
37
|
-
const fromRegistry = `${jfRegistryUrl}/${repositoryName}-${fromEnv}-docker-local`;
|
|
38
|
-
const toRegistry = `${jfRegistryUrl}/${repositoryName}-${toEnv}-docker-local`;
|
|
39
|
-
const imageName = `${repositoryName}:${tag}`;
|
|
40
|
-
const fromFullImageName = `${fromRegistry}/${imageName}`;
|
|
41
|
-
const toFullImageName = `${toRegistry}/${imageName}`;
|
|
42
|
-
|
|
43
|
-
console.log(
|
|
44
|
-
`Copying Docker image: ${fromFullImageName} -> ${toFullImageName}`,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
// Login to source registry
|
|
48
|
-
await $`echo ${envInfo[fromEnv].jfrog.password} | docker login --username ${envInfo[fromEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
49
|
-
await $`docker pull ${fromFullImageName}`;
|
|
50
|
-
await $`docker tag ${fromFullImageName} ${toFullImageName}`;
|
|
51
|
-
|
|
52
|
-
// Login to target registry
|
|
53
|
-
await $`echo ${envInfo[toEnv].jfrog.password} | docker login --username ${envInfo[toEnv].jfrog.username} --password-stdin ${jfRegistryUrl}`;
|
|
54
|
-
await $`docker push ${toFullImageName}`;
|
|
55
|
-
}
|
|
1
|
+
import { $ } from 'zx';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
TARGET_ENV
|
|
6
|
+
PUBLISH_TAG
|
|
7
|
+
REPOSITORY_NAME
|
|
8
|
+
*/
|
|
9
|
+
export async function copy() {
|
|
10
|
+
const JF_REGISTRY_URL = 'registry.paperout.com';
|
|
11
|
+
const SOURCE_REGISTRY = `${JF_REGISTRY_URL}/${process.env.REPOSITORY_NAME}-dev-docker-local`;
|
|
12
|
+
const TARGET_REGISTRY = `${JF_REGISTRY_URL}/${process.env.REPOSITORY_NAME}-${process.env.TARGET_ENV}-docker-local`;
|
|
13
|
+
const IMAGE_NAME = `${process.env.REPOSITORY_NAME}:${process.env.PUBLISH_TAG}`;
|
|
14
|
+
const SOURCE_FULL_IMAGE_NAME = `${SOURCE_REGISTRY}/${IMAGE_NAME}`;
|
|
15
|
+
const TARGET_FULL_IMAGE_NAME = `${TARGET_REGISTRY}/${IMAGE_NAME}`;
|
|
16
|
+
|
|
17
|
+
console.log(`Copying Docker image: ${SOURCE_FULL_IMAGE_NAME} -> ${TARGET_FULL_IMAGE_NAME}`);
|
|
18
|
+
|
|
19
|
+
// Login to source registry
|
|
20
|
+
await $`echo ${process.env.JF_REGISTRY_PASSWORD_DEV} | docker login --username ${process.env.JF_REGISTRY_USER_DEV} --password-stdin ${JF_REGISTRY_URL}`;
|
|
21
|
+
await $`docker pull ${SOURCE_FULL_IMAGE_NAME}`;
|
|
22
|
+
await $`docker tag ${SOURCE_FULL_IMAGE_NAME} ${TARGET_FULL_IMAGE_NAME}`;
|
|
23
|
+
|
|
24
|
+
// Login to target registry
|
|
25
|
+
await $`echo ${process.env.JF_REGISTRY_PASSWORD_QA} | docker login --username ${process.env.JF_REGISTRY_USER_QA} --password-stdin ${JF_REGISTRY_URL}`;
|
|
26
|
+
await $`docker push ${TARGET_FULL_IMAGE_NAME}`;
|
|
27
|
+
}
|