Skip to content

Pob app integration - CICD - VBS Steps resp. Shell Scripts #1730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# OIC CICD Visual Builder Studio / Build Jobs - Shell Steps

Assets that contain oic related elementary commands and API interactions to achieve Continual Integration and Continual Deployment of the integration flows and related artifacts


## OIC CICD - Files
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.

Review Date: 28.04.2025

# When to use these assets?

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

# How to use these asset?

The information is generic in nature and not specified for a particular customer.

# License

Copyright (c) 2025 Oracle and/or its affiliates.

Licensed under the Universal Permissive License (UPL), Version 1.0.

See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# OCI CICD

This folder purpose is to share atomic artifacts on the CICD implementation for OIC.
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.
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.
![image](./images/VBStudio_Archi_Medium.jpg)

## OCI CICD Tooling

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.
Scripts located in the folder is possible to use directly as the Step in the VBS.
![image](./images/VBS-build-job-step.png)

## OCI VBS and CICD
[BS provides Free* OCI PaaS Service](https://vbcookbook.oracle.com/) to
- Plan and manage development processes with issue tracking, agile and sprint planning, wikis, and development dashboards
- Manage code lifecycle with Git repositories, peer code review, and continuous integration and delivery pipelines
- Gain flexibility with support for popular build and testing frameworks and infrastructure-as-code standards

*Note: One(Fisrst) instance of the Oracle Visual Builder Studio service is for Free (20 gigabyte storage included)*
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
# ****************************************************************************************
# Script: oic3_activate_integration.sh
#
# This script is implementing comand to activate integration in the OIC environment as part of CICD Implementation for OCI/OIC
#
# Oracle
# Created by: Peter Obert
# Created date: 11/2024
# Updated date: 25/04/2025
# VBS adaptation: 25/04/2025
# Last updated by: Peter Obert
# Last updated date: 25/04/2025
# 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
#
# No mandatory parameters:
# 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
#
#
# Disclaimer:
#
# You expressly understand and agree that your use of the utilities is at your sole risk and that
# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims
# all warranties of any kind, whether express or implied, including, but not limited to, the implied
# warranties of merchantability, fitness for a particular purpose and non-infringement.
# Any material downloaded or otherwise obtained through this delivery is done at your own discretion
# and risk and you will be solely responsible for any damage to your computer system or loss of data
# that results from the download of any such material.
#
# ****************************************************************************************


# get the token to access OIC REST API# get the token to access OIC REST API
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/')

access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}')



# Check if access_token is empty or null
if [ -z "$access_token" ]; then
echo "Failed to retrieve access token from the first API."
exit 1
fi

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>>)



# Error handling
http_status=$(echo "$activate_integration_api" | jq -r '.status')
echo "Activation integration status: $activate_integration_api"


# Check if the HTTP status code is ACTIVATION_INPROGRESS (OK)
if [ "$http_status" != "ACTIVATION_INPROGRESS" ]; then
echo "Error: Activation integration failed with HTTP status code: $http_status" >&2
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
# ****************************************************************************************
# Script: oic3_create_iCalSchedule_project_integration.sh
#
# 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
#
# Oracle
# Created by: Peter Obert
# Created date: 04/2025
# Updated date: 25/04/2025
# VBS adaptation: 25/04/2025
# Last updated by: Peter Obert
# Last updated date: 28/04/2025
# 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
#
# No mandatory parameters:
# 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
#
#
# Disclaimer:
#
# You expressly understand and agree that your use of the utilities is at your sole risk and that
# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims
# all warranties of any kind, whether express or implied, including, but not limited to, the implied
# warranties of merchantability, fitness for a particular purpose and non-infringement.
# Any material downloaded or otherwise obtained through this delivery is done at your own discretion
# and risk and you will be solely responsible for any damage to your computer system or loss of data
# that results from the download of any such material.
#
# ****************************************************************************************
# get the token to access OIC REST API
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/')

access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}')

# Check if access_token is empty or null
if [ -z "$access_token" ]; then
echo "Failed to retrieve access token from the first API."
exit 1
fi

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
cat ./schedule.json

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>>)



# Error handling
echo "Create iCal Schedule for Integration response: $CreateSchedule_Integration_api"
# Error handling
http_freq=$(echo "$CreateSchedule_Integration_api" | jq -r '.frequency')
http_status=$(echo "$CreateSchedule_Integration_api" | jq -r '.status')

