|
| 1 | +# CI/CD Setup for Grafana Quickwit Image |
| 2 | + |
| 3 | +This repository includes a GitHub Actions workflow that automatically builds and pushes a Grafana Docker image with the patched Quickwit datasource plugin to ECR. |
| 4 | + |
| 5 | +## Required GitHub Secrets |
| 6 | + |
| 7 | +The workflow requires the following secret to be configured in the repository: |
| 8 | + |
| 9 | +### `AWS_ROLE_ARN` |
| 10 | +AWS IAM Role ARN with permissions to push to ECR. |
| 11 | + |
| 12 | +**Example format**: `arn:aws:iam::337909757619:role/github-actions-ecr-push` |
| 13 | + |
| 14 | +**Required Permissions**: |
| 15 | +```json |
| 16 | +{ |
| 17 | + "Version": "2012-10-17", |
| 18 | + "Statement": [ |
| 19 | + { |
| 20 | + "Effect": "Allow", |
| 21 | + "Action": [ |
| 22 | + "ecr:GetAuthorizationToken", |
| 23 | + "ecr:BatchCheckLayerAvailability", |
| 24 | + "ecr:GetDownloadUrlForLayer", |
| 25 | + "ecr:BatchGetImage", |
| 26 | + "ecr:PutImage", |
| 27 | + "ecr:InitiateLayerUpload", |
| 28 | + "ecr:UploadLayerPart", |
| 29 | + "ecr:CompleteLayerUpload" |
| 30 | + ], |
| 31 | + "Resource": [ |
| 32 | + "arn:aws:ecr:us-east-1:337909757619:repository/grafana-quickwit" |
| 33 | + ] |
| 34 | + }, |
| 35 | + { |
| 36 | + "Effect": "Allow", |
| 37 | + "Action": [ |
| 38 | + "ecr:GetAuthorizationToken" |
| 39 | + ], |
| 40 | + "Resource": "*" |
| 41 | + } |
| 42 | + ] |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +## Setting up the Secret |
| 47 | + |
| 48 | +1. Go to the repository on GitHub: https://github.com/Iterable/quickwit-datasource |
| 49 | +2. Navigate to **Settings** → **Secrets and variables** → **Actions** |
| 50 | +3. Click **New repository secret** |
| 51 | +4. Name: `AWS_ROLE_ARN` |
| 52 | +5. Value: The ARN of your IAM role (e.g., `arn:aws:iam::337909757619:role/github-actions-ecr-push`) |
| 53 | +6. Click **Add secret** |
| 54 | + |
| 55 | +## IAM Role Trust Policy |
| 56 | + |
| 57 | +The IAM role must trust GitHub Actions from the Iterable organization: |
| 58 | + |
| 59 | +```json |
| 60 | +{ |
| 61 | + "Version": "2012-10-17", |
| 62 | + "Statement": [ |
| 63 | + { |
| 64 | + "Effect": "Allow", |
| 65 | + "Principal": { |
| 66 | + "Federated": "arn:aws:iam::337909757619:oidc-provider/token.actions.githubusercontent.com" |
| 67 | + }, |
| 68 | + "Action": "sts:AssumeRoleWithWebIdentity", |
| 69 | + "Condition": { |
| 70 | + "StringEquals": { |
| 71 | + "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" |
| 72 | + }, |
| 73 | + "StringLike": { |
| 74 | + "token.actions.githubusercontent.com:sub": "repo:Iterable/quickwit-datasource:*" |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + ] |
| 79 | +} |
| 80 | +``` |
| 81 | + |
| 82 | +## Workflow Triggers |
| 83 | + |
| 84 | +The workflow runs on: |
| 85 | +- **Push** to `disable-field-caps-all-fields` branch |
| 86 | +- **Push** to `main` branch |
| 87 | +- **Tags** matching `v*` pattern |
| 88 | +- **Manual** trigger via workflow_dispatch |
| 89 | + |
| 90 | +## Image Tags |
| 91 | + |
| 92 | +Images are tagged as: |
| 93 | +- `<grafana-version>-quickwit-<plugin-version>-<short-sha>` for branch builds |
| 94 | +- `<grafana-version>-quickwit-<version>` for tag builds |
| 95 | +- `latest` for main branch or tag builds |
| 96 | + |
| 97 | +**Example**: `12.4.0-quickwit-0.6.0-patched-a1b2c3d` |
| 98 | + |
| 99 | +## Target ECR Repository |
| 100 | + |
| 101 | +- **Repository**: `grafana-quickwit` |
| 102 | +- **Region**: `us-east-1` |
| 103 | +- **Registry**: `337909757619.dkr.ecr.us-east-1.amazonaws.com` |
| 104 | + |
| 105 | +## Verifying the Workflow |
| 106 | + |
| 107 | +After setting up the secret, the workflow will run automatically on the next push. You can also trigger it manually: |
| 108 | + |
| 109 | +1. Go to **Actions** tab |
| 110 | +2. Select **Build and Push Grafana with Quickwit Plugin** |
| 111 | +3. Click **Run workflow** |
| 112 | +4. Select the branch and click **Run workflow** |
| 113 | + |
| 114 | +## Troubleshooting |
| 115 | + |
| 116 | +**Error: Unable to locate credentials** |
| 117 | +- Verify the `AWS_ROLE_ARN` secret is set correctly |
| 118 | +- Check that the IAM role exists and the ARN is correct |
| 119 | + |
| 120 | +**Error: AccessDenied** |
| 121 | +- Verify the IAM role has the correct permissions policy |
| 122 | +- Verify the IAM role's trust policy allows GitHub Actions from this repository |
| 123 | + |
| 124 | +**Error: Repository does not exist** |
| 125 | +- Verify the ECR repository `grafana-quickwit` exists in `us-east-1` |
| 126 | +- Check the repository name in the workflow matches exactly |
0 commit comments