|
| 1 | +# CI/CD Integration Guide for Tekton Nightly Releases |
| 2 | + |
| 3 | +This guide provides simple patterns for integrating nightly releases into your existing CI/CD workflow. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +Nightly releases run independently and publish container images to `ghcr.io/{owner}/pipeline/`. You can integrate these into your workflow in a few simple ways: |
| 8 | + |
| 9 | +- **Independent**: Nightly builds run on their own schedule (03:00 UTC) |
| 10 | +- **Tested**: Each build includes basic validation before publishing |
| 11 | +- **Available**: Images are published to GitHub Container Registry |
| 12 | + |
| 13 | +## Integration Patterns |
| 14 | + |
| 15 | +### Pattern 1: Use Nightly Images in Testing |
| 16 | + |
| 17 | +Test your applications against the latest nightly build: |
| 18 | + |
| 19 | +```yaml |
| 20 | +name: Test with Nightly Tekton |
| 21 | +on: |
| 22 | + schedule: |
| 23 | + - cron: '0 6 * * *' # Run after nightly build |
| 24 | + |
| 25 | +jobs: |
| 26 | + test: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Install Latest Nightly |
| 32 | + run: | |
| 33 | + # Install the latest nightly release |
| 34 | + kubectl apply -f https://storage.googleapis.com/tekton-releases-nightly/pipeline/nightly/latest/release.yaml |
| 35 | + |
| 36 | + # Wait for it to be ready |
| 37 | + kubectl wait --for=condition=Available=True deployment/tekton-pipelines-controller -n tekton-pipelines --timeout=300s |
| 38 | + |
| 39 | + - name: Run Your Tests |
| 40 | + run: | |
| 41 | + # Run your pipeline tests here |
| 42 | + echo "Testing with nightly Tekton..." |
| 43 | +``` |
| 44 | +
|
| 45 | +### Pattern 2: Deploy to Staging After Successful Build |
| 46 | +
|
| 47 | +Automatically deploy successful nightly builds to staging: |
| 48 | +
|
| 49 | +```yaml |
| 50 | +name: Deploy Nightly to Staging |
| 51 | +on: |
| 52 | + workflow_run: |
| 53 | + workflows: ["Tekton Nightly Release"] |
| 54 | + types: [completed] |
| 55 | + |
| 56 | +jobs: |
| 57 | + deploy: |
| 58 | + if: ${{ github.event.workflow_run.conclusion == 'success' }} |
| 59 | + runs-on: ubuntu-latest |
| 60 | + environment: staging |
| 61 | + steps: |
| 62 | + - name: Deploy to Staging |
| 63 | + run: | |
| 64 | + # Configure kubectl for your staging cluster |
| 65 | + echo "${{ secrets.STAGING_KUBECONFIG }}" | base64 -d > $HOME/.kube/config |
| 66 | + |
| 67 | + # Deploy the latest nightly |
| 68 | + kubectl apply -f https://storage.googleapis.com/tekton-releases-nightly/pipeline/nightly/latest/release.yaml |
| 69 | + |
| 70 | + # Verify deployment |
| 71 | + kubectl wait --for=condition=Available=True deployment/tekton-pipelines-controller -n tekton-pipelines --timeout=300s |
| 72 | + echo "✅ Staging deployment complete" |
| 73 | +``` |
| 74 | +
|
| 75 | +### Pattern 3: Quality Gates |
| 76 | +
|
| 77 | +Block releases if nightly builds are failing: |
| 78 | +
|
| 79 | +```yaml |
| 80 | +name: Release |
| 81 | +on: |
| 82 | + push: |
| 83 | + tags: ['v*'] |
| 84 | + |
| 85 | +jobs: |
| 86 | + check-nightly: |
| 87 | + runs-on: ubuntu-latest |
| 88 | + steps: |
| 89 | + - name: Check Recent Nightly Status |
| 90 | + env: |
| 91 | + GH_TOKEN: ${{ github.token }} |
| 92 | + run: | |
| 93 | + # Check last 3 nightly runs |
| 94 | + FAILED_RUNS=$(gh run list --workflow="Tekton Nightly Release" --limit=3 --json=conclusion --jq '[.[] | select(.conclusion == "failure")] | length') |
| 95 | + |
| 96 | + if [ "$FAILED_RUNS" -ge 2 ]; then |
| 97 | + echo "❌ Multiple recent nightly failures - investigate before releasing" |
| 98 | + exit 1 |
| 99 | + fi |
| 100 | + |
| 101 | + echo "✅ Recent nightly builds are healthy" |
| 102 | + |
| 103 | + release: |
| 104 | + needs: check-nightly |
| 105 | + runs-on: ubuntu-latest |
| 106 | + steps: |
| 107 | + - name: Proceed with Release |
| 108 | + run: echo "🚀 Releasing..." |
| 109 | +``` |
| 110 | +
|
| 111 | +## Notifications |
| 112 | +
|
| 113 | +### Slack Notifications |
| 114 | +
|
| 115 | +Get notified when nightly builds fail: |
| 116 | +
|
| 117 | +```yaml |
| 118 | +name: Nightly Notifications |
| 119 | +on: |
| 120 | + workflow_run: |
| 121 | + workflows: ["Tekton Nightly Release"] |
| 122 | + types: [completed] |
| 123 | + |
| 124 | +jobs: |
| 125 | + notify: |
| 126 | + if: ${{ github.event.workflow_run.conclusion == 'failure' }} |
| 127 | + runs-on: ubuntu-latest |
| 128 | + steps: |
| 129 | + - name: Notify Slack |
| 130 | + env: |
| 131 | + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 132 | + run: | |
| 133 | + curl -X POST -H 'Content-type: application/json' \ |
| 134 | + --data "{\"text\":\"❌ Nightly Tekton build failed: ${{ github.event.workflow_run.html_url }}\"}" \ |
| 135 | + "$SLACK_WEBHOOK" |
| 136 | +``` |
| 137 | +
|
| 138 | +## Development Workflow |
| 139 | +
|
| 140 | +### Testing Changes Impact |
| 141 | +
|
| 142 | +Before merging changes that might affect nightly builds: |
| 143 | +
|
| 144 | +```bash |
| 145 | +# Test your changes don't break nightly builds |
| 146 | +gh workflow run "Tekton Nightly Release" --ref your-branch |
| 147 | + |
| 148 | +# Wait and check the result |
| 149 | +gh run watch |
| 150 | +``` |
| 151 | + |
| 152 | +### Monitoring Nightly Health |
| 153 | + |
| 154 | +Simple script to check nightly build health: |
| 155 | + |
| 156 | +```bash |
| 157 | +#!/bin/bash |
| 158 | +# check-nightly-health.sh |
| 159 | + |
| 160 | +RECENT_RUNS=$(gh run list --workflow="Tekton Nightly Release" --limit=5 --json=conclusion --jq '[.[] | select(.conclusion == "failure")] | length') |
| 161 | + |
| 162 | +if [ "$RECENT_RUNS" -ge 3 ]; then |
| 163 | + echo "⚠️ Nightly builds need attention ($RECENT_RUNS recent failures)" |
| 164 | + exit 1 |
| 165 | +else |
| 166 | + echo "✅ Nightly builds are healthy" |
| 167 | +fi |
| 168 | +``` |
| 169 | + |
| 170 | +## Troubleshooting |
| 171 | + |
| 172 | +### Common Issues |
| 173 | + |
| 174 | +1. **Wrong Workflow Name** |
| 175 | + ```yaml |
| 176 | + # ❌ Wrong |
| 177 | + workflows: ["Tekton Nightly Release (Production Ready)"] |
| 178 | + |
| 179 | + # ✅ Correct |
| 180 | + workflows: ["Tekton Nightly Release"] |
| 181 | + ``` |
| 182 | +
|
| 183 | +2. **Assuming Specific Dates** |
| 184 | + ```bash |
| 185 | + # ❌ Wrong - assumes build happened today |
| 186 | + :nightly-$(date +%Y%m%d) |
| 187 | + |
| 188 | + # ✅ Correct - use latest |
| 189 | + https://storage.googleapis.com/tekton-releases-nightly/pipeline/nightly/latest/release.yaml |
| 190 | + ``` |
| 191 | + |
| 192 | +3. **Missing Error Handling** |
| 193 | + ```bash |
| 194 | + # ❌ Wrong |
| 195 | + kubectl apply -f some-url |
| 196 | + |
| 197 | + # ✅ Correct |
| 198 | + if ! kubectl apply -f some-url; then |
| 199 | + echo "Failed to apply" |
| 200 | + exit 1 |
| 201 | + fi |
| 202 | + ``` |
| 203 | + |
| 204 | +### Getting Help |
| 205 | + |
| 206 | +- Check the nightly workflow logs in your repository's Actions tab |
| 207 | +- Look at recent runs to see if there's a pattern in failures |
| 208 | +- Issues are typically related to: |
| 209 | + - GitHub token permissions (`packages:write`, `contents:read`) |
| 210 | + - Container registry connectivity |
| 211 | + - Kubernetes version compatibility |
| 212 | + |
| 213 | +--- |
| 214 | + |
| 215 | +This simplified integration approach focuses on practical, everyday use cases without unnecessary complexity. The nightly release system is designed to "just work" - these patterns help you make the most of it without overengineering. |
0 commit comments