Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Current »

Accelario Virtualization can be integrated natively into Bitbucket pipelines.

It is done by adding a section to bitbucket-pipelines.yml file of any Bitbucket 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 Bitbucket pipeline - should be added bitbucket-pipelines.yml:

pipelines:
  branches:
    master:
      - step:
          name: acellario-create-vdb
          image: ubuntu:latest
          script:
            - apt-get update && apt-get install -y curl jq
            - |
              export TOKEN=$(curl -X POST "http://$VIRTUALIZATION_IP:8080/api/v1/login" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"username\": \"$VIRTUALIZATION_LOGIN\", \"password\": \"$VIRTUALIZATION_PASSWORD\"}" |awk -F ":" '{print $2}' |  cut -d '}' -f 1 | cut -d '"' -f 2)
            - |
              export VDB_ID=$(curl -X POST "http://$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\":\"$SNAPSHOT_ID\",\"snapshotInterval\":0,\"refreshSchedule\":{\"count\":0,\"interval\":\"MINUTES\",\"startFromDate\":\"2021-12-22 15:16\",\"retentionCount\":14}},\"startVdbRequest\":{\"name\":\"QA_VDB\",\"description\":\"\",\"dstDbHomeId\":\"$TGT_HOME_ID\",\"dbSid\":\"QA\",\"advancedParams\":[{\"name\":\"PostSqlScriptPath\",\"value\":\"\"},{\"name\":\"PreOsScriptPath\",\"value\":\"\"},{\"name\":\"PostOsScriptPath\",\"value\":\"\"}],\"racInstances\":[]}}" |tee /dev/stderr |awk -F ":" '{print $2}' |  cut -d '}' -f 1 | cut -d '"' -f 2)
            - sleep 5
            - |
              export vdb_check=$(curl -X GET "http://$VIRTUALIZATION_IP:8080/api/v1/vdb"  -H "accept: application/json" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" | jq -r .[0]."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://$VIRTUALIZATION_IP:8080/api/v1/vdb"  -H "accept: application/json" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" | jq -r .[0]."status");
              done
            - |
              curl -X GET "http://$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 may be defined at any level in Bitbucket, as described here

  • VIRTUALIZATION_IP - the IP/hostname of an Accelario Virtualization central server

  • VIRTUALIZATION_LOGIN - username to Accelario Virtualization

  • VIRTUALIZATION_PASSWORD - password to Accelario Virtualization

  • SNAPSHOT_ID - snapshot id to create VDB from

  • TGT_HOME_ID - target home id to start the VDB in

  • No labels