Skip to content

Commit e534010

Browse files
authored
Merge pull request #1730 from oracle-devrel/pob-app-integration
Pob app integration - CICD - VBS Steps resp. Shell Scripts
2 parents 1e600d6 + 4da9ad9 commit e534010

29 files changed

+1483
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# OIC CICD Visual Builder Studio / Build Jobs - Shell Steps
2+
3+
Assets that contain oic related elementary commands and API interactions to achieve Continual Integration and Continual Deployment of the integration flows and related artifacts
4+
5+
6+
## OIC CICD - Files
7+
Collection of the atomic steps implementing the OIC Management API requests calls from the unix shell. Outh2 Authorization is the auth schema and Integratged Application for the Authorization Code or Client Credentials with OIC management API scope is needed(clientId, clientSecret). OCI user key and OCIDs needed to build the OCI V1 signature for the OCI commands for the start/stop OIC service instance.
8+
9+
Review Date: 28.04.2025
10+
11+
# When to use these assets?
12+
13+
These assets should be used whenever needed to design automatic Integrations deployment or OIC instance management using shell steps with cURL commands - OIC API calls
14+
15+
# How to use these asset?
16+
17+
The information is generic in nature and not specified for a particular customer.
18+
19+
# License
20+
21+
Copyright (c) 2025 Oracle and/or its affiliates.
22+
23+
Licensed under the Universal Permissive License (UPL), Version 1.0.
24+
25+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# OCI CICD
2+
3+
This folder purpose is to share atomic artifacts on the CICD implementation for OIC.
4+
Attached scripts is possible to use and process on a linux machine however the best option is to use it directly within your prefered CICD Tool.
5+
CLI interaction is implemented using [cURL - command-line tool](https://curl.se/) primarily used for transferring data using various protocols like HTTP, HTTPS, FTP, and more.
6+
![image](./images/VBStudio_Archi_Medium.jpg)
7+
8+
## OCI CICD Tooling
9+
10+
OCI provides [PaaS service Oracle Visual Builder Studio(VBS)](https://www.oracle.com/uk/application-development/visual-builder-studio/#rc30p3) that helps rapidly create and extend SaaS applications using a visual development environment with integrated agile and collaborative development, version control, and continuous delivery automation.
11+
Scripts located in the folder is possible to use directly as the Step in the VBS.
12+
![image](./images/VBS-build-job-step.png)
13+
14+
## OCI VBS and CICD
15+
[BS provides Free* OCI PaaS Service](https://vbcookbook.oracle.com/) to
16+
- Plan and manage development processes with issue tracking, agile and sprint planning, wikis, and development dashboards
17+
- Manage code lifecycle with Git repositories, peer code review, and continuous integration and delivery pipelines
18+
- Gain flexibility with support for popular build and testing frameworks and infrastructure-as-code standards
19+
20+
*Note: One(Fisrst) instance of the Oracle Visual Builder Studio service is for Free (20 gigabyte storage included)*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# ****************************************************************************************
3+
# Script: oic3_activate_integration.sh
4+
#
5+
# This script is implementing comand to activate integration in the OIC environment as part of CICD Implementation for OCI/OIC
6+
#
7+
# Oracle
8+
# Created by: Peter Obert
9+
# Created date: 11/2024
10+
# Updated date: 25/04/2025
11+
# VBS adaptation: 25/04/2025
12+
# Last updated by: Peter Obert
13+
# Last updated date: 25/04/2025
14+
# Last updated comments:The script is activating global integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html
15+
#
16+
# No mandatory parameters:
17+
# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy
18+
#
19+
#
20+
# Disclaimer:
21+
#
22+
# You expressly understand and agree that your use of the utilities is at your sole risk and that
23+
# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims
24+
# all warranties of any kind, whether express or implied, including, but not limited to, the implied
25+
# warranties of merchantability, fitness for a particular purpose and non-infringement.
26+
# Any material downloaded or otherwise obtained through this delivery is done at your own discretion
27+
# and risk and you will be solely responsible for any damage to your computer system or loss of data
28+
# that results from the download of any such material.
29+
#
30+
# ****************************************************************************************
31+
32+
33+
# get the token to access OIC REST API# get the token to access OIC REST API
34+
response=$(curl -i -H 'Authorization: Basic <<client_id_client_secret_basictoken>>' --request POST 'https://<<your_IDom_service>>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<<your_oic_mgmt_scope>>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/')
35+
36+
access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}')
37+
38+
39+
40+
# Check if access_token is empty or null
41+
if [ -z "$access_token" ]; then
42+
echo "Failed to retrieve access token from the first API."
43+
exit 1
44+
fi
45+
46+
activate_integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "X-HTTP-Method-Override: PATCH" -H "Content-Type: application/json" -d "{\"status\": \"ACTIVATED\"}" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/integrations/<<my_integration_ID>>%7C<<Version>>?integrationInstance=<<your_oic_instance_name>>)
47+
48+
49+
50+
# Error handling
51+
http_status=$(echo "$activate_integration_api" | jq -r '.status')
52+
echo "Activation integration status: $activate_integration_api"
53+
54+
55+
# Check if the HTTP status code is ACTIVATION_INPROGRESS (OK)
56+
if [ "$http_status" != "ACTIVATION_INPROGRESS" ]; then
57+
echo "Error: Activation integration failed with HTTP status code: $http_status" >&2
58+
exit 1
59+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
# ****************************************************************************************
3+
# Script: oic3_create_iCalSchedule_project_integration.sh
4+
#
5+
# This script is implementing comand to create a schedule using iCal expression for the project integration - OIC environment as part of CICD Implementation for OCI/OIC or example of trigger integration on system event
6+
#
7+
# Oracle
8+
# Created by: Peter Obert
9+
# Created date: 04/2025
10+
# Updated date: 25/04/2025
11+
# VBS adaptation: 25/04/2025
12+
# Last updated by: Peter Obert
13+
# Last updated date: 28/04/2025
14+
# Last updated comments:The script is creating a schedule using iCal expression for the project integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html
15+
#
16+
# No mandatory parameters:
17+
# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy
18+
#
19+
#
20+
# Disclaimer:
21+
#
22+
# You expressly understand and agree that your use of the utilities is at your sole risk and that
23+
# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims
24+
# all warranties of any kind, whether express or implied, including, but not limited to, the implied
25+
# warranties of merchantability, fitness for a particular purpose and non-infringement.
26+
# Any material downloaded or otherwise obtained through this delivery is done at your own discretion
27+
# and risk and you will be solely responsible for any damage to your computer system or loss of data
28+
# that results from the download of any such material.
29+
#
30+
# ****************************************************************************************
31+
# get the token to access OIC REST API
32+
response=$(curl -i -H 'Authorization: Basic <<client_id_client_secret_basictoken>>' --request POST 'https://<<your_IDom_service>>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<<your_oic_mgmt_scope>>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/')
33+
34+
access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}')
35+
36+
# Check if access_token is empty or null
37+
if [ -z "$access_token" ]; then
38+
echo "Failed to retrieve access token from the first API."
39+
exit 1
40+
fi
41+
42+
echo '{"icalExpression":"FREQ=MONTHLY;BYDAY=MO,TUE;BYHOUR=12,14;BYMINUTE=20;","name":"my_schedule_name_01_00_0000","startDate":null,"endDate":null,"scheduleTZ":"GMT"}' > ./schedule.json
43+
cat ./schedule.json
44+
45+
CreateSchedule_Integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d @schedule.json https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<<my_project_id>>/integrations/<<my_integration_id>>%7C<<01.00.0000>>/schedule?integrationInstance=<<your_oic_instance_name>>)
46+
47+
48+
49+
# Error handling
50+
echo "Create iCal Schedule for Integration response: $CreateSchedule_Integration_api"
51+
# Error handling
52+
http_freq=$(echo "$CreateSchedule_Integration_api" | jq -r '.frequency')
53+
http_status=$(echo "$CreateSchedule_Integration_api" | jq -r '.status')
54+
55+
# Check if the CreateSchedule_Integration_api response is with no content
56+
if [[ -n "$http_status" || -n "$http_freq" ]]
57+
then
58+
echo "Integration schedule using iCal creation succeeded with with reply: $CreateSchedule_Integration_api" >&2
59+
else
60+
echo "Error: Integration schedule using iCal creation failed with Response: $CreateSchedule_Integration_api" >&2
61+
exit 1
62+
fi
63+
exit 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
# ****************************************************************************************
3+
# Script: oic3_createSchedule_project_integration.sh
4+
#
5+
# This script is implementing comand to create a schedule for the project integration - OIC environment as part of CICD Implementation for OCI/OIC or example of trigger integration on system event
6+
#
7+
# Oracle
8+
# Created by: Peter Obert
9+
# Created date: 04/2025
10+
# Updated date: 25/04/2025
11+
# VBS adaptation: 25/04/2025
12+
# Last updated by: Peter Obert
13+
# Last updated date: 28/04/2025
14+
# Last updated comments:The script is creating a schedule for the project integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html
15+
#
16+
# No mandatory parameters:
17+
# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy
18+
#
19+
#
20+
# Disclaimer:
21+
#
22+
# You expressly understand and agree that your use of the utilities is at your sole risk and that
23+
# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims
24+
# all warranties of any kind, whether express or implied, including, but not limited to, the implied
25+
# warranties of merchantability, fitness for a particular purpose and non-infringement.
26+
# Any material downloaded or otherwise obtained through this delivery is done at your own discretion
27+
# and risk and you will be solely responsible for any damage to your computer system or loss of data
28+
# that results from the download of any such material.
29+
#
30+
# ****************************************************************************************
31+
# get the token to access OIC REST API
32+
response=$(curl -i -H 'Authorization: Basic <<client_id_client_secret_basictoken>>' --request POST 'https://<<your_IDom_service>>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<<your_oic_mgmt_scope>>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/')
33+
34+
access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}')
35+
36+
# Check if access_token is empty or null
37+
if [ -z "$access_token" ]; then
38+
echo "Failed to retrieve access token from the first API."
39+
exit 1
40+
fi
41+
42+
echo '{"frequency":{"frequencyType":"DAILY","interval":1},"name":"my_schedule_name_01_00_0000","startDate":"2/14/2025|0:0:0","endDate":null,"scheduleTZ":"UTC"}' > ./schedule.json
43+
cat ./schedule.json
44+
45+
CreateSchedule_Integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d @schedule.json https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<<my_integrationproject_id>>/integrations/<<my_integration_id>>%7C01.00.0000/schedule?integrationInstance=<<your_oic_instance_name>>)
46+
47+
48+
49+
# Error handling
50+
echo "Create Schedule for Integration response: $CreateSchedule_Integration_api"
51+
# Error handling
52+
http_freq=$(echo "$CreateSchedule_Integration_api" | jq -r '.frequency')
53+
http_status=$(echo "$CreateSchedule_Integration_api" | jq -r '.status')
54+
55+
# Check if the RunNowSchedulable_Integration_api response is with no content
56+
if [[ -n "$http_status" || -n "$http_freq" ]]
57+
then
58+
echo "Integration schedule creation succeeded with with reply: $CreateSchedule_Integration_api" >&2
59+
else
60+
echo "Error: Integration schedule creation failed with Response: $CreateSchedule_Integration_api" >&2
61+
exit 1
62+
fi
63+
exit 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
# ****************************************************************************************
3+
# Script: oic3_deactivate_integration.sh
4+
#
5+
# This script is implementing comand to deactivate integration in the OIC environment as part of CICD Implementation for OCI/OIC
6+
#
7+
# Oracle
8+
# Created by: Peter Obert
9+
# Created date: 11/2024
10+
# Updated date: 25/04/2025
11+
# VBS adaptation: 25/04/2025
12+
# Last updated by: Peter Obert
13+
# Last updated date: 25/04/2025
14+
# Last updated comments:The script is deactivating global integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html
15+
#
16+
# No mandatory parameters:
17+
# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy
18+
#
19+
#
20+
# Disclaimer:
21+
#
22+
# You expressly understand and agree that your use of the utilities is at your sole risk and that
23+
# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims
24+
# all warranties of any kind, whether express or implied, including, but not limited to, the implied
25+
# warranties of merchantability, fitness for a particular purpose and non-infringement.
26+
# Any material downloaded or otherwise obtained through this delivery is done at your own discretion
27+
# and risk and you will be solely responsible for any damage to your computer system or loss of data
28+
# that results from the download of any such material.
29+
#
30+
# ****************************************************************************************
31+
32+
33+
# get the token to access OIC REST API
34+
response=$(curl -i -H 'Authorization: Basic <<client_id_client_secret_basictoken>>' --request POST 'https://<<your_IDom_service>>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<<your_oic_mgmt_scope>>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/')
35+
36+
access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}')
37+
38+
# Check if access_token is empty or null
39+
if [ -z "$access_token" ]; then
40+
echo "Failed to retrieve access token from the first API."
41+
exit 1
42+
fi
43+
44+
deactivate_integration_api=$(curl -X POST -H "Authorization: Bearer $access_token" -H "X-HTTP-Method-Override: PATCH" -H "Content-Type: application/json" -d "{\"status\": \"CONFIGURED\"}" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/integrations/<<my_integration_id>>%7C01.00.0000?integrationInstance=<<your_oic_instance_name>>)
45+
46+
47+
48+
# Error handling
49+
http_status=$(echo "$deactivate_integration_api" | jq -r '.status')
50+
echo "Export integration status: $deactivate_integration_api"
51+
52+
53+
# Check if the HTTP status code is DEACTIVATION_INPROGRESS (OK)
54+
if [ "$http_status" != "DEACTIVATION_INPROGRESS" ]; then
55+
echo "Error: Deactivation of the integration failed with the status code: $http_status" >&2
56+
exit 1
57+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
# ****************************************************************************************
3+
# Script: oic3_deleteSchedule_project_integration.sh
4+
#
5+
# This script is implementing comand to delete a schedule for the project integration - OIC environment as part of CICD Implementation for OCI/OIC or example of trigger integration on system event
6+
#
7+
# Oracle
8+
# Created by: Peter Obert
9+
# Created date: 04/2025
10+
# Updated date: 25/04/2025
11+
# VBS adaptation: 25/04/2025
12+
# Last updated by: Peter Obert
13+
# Last updated date: 28/04/2025
14+
# Last updated comments:The script is deleting a schedule for the project integration - adaptation based on https://docs.oracle.com/en/cloud/paas/application-integration/rest-api/rest-endpoints.html
15+
#
16+
# No mandatory parameters:
17+
# this is the script template and it is not bringing any external/run parameters to keep it as simple as possible. That can be added/modified by the user and concrete build/pipelining strategy
18+
#
19+
#
20+
# Disclaimer:
21+
#
22+
# You expressly understand and agree that your use of the utilities is at your sole risk and that
23+
# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims
24+
# all warranties of any kind, whether express or implied, including, but not limited to, the implied
25+
# warranties of merchantability, fitness for a particular purpose and non-infringement.
26+
# Any material downloaded or otherwise obtained through this delivery is done at your own discretion
27+
# and risk and you will be solely responsible for any damage to your computer system or loss of data
28+
# that results from the download of any such material.
29+
#
30+
# ****************************************************************************************
31+
# get the token to access OIC REST API
32+
response=$(curl -i -H 'Authorization: Basic <<client_id_client_secret_basictoken>>' --request POST 'https://<<your_IDom_service>>.identity.oraclecloud.com:443/oauth2/v1/token' -H 'Content-Type:application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=https://<<your_oic_mgmt_scope>>.integration.eu-frankfurt-1.ocp.oraclecloud.com:443/ic/api/')
33+
34+
access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}')
35+
36+
# Check if access_token is empty or null
37+
if [ -z "$access_token" ]; then
38+
echo "Failed to retrieve access token from the first API."
39+
exit 1
40+
fi
41+
42+
43+
DeleteSchedule_Integration_api=$(curl -X DELETE -H "Authorization: Bearer $access_token" -H "X-HTTP-Method-Override: PATCH" https://design.integration.eu-frankfurt-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/<<my_integrationproject_id>>/integrations/<<my_integration_id>>%7C01.00.0000/schedule?integrationInstance=<<your_oic_instance_name>>)
44+
45+
46+
47+
# Error handling
48+
echo "Stop Schedule for Integration response: $DeleteSchedule_Integration_api"
49+
# Error handling
50+
http_links=$(echo "$DeleteSchedule_Integration_api" | jq -r '.links')
51+
http_status=$(echo "$DeleteSchedule_Integration_api" | jq -r '.status')
52+
53+
# Check if the DeleteSchedule_Integration_api response is with no content
54+
if [[ -n "$http_status" || (! -n "$http_links") ]]
55+
then
56+
echo "Integration schedule delete succeeded/or schedule is not present with with reply: $DeleteSchedule_Integration_api" >&2
57+
else
58+
echo "Error: Integration schedule delete failed with Response: $DeleteSchedule_Integration_api" >&2
59+
exit 1
60+
fi
61+
exit 0

0 commit comments

Comments
 (0)