Skip to content

State Action

The State Action changes the state of a Quant Cloud environment. Use it to redeploy an environment, for example after you change an environment variable or secret.

Repository: quantcdn/quant-cloud-environment-state-action

- uses: quantcdn/quant-cloud-environment-state-action@v4
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: my-org
application: my-app
environment: production
action: redeploy

To make a workflow wait, poll the environment after the redeploy step. GET /api/v3/organizations/{org}/applications/{app}/environments/{env} returns deploymentStatus (IN_PROGRESS, COMPLETED or FAILED), deploymentFailureReason, runningCount and desiredCount. Right after the request, the status can still describe the previous deployment, so wait about a minute before the first check.

- name: Wait for the deployment to finish
env:
QUANT_API_KEY: ${{ secrets.QUANT_API_KEY }}
URL: https://dashboard.quantcdn.io/api/v3/organizations/my-org/applications/my-app/environments/production
run: |
sleep 60
for i in $(seq 1 40); do
BODY=$(curl -fsS -H "Authorization: Bearer $QUANT_API_KEY" "$URL")
STATUS=$(echo "$BODY" | jq -r '.deploymentStatus // empty')
echo "Check $i/40: deploymentStatus=$STATUS"
if [ "$STATUS" = "COMPLETED" ]; then exit 0; fi
if [ "$STATUS" = "FAILED" ]; then
echo "::error::$(echo "$BODY" | jq -r '.deploymentFailureReason // "deployment failed"')"
exit 1
fi
sleep 15
done
echo "::error::Deployment still in progress after 10 minutes"
exit 1

On QuantGov, use https://dash.quantgov.cloud/api/v3 in the URL.

Input Required Description
api_key Yes Quant Cloud API key
organization Yes Organisation name
application Yes Application name
environment Yes Environment name
action No redeploy (default), stop or start
base_url No Platform API base URL. Set it for QuantGov.

For a QuantGov project, set base_url to the QuantGov dashboard host. The action also accepts the /api/v3 form.

- uses: quantcdn/quant-cloud-environment-state-action@v4
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: my-org
application: my-app
environment: production
base_url: https://dash.quantgov.cloud

See QuantCDN and QuantGov for the host of each platform.