Skip to content

Commit 7826807

Browse files
committed
Review comments incorporated.
1 parent 3da33d3 commit 7826807

File tree

14 files changed

+86
-29
lines changed

14 files changed

+86
-29
lines changed

oci-pipeline-examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ All about devops pipelines using OCI Devops.
1111
<details>
1212
<summary>Cascaded Pipelines - click to expand</summary>
1313

14-
* [Cascaded Pipelines](./oci-cascaded-pipelines)
14+
* [Cascaded Pipelines - With in the Region](./oci-cascaded-pipelines/same-region/)
1515

1616
</details>
1717

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# OCI DevOps Cascaded Pipelines - Same Region
2+
3+
## Objective
4+
* Invocation of another build or deploy pipeline after the successful execution of build/deploy pipeline.
5+
6+
## Prerequisites & References
7+
This guide assumes that you already have required pipelines created to invoke them cascadly. You may refer to below links to create and setup pipelines.
8+
* Reference Architecture - https://github.com/oracle-quickstart/oci-arch-ci-cd-devops
9+
* Oracle DevOps Documentation - https://docs.oracle.com/en-us/iaas/Content/devops/using/home.htm
10+
* IAM Policies - https://docs.oracle.com/en-us/iaas/Content/devops/using/devops_iampolicies.htm
11+
12+
## Samples
13+
14+
Sample procedure and code snippets for the cascaded pipelines of the below scenarios.
15+
16+
* [Trigger Build Pipeline from Build Pipeline](trigger-build-from-build)
17+
* [Trigger Deploy Pipeline from Build Pipeline](trigger-deploy-from-build)
18+
* [Trigger Build Pipeline from Deploy Pipeline](trigger-build-from-deploy)
19+
* [Trigger Deploy Pipeline from Deploy Pipeline](trigger-deploy-from-deploy)
20+
21+

oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-build-from-build/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,27 @@
99
**Step 1:**
1010
Clone the repository code.
1111
```
12-
$ git clone https://github.com/oracle-cloud-infra/oci-devops-cascaded-pipelines.git
12+
$ git init oci-devops-coderepo-with-gitlab
13+
$ cd oci-devops-coderepo-with-gitlab
14+
$ git remote add origin https://github.com/oracle-devrel/oci-devops-examples
15+
$ git config core.sparsecheckout true
16+
$ echo "oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-build-from-build/*">>.git/info/sparse-checkout
17+
$ git pull --depth=1 origin main
1318
```
1419

1520
**Step 2:**
1621
Change to function directory.
1722
```
18-
$ cd oci-devops-cascaded-pipelines/same-region/trigger-build-from-build/node-function
23+
$ cd node-function
1924
```
2025

2126
**Step 3:**
22-
In `func.js`, update `buildPipelineId` and `displayNamePrefixForNewRun` with appropriate values as below.
27+
In `func.yaml`, update `build_pipeline_id` and `display_name_prefix_for_new_run` with appropriate values as below.
2328

2429
```
25-
const buildPipelineId = "<target-build-pipeline-ocid>"
26-
const displayNamePrefixForNewRun = "AutoTriggeredCascadedPipeline_";
30+
config:
31+
build_pipeline_id: "<BUILD-PIPELINE-OCID>"
32+
display_name_prefix_for_new_run: "AutoTriggeredCascade2_"
2733
```
2834

2935
**Step 4:**

oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-build-from-build/node-function/func.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const fdk = require('@fnproject/fdk');
22
const common = require("oci-common");
33
const devops = require("oci-devops");
44

5-
const buildPipelineId = "ocid1.devopsbuildpipeline.oc1.ap-hyderabad-1.amaaaaaak56z2vqazjgskjqjjdjqowrdn3d6eatvhsixvhzb2ozoje2qxh7q"
6-
const displayNamePrefixForNewRun = "AutoTriggeredCascade2_";
5+
const buildPipelineId = process.env.build_pipeline_id;
6+
const displayNamePrefixForNewRun = process.env.display_name_prefix_for_new_run;
77

