|
| 1 | +# Getting Started: Helm Charts Sync with GitHub App |
| 2 | + |
| 3 | +**Updated to use GitHub App authentication** 🚀 |
| 4 | + |
| 5 | +This guide will get you from zero to a working automated Helm chart sync in ~15 minutes. |
| 6 | + |
| 7 | +## 🎯 What You're Setting Up |
| 8 | + |
| 9 | +An automated workflow that: |
| 10 | +- Syncs Helm charts from `fluent/fluent-operator` → `fluent/helm-charts` |
| 11 | +- Creates pull requests automatically |
| 12 | +- Runs on releases, tags, or manually |
| 13 | +- Uses secure GitHub App authentication |
| 14 | + |
| 15 | +## ⚡ Quick Start (15 minutes) |
| 16 | + |
| 17 | +### Step 1: Create GitHub App (5 min) |
| 18 | + |
| 19 | +1. **Go to:** https://github.com/organizations/fluent/settings/apps/new |
| 20 | + |
| 21 | +2. **Fill in:** |
| 22 | + - **Name:** `Fluent Helm Charts Sync` |
| 23 | + - **Homepage:** `https://github.com/fluent/fluent-operator` |
| 24 | + - **Webhook:** ❌ Uncheck "Active" |
| 25 | + |
| 26 | +3. **Permissions:** |
| 27 | + - Contents: `Read and write` |
| 28 | + - Pull requests: `Read and write` |
| 29 | + |
| 30 | +4. **Click:** "Create GitHub App" |
| 31 | + |
| 32 | +5. **Generate private key:** |
| 33 | + - Scroll to "Private keys" |
| 34 | + - Click "Generate a private key" |
| 35 | + - Save the downloaded `.pem` file |
| 36 | + |
| 37 | +6. **Note your App ID:** |
| 38 | + - At the top of the page: "App ID: 123456" |
| 39 | + - Write it down! |
| 40 | + |
| 41 | +### Step 2: Install App (2 min) |
| 42 | + |
| 43 | +1. **Click:** "Install App" (left sidebar) |
| 44 | +2. **Select:** Only `fluent/helm-charts` repository |
| 45 | +3. **Click:** "Install" |
| 46 | + |
| 47 | +### Step 3: Add Secrets (3 min) |
| 48 | + |
| 49 | +1. **Go to:** https://github.com/fluent/fluent-operator/settings/secrets/actions |
| 50 | + |
| 51 | +2. **Add Secret #1:** |
| 52 | + - Click "New repository secret" |
| 53 | + - Name: `HELM_SYNC_APP_ID` |
| 54 | + - Value: Your App ID from Step 1.6 |
| 55 | + - Click "Add secret" |
| 56 | + |
| 57 | +3. **Add Secret #2:** |
| 58 | + - Click "New repository secret" |
| 59 | + - Name: `HELM_SYNC_APP_PRIVATE_KEY` |
| 60 | + - Value: Entire contents of `.pem` file (including BEGIN/END lines) |
| 61 | + - Click "Add secret" |
| 62 | + |
| 63 | +### Step 4: Test It! (5 min) |
| 64 | + |
| 65 | +```bash |
| 66 | +# Test the workflow manually |
| 67 | +gh workflow run sync-helm-charts.yaml \ |
| 68 | + -f pr_title="[TEST] Initial sync test" \ |
| 69 | + -f charts_to_sync="fluentd-crds" |
| 70 | + |
| 71 | +# Watch it run |
| 72 | +gh run watch |
| 73 | + |
| 74 | +# Expected: PR created in fluent/helm-charts by "fluent-helm-charts-sync[bot]" |
| 75 | +``` |
| 76 | + |
| 77 | +**Success indicators:** |
| 78 | +- ✅ Workflow completes without errors |
| 79 | +- ✅ PR created in fluent/helm-charts |
| 80 | +- ✅ PR author shows as your app bot |
| 81 | +- ✅ PR has properly formatted description |
| 82 | + |
| 83 | +**If it works:** Close the test PR and celebrate! 🎉 |
| 84 | + |
| 85 | +**If it fails:** See [Troubleshooting](#-troubleshooting) below |
| 86 | + |
| 87 | +## 📖 Detailed Documentation |
| 88 | + |
| 89 | +### For Complete Setup Instructions |
| 90 | +👉 **[GITHUB_APP_SETUP.md](GITHUB_APP_SETUP.md)** - Step-by-step with screenshots |
| 91 | + |
| 92 | +### For Daily Usage |
| 93 | +👉 **[HELM_SYNC_README.md](HELM_SYNC_README.md)** - How to use the workflow |
| 94 | + |
| 95 | +### For Understanding the Flow |
| 96 | +👉 **[WORKFLOW_FLOW.md](WORKFLOW_FLOW.md)** - Visual diagrams and explanations |
| 97 | + |
| 98 | +### For Quick Reference |
| 99 | +👉 **[SETUP_CHECKLIST.md](SETUP_CHECKLIST.md)** - Checklist format |
| 100 | + |
| 101 | +### For Decision-Making |
| 102 | +👉 **[GITHUB_APP_VS_PAT.md](GITHUB_APP_VS_PAT.md)** - Why GitHub App vs PAT |
| 103 | + |
| 104 | +## 🚀 Daily Usage |
| 105 | + |
| 106 | +Once set up, using the workflow is simple: |
| 107 | + |
| 108 | +### Automatic Sync (Recommended) |
| 109 | + |
| 110 | +```bash |
| 111 | +# Just create a release - workflow triggers automatically! |
| 112 | +gh release create v3.5.0 \ |
| 113 | + --title "Release v3.5.0" \ |
| 114 | + --notes-file RELEASE_NOTES.md |
| 115 | + |
| 116 | +# Or push a version tag |
| 117 | +git tag v3.5.0 |
| 118 | +git push origin v3.5.0 |
| 119 | +``` |
| 120 | + |
| 121 | +The workflow will: |
| 122 | +1. Detect the release/tag |
| 123 | +2. Sync all charts |
| 124 | +3. Create a PR in fluent/helm-charts |
| 125 | +4. Wait for your review |
| 126 | + |
| 127 | +### Manual Sync |
| 128 | + |
| 129 | +```bash |
| 130 | +# Sync all charts |
| 131 | +gh workflow run sync-helm-charts.yaml |
| 132 | + |
| 133 | +# Sync specific charts only |
| 134 | +gh workflow run sync-helm-charts.yaml \ |
| 135 | + -f charts_to_sync="fluent-operator,fluentd-crds" |
| 136 | + |
| 137 | +# Custom PR title |
| 138 | +gh workflow run sync-helm-charts.yaml \ |
| 139 | + -f pr_title="Update charts for v3.5.0" |
| 140 | +``` |
| 141 | + |
| 142 | +### Monitoring |
| 143 | + |
| 144 | +```bash |
| 145 | +# List recent runs |
| 146 | +gh run list --workflow=sync-helm-charts.yaml --limit 5 |
| 147 | + |
| 148 | +# Watch current run |
| 149 | +gh run watch |
| 150 | + |
| 151 | +# View specific run |
| 152 | +gh run view <run-id> --log |
| 153 | +``` |
| 154 | + |
| 155 | +## 🐛 Troubleshooting |
| 156 | + |
| 157 | +### "Resource not accessible by integration" |
| 158 | + |
| 159 | +**Fix:** |
| 160 | +1. Check app is installed on helm-charts: |
| 161 | + ``` |
| 162 | + https://github.com/organizations/fluent/settings/installations |
| 163 | + ``` |
| 164 | +2. Verify "fluent/helm-charts" is in the access list |
| 165 | +3. Check permissions: Contents + Pull requests both set to "Write" |
| 166 | + |
| 167 | +### "Bad credentials" |
| 168 | + |
| 169 | +**Fix:** |
| 170 | +1. Verify `HELM_SYNC_APP_ID` is just the number (e.g., `123456`) |
| 171 | +2. Verify `HELM_SYNC_APP_PRIVATE_KEY` includes: |
| 172 | + ``` |
| 173 | + -----BEGIN RSA PRIVATE KEY----- |
| 174 | + [key content] |
| 175 | + -----END RSA PRIVATE KEY----- |
| 176 | + ``` |
| 177 | +3. No extra spaces or formatting in secrets |
| 178 | + |
| 179 | +### "Could not resolve to a Repository" |
| 180 | + |
| 181 | +**Fix:** |
| 182 | +1. App not installed on helm-charts repository |
| 183 | +2. Go to installations → Configure → Add helm-charts |
| 184 | + |
| 185 | +### Workflow runs but no PR created |
| 186 | + |
| 187 | +**Possible causes:** |
| 188 | +- No changes detected (charts already synced) ✅ This is OK! |
| 189 | +- Missing "Pull requests: Write" permission |
| 190 | +- Branch already exists in helm-charts |
| 191 | + |
| 192 | +## 📊 Files Created |
| 193 | + |
| 194 | +Here's everything that was created for you: |
| 195 | + |
| 196 | +``` |
| 197 | +.github/workflows/ |
| 198 | +├── sync-helm-charts.yaml (12K) ← The main workflow |
| 199 | +├── test-sync.sh (6.5K) ← Local testing script |
| 200 | +│ |
| 201 | +├── GETTING_STARTED.md (THIS FILE) ← Start here! |
| 202 | +├── GITHUB_APP_SETUP.md (9.9K) ← Detailed setup guide |
| 203 | +├── SETUP_CHECKLIST.md (5.5K) ← Quick checklist |
| 204 | +│ |
| 205 | +├── HELM_SYNC_README.md (9.7K) ← Complete usage docs |
| 206 | +├── WORKFLOW_FLOW.md (15K) ← Visual flow diagrams |
| 207 | +├── GITHUB_APP_VS_PAT.md (7.8K) ← Why we chose GitHub App |
| 208 | +└── README.md (5.6K) ← Workflows overview |
| 209 | +``` |
| 210 | + |
| 211 | +**Total:** 72KB of documentation to make your life easier! 📚 |
| 212 | + |
| 213 | +## ✅ What Changed from PAT Approach |
| 214 | + |
| 215 | +If you're familiar with Personal Access Tokens: |
| 216 | + |
| 217 | +| Aspect | Old (PAT) | New (GitHub App) | |
| 218 | +|--------|-----------|------------------| |
| 219 | +| **Secrets** | 1 secret (token) | 2 secrets (app ID + key) | |
| 220 | +| **Setup time** | 5 min | 15 min | |
| 221 | +| **Expiration** | 1 year | Never | |
| 222 | +| **User-tied** | Yes | No | |
| 223 | +| **Security** | Good | Better | |
| 224 | +| **Attribution** | User | Bot | |
| 225 | +| **Maintenance** | Annual renewal | Optional key rotation | |
| 226 | + |
| 227 | +**Bottom line:** 10 extra minutes now saves hours later + better security. |
| 228 | + |
| 229 | +## 🎓 Learning Path |
| 230 | + |
| 231 | +1. **Today:** Follow this quick start |
| 232 | +2. **Tomorrow:** Read [HELM_SYNC_README.md](HELM_SYNC_README.md) for details |
| 233 | +3. **Later:** Review [WORKFLOW_FLOW.md](WORKFLOW_FLOW.md) to understand internals |
| 234 | +4. **Ongoing:** Reference [GITHUB_APP_SETUP.md](GITHUB_APP_SETUP.md) for management |
| 235 | + |
| 236 | +## 🔒 Security Checklist |
| 237 | + |
| 238 | +Before going to production: |
| 239 | + |
| 240 | +- [ ] App has minimum permissions (only Contents + Pull requests) |
| 241 | +- [ ] App installed only on helm-charts (not all repos) |
| 242 | +- [ ] Private key stored as secret (never committed) |
| 243 | +- [ ] Local `.pem` file deleted after adding to secrets |
| 244 | +- [ ] Both secrets added correctly |
| 245 | +- [ ] Test workflow completed successfully |
| 246 | +- [ ] Team knows how to manage the app |
| 247 | + |
| 248 | +## 🎉 Success Criteria |
| 249 | + |
| 250 | +You know it's working when: |
| 251 | + |
| 252 | +✅ Workflow runs without errors |
| 253 | +✅ PR created automatically in helm-charts |
| 254 | +✅ PR author shows as "fluent-helm-charts-sync[bot]" |
| 255 | +✅ PR has formatted description with versions |
| 256 | +✅ Charts are synced correctly |
| 257 | +✅ Merging PR triggers helm-charts CI |
| 258 | + |
| 259 | +## 🆘 Need Help? |
| 260 | + |
| 261 | +**Read in order:** |
| 262 | +1. This file's [Troubleshooting](#-troubleshooting) section |
| 263 | +2. [GITHUB_APP_SETUP.md](GITHUB_APP_SETUP.md#troubleshooting) |
| 264 | +3. [HELM_SYNC_README.md](HELM_SYNC_README.md#troubleshooting) |
| 265 | +4. GitHub Actions logs in the failed workflow |
| 266 | +5. Ask maintainers: @wenchajun @marcofranssen @joshuabaird |
| 267 | + |
| 268 | +## 🚀 Ready? |
| 269 | + |
| 270 | +Let's do this! Start with Step 1 above. ⬆️ |
| 271 | + |
| 272 | +--- |
| 273 | + |
| 274 | +**Created:** November 2025 |
| 275 | +**Status:** Production Ready |
| 276 | +**Estimated Setup Time:** 15 minutes |
| 277 | +**Difficulty:** Beginner-friendly 🟢 |
| 278 | + |
0 commit comments