GitHub
Accelario Virtualization can be integrated natively into GitHub workflow
It is done by adding a section to blank.yml
file of any GitHub repository. Inside the section, a script makes API calls to the Accelario Virtualization engine to perform any needed operation.
The configuration to create a VDB as part of GitHub workflow - should be added blank.yml
, the important part is in section acellario-create-vdb
, all the rest can be configured as you wish:
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# Runs a set of commands using the runners shell
- name: acellario-create-vdb
run: |
TOKEN=$(curl -X POST "http://${{ vars.VIRTUALIZATION_IP }}:8080/api/v1/login" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"username\": \"${{ secrets.VIRTUALIZATION_LOGIN }}\", \"password\": \"${{ secrets.VIRTUALIZATION_PASSWORD }}\"}" |awk -F ":" '{print $2}' | cut -d '}' -f 1 | cut -d '"' -f 2)
VDB_ID=$(curl -X POST "http://${{ vars.VIRTUALIZATION_IP }}:8080/api/v1/vdb" -H "accept: application/json" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d "{\"startImmidiately\":true,\"createVolumeRequest\":{\"name\":\"QA_VDB\",\"description\":\"\",\"type\":\"CLONE\",\"parentId\":\"${{ vars.SNAPSHOT_ID }}\",\"snapshotInterval\":0,\"refreshSchedule\":{\"count\":0,\"interval\":\"MINUTES\",\"startFromDate\":\"2021-12-22 15:16\",\"retentionCount\":14}},\"startVdbRequest\":{\"name\":\"QA_VDB\",\"description\":\"\",\"dstDbHomeId\":\"${{ vars.TGT_HOME_ID }}\",\"dbSid\":\"QA\",\"advancedParams\":[{\"name\":\"PostSqlScriptPath\",\"value\":\"\"},{\"name\":\"PreOsScriptPath\",\"value\":\"\"},{\"name\":\"PostOsScriptPath\",\"value\":\"\"}],\"racInstances\":[],\"dbPort\":5560}}" |tee /dev/stderr |awk -F ":" '{print $2}' | cut -d '}' -f 1 | cut -d '"' -f 2)
sleep 5
vdb_check=$(curl -X GET "http://${{ vars.VIRTUALIZATION_IP }}:8080/api/v1/vdb" -H "accept: application/json" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" | jq -r --arg VDB_ID "$VDB_ID" '.[] | select(.id == $VDB_ID) | .status')
while [[ "$vdb_check" == "IN_PROGRESS" ]];
do
echo "VDB creation IN_PROGRESS. Sleeping 30 second until next check" && sleep 30;
export vdb_check=$(curl -X GET "http://${{ vars.VIRTUALIZATION_IP }}:8080/api/v1/vdb" -H "accept: application/json" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" | jq -r --arg VDB_ID "$VDB_ID" '.[] | select(.id == $VDB_ID) | .status');
done
if [[ "$vdb_check" == "UP" ]]; then
echo "VDBCreate passed"
else
echo "VDBCreate failed"
exit 1
fi
curl -X GET "http://${{ vars.VIRTUALIZATION_IP }}:8080/api/v1/lvm/info/$VDB_ID" -H "accept: application/json" -H "Authorization: Bearer $TOKEN"
This script relies on pre-defined variables. The variables should be defined in the repository’s settings, under Actions secrets and variables, as described here
Variables:
VIRTUALIZATION_IP
- the IP/hostname of an Accelario Virtualization central serverSNAPSHOT_ID
- snapshot id to create VDB fromTGT_HOME_ID
- target home id to start the VDB in
Secrets:
VIRTUALIZATION_LOGIN
- username to Accelario VirtualizationVIRTUALIZATION_PASSWORD
- password to Accelario Virtualization