@docupace/pipeline 1.0.1-2.ervins.14 → 1.0.1-2.ervins.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.12.ervins.14",
3
+ "version": "1.0.12.ervins.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -278,9 +278,6 @@ async function getAuth0AuthToken(auth0Domain, clientId, clientSecret) {
278
278
 
279
279
  async function configureUI(siteHost, coreURL, docupaceHost, site, env, useNewDomain, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Token, vaultSiteSecretsPath, imageTag, repoPath) {
280
280
  console.log(`Configuring UI for site: ${site} Host: ${siteHost} in env: ${env}`);
281
- siteHost = siteHost.replace('https://', '');
282
- coreURL = coreURL.replace('https://', '');
283
-
284
281
 
285
282
  try {
286
283
  const auth0Response = await axios.get(`https://${auth0Domain}/api/v2/clients`, {
@@ -408,8 +405,6 @@ externalConnectService:
408
405
  }
409
406
 
410
407
  async function configureGraphQLServer(siteHost, coreURL, docupaceHost, site, env, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Token, vaultSiteSecretsPath, imageTag, standardConfigRemoteBranch, repoPath, commonSecrets) {
411
- siteHost = siteHost.replace('https://', '');
412
- coreURL = coreURL.replace('https://', '');
413
408
  console.log(`Configuring GraphQL Server for site: ${site} Host: ${siteHost} in env: ${env}`);
414
409
 
415
410
  try {
@@ -513,7 +508,7 @@ ingress:
513
508
  }
514
509
  }
515
510
 
516
- export async function configureFromSite(fromSite, toSite, env, deployUI, deployGraphQLServer, useNewDomain) {
511
+ export async function configureFromSite(fromSite, toSite, env,fromEnv,toEnv, deployUI, deployGraphQLServer, useNewDomain) {
517
512
  console.log(`Configuring Auth0 tenants and ArgoCD apps for site: ${toSite} in env: ${env} from site: ${fromSite}`);
518
513
  // Common Secrets
519
514
  const commonSecretsPath = getVaultSecretsConfigs(toSite).commonSecretsPath;
@@ -525,7 +520,7 @@ export async function configureFromSite(fromSite, toSite, env, deployUI, deployG
525
520
  console.log(`siteCommonSecretsPath => ${siteCommonSecretsPath}`)
526
521
  const siteCommonSecrets = await getVaultSecrets(siteCommonSecretsPath);
527
522
 
528
- const auth0Domain = `docupace-${env}-${toSite}.us.auth0.com`
523
+ const auth0Domain = `docupace-${toEnv}-${toSite}.us.auth0.com`
529
524
  const auth0ClientId = siteCommonSecrets.AUTH0_CLIENT_ID;
530
525
  const auth0ClientSecret = siteCommonSecrets.AUTH0_CLIENT_SECRET;
531
526
  const auth0Token = await getAuth0AuthToken(auth0Domain, auth0ClientId, auth0ClientSecret);
@@ -539,7 +534,7 @@ export async function configureFromSite(fromSite, toSite, env, deployUI, deployG
539
534
  console.log(`graphqlSecretsPath => ${graphqlSecretsPath}`);
540
535
 
541
536
  // Clone repositories
542
- const repoPath = await cloneEnvRepository(env);
537
+ const repoPath = await cloneEnvRepository(toEnv);
543
538
  const auth0RepoPath = await cloneRepository('auth0-site-setup');
544
539
 
545
540
  // Read deploy configs
@@ -19,22 +19,20 @@ export async function addApacheSite() {
19
19
  log('Error: HAPROXY_PRIVATE_KEY not set.');
20
20
  process.exit(1);
21
21
  }
22
-
23
- await fs.writeFile('private.key', Buffer.from(haproxyPrivateKey, 'base64'));
22
+
23
+ //await fs.writeFile('private.key', haproxyPrivateKey);
24
+ await $`echo "${haproxyPrivateKey}" > private.key`;
24
25
  await fs.chmod('private.key', 0o600);
25
-
26
26
 
27
+
28
+ const server = `${process.env.ENVIRONMENT}-apalb01a.corp.docupace.com`;
27
29
  console.log("Running command");
28
- const sshCmd = (server,script) =>
30
+ const sshCmd = (script) =>
29
31
  $`ssh -i private.key -o StrictHostKeyChecking=no root@${server} ${script}`;
30
32
 
31
- let server = `${process.env.ENVIRONMENT}-apalb01a.corp.docupace.com`;
32
33
  // The script is run twice in the Bash version
33
- await sshCmd(server, `/root/repo/iis-preprod/scripts/addsite/add_core_site.sh ${process.env.ENVIRONMENT} ${process.env.SITE}`);
34
-
35
- server = `${process.env.ENVIRONMENT}-apalb01b.corp.docupace.com`;
36
-
37
- await sshCmd(server,`/root/repo/iis-preprod/scripts/addsite/add_core_site.sh ${process.env.ENVIRONMENT} ${process.env.SITE}`);
34
+ await sshCmd(`/root/repo/iis-preprod/scripts/addsite/add_core_site.sh ${process.env.ENVIRONMENT} ${process.env.SITE}`);
35
+ //await sshCmd(`/root/repo/iis-preprod/scripts/addsite/add_core_site.sh ${process.env.ENVIRONMENT} ${process.env.SITE}`);
38
36
  }
39
37
 
40
38