88
fdk.handle(async function(input){
99
const provider = common.ResourcePrincipalAuthenticationDetailsProvider.builder();

oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-build-from-build/node-function/func.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ runtime: node
55
build_image: fnproject/node:14-dev
66
run_image: fnproject/node:14
77
entrypoint: node func.js
8+
config:
9+
build_pipeline_id: "<BUILD-PIPELINE-OCID>"
10+
display_name_prefix_for_new_run: "AutoTriggeredCascade2_"

oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-build-from-deploy/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,27 @@
1010
**Step 1:**
1111
Clone the repository code.
1212
```
13-
$ git clone https://github.com/oracle-cloud-infra/oci-devops-cascaded-pipelines.git
13+
$ git init oci-devops-coderepo-with-gitlab
14+
$ cd oci-devops-coderepo-with-gitlab
15+
$ git remote add origin https://github.com/oracle-devrel/oci-devops-examples
16+
$ git config core.sparsecheckout true
17+
$ echo "oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-build-from-deploy/*">>.git/info/sparse-checkout
18+
$ git pull --depth=1 origin main
1419
```
1520

1621
**Step 2:**
1722
Change to function directory.
1823
```
19-
$ cd oci-devops-cascaded-pipelines/same-region/trigger-build-from-deploy/node-function
24+
$ cd node-function
2025
```
2126

2227
**Step 3:**
23-
In `func.js`, update `buildPipelineId` and `displayNamePrefixForNewRun` with appropriate values as below.
28+
In `func.yaml`, update `build_pipeline_id` and `display_name_prefix_for_new_run` with appropriate values as below.
2429

2530
```
26-
const buildPipelineId = "<target-build-pipeline-ocid>"
27-
const displayNamePrefixForNewRun = "AutoTriggeredCascadedPipeline_";
31+
config:
32+
build_pipeline_id: "<BUILD-PIPELINE-OCID>"
33+
display_name_prefix_for_new_run: "AutoTriggeredCascadedPipeline_"
2834
```
2935

3036
**Step 4:**

oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-build-from-deploy/node-function/func.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const fdk = require('@fnproject/fdk');
22
const common = require("oci-common");
33
const devops = require("oci-devops");
44

5-
const buildPipelineId = "<target-build-pipeline-ocid>"
6-
const displayNamePrefixForNewRun = "AutoTriggeredCascadedPipeline_";
5+
const buildPipelineId = process.env.build_pipeline_id;
6+
const displayNamePrefixForNewRun = process.env.display_name_prefix_for_new_run;
77

88
fdk.handle(async function(input){
99
const provider = common.ResourcePrincipalAuthenticationDetailsProvider.builder();

oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-build-from-deploy/node-function/func.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ runtime: node
55
build_image: fnproject/node:14-dev
66
run_image: fnproject/node:14
77
entrypoint: node func.js
8+
config:
9+
build_pipeline_id: "<BUILD-PIPELINE-OCID>"
10+
display_name_prefix_for_new_run: "AutoTriggeredCascadedPipeline_"

oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-deploy-from-build/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,27 @@
99
**Step 1:**
1010
Clone the repository code.
1111
```
12-
$ git clone https://github.com/oracle-cloud-infra/oci-devops-cascaded-pipelines.git
12+
$ git init oci-devops-coderepo-with-gitlab
13+
$ cd oci-devops-coderepo-with-gitlab
14+
$ git remote add origin https://github.com/oracle-devrel/oci-devops-examples
15+
$ git config core.sparsecheckout true
16+
$ echo "oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-deploy-from-build/*">>.git/info/sparse-checkout
17+
$ git pull --depth=1 origin main
1318
```
1419

1520
**Step 2:**
1621
Change to function directory.
1722
```
18-
$ cd oci-devops-cascaded-pipelines/same-region/trigger-deploy-from-build/node-function
23+
$ cd node-function
1924
```
2025

2126
**Step 3:**
22-
In `func.js`, update `deployPipelineId` and `displayNamePrefixForNewRun` with appropriate values as below.
27+
In `func.yaml`, update `deploy_pipeline_id` and `display_name_prefix_for_new_run` with appropriate values as below.
2328

2429
```
25-
const deployPipelineId = "<target-deploy-pipeline-ocid>"
26-
const displayNamePrefixForNewRun = "AutoTriggeredCascadedPipeline_";
30+
config:
31+
deploy_pipeline_id: "<DEPLOY-PIPELINE-OCID>"
32+
display_name_prefix_for_new_run: "AutoTriggeredCascade2_"
2733
```
2834

2935
**Step 4:**

oci-pipeline-examples/oci-cascaded-pipelines/same-region/trigger-deploy-from-build/node-function/func.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const fdk = require('@fnproject/fdk');
22
const common = require("oci-common");
33
const devops = require("oci-devops");
44

5-
const deployPipelineId = "ocid1.devopsdeploypipeline.oc1.ap-hyderabad-1.amaaaaaak56z2vqavh6diwgyr4cbhqxrfmqqc6riohwyo7rvcje4vmfq5fbq";
6-
const displayNamePrefixForNewRun = "AutoTriggeredCascade2_";
5+
const deployPipelineId = process.env.deploy_pipeline_id;
6+
const displayNamePrefixForNewRun = process.env.display_name_prefix_for_new_run;
77

88
fdk.handle(async function(input){
99
const provider = common.ResourcePrincipalAuthenticationDetailsProvider.builder();

0 commit comments

Comments
 (0)