一键导入
scripting
Use when running acli commands non-interactively in scripts, CI/CD pipelines, or automation where interactive prompts must be suppressed.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when running acli commands non-interactively in scripts, CI/CD pipelines, or automation where interactive prompts must be suppressed.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when user asks about updating outdated Drupal packages, upgrading Drupal core minor or patch versions, updating contrib modules, or resolving composer version conflicts.
Use when user asks about fixing security vulnerabilities, composer audit failures, vulnerable Drupal packages, or CVE advisories in a Drupal codebase.
Use when user wants to update Drupal dependencies and deploy the changes to an Acquia environment, optionally triggering a pipeline build. Chains drupal-maintenance, acli, and pipelines-cli skills.
Use when listing Acquia Cloud applications, linking or unlinking a local repo to an application, opening an app in browser, checking VCS/branch deployment status, or exporting a site archive.
Use when setting up a new Code Studio (GitLab CI/CD) project, changing PHP version in Code Studio builds. NOT for checking pipeline job status — use pipelines-cli-pipeline-operations for that.
Use when listing, creating, deleting, or mirroring Cloud environments, managing CDEs, deploying code to an environment, or checking environment status.
| name | scripting |
| description | Use when running acli commands non-interactively in scripts, CI/CD pipelines, or automation where interactive prompts must be suppressed. |
| license | Proprietary |
| compatibility | acli>=2.x |
| metadata | {"category":"automation","author":"Acquia","version":"1.0.0","tags":"acli, acquia-cloud, scripting, ci-cd, automation","software_requirements":"acli>=2.x"} |
Use when:
Use acli in scripts, CI/CD pipelines, and automation workflows to manage Acquia Cloud resources programmatically.
All acli commands can run non-interactively by providing options. This is essential for scripts and CI/CD.
# Interactive - prompts for missing information
acli ide:create
# Non-interactive - provides all info upfront
acli ide:create \
--application=abc123 \
--label="Automated IDE"
# No prompts - fails if info is missing
acli <command> --no-interaction
# Don't wait for async operations
acli <command> --no-wait
# Skip confirmations
acli <command> --yes
#!/bin/bash
# deploy.sh - Deploy to staging nightly
BRANCH="develop"
ENVIRONMENT="staging"
ENV_ID="<environment-id>"
acli api:environments:code-switch $ENV_ID $BRANCH
# Verify Drupal status
acli remote:drush status
Run via cron:
# crontab -e
# Deploy every night at 2am
0 2 * * * /path/to/deploy.sh >> /tmp/deploy.log 2>&1
#!/bin/bash
# cache-clear.sh - Clear caches across environments
set -e # Exit on any error
acli remote:drush cr
echo "Caches cleared!"
Deploy on push to main:
# .github/workflows/deploy.yml
name: Deploy to Acquia
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install acli
run: |
curl -fsSL https://github.com/acquia/cli/releases/latest/download/acli \
-o /usr/local/bin/acli
chmod +x /usr/local/bin/acli
- name: Authenticate
env:
ACQUIA_KEY: ${{ secrets.ACQUIA_KEY }}
ACQUIA_SECRET: ${{ secrets.ACQUIA_SECRET }}
run: |
mkdir -p ~/.acquia
cat > ~/.acquia/credentials.json <<EOF
{
"acquia-cloud-api": {
"key": "$ACQUIA_KEY",
"secret": "$ACQUIA_SECRET"
}
}
EOF
- name: Deploy to production
run: |
acli api:environments:code-switch ${{ vars.ACQUIA_PROD_ENV_ID }} main
# .gitlab-ci.yml
deploy_production:
stage: deploy
image: ubuntu:latest
before_script:
- curl -fsSL https://github.com/acquia/cli/releases/latest/download/acli \
-o /usr/local/bin/acli
- chmod +x /usr/local/bin/acli
- mkdir -p ~/.acquia
- |
cat > ~/.acquia/credentials.json <<EOF
{
"acquia-cloud-api": {
"key": "$ACQUIA_KEY",
"secret": "$ACQUIA_SECRET"
}
}
EOF
script:
- acli api:environments:code-switch $ACQUIA_PROD_ENV_ID $CI_COMMIT_BRANCH
only:
- main
#!/bin/bash
acli ide:create --application=abc123
if [ $? -eq 0 ]; then
echo "IDE created successfully"
else
echo "IDE creation failed"
exit 1
fi
#!/bin/bash
set -e # Exit on first error
trap 'echo "Error occurred on line $LINENO"' ERR
acli api:environments:code-switch $ENV_ID main
echo "Deploy successful!"
#!/bin/bash
retry_count=0
max_retries=3
while [ $retry_count -lt $max_retries ]; do
if acli remote:drush updatedb; then
echo "Database updates completed"
exit 0
fi
retry_count=$((retry_count + 1))
if [ $retry_count -lt $max_retries ]; then
echo "Attempt $retry_count failed. Retrying..."
sleep 10
fi
done
echo "Failed after $max_retries attempts"
exit 1
#!/bin/bash
LOGFILE="/var/log/acli-deploy.log"
{
echo "=== Deploy started at $(date) ==="
acli api:environments:code-switch $ENV_ID main
echo "=== Deploy finished at $(date) ==="
} >> $LOGFILE 2>&1
#!/bin/bash
SLACK_WEBHOOK="$SLACK_WEBHOOK_URL"
send_slack() {
curl -X POST $SLACK_WEBHOOK \
-H 'Content-Type: application/json' \
-d "{
\"text\": \"Acquia deployment: $1\",
\"channel\": \"#deployments\"
}"
}
if acli api:environments:code-switch $ENV_ID main; then
send_slack "✓ Production deployment successful"
else
send_slack "✗ Production deployment failed"
exit 1
fi
For automation on servers, use API keys instead of browser authentication.
In Acquia Cloud UI:
# Method 1: Environment variables
export ACQUIA_KEY="your-key-here"
export ACQUIA_SECRET="your-secret-here"
acli api:applications:list
# Method 2: Credentials file
mkdir -p ~/.acquia
cat > ~/.acquia/credentials.json <<EOF
{
"acquia-cloud-api": {
"key": "your-key-here",
"secret": "your-secret-here"
}
}
EOF
acli api:applications:list
# Option 1: AWS Secrets Manager
aws secretsmanager get-secret-value --secret-id acquia-cli-key
# Option 2: HashiCorp Vault
vault kv get secret/acquia/cli-key
# Option 3: GitHub Secrets (for Actions)
# Set ACQUIA_KEY and ACQUIA_SECRET as repository secrets
--no-interaction — Always pass this in scripts to prevent prompts from blocking the process.set -e — Exit immediately on any error so failures don't silently continue.app:task-wait — After async operations, wait for completion before the next step.Set the ACLI_NO_INTERACTION environment variable and supply credentials explicitly:
export ACLI_NO_INTERACTION=1
export ACLI_KEY=your-api-key
export ACLI_SECRET=your-api-secret
acli api:applications:list
Always pass --no-interaction in scripts:
acli ide:create --application=abc123 --label="CI IDE" --no-interaction
Use set -e at the top of your script:
#!/bin/bash
set -e
acli auth:login --no-interaction
acli api:environments:code-switch $ENV_ID main