@docupace/pipeline 1.0.1-2.ervinsUpdate2.5 → 1.0.1
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/package.json +4 -19
- package/src/changeset/cli.js +169 -215
- package/src/changeset/validate.js +33 -36
- package/src/next/cli.js +30 -148
- package/src/next/copy.js +16 -19
- package/src/next/deploy.js +63 -300
- package/src/next/publish.js +40 -42
- package/src/next/pull.js +4 -4
- package/src/next/sonar.js +11 -11
- package/.prettierrc.cjs +0 -12
- package/eslint.config.js +0 -26
- package/src/auth0/cli.js +0 -31
- package/src/auth0/configure.js +0 -651
- package/src/auth0/vault.js +0 -107
- package/src/jenkins/setParams.groovy +0 -59
- package/src/next/apache.js +0 -40
- package/src/next/config.js +0 -84
- package/src/next/connect.js +0 -199
- package/src/next/haproxy.js +0 -50
- package/src/next/jenkins.js +0 -122
- package/src/next/pipline.js +0 -115
- package/src/next/vault.js +0 -39
- package/terraform/apply.sh +0 -26
- package/terraform/init.sh +0 -36
- package/terraform/plan.sh +0 -44
- package/terraform/validate.sh +0 -17
package/src/next/publish.js
CHANGED
|
@@ -1,48 +1,46 @@
|
|
|
1
1
|
import { $ } from 'zx';
|
|
2
2
|
|
|
3
3
|
export async function publish(GIT_SHA) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
await $`docker tag ${IMAGE_NAME} ${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}`;
|
|
22
|
-
await $`docker push ${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}`;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Tag and push build image
|
|
26
|
-
await $`docker tag ${IMAGE_NAME} ${JF_REGISTRY_FULL_URL}/${BUILD_IMAGE_NAME}`;
|
|
27
|
-
await $`docker push ${JF_REGISTRY_FULL_URL}/${BUILD_IMAGE_NAME}`;
|
|
28
|
-
|
|
29
|
-
// Fetch Git tags pointing to the current HEAD
|
|
30
|
-
const gitTagsOutput = (await $`git tag --points-at HEAD`).stdout.trim();
|
|
31
|
-
const gitTags = gitTagsOutput.split('\n').filter((tag) => tag);
|
|
32
|
-
|
|
33
|
-
// Tag and push each Git tag as a Docker tag
|
|
34
|
-
if (gitTags.length > 0) {
|
|
35
|
-
console.log(`Found Git tags pointing to HEAD: ${gitTags.join(', ')}`);
|
|
36
|
-
for (const gitTag of gitTags) {
|
|
37
|
-
const dockerTag = `${JF_REGISTRY_FULL_URL}/${BITBUCKET_REPO_SLUG}:${gitTag}`;
|
|
38
|
-
console.log(`Tagging and pushing Docker image for Git tag: ${gitTag}`);
|
|
39
|
-
await $`docker tag ${IMAGE_NAME} ${dockerTag}`;
|
|
40
|
-
await $`docker push ${dockerTag}`;
|
|
4
|
+
const BITBUCKET_REPO_SLUG = process.env.BITBUCKET_REPO_SLUG;
|
|
5
|
+
const BUILD_IMAGE_NAME = `${BITBUCKET_REPO_SLUG}:build-${process.env.BITBUCKET_BUILD_NUMBER}`;
|
|
6
|
+
const IMAGE_NAME = `${BITBUCKET_REPO_SLUG}:sha-${GIT_SHA}`;
|
|
7
|
+
const JF_REGISTRY_FULL_URL = `${process.env.JF_REGISTRY_URL}/${process.env.JF_REGISTRY_REPO_NAME}`;
|
|
8
|
+
|
|
9
|
+
console.log(`Publishing Docker image: ${IMAGE_NAME}`);
|
|
10
|
+
|
|
11
|
+
// Docker login
|
|
12
|
+
await $`echo ${process.env.JF_REGISTRY_PASSWORD_DEV} | docker login --username ${process.env.JF_REGISTRY_USER_DEV} --password-stdin ${process.env.JF_REGISTRY_URL}`;
|
|
13
|
+
|
|
14
|
+
// Check if the image already exists
|
|
15
|
+
try {
|
|
16
|
+
await $`docker manifest inspect ${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}`;
|
|
17
|
+
console.log(`Tag sha-${GIT_SHA} already exists in the remote repository. Skipping push.`);
|
|
18
|
+
} catch {
|
|
19
|
+
await $`docker tag ${IMAGE_NAME} ${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}`;
|
|
20
|
+
await $`docker push ${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}`;
|
|
41
21
|
}
|
|
42
|
-
} else {
|
|
43
|
-
console.log('No Git tags found pointing to the current HEAD.');
|
|
44
|
-
}
|
|
45
22
|
|
|
46
|
-
|
|
47
|
-
|
|
23
|
+
// Tag and push build image
|
|
24
|
+
await $`docker tag ${IMAGE_NAME} ${JF_REGISTRY_FULL_URL}/${BUILD_IMAGE_NAME}`;
|
|
25
|
+
await $`docker push ${JF_REGISTRY_FULL_URL}/${BUILD_IMAGE_NAME}`;
|
|
26
|
+
|
|
27
|
+
// Fetch Git tags pointing to the current HEAD
|
|
28
|
+
const gitTagsOutput = (await $`git tag --points-at HEAD`).stdout.trim();
|
|
29
|
+
const gitTags = gitTagsOutput.split('\n').filter((tag) => tag);
|
|
30
|
+
|
|
31
|
+
// Tag and push each Git tag as a Docker tag
|
|
32
|
+
if (gitTags.length > 0) {
|
|
33
|
+
console.log(`Found Git tags pointing to HEAD: ${gitTags.join(', ')}`);
|
|
34
|
+
for (const gitTag of gitTags) {
|
|
35
|
+
const dockerTag = `${JF_REGISTRY_FULL_URL}/${BITBUCKET_REPO_SLUG}:${gitTag}`;
|
|
36
|
+
console.log(`Tagging and pushing Docker image for Git tag: ${gitTag}`);
|
|
37
|
+
await $`docker tag ${IMAGE_NAME} ${dockerTag}`;
|
|
38
|
+
await $`docker push ${dockerTag}`;
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
console.log('No Git tags found pointing to the current HEAD.');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Docker logout
|
|
45
|
+
await $`docker logout ${process.env.JF_REGISTRY_URL}`;
|
|
48
46
|
}
|
package/src/next/pull.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $ } from 'zx';
|
|
2
2
|
|
|
3
3
|
export async function pull(imageName) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
const JF_REGISTRY_FULL_URL = `${process.env.JF_REGISTRY_URL}/${process.env.JF_REGISTRY_REPO_NAME}`;
|
|
5
|
+
console.log(`Pulling Docker image: ${JF_REGISTRY_FULL_URL}/${imageName}`);
|
|
6
|
+
await $`docker pull ${JF_REGISTRY_FULL_URL}/${imageName}`;
|
|
7
|
+
}
|
package/src/next/sonar.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { $ } from 'zx';
|
|
2
2
|
|
|
3
3
|
export async function sonar(GIT_SHA) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const IMAGE_NAME = `${process.env.BITBUCKET_REPO_SLUG}:sha-${GIT_SHA}`;
|
|
5
|
+
const SONAR_CONTAINER_NAME = `${process.env.BITBUCKET_REPO_SLUG}-${GIT_SHA}`;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
console.log(`Running Sonar analysis on Docker image: ${IMAGE_NAME}`);
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
// Remove existing container
|
|
10
|
+
const existingContainer = (
|
|
11
|
+
await $`docker ps -a --filter "name=${SONAR_CONTAINER_NAME}" --format "{{.Names}}"`
|
|
12
|
+
).stdout.trim();
|
|
13
|
+
if (existingContainer) {
|
|
14
|
+
await $`docker rm -f ${SONAR_CONTAINER_NAME}`;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
await $`docker run --rm \
|
|
18
18
|
-e BRANCH=${process.env.BITBUCKET_BRANCH} \
|
|
19
19
|
-e PR_ID=${process.env.BITBUCKET_PR_ID} \
|
|
20
20
|
-e PR_DESTINATION_BRANCH=${process.env.BITBUCKET_PR_DESTINATION_BRANCH} \
|
package/.prettierrc.cjs
DELETED
package/eslint.config.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import globals from 'globals';
|
|
2
|
-
import pluginJs from '@eslint/js';
|
|
3
|
-
import prettierConfig from 'eslint-config-prettier';
|
|
4
|
-
import prettierPlugin from 'eslint-plugin-prettier';
|
|
5
|
-
|
|
6
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
7
|
-
export default [
|
|
8
|
-
{
|
|
9
|
-
languageOptions: {
|
|
10
|
-
globals: {
|
|
11
|
-
...globals.browser,
|
|
12
|
-
...globals.node, // Add Node.js globals
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
pluginJs.configs.recommended,
|
|
17
|
-
{
|
|
18
|
-
plugins: {
|
|
19
|
-
prettier: prettierPlugin,
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
...prettierConfig.rules,
|
|
23
|
-
'prettier/prettier': 'error',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
];
|
package/src/auth0/cli.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import {
|
|
5
|
-
configureFromSite
|
|
6
|
-
} from './configure.js';
|
|
7
|
-
import {
|
|
8
|
-
getVaultSecrets
|
|
9
|
-
} from './vault.js'
|
|
10
|
-
|
|
11
|
-
import dotenv from 'dotenv';
|
|
12
|
-
|
|
13
|
-
dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
|
|
14
|
-
|
|
15
|
-
const program = new Command();
|
|
16
|
-
|
|
17
|
-
program
|
|
18
|
-
.command('configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain>')
|
|
19
|
-
.description('Configure the Auth0 tenants in env for the given site')
|
|
20
|
-
.action(async (fromSite, toSite, fromEnv,toEnv, deployUI, deployGraphQLServer, useNewDomain) => {
|
|
21
|
-
await configureFromSite(fromSite, toSite, fromEnv, toEnv, deployUI, deployGraphQLServer, useNewDomain);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
program
|
|
25
|
-
.command('getVaultSecrets <vaultPath>')
|
|
26
|
-
.description('Get Secrets for Vault PATH')
|
|
27
|
-
.action(async (vaultPath) => {
|
|
28
|
-
await getVaultSecrets(vaultPath);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
program.parse(process.argv);
|