@docupace/pipeline 1.0.2-5.1 → 1.0.2

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/src/next/pull.js CHANGED
@@ -1,7 +1,7 @@
1
- import { $ } from 'zx';
2
-
3
- export async function pull(imageName) {
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
- }
1
+ import { $ } from 'zx';
2
+
3
+ export async function pull(imageName) {
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,23 +1,23 @@
1
- import { $ } from 'zx';
2
-
3
- export async function sonar(GIT_SHA) {
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
-
7
- console.log(`Running Sonar analysis on Docker image: ${IMAGE_NAME}`);
8
-
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
-
17
- await $`docker run --rm \
18
- -e BRANCH=${process.env.BITBUCKET_BRANCH} \
19
- -e PR_ID=${process.env.BITBUCKET_PR_ID} \
20
- -e PR_DESTINATION_BRANCH=${process.env.BITBUCKET_PR_DESTINATION_BRANCH} \
21
- -e SONAR_TOKEN=${process.env.SONAR_TOKEN} \
22
- --name ${SONAR_CONTAINER_NAME} ${IMAGE_NAME} pnpm sonar`;
23
- }
1
+ import { $ } from 'zx';
2
+
3
+ export async function sonar(GIT_SHA) {
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
+
7
+ console.log(`Running Sonar analysis on Docker image: ${IMAGE_NAME}`);
8
+
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
+
17
+ await $`docker run --rm \
18
+ -e BRANCH=${process.env.BITBUCKET_BRANCH} \
19
+ -e PR_ID=${process.env.BITBUCKET_PR_ID} \
20
+ -e PR_DESTINATION_BRANCH=${process.env.BITBUCKET_PR_DESTINATION_BRANCH} \
21
+ -e SONAR_TOKEN=${process.env.SONAR_TOKEN} \
22
+ --name ${SONAR_CONTAINER_NAME} ${IMAGE_NAME} pnpm sonar`;
23
+ }
package/.prettierrc.cjs DELETED
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- parser: 'typescript',
3
- trailingComma: 'all',
4
- tabWidth: 2,
5
- semi: true,
6
- singleQuote: true,
7
- printWidth: 80,
8
- tabs: false,
9
- jsxSingleQuote: false,
10
- bracketSameLine: true,
11
- arrowParens: 'always',
12
- };
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
- ];
@@ -1,75 +0,0 @@
1
- import axios from 'axios';
2
-
3
- import {
4
- createAlias
5
- } from '../next/alias.js';
6
-
7
- import {getAuth0AuthToken} from './configure.js';
8
-
9
- import {
10
- getVaultSecrets,
11
- } from './vault.js';
12
-
13
- import {
14
- getVaultSecretsConfigs,
15
- } from '../next/config.js';
16
-
17
- import {
18
- cloneEnvRepository,
19
- readDeployConfig,
20
- } from '../next/deploy.js';
21
-
22
- export async function getCCAlias ({application, auth0Domain, auth0AuthToken}){
23
- console.log(`Forming alias name for application ${application}...`);
24
-
25
- try {
26
- const auth0Response = await axios.get(`https://${auth0Domain}/api/v2/clients`, {
27
- headers: {authorization: `Bearer ${auth0AuthToken}`},
28
- });
29
-
30
- const appAuth0ClientIdData = auth0Response.data.find(client => client.name === `${application}`);
31
- const appAuth0ClientId = appAuth0ClientIdData.client_id;
32
-
33
- console.log(`Client Credentials Alias: ${appAuth0ClientId}@clients`);
34
- return `${appAuth0ClientId}@clients`;
35
- } catch (err) {
36
- console.error(`Failed to form alias name for application: ${application}: ${err.message}`);
37
- }
38
- }
39
-
40
- export async function configureAlias(site, env, username, password, realm) {
41
-
42
- console.log(`Creating alias for site: ${site} in env: ${env}`);
43
-
44
- const commonSecretsPath = getVaultSecretsConfigs(site).commonSecretsPath;
45
- console.log(`commonSecretsPath => ${commonSecretsPath}`)
46
- const commonSecrets = await getVaultSecrets(commonSecretsPath);
47
-
48
- // Site Common Secrets
49
- const siteCommonSecretsPath = getVaultSecretsConfigs(site).siteCommonSecretsPath;
50
- console.log(`siteCommonSecretsPath => ${siteCommonSecretsPath}`)
51
- const siteCommonSecrets = await getVaultSecrets(siteCommonSecretsPath);
52
-
53
- const auth0Domain = `docupace-${env}-${site}.us.auth0.com`
54
- const auth0ClientId = siteCommonSecrets.AUTH0_CLIENT_ID;
55
- const auth0ClientSecret = siteCommonSecrets.AUTH0_CLIENT_SECRET;
56
- const auth0Token = await getAuth0AuthToken(auth0Domain, auth0ClientId, auth0ClientSecret);
57
-
58
- await cloneEnvRepository(env);
59
-
60
- const { deployConfig: deployGraphQLServerConfig} = await readDeployConfig('graphql-server', env, site, 'values');
61
- const coreUrl = deployGraphQLServerConfig.graphqlServer.coreUrl;
62
-
63
- const clientCredentialsAlias = await getCCAlias({
64
- application: 'docupace-graphql-client-credentials',
65
- auth0Domain: auth0Domain,
66
- auth0AuthToken: auth0Token
67
- });
68
-
69
- await createAlias(
70
- coreUrl,
71
- username,
72
- password,
73
- realm,
74
- clientCredentialsAlias);
75
- }
package/src/auth0/cli.js DELETED
@@ -1,41 +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
- import {
13
- configureAlias
14
- } from "./alias.js";
15
-
16
- dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
17
-
18
- const program = new Command();
19
-
20
- program
21
- .command('configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <configureMFA>')
22
- .description('Configure the Auth0 tenants in env for the given site')
23
- .action(async (fromSite, toSite, fromEnv,toEnv, deployUI, deployGraphQLServer, useNewDomain, configureMFA) => {
24
- await configureFromSite(fromSite, toSite, fromEnv, toEnv, deployUI, deployGraphQLServer, useNewDomain, configureMFA);
25
- });
26
-
27
- program
28
- .command('getVaultSecrets <vaultPath>')
29
- .description('Get Secrets for Vault PATH')
30
- .action(async (vaultPath) => {
31
- await getVaultSecrets(vaultPath);
32
- });
33
-
34
- program
35
- .command('configureAlias <site> <env> <username> <password> <realm>')
36
- .description('Configure Core Alias for the given site')
37
- .action(async (site, env, username, password, realm) => {
38
- await configureAlias(site, env, username, password, realm);
39
- });
40
-
41
- program.parse(process.argv);