# Check if the CreateSchedule_Integration_api response is with no content
if [[ -n "$http_status" || -n "$http_freq" ]]
then
echo "Integration schedule using iCal creation succeeded with with reply: $CreateSchedule_Integration_api" >&2
else
echo "Error: Integration schedule using iCal creation failed with Response: $CreateSchedule_Integration_api" >&2
exit 1
fi
exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
# ****************************************************************************************
# Script: oic3_createSchedule_project_integration.sh
#
# 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
#
# Oracle
# Created by: Peter Obert
# Created date: 04/2025
# Updated date: 25/04/2025
# VBS adaptation: 25/04/2025
# Last updated by: Peter Obert
# Last updated date: 28/04/2025
# 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
#
# No mandatory parameters:
# 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
#
#
# Disclaimer:
#
# You expressly understand and agree that your use of the utilities is at your sole risk and that
# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims
# all warranties of any kind, whether express or implied, including, but not limited to, the implied
# warranties of merchantability, fitness for a particular purpose and non-infringement.
# Any material downloaded or otherwise obtained through this delivery is done at your own discretion
# and risk and you will be solely responsible for any damage to your computer system or loss of data
# that results from the download of any such material.
#
# ****************************************************************************************
# get the token to access OIC REST API
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/')

access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}')

# Check if access_token is empty or null
if [ -z "$access_token" ]; then
echo "Failed to retrieve access token from the first API."
exit 1
fi

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
cat ./schedule.json

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>>)



# Error handling
echo "Create Schedule for Integration response: $CreateSchedule_Integration_api"
# Error handling
http_freq=$(echo "$CreateSchedule_Integration_api" | jq -r '.frequency')
http_status=$(echo "$CreateSchedule_Integration_api" | jq -r '.status')

# Check if the RunNowSchedulable_Integration_api response is with no content
if [[ -n "$http_status" || -n "$http_freq" ]]
then
echo "Integration schedule creation succeeded with with reply: $CreateSchedule_Integration_api" >&2
else
echo "Error: Integration schedule creation failed with Response: $CreateSchedule_Integration_api" >&2
exit 1
fi
exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
# ****************************************************************************************
# Script: oic3_deactivate_integration.sh
#
# This script is implementing comand to deactivate integration in the OIC environment as part of CICD Implementation for OCI/OIC
#
# Oracle
# Created by: Peter Obert
# Created date: 11/2024
# Updated date: 25/04/2025
# VBS adaptation: 25/04/2025
# Last updated by: Peter Obert
# Last updated date: 25/04/2025
# 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
#
# No mandatory parameters:
# 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
#
#
# Disclaimer:
#
# You expressly understand and agree that your use of the utilities is at your sole risk and that
# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims
# all warranties of any kind, whether express or implied, including, but not limited to, the implied
# warranties of merchantability, fitness for a particular purpose and non-infringement.
# Any material downloaded or otherwise obtained through this delivery is done at your own discretion
# and risk and you will be solely responsible for any damage to your computer system or loss of data
# that results from the download of any such material.
#
# ****************************************************************************************


# get the token to access OIC REST API
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/')

access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}')

# Check if access_token is empty or null
if [ -z "$access_token" ]; then
echo "Failed to retrieve access token from the first API."
exit 1
fi

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>>)



# Error handling
http_status=$(echo "$deactivate_integration_api" | jq -r '.status')
echo "Export integration status: $deactivate_integration_api"


# Check if the HTTP status code is DEACTIVATION_INPROGRESS (OK)
if [ "$http_status" != "DEACTIVATION_INPROGRESS" ]; then
echo "Error: Deactivation of the integration failed with the status code: $http_status" >&2
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
# ****************************************************************************************
# Script: oic3_deleteSchedule_project_integration.sh
#
# 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
#
# Oracle
# Created by: Peter Obert
# Created date: 04/2025
# Updated date: 25/04/2025
# VBS adaptation: 25/04/2025
# Last updated by: Peter Obert
# Last updated date: 28/04/2025
# 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
#
# No mandatory parameters:
# 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
#
#
# Disclaimer:
#
# You expressly understand and agree that your use of the utilities is at your sole risk and that
# the utilities are provided on an "as is" and "as available" basis. Oracle expressly disclaims
# all warranties of any kind, whether express or implied, including, but not limited to, the implied
# warranties of merchantability, fitness for a particular purpose and non-infringement.
# Any material downloaded or otherwise obtained through this delivery is done at your own discretion
# and risk and you will be solely responsible for any damage to your computer system or loss of data
# that results from the download of any such material.
#
# ****************************************************************************************
# get the token to access OIC REST API
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/')

access_token=$(echo "$response" | grep -o '"access_token":[^,}]*' | awk -F '"' '{print $4}')

# Check if access_token is empty or null
if [ -z "$access_token" ]; then
echo "Failed to retrieve access token from the first API."
exit 1
fi


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>>)



# Error handling
echo "Stop Schedule for Integration response: $DeleteSchedule_Integration_api"
# Error handling
http_links=$(echo "$DeleteSchedule_Integration_api" | jq -r '.links')
http_status=$(echo "$DeleteSchedule_Integration_api" | jq -r '.status')

# Check if the DeleteSchedule_Integration_api response is with no content
if [[ -n "$http_status" || (! -n "$http_links") ]]
then
echo "Integration schedule delete succeeded/or schedule is not present with with reply: $DeleteSchedule_Integration_api" >&2
else
echo "Error: Integration schedule delete failed with Response: $DeleteSchedule_Integration_api" >&2
exit 1
fi
exit 0
Loading