@docupace/pipeline 1.0.38 → 1.0.39-matttest.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.38",
3
+ "version": "1.0.39-matttest.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -40,6 +40,7 @@
40
40
  "scripts": {
41
41
  "test-deploy-core": "dp-next-cli deploy-core-pipeline dev template",
42
42
  "test-deploy-from-site": "dp-next-cli deploy-from-site --from-env dev --to-env dev --from-site financialdev --to-site template --deploy-core true",
43
- "test-run-pipline": "dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa"
43
+ "test-run-pipline": "dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa",
44
+ "test-validate": "dp-changset-cli validate"
44
45
  }
45
46
  }
package/src/auth0/cli.js CHANGED
@@ -15,7 +15,7 @@ const program = new Command();
15
15
 
16
16
  program
17
17
  .command(
18
- 'configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <useS3> <deployCCUI>',
18
+ 'configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <useS3>',
19
19
  )
20
20
  .description('Configure the Auth0 tenants in env for the given site')
21
21
  .action(
@@ -28,7 +28,6 @@ program
28
28
  deployGraphQLServer,
29
29
  useNewDomain,
30
30
  useS3,
31
- deployCCUI,
32
31
  ) => {
33
32
  await configureFromSite(
34
33
  fromSite,
@@ -39,7 +38,6 @@ program
39
38
  deployGraphQLServer,
40
39
  useNewDomain,
41
40
  useS3 === 'true' || useS3 === true,
42
- deployCCUI,
43
41
  );
44
42
  },
45
43
  );
