@docupace/pipeline 1.0.6-alpha.1 → 1.0.6-alpha.10

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.6-alpha.1",
3
+ "version": "1.0.6-alpha.10",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -35,6 +35,7 @@
35
35
  },
36
36
  "scripts": {
37
37
  "test-deploy-core": "dp-next-cli deploy-core-pipeline dev template",
38
- "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"
38
+ "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",
39
+ "test-run-pipline": "dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa"
39
40
  }
40
41
  }
package/src/next/cli.js CHANGED
@@ -16,7 +16,7 @@ const program = new Command();
16
16
  // GIT SHA computation
17
17
  import { $ } from 'zx';
18
18
  import { deployCore } from './jenkins.js';
19
- import {runPipeline, triggerPipelineByName} from './pipline.js';
19
+ import { runPipeline } from './pipline.js';
20
20
  const GIT_SHA = (await $`git log --pretty=format:'%h' -n 1`).stdout.trim();
21
21
 
22
22
  program
@@ -96,7 +96,7 @@ program
96
96
  });
97
97
 
98
98
  program
99
- .command('trigger-pipeline')
99
+ .command('run-pipeline')
100
100
  .description('Trigger a pipeline by name')
101
101
  .requiredOption('-r, --repository <repository>', 'Repository name')
102
102
  .requiredOption('-p, --pipeline-name <pipelineName>', 'Pipeline name')
@@ -112,13 +112,14 @@ program
112
112
  return { ...previous, [key]: val };
113
113
  },
114
114
  {},
115
- ) // Initialize as an empty object
115
+ )
116
+ .option('-w, --wait', 'Wait for the pipeline to complete', false) // Defaults to false
116
117
  .action(async (cmdObj) => {
117
118
  try {
118
- const { repository, pipelineName, branch, variables } = cmdObj;
119
+ const { repository, pipelineName, branch, variables, wait } = cmdObj;
119
120
 
120
121
  // Call the triggerPipelineByName function
121
- await triggerPipelineByName(repository, pipelineName, branch, variables);
122
+ await runPipeline(repository, pipelineName, branch, variables, wait);
122
123
  } catch (error) {
123
124
  console.error('Error triggering pipeline:', error.message);
124
125
  process.exit(1);
@@ -3,7 +3,9 @@ import { getBitbucketInfo } from './config.js';
3
3
 
4
4
  const BITBUCKET_BASE_URL = 'https://api.bitbucket.org/2.0';
5
5
 
6
- export async function triggerPipelineByName(
6
+ const BITBUCKET_WS_URL = 'https://bitbucket.org/dp-cloud';
7
+
8
+ async function triggerPipelineByName(
7
9
  repository,
8
10
  pipelineName,
9
11
  branch,
@@ -67,7 +69,13 @@ async function getPipelineStatus(repository, pipelineUUID) {
67
69
  }
68
70
  }
69
71
 
70
- export async function runPipeline(repository, pipelineName, branch, variables) {
72
+ export async function runPipeline(
73
+ repository,
74
+ pipelineName,
75
+ branch,
76
+ variables,
77
+ wait = false,
78
+ ) {
71
79
  try {
72
80
  console.log(
73
81
  `Triggering custom pipeline: ${pipelineName} for branch: ${branch}...`,
@@ -78,9 +86,20 @@ export async function runPipeline(repository, pipelineName, branch, variables) {
78
86
  branch,
79
87
  variables,
80
88
  );
89
+
81
90
  const pipelineUUID = pipeline.uuid;
91
+ const buildNumber = pipeline.build_number;
82
92
 
83
93
  console.log(`Pipeline triggered with UUID: ${pipelineUUID}`);
94
+ console.log(
95
+ `See results here: ${BITBUCKET_WS_URL}/${repository}/piplines/results/${buildNumber}`,
96
+ );
97
+
98
+ if (!wait) {
99
+ return;
100
+ }
101
+
102
+
84
103
  let status = '';
85
104
  do {
86
105
  console.log('Checking pipeline status...');