GitLab CI/CD Integration with Nutanix Blueprint
Last updated: March 4, 2026
Table of Contents
My Use Case for This Integration
In my home-lab projects, I build small services that need a clean VM to test on. Rather than keeping a persistent "test VM" (which drifts over time), I wanted each GitLab pipeline run to:
Launch a fresh VM via a Nutanix Blueprint
Deploy the application to that VM
Run integration tests against it
Tear it down when done
The Blueprint in Nutanix handles the VM provisioning with all the baseline configuration (OS, network, user, SSH keys). GitLab CI/CD handles the application deployment and testing on top of it.
The connecting piece is the Prism Central v3 REST API.
How the Integration Works
Everything is driven through HTTP calls to Prism Central. No Nutanix-specific agent needs to run on the GitLab runner.
Prism Central v3 API for Blueprint Operations
Authentication
Prism Central's API uses HTTP Basic Auth. There is no token exchange needed for simple use — credentials go in every request header.
Note: 9440 is the default Prism Central HTTPS port.
Find a Blueprint by Name
Get Blueprint Runtime Editables
Before launching, you need the blueprint's runtime variable spec, which tells you which variables you can override at launch time:
Launch a Blueprint
Poll for Completion
Blueprint launches are asynchronous. Poll the application state until it reaches running or error:
Get VM IP Address
Once the application state is running, retrieve the VM's IP address:
The JSON path varies depending on your blueprint structure. I recommend running jq . on a launched application first to explore the structure and find the right path.
Delete an Application
GitLab CI/CD Variable Setup
Store sensitive values in GitLab CI/CD Variables (Project → Settings → CI/CD → Variables). Never hardcode credentials in .gitlab-ci.yml.
PC_HOST
Variable
Prism Central FQDN or IP
PC_USERNAME
Variable
Prism Central username
PC_PASSWORD
Secret
Prism Central password (masked + protected)
BLUEPRINT_NAME
Variable
Name of the blueprint to launch
BLUEPRINT_PROFILE_DEV
Variable
UUID of the "dev" profile
BLUEPRINT_PROFILE_PROD
Variable
UUID of the "prod" profile
Get profile UUIDs from Prism Central UI (Blueprint Designer → Profiles → click profile → UUID in URL) or via API:
Blueprint Launch Script
I maintain a reusable shell script in my project repo (scripts/nutanix_deploy.sh) that the pipeline calls:
And a corresponding teardown script (scripts/nutanix_destroy.sh):
GitLab Pipeline Design
The pipeline has three stages:
provision — launch the Blueprint and capture the VM IP
deploy_and_test — deploy the app, run tests (uses VM IP from stage 1)
teardown — destroy the application (always runs, even on failure)
Passing State Between Jobs
GitLab jobs run in separate containers. To pass the APP_UUID and VM_IP between jobs, I use artifacts:
The dotenv artifact type automatically injects the variables into subsequent jobs.
Full .gitlab-ci.yml Reference
Environment Promotion with Blueprint Profiles
A single Blueprint can carry multiple profiles. I keep:
dev profile: Minimum vCPU and memory — fast to spin up, used for integration test pipelines
staging profile: Same sizing as production — used for pre-release pipelines on
mainbranch
In .gitlab-ci.yml, I select the profile based on the branch:
This keeps all infrastructure variation inside the Blueprint profiles, not scattered across pipeline scripts.
Teardown and Cleanup Automation
One problem I ran into: if a pipeline fails partway through and GitLab variables are not available (e.g., the pipeline itself was cancelled before teardown), stale VMs accumulate on the cluster.
My housekeeping approach: a scheduled GitLab pipeline runs nightly to find and delete any applications with the ci- prefix that are older than 6 hours:
This runs as a scheduled pipeline in GitLab (Settings → CI/CD → Schedules → nightly).
Troubleshooting API Calls
Problem: SSL certificate errors Nutanix CE ships with a self-signed certificate. Add -k (insecure) or --insecure to curl in lab environments. In production, import the proper certificate.
Problem: 401 Unauthorized Verify username and password are correct. The account needs at least "Operator" role on the Prism Central project that owns the blueprint.
Problem: Blueprint UUID is null The filter parameter is case-sensitive and uses a specific syntax. Check that the blueprint name in the API filter matches exactly what's in Prism Central.
Problem: Application stays in "provisioning" state forever Check the blueprint launch logs in Prism Central (Self-Service → Applications → click the app → Audit tab). Usually this means a Task script failed or the VM image is missing.
Problem: VM IP is null after app reaches "running" The JSON path to the IP depends on the blueprint substrate type and whether IPAM is configured. Inspect the full app response with | jq . to find the right path.
Next Steps
Continue to the next article: Automating Nutanix Backup with Ansible — where I cover using the nutanix.ncp Ansible collection to automate VM snapshots and protection domains.
Last updated