@@ -57,7 +57,6 @@ export async function getAuth0AuthToken(auth0Domain, clientId, clientSecret) {
57
57
  async function configureUI(
58
58
  siteHost,
59
59
  coreURL,
60
- connectURL,
61
60
  docupaceHost,
62
61
  site,
63
62
  env,
@@ -75,7 +74,6 @@ async function configureUI(
75
74
  );
76
75
  siteHost = siteHost.replace('https://', '');
77
76
  coreURL = coreURL.replace('https://', '');
78
- connectURL = connectURL.replace('https://', '');
79
77
 
80
78
  try {
81
79
  const auth0Response = await axios.get(
@@ -131,7 +129,7 @@ uiMain:
131
129
  auth0ClientId: vault:secret/data/${site}/ui/config#AUTH0_CLIENT_ID
132
130
  graphqlClientUrl: https://${siteHost}/api/graphql
133
131
  graphqlServerUrl: https://${siteHost}/api/graphql
134
- connectUrl: https://${connectURL}
132
+ connectUrl: https://${siteHost}
135
133
  coreUrl: https://${coreURL}
136
134
  env:
137
135
  AUTH0_CLIENT_SECRET: vault:secret/data/${site}/ui/config#AUTH0_CLIENT_SECRET
@@ -246,167 +244,6 @@ externalConnectService:
246
244
  }
247
245
  }
248
246
 
249
- async function configureCCUI(
250
- siteHost,
251
- coreURL,
252
- connectURL,
253
- docupaceHost,
254
- site,
255
- env,
256
- auth0Domain,
257
- auth0ClientId,
258
- auth0ClientSecret,
259
- auth0Token,
260
- vaultSiteSecretsPath,
261
- imageTag,
262
- repoPath,
263
- useS3,
264
- ccUrl,
265
- ) {
266
- console.log(
267
- `Configuring CC UI for site: ${site} Host: ${siteHost} in env: ${env}`,
268
- );
269
- siteHost = siteHost.replace('https://', '');
270
- coreURL = coreURL.replace('https://', '');
271
- connectURL = connectURL.replace('https://', '');
272
- ccUrl = ccUrl.replace('https://', '');
273
-
274
- try {
275
- const auth0Response = await axios.get(
276
- `https://${auth0Domain}/api/v2/clients`,
277
- {
278
- headers: { authorization: `Bearer ${auth0Token}` },
279
- },
280
- );
281
-
282
- const uiClient = auth0Response.data.find(
283
- (client) => client.name === 'docupace-ui-cc',
284
- );
285
- const uiAuth0ClientId = uiClient.client_id;
286
- const uiAuth0ClientSecret = uiClient.client_secret;
287
-
288
- // Generate Auth0 Secret
289
- const uiAuth0Secret = crypto
290
- .randomBytes(48)
291
- .toString('base64')
292
- .replace(/[^a-zA-Z0-9]/g, '');
293
-
294
- // Prepare data payload
295
- console.log('Preparing Vault CC UI data payload...');
296
- const ccUISecretData = JSON.stringify({
297
- data: {
298
- AUTH0_CLIENT_ID: uiAuth0ClientId,
299
- AUTH0_CLIENT_SECRET: uiAuth0ClientSecret,
300
- AUTH0_SECRET: uiAuth0Secret,
301
- },
302
- });
303
- console.log('Updating Vault Site Secret =>', vaultSiteSecretsPath);
304
- await updateVaultSecrets(vaultSiteSecretsPath, ccUISecretData);
305
-
306
- let siteAWSSecrets = null;
307
-
308
- if (useS3 === true || useS3 === 'true') {
309
- const siteAWSSecretsPath = getVaultSecretsConfigs(site).awsSecretsPath;
310
- siteAWSSecrets = await getVaultSecrets(siteAWSSecretsPath);
311
- console.log(`siteAWSSecretsPath => ${siteAWSSecretsPath}`);
312
- }
313
-
314
- // Prepare cc.app.yaml
315
- const uiССAppYaml = `
316
- repo: docupace-ui-main
317
- revision: master
318
- `.trim();
319
- // Prepare cc.values.yaml
320
- const uiССValuesYaml = `
321
- uiMain:
322
- auth0BaseUrl: https://${ccUrl}
323
- auth0IssuerBaseUrl: https://${auth0Domain}
324
- auth0ClientId: vault:secret/data/${site}/ui-cc/config#AUTH0_CLIENT_ID
325
- graphqlClientUrl: https://${siteHost}/api/graphql
326
- graphqlServerUrl: https://${siteHost}/api/graphql
327
- connectUrl: https://${connectURL}
328
- coreUrl: https://${coreURL}
329
- env:
330
- AUTH0_AUDIENCE: core-api-access
331
- AUTH0_CLIENT_SECRET: vault:secret/data/${site}/ui-cc/config#AUTH0_CLIENT_SECRET
332
- AUTH0_SECRET: vault:secret/data/${site}/ui-cc/config#AUTH0_SECRET
333
- ${
334
- useS3 === true || useS3 === 'true'
335
- ? `
336
- AWS_ACCESS_KEY_ID: vault:secret/data/${site}/aws/config#AWS_ACCESS_KEY_ID
337
- AWS_BUCKET_NAME: vault:secret/data/${site}/aws/config#AWS_BUCKET_NAME
338
- AWS_SECRET_ACCESS_KEY: vault:secret/data/${site}/aws/config#AWS_SECRET_ACCESS_KEY
339
- image:
340
- repository: registry.paperout.com/docupace-ui-main-dev-docker-local/cc-ui-app
341
- tag: ${imageTag}
342
- imagePullSecrets:
343
- - name: jf-artifactory
344
- ingress:
345
- enabled: true
346
- className: nginx
347
- annotations:
348
- external-dns.alpha.kubernetes.io/hostname: ${ccUrl}
349
- external-dns.alpha.kubernetes.io/zone: public
350
- cert-manager.io/cluster-issuer: letsencrypt
351
- nginx.ingress.kubernetes.io/proxy-buffer-size: 128k
352
- hosts:
353
- - host: ${ccUrl}
354
- paths:
355
- - path: /
356
- pathType: Prefix
357
- tls:
358
- - hosts:
359
- - ${ccUrl}
360
- secretName: dp-cc-ui-cert
361
- `.trim()
362
- : ''
363
- }
364
- ${
365
- useS3 === true || useS3 === 'true'
366
- ? `
367
- serviceAccount:
368
- create: true
369
- annotations:
370
- eks.amazonaws.com/role-arn: arn:aws:iam::${siteAWSSecrets.AWS_ACCOUNT_ID}:role/eks-pod-identity-connect-next-${env}-${site}-bucket
371
- `.trim()
372
- : ''
373
- }
374
- `.trim();
375
-
376
- console.log('Writing configuration files...');
377
- await ensureDirectoryExists(path.resolve(`${repoPath}/dp/${site}`));
378
-
379
- await fs.writeFile(
380
- `${repoPath}/dp/${site}/cc.app.yaml`,
381
- uiССAppYaml,
382
- (err) => {
383
- if (err) {
384
- console.error('Failed to write the file:', err);
385
- } else {
386
- console.log('File written successfully.');
387
- }
388
- },
389
- );
390
-
391
- await fs.writeFile(
392
- `${repoPath}/dp/${site}/cc.values.yaml`,
393
- uiССValuesYaml,
394
- (err) => {
395
- if (err) {
396
- console.error('Failed to write the file:', err);
397
- } else {
398
- console.log('File written successfully.');
399
- }
400
- },
401
- );
402
- console.log('Done!');
403
- console.log('Updating Core Site Config...');
404
- await updateCoreSiteConfig(site, env, useS3);
405
- } catch (error) {
406
- console.error('Error configuring UI:', error);
407
- }
408
- }
409
-
410
247
  export async function cleanAndWritePropertiesFile(configPath, content) {
411
248
  try {
412
249
  const cleanedContent = content
@@ -619,7 +456,6 @@ export async function configureFromSite(
619
456
  deployGraphQLServer,
620
457
  useNewDomain,
621
458
  useS3,
622
- deployCCUI,
623
459
  ) {
624
460
  console.log(
625
461
  `Configuring Auth0 tenants and ArgoCD apps for site: ${toSite} in env: ${toEnv} from site: ${fromSite}`,
@@ -644,14 +480,10 @@ export async function configureFromSite(
644
480
  auth0ClientSecret,
645
481
  );
646
482
 
647
- // UI MAIN app
483
+ // UI app
648
484
  const uiSecretsPath = getVaultSecretsConfigs(toSite).uiSecretsPath;
649
485
  console.log(`uiSecretsPath => ${uiSecretsPath}`);
650
486
 
651
- // UI CC app
652
- const ccUISecretsPath = getVaultSecretsConfigs(toSite).ccUISecretsPath;
653
- console.log(`ccUISecretsPath => ${ccUISecretsPath}`);
654
-
655
487
  // GraphQL-Server app
656
488
  const graphqlSecretsPath =
657
489
  getVaultSecretsConfigs(toSite).graphqlServerSecretsPath;
@@ -701,22 +533,17 @@ export async function configureFromSite(
701
533
  const envConfig = environmentConfig[toEnv];
702
534
 
703
535
  let CORE_URL, SITE_HOST, CORE_API_CONTEXT, CONNECT_URL, DOCUPACE_HOST;
704
- const newUrl = envConfig.newUrl(toSite);
705
- const ccUrl = envConfig.ccUrl(toSite);
706
-
707
- SITE_HOST = `${newUrl}`;
708
-
709
- if (useNewDomain === true || useNewDomain === 'true') {
536
+ if (useNewDomain) {
710
537
  const newUrl = envConfig.newUrl(toSite);
711
538
  CORE_URL = `${newUrl}/core`;
712
- // SITE_HOST = newUrl;
539
+ SITE_HOST = newUrl;
713
540
  CORE_API_CONTEXT = 'core';
714
541
  CONNECT_URL = `${newUrl}/connect`;
715
542
  DOCUPACE_HOST = envConfig.docupaceHost();
716
543
  } else {
717
544
  const oldUrl = envConfig.oldUrl(toSite);
718
545
  CORE_URL = oldUrl;
719
- // SITE_HOST = oldUrl;
546
+ SITE_HOST = oldUrl;
720
547
  CORE_API_CONTEXT = toSite;
721
548
  CONNECT_URL = `${oldUrl}_ui`;
722
549
  }
@@ -725,7 +552,6 @@ export async function configureFromSite(
725
552
  await configureUI(
726
553
  SITE_HOST,
727
554
  CORE_URL,
728
- CONNECT_URL,
729
555
  DOCUPACE_HOST,
730
556
  toSite,
731
557
  toEnv,
@@ -740,26 +566,6 @@ export async function configureFromSite(
740
566
  );
741
567
  }
742
568
 
743
- if (deployCCUI === true || deployCCUI === 'true') {
744
- await configureCCUI(
745
- SITE_HOST,
746
- CORE_URL,
747
- CONNECT_URL,
748
- DOCUPACE_HOST,
749
- toSite,
750
- toEnv,
751
- auth0Domain,
752
- auth0ClientId,
753
- auth0ClientSecret,
754
- auth0Token,
755
- ccUISecretsPath,
756
- uiImageTag,
757
- repoPathToEnv,
758
- useS3,
759
- ccUrl,
760
- );
761
- }
762
-
763
569
  await configureGraphQLServer(
764
570
  SITE_HOST,
765
571
  CORE_URL,
@@ -10,6 +10,7 @@ import z from 'zod';
10
10
  import dotenv from 'dotenv';
11
11
  import { makeJiraRequest, updateComponentVersion } from '../next/jira.js';
12
12
  dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
13
+ import { setGitInfo } from '../next/util.js';
13
14
 
14
15
  const program = new Command();
15
16
 
@@ -61,13 +62,6 @@ async function getMainPackage() {
61
62
  throw new Error('Main package.json not found');
62
63
  }
63
64
 
64
- // Helper function to set Git info
65
- async function setGitInfo() {
66
- await $`git config --global user.email "gitops@docupace.com"`;
67
- await $`git config --global user.name "Gitops"`;
68
- await $`git remote set-url origin https://${process.env.THIS_REP_TOKEN}@bitbucket.org/${process.env.BITBUCKET_REPO_FULL_NAME}.git`;
69
- }
70
-
71
65
  const changeSetPackage = `{
72
66
  "name": "changeset-package",
73
67
  "version": "1.0.0",
@@ -159,15 +153,15 @@ async function commitTagCommand() {
159
153
 
160
154
  // Command: validate
161
155
  program
162
- .command('validate <path>')
156
+ .command('validate')
163
157
  .description('Validate changesets for the provided PR')
164
- .action(async (path) => {
158
+ .action(async () => {
165
159
  if (!process.env.BITBUCKET_PR_ID) {
166
160
  return;
167
161
  }
168
162
  console.log('🔍 Validating changesets...');
169
163
  try {
170
- await validateChangesets(path);
164
+ await validateChangesets();
171
165
  console.log('✅ Changeset validation passed.');
172
166
  } catch (error) {
173
167
  console.error(
@@ -225,7 +219,6 @@ program
225
219
  await $`git add .`;
226
220
  await $`git commit -m "Open next alpha version"`;
227
221
  await $`git push origin`;
228
-
229
222
  });
230
223
 
231
224
  program
@@ -263,7 +256,7 @@ program
263
256
 
264
257
  if (!jiraResponse.ok) {
265
258
  throw new Error(
266
- `Failed to fetch Jira ticket. Status: ${jiraResponse.status}`,
259
+ `Failed to fetch Jira ticket. Status: ${jiraResponse.status}`,
267
260
  );
268
261
  }
269
262
  const jiraTicketData = await jiraResponse.json();
@@ -1,7 +1,43 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
+ import { $ } from 'zx';
3
4
 
4
- export async function validateChangesets(directoryPath) {
5
+ import { getChangedPackages, isMonoRepo, setGitInfo } from '../next/util.js';
6
+
7
+ const CHANGESET_DIR = '.changeset';
8
+
9
+ export async function validateChangesets() {
10
+ /*if (isMonoRepo()) {
11
+ const branch = process.env.BITBUCKET_BRANCH;
12
+ const destBranch = process.env.BITBUCKET_PR_DESTINATION_BRANCH;
13
+
14
+ const changePackages = await getChangedPackages(destBranch, branch);
15
+
16
+ const appPackages = changePackages.filter((appPackage) =>
17
+ appPackage.name.endsWith('-app'),
18
+ );
19
+
20
+ let appPaths;
21
+ if (appPackages.length > 0) {
22
+ appPaths = appPackages.map((appPackage) => appPackage.path);
23
+ for (const appPath of appPaths) {
24
+ const changesetPath = path.resolve(appPath, CHANGESET_DIR);
25
+ await validateChangesetPath(changesetPath);
26
+ }
27
+ } else {
28
+ throw new Error('No changeset for at least one app');
29
+ }
30
+ } else {
31
+ await validateChangesetPath(path.resolve(process.cwd(), CHANGESET_DIR));
32
+ }*/
33
+
34
+ await setGitInfo();
35
+ const destBranch = process.env.BITBUCKET_PR_DESTINATION_BRANCH;
36
+ await $`git fetch origin ${destBranch}:${destBranch}`;
37
+ await $`changeset status --since=${destBranch}`;
38
+ }
39
+
40
+ export async function validateChangesetPath(directoryPath) {
5
41
  try {
6
42
  // Step 1: Read the directory for md files excluding README.md
7
43
  const allFiles = fs.readdirSync(directoryPath);
@@ -5,31 +5,26 @@ export const environmentConfig = {
5
5
  newUrl: (site) => `https://${site}.dev.dpai.tech`,
6
6
  oldUrl: (site) => `https://www.dev.docupaceinc.com/${site}`,
7
7
  docupaceHost: () => 'www.dev.docupaceinc.com',
8
- ccUrl: (site) => `https://${site}-cc.dev.dpai.tech`,
9
8
  },
10
9
  qa: {
11
10
  newUrl: (site) => `https://${site}.qa.dpai.tech`,
12
11
  oldUrl: (site) => `https://www.preprod.docupaceinc.com/${site}`,
13
12
  docupaceHost: () => 'www.preprod.docupaceinc.com',
14
- ccUrl: (site) => `https://${site}-cc.qa.dpai.tech`,
15
13
  },
16
14
  uat: {
17
- newUrl: (site) => `https://${site}.uat.dpai.tech`,
15
+ newUrl: (site) => `https://${site}.qa.dpai.tech`,
18
16
  oldUrl: (site) => `https://www2.paperout.com/${site}_uat`,
19
17
  docupaceHost: () => 'www2.paperout.com',
20
- ccUrl: (site) => `https://${site}-cc.uat.dpai.tech`,
21
18
  },
22
19
  stage: {
23
- newUrl: (site) => `https://${site}.stg.dpai.tech`,
20
+ newUrl: (site) => `https://${site}.stage.dpai.tech`,
24
21
  oldUrl: (site) => `https://www2.paperout.com/${site}_staging`,
25
22
  docupaceHost: () => 'www2.paperout.com',
26
- ccUrl: (site) => `https://${site}-cc.stg.dpai.tech`,
27
23
  },
28
24
  prod: {
29
25
  newUrl: (site) => `https://${site}.dpai.tech`,
30
26
  oldUrl: (site) => `https://www2.paperout.com/${site}`,
31
27
  docupaceHost: () => 'www2.paperout.com',
32
- ccUrl: (site) => `https://${site}-cc.dpai.tech`,
33
28
  },
34
29
  };
35
30
 
@@ -85,7 +80,6 @@ export const getVaultSecretsConfigs = (site) => {
85
80
  siteCommonSecretsPath: `secret/data/${site}/common/config`,
86
81
  graphqlServerSecretsPath: `secret/data/${site}/graphql-server/config`,
87
82
  uiSecretsPath: `secret/data/${site}/ui/config`,
88
- ccUISecretsPath: `secret/data/${site}/ui-cc/config`,
89
83
  awsSecretsPath: `secret/data/${site}/aws/config`,
90
84
  };
91
85
  };
@@ -0,0 +1,58 @@
1
+ import { existsSync } from 'fs';
2
+ import { join } from 'path';
3
+ import { $, nothrow } from 'zx';
4
+
5
+ export function isMonoRepo() {
6
+ // Check for the presence of turbo.json which indicates a Turborepo monorepo
7
+ return existsSync(join(process.cwd(), 'turbo.json'));
8
+ }
9
+
10
+ /**
11
+ * Gets the packages that have changed between two git references (branches or tags)
12
+ * @param {string} fromRef - The starting git reference (branch or tag)
13
+ * @param {string} toRef - The ending git reference (branch or tag)
14
+ * @returns {Promise<Array<{name: string, path: string}>>} - Array of changed packages with name and path
15
+ */
16
+ export async function getChangedPackages(fromRef, toRef) {
17
+ try {
18
+ // Run the turbo command to get changed packages between branches
19
+ const filterArg = `[${fromRef}...${toRef}]`;
20
+ const turboDryOutput =
21
+ await $`turbo run build --filter=${filterArg} --dry=json`;
22
+ const packageNames =
23
+ await $`echo ${turboDryOutput} | jq -r '.tasks[].taskId' | cut -d'#' -f1 | sort -u`;
24
+
25
+ // If we didn't get any package names, return empty array
26
+ if (!packageNames.stdout.trim()) {
27
+ return [];
28
+ }
29
+
30
+ // For each package name, get its path
31
+ const packages = [];
32
+ const packageNamesList = packageNames.stdout.trim().split('\n');
33
+
34
+ for (const packageName of packageNamesList) {
35
+ if (packageName) {
36
+ const packagePath =
37
+ await $`pnpm m ls -r --json | jq -r --arg name ${packageName} '.[] | select(.name == $name) | .path'`;
38
+ if (packagePath.stdout.trim()) {
39
+ packages.push({
40
+ name: packageName,
41
+ path: packagePath.stdout.trim(),
42
+ });
43
+ }
44
+ }
45
+ }
46
+
47
+ return packages;
48
+ } catch (error) {
49
+ console.error('Error getting changed packages:', error);
50
+ return [];
51
+ }
52
+ }
53
+
54
+ export async function setGitInfo() {
55
+ await $`git config --global user.email "gitops@docupace.com"`;
56
+ await $`git config --global user.name "Gitops"`;
57
+ await $`git remote set-url origin https://${process.env.THIS_REP_TOKEN}@bitbucket.org/${process.env.BITBUCKET_REPO_FULL_NAME}.git`;
58
+ }
@@ -2,7 +2,6 @@
2
2
  set -e
3
3
 
4
4
  PROJECT=$1
5
- export ROLE_NAME="${2:-atlassian-bitbucket-pipelines-runner-eks-role}"
6
5
 
7
6
  if [[ -z "$PROJECT" ]]; then
8
7
  echo "Error: Project name is required."
@@ -10,6 +9,7 @@ if [[ -z "$PROJECT" ]]; then
10
9
  exit 1
11
10
  fi
12
11
 
12
+ export ROLE_NAME="atlassian-bitbucket-pipelines-runner-eks-role"
13
13
  export SESSION_NAME="EKSAdminSession"
14
14
  export EKS_CLUSTER_NAME="connect-next-${CURRENT_ENVIRONMENT}-eks-cluster"
15
15
  export ROLE_ARN="arn:aws:iam::$(aws sts get-caller-identity | jq -r '.Account'):role/$ROLE_NAME"
package/terraform/init.sh CHANGED
@@ -3,7 +3,6 @@ set -e
3
3
 
4
4
  PROJECT=$1
5
5
  CURRENT_ENVIRONMENT=$2
6
- export ROLE_NAME="${3:-atlassian-bitbucket-pipelines-runner-eks-role}"
7
6
 
8
7
  if [[ -z "$PROJECT" ]]; then
9
8
  echo "Error: Project name is required."
@@ -17,6 +16,7 @@ if [[ -z "$CURRENT_ENVIRONMENT" ]]; then
17
16
  exit 1
18
17
  fi
19
18
 
19
+ export ROLE_NAME="atlassian-bitbucket-pipelines-runner-eks-role"
20
20
  export SESSION_NAME="EKSAdminSession"
21
21
  export EKS_CLUSTER_NAME="connect-next-${CURRENT_ENVIRONMENT}-eks-cluster"
22
22
  export ROLE_ARN="arn:aws:iam::$(aws sts get-caller-identity | jq -r '.Account'):role/$ROLE_NAME"
@@ -37,7 +37,6 @@ info () {
37
37
  echo "PROJECT => $PROJECT"
38
38
  echo "CURRENT_ENVIRONMENT => $CURRENT_ENVIRONMENT"
39
39
  echo "SITE_NAME => $SITE_NAME"
40
- echo "Using AWS Role: $ROLE_NAME"
41
40
  }
42
41
 
43
42
  if [[ "$PROJECT" == "s3" ]]; then
package/terraform/plan.sh CHANGED
@@ -3,7 +3,6 @@ set -e
3
3
 
4
4
  PROJECT=$1
5
5
  CURRENT_ENVIRONMENT=$2
6
- export ROLE_NAME="${3:-atlassian-bitbucket-pipelines-runner-eks-role}"
7
6
 
8
7
  if [[ -z "$PROJECT" ]]; then
9
8
  echo "Error: Project name is required."
@@ -17,6 +16,7 @@ if [[ -z "$CURRENT_ENVIRONMENT" ]]; then
17
16
  exit 1
18
17
  fi
19
18
 
19
+ export ROLE_NAME="atlassian-bitbucket-pipelines-runner-eks-role"
20
20
  export SESSION_NAME="EKSAdminSession"
21
21
  export EKS_CLUSTER_NAME="connect-next-${CURRENT_ENVIRONMENT}-eks-cluster"
22
22
  export ROLE_ARN="arn:aws:iam::$(aws sts get-caller-identity | jq -r '.Account'):role/$ROLE_NAME"
package/commit-message DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- TEMPERATURE=${TEMPERATURE:-1}
4
- MAX_TOKENS=${MAX_TOKENS:-512}
5
- MODEL=${MODEL:-"gemma3:27b"}
6
- INTRO=${INTRO:-"Create a commit message, focusing on the files modified."}
7
- OLLAMA_ENDPOINT=${OLLAMA_ENDPOINT:-"http://10.10.22.111:11434/v1/completions"}
8
-
9
- # Get a list of staged files
10
- changed_files=$(git diff --cached --name-only)
11
- diff_messages=""
12
-
13
- for file in $changed_files; do
14
- diff_messages+="$(git diff --cached -- "$file")"
15
- done
16
-
17
- payload=$(jq -n \
18
- --arg model "$MODEL" \
19
- --arg prompt "$(
20
- echo "$INTRO";
21
- echo "$diff_messages"
22
- )" \
23
- --argjson temp "$TEMPERATURE" \
24
- --argjson tokens "$MAX_TOKENS" \
25
- '{
26
- model: $model,
27
- prompt: $prompt,
28
- temperature: $temp,
29
- max_tokens: $tokens
30
- }'
31
- )
32
-
33
- response=$(curl -s -X POST "$OLLAMA_ENDPOINT" \
34
- -H "Content-Type: application/json" \
35
- -d "$payload")
36
-
37
- echo "$payload" | jq . > /tmp/ollama-summary.json
38
- echo "$response" | jq . >> /tmp/ollama-summary.json
39
-
40
- echo "$response" | jq -r '.choices[0].text' | sed '/./,$!d'
package/pull-request-sum DELETED
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- TARGET_BRANCH="INFP-10599-create-new-build-agent-runner-in-uat"
4
-
5
- TEMPERATURE=${TEMPERATURE:-1}
6
- MAX_TOKENS=${MAX_TOKENS:-512}
7
- MODEL=${MODEL:-"gemma3:27b"}
8
- INTRO=${INTRO:-"Summarize the changes introduced in this commit message, focusing on the files modified."}
9
- OLLAMA_ENDPOINT=${OLLAMA_ENDPOINT:-"http://10.10.22.111:11434/v1/completions"}
10
-
11
- # Get a list of staged files
12
- changed_files=$(git diff --cached --name-only)
13
- diff_messages=""
14
-
15
- for file in $changed_files; do
16
- diff_messages+="$(git diff --cached -- "$file")"
17
- done
18
-
19
- payload=$(jq -n \
20
- --arg model "$MODEL" \
21
- --arg prompt "$(
22
- echo "$INTRO";
23
- echo "$diff_messages"
24
- )" \
25
- --argjson temp "$TEMPERATURE" \
26
- --argjson tokens "$MAX_TOKENS" \
27
- '{
28
- model: $model,
29
- prompt: $prompt,
30
- temperature: $temp,
31
- max_tokens: $tokens
32
- }'
33
- )
34
-
35
- response=$(curl -s -X POST "$OLLAMA_ENDPOINT" \
36
- -H "Content-Type: application/json" \
37
- -d "$payload")
38
-
39
- echo "$payload" | jq . > /tmp/ollama-summary.json
40
- echo "$response" | jq . >> /tmp/ollama-summary.json
41
-
42
- echo "$response" | jq -r '.choices[0].text' | sed '/./,$!d'
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- TARGET_BRANCH=master
4
-
5
- TEMPERATURE=${TEMPERATURE:-1}
6
- MAX_TOKENS=${MAX_TOKENS:-512}
7
- MODEL=${MODEL:-"gemma3:27b"}
8
- INTRO=${INTRO:-"Write a summary of the commits in this pull request"}
9
- OLLAMA_ENDPOINT=${OLLAMA_ENDPOINT:-"http://10.10.22.111:11434/v1/completions"}
10
-
11
- payload=$(jq -n \
12
- --arg model "$MODEL" \
13
- --arg prompt "$(
14
- echo "$INTRO";
15
- git log origin/$TARGET_BRANCH --format='%B';
16
- )" \
17
- --argjson temp "$TEMPERATURE" \
18
- --argjson tokens "$MAX_TOKENS" \
19
- '{
20
- model: $model,
21
- prompt: $prompt,
22
- temperature: $temp,
23
- max_tokens: $tokens
24
- }'
25
- )
26
-
27
- response=$(curl -s -X POST "$OLLAMA_ENDPOINT" \
28
- -H "Content-Type: application/json" \
29
- -d "$payload")
30
-
31
- echo "$payload" | jq . > /tmp/ollama-summary.json
32
- echo "$response" | jq . >> /tmp/ollama-summary.json
33
-
34
- echo "$response" | jq -r '.choices[0].text' | sed '/./,$!d'
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -e
3
-
4
- TARGET_BRANCH=master
5
- TEMPERATURE=${TEMPERATURE:-1}
6
- MAX_TOKENS=${MAX_TOKENS:-512}
7
- MODEL=${MODEL:-"gemma3:27b"}
8
- INTRO=${INTRO:-"Below are some commit messages. Write a one sentence summary of them."}
9
-
10
- LLM_ENDPOINT=${LLM_ENDPOINT:-"http://10.10.22.111:11434/v1/completions"} # Ollama or LocalAI
11
-
12
- function num_commits {
13
- git log origin/$TARGET_BRANCH --oneline | wc -l
14
- }
15
-
16
- function single_commit_title {
17
- git log origin/$TARGET_BRANCH --format='%s' | head -1
18
- }
19
-
20
- function multi_commit_title {
21
- prompt="$(
22
- echo "$INTRO"
23
- git log origin/$TARGET_BRANCH --format='%B'
24
- )"
25
-
26
- payload=$(jq -n \
27
- --arg model "$MODEL" \
28
- --arg prompt "$prompt" \
29
- --argjson temp "$TEMPERATURE" \
30
- --argjson tokens "$MAX_TOKENS" \
31
- '{
32
- model: $model,
33
- prompt: $prompt,
34
- temperature: $temp,
35
- max_tokens: $tokens
36
- }')
37
-
38
- response=$(curl -s -X POST "$LLM_ENDPOINT" \
39
- -H "Content-Type: application/json" \
40
- -d "$payload")
41
-
42
- echo "$payload" | jq . > /tmp/llama-title.json
43
- echo "$response" | jq . >> /tmp/llama-title.json
44
-
45
- error_message=$(echo "$response" | jq -r '.error.message // empty')
46
- if [[ -n "$error_message" ]]; then
47
- echo "LLM API error: $error_message"
48
- exit 1
49
- fi
50
-
51
- echo "$response" | jq -r '.choices[0].text' | sed '/./,$!d' | head -1
52
- }
53
-
54
- function main {
55
- if [ "$(num_commits)" -eq 0 ]; then
56
- echo "Error: No commits found on branch origin/$TARGET_BRANCH."
57
- exit 1
58
- fi
59
- if [ "$(num_commits)" -eq 1 ]; then
60
- single_commit_title
61
- else
62
- multi_commit_title
63
- fi
64
- }
65
-
66
- main