# "CI/CD on Zerops" ## Keywords ci cd, github, gitlab, github actions, gitlab ci, webhook, automatic deploy, trigger, pipeline, continuous deployment, zcli push, jenkins, circleci, generic ci ## TL;DR Zerops supports GitHub/GitLab webhook triggers (new tag or push to branch) and GitHub Actions / GitLab CI via `zcli push` with an access token. ## GitHub Integration (Webhook) ### Setup (GUI) 1. Service detail → Build, Deploy, Run Pipeline Settings 2. Connect with GitHub repository 3. Select repo + authorize (requires **full access** for webhooks) 4. Choose trigger: **New tag** (optional regex filter) or **Push to branch** ### GitHub Actions ```yaml # .github/workflows/deploy.yaml name: Deploy on: push jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: zeropsio/actions@main with: access-token: } service-id: ``` - `access-token`: From Settings → Access Token Management - `service-id`: From service URL or three-dot menu → Copy Service ID ## GitLab Integration (Webhook) ### Setup (GUI) 1. Service detail → Build, Deploy, Run Pipeline Settings 2. Connect with GitLab repository 3. Authorize (requires **full access** for webhooks) 4. Choose trigger: **New tag** (optional regex) or **Push to branch** ## Skip Pipeline Include `ci skip` or `skip ci` in commit message (case-insensitive). ## Disconnect Service detail → Build, Deploy, Run → Stop automatic build trigger. ## Gotchas 1. **Full repo access required**: Webhook integration needs full access to create/manage webhooks 2. **`ci skip` in commit message**: Prevents pipeline trigger — useful for docs-only changes 3. **Service ID not obvious**: Find it in service URL or three-dot menu → Copy Service ID ## GitLab CI ```yaml # .gitlab-ci.yml deploy: stage: deploy image: ubuntu:latest script: - apt-get update && apt-get install -y curl - curl -L https://zerops.io/zcli/install.sh | sh - zcli login $ZEROPS_TOKEN - zcli push --project-id $ZEROPS_PROJECT_ID --service-id $ZEROPS_SERVICE_ID only: - main ``` ## Generic CI (Any System) Any CI system with shell access can deploy via `zcli push`: 1. Install zcli: `curl -L https://zerops.io/zcli/install.sh | sh` 2. Authenticate: `zcli login ` 3. Deploy: `zcli push --project-id --service-id ` ### zcli push key flags | Flag | Description | |------|-------------| | `--project-id` | Target project ID | | `--service-id` | Target service ID | | `--setup` | zerops.yml setup name (if different from service hostname) | | `--version-name` | Custom version label (e.g. git tag) | | `--workspace-state` | `all` (default), `clean` (git clean), `staged` (staged only) | | `--no-git` | Deploy without git context | | `--deploy-git-folder` | Include `.git/` directory in deploy | ## See Also - zerops://themes/core -- zerops.yml schema reference - zerops://guides/deployment-lifecycle -- build and deploy pipeline - zerops://themes/core -- platform infrastructure