-
Notifications
You must be signed in to change notification settings - Fork 88
ci: reduce PR feedback loop with targeted caching #1294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e60ea3a
9a34ca9
1cacc1d
c4ff934
fc16590
bcdfbc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,9 @@ on: | |
| push: | ||
| branches: [ main ] | ||
|
|
||
| env: | ||
| KIND_VERSION: "v0.27.0" | ||
|
|
||
| concurrency: | ||
| group: e2e-tests-${{ github.event.pull_request.number || github.sha }} | ||
| cancel-in-progress: true | ||
|
|
@@ -87,71 +90,102 @@ jobs: | |
| with: | ||
| driver-opts: network=host | ||
|
|
||
| - name: Build component images from PR code | ||
| - name: Build or pull frontend image | ||
| if: needs.detect-changes.outputs.frontend == 'true' | ||
| uses: docker/build-push-action@v7 | ||
| with: | ||
|
Comment on lines
+95
to
+96
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# List tag-pinned actions in the changed workflow.
rg -nP '^\s*uses:\s*[^@\s]+@v[0-9]+' .github/workflows/e2e.ymlRepository: ambient-code/platform Length of output: 551 🏁 Script executed: head -20 .github/workflows/e2e.ymlRepository: ambient-code/platform Length of output: 405 🏁 Script executed: sed -n '90,100p' .github/workflows/e2e.ymlRepository: ambient-code/platform Length of output: 422 🏁 Script executed: sed -n '110,120p' .github/workflows/e2e.ymlRepository: ambient-code/platform Length of output: 500 🏁 Script executed: sed -n '1,40p' .github/workflows/e2e.ymlRepository: ambient-code/platform Length of output: 1194 🏁 Script executed: sed -n '170,180p' .github/workflows/e2e.ymlRepository: ambient-code/platform Length of output: 335 🏁 Script executed: sed -n '230,245p' .github/workflows/e2e.ymlRepository: ambient-code/platform Length of output: 584 🏁 Script executed: grep -n 'permissions:' .github/workflows/e2e.ymlRepository: ambient-code/platform Length of output: 47 Workflow actions must be pinned to commit SHAs and permissions scoped. All action usages rely on mutable version tags ( Additionally, the workflow lacks an explicit top-level Replace version tags with full commit SHAs (e.g., 🤖 Prompt for AI Agents |
||
| context: components/frontend | ||
| file: components/frontend/Dockerfile | ||
| load: true | ||
| tags: quay.io/ambient_code/vteam_frontend:e2e-test | ||
| cache-from: | | ||
| type=gha,scope=frontend-amd64 | ||
| type=gha,scope=e2e-frontend | ||
| cache-to: type=gha,mode=max,scope=e2e-frontend | ||
|
|
||
| - name: Pull frontend latest (unchanged) | ||
| if: needs.detect-changes.outputs.frontend != 'true' | ||
| run: | | ||
| echo "======================================" | ||
| echo "Building images from PR code..." | ||
| echo "PR #${{ github.event.pull_request.number }}" | ||
| echo "SHA: ${{ github.event.pull_request.head.sha }}" | ||
| echo "======================================" | ||
| docker pull quay.io/ambient_code/vteam_frontend:latest | ||
| docker tag quay.io/ambient_code/vteam_frontend:latest quay.io/ambient_code/vteam_frontend:e2e-test | ||
|
|
||
| # Build frontend image (if changed or use latest) | ||
| if [ "${{ needs.detect-changes.outputs.frontend }}" == "true" ]; then | ||
| echo "Building frontend (changed)..." | ||
| docker build -t quay.io/ambient_code/vteam_frontend:e2e-test \ | ||
| -f components/frontend/Dockerfile \ | ||
| components/frontend | ||
| else | ||
| echo "Frontend unchanged, pulling latest..." | ||
| docker pull quay.io/ambient_code/vteam_frontend:latest | ||
| docker tag quay.io/ambient_code/vteam_frontend:latest quay.io/ambient_code/vteam_frontend:e2e-test | ||
| fi | ||
| - name: Build or pull backend image | ||
| if: needs.detect-changes.outputs.backend == 'true' | ||
| uses: docker/build-push-action@v7 | ||
| with: | ||
| context: components/backend | ||
| file: components/backend/Dockerfile | ||
| load: true | ||
| tags: quay.io/ambient_code/vteam_backend:e2e-test | ||
| cache-from: | | ||
| type=gha,scope=backend-amd64 | ||
| type=gha,scope=e2e-backend | ||
| cache-to: type=gha,mode=max,scope=e2e-backend | ||
|
|
||
| # Build backend image (if changed or use latest) | ||
| if [ "${{ needs.detect-changes.outputs.backend }}" == "true" ]; then | ||
| echo "Building backend (changed)..." | ||
| docker build -t quay.io/ambient_code/vteam_backend:e2e-test \ | ||
| -f components/backend/Dockerfile \ | ||
| components/backend | ||
| else | ||
| echo "Backend unchanged, pulling latest..." | ||
| docker pull quay.io/ambient_code/vteam_backend:latest | ||
| docker tag quay.io/ambient_code/vteam_backend:latest quay.io/ambient_code/vteam_backend:e2e-test | ||
| fi | ||
| - name: Pull backend latest (unchanged) | ||
| if: needs.detect-changes.outputs.backend != 'true' | ||
| run: | | ||
| docker pull quay.io/ambient_code/vteam_backend:latest | ||
| docker tag quay.io/ambient_code/vteam_backend:latest quay.io/ambient_code/vteam_backend:e2e-test | ||
|
|
||
| # Build operator image (if changed or use latest) | ||
| if [ "${{ needs.detect-changes.outputs.operator }}" == "true" ]; then | ||
| echo "Building operator (changed)..." | ||
| docker build -t quay.io/ambient_code/vteam_operator:e2e-test \ | ||
| -f components/operator/Dockerfile \ | ||
| components/operator | ||
| else | ||
| echo "Operator unchanged, pulling latest..." | ||
| docker pull quay.io/ambient_code/vteam_operator:latest | ||
| docker tag quay.io/ambient_code/vteam_operator:latest quay.io/ambient_code/vteam_operator:e2e-test | ||
| fi | ||
| - name: Build or pull operator image | ||
| if: needs.detect-changes.outputs.operator == 'true' | ||
| uses: docker/build-push-action@v7 | ||
| with: | ||
| context: components/operator | ||
| file: components/operator/Dockerfile | ||
| load: true | ||
| tags: quay.io/ambient_code/vteam_operator:e2e-test | ||
| cache-from: | | ||
| type=gha,scope=operator-amd64 | ||
| type=gha,scope=e2e-operator | ||
| cache-to: type=gha,mode=max,scope=e2e-operator | ||
|
|
||
| # Build ambient-runner image (if changed or use latest) | ||
| if [ "${{ needs.detect-changes.outputs.claude-runner }}" == "true" ]; then | ||
| echo "Building ambient-runner (changed)..." | ||
| docker build -t quay.io/ambient_code/vteam_claude_runner:e2e-test \ | ||
| -f components/runners/ambient-runner/Dockerfile \ | ||
| components/runners | ||
| else | ||
| echo "Claude-runner unchanged, pulling latest..." | ||
| docker pull quay.io/ambient_code/vteam_claude_runner:latest | ||
| docker tag quay.io/ambient_code/vteam_claude_runner:latest quay.io/ambient_code/vteam_claude_runner:e2e-test | ||
| fi | ||
| - name: Pull operator latest (unchanged) | ||
| if: needs.detect-changes.outputs.operator != 'true' | ||
| run: | | ||
| docker pull quay.io/ambient_code/vteam_operator:latest | ||
| docker tag quay.io/ambient_code/vteam_operator:latest quay.io/ambient_code/vteam_operator:e2e-test | ||
|
|
||
| echo "" | ||
| echo "✅ All images ready" | ||
| docker images | grep e2e-test | ||
| - name: Build or pull ambient-runner image | ||
| if: needs.detect-changes.outputs.claude-runner == 'true' | ||
| uses: docker/build-push-action@v7 | ||
| with: | ||
| context: components/runners | ||
| file: components/runners/ambient-runner/Dockerfile | ||
| load: true | ||
| tags: quay.io/ambient_code/vteam_claude_runner:e2e-test | ||
| cache-from: | | ||
| type=gha,scope=ambient-runner-amd64 | ||
| type=gha,scope=e2e-ambient-runner | ||
| cache-to: type=gha,mode=max,scope=e2e-ambient-runner | ||
|
|
||
| - name: Pull ambient-runner latest (unchanged) | ||
| if: needs.detect-changes.outputs.claude-runner != 'true' | ||
| run: | | ||
| docker pull quay.io/ambient_code/vteam_claude_runner:latest | ||
| docker tag quay.io/ambient_code/vteam_claude_runner:latest quay.io/ambient_code/vteam_claude_runner:e2e-test | ||
|
|
||
| - name: Show built images | ||
| run: docker images | grep e2e-test | ||
|
|
||
| - name: Cache kind binary | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/k8s-tools/kind | ||
| key: kind-${{ runner.os }}-${{ env.KIND_VERSION }} | ||
|
|
||
| - name: Install kind | ||
| run: | | ||
| curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64 | ||
| chmod +x ./kind | ||
| sudo mv ./kind /usr/local/bin/kind | ||
| mkdir -p ~/k8s-tools | ||
| if [[ ! -f ~/k8s-tools/kind ]]; then | ||
| echo "Downloading kind $KIND_VERSION..." | ||
| curl -sLo ~/k8s-tools/kind "https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64" | ||
| chmod +x ~/k8s-tools/kind | ||
| else | ||
| echo "Using cached kind" | ||
| fi | ||
| sudo cp ~/k8s-tools/kind /usr/local/bin/kind | ||
| kind version | ||
|
|
||
| - name: Setup kind cluster | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add explicit least-privilege
permissionsfor this workflow.The workflow introduces cache writes and multiple third-party actions but does not scope
GITHUB_TOKENpermissions explicitly.Suggested hardening baseline
As per coding guidelines,
.github/workflows/**/*.{yml,yaml}: - Pin action versions to SHA. Verify secrets are not exposed and permissions are scoped.📝 Committable suggestion
🤖 Prompt for AI Agents