Skip to content

fix(controller): add bounded exponential backoff and jitter to queue retries #502

fix(controller): add bounded exponential backoff and jitter to queue retries

fix(controller): add bounded exponential backoff and jitter to queue retries #502

Workflow file for this run

# Continuous Integration Workflow
# Runs tests, linting, and build checks on code changes
# Optimized to skip jobs when only irrelevant files change
name: CI
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
workflow_dispatch:
inputs:
debug:
description: 'Enable debug logging'
required: false
default: 'false'
type: boolean
# Cancel in-progress runs for the same branch
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
GO_VERSION_FILE: go.mod
GOWORK: off
jobs:
detect-changes:
name: Detect Changes
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
go-changed: ${{ steps.changes.outputs.go }}
proto-changed: ${{ steps.changes.outputs.proto }}
ci-changed: ${{ steps.changes.outputs.ci }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect file changes
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
go:
- '**/*.go'
- 'go.mod'
- 'go.sum'
- 'Makefile'
proto:
- 'api/proto/**'
- 'buf.yaml'
- 'buf.gen.yaml'
ci:
- '.github/workflows/ci.yml'
- '.golangci.yml'
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
needs: detect-changes
if: |
needs.detect-changes.outputs.go-changed == 'true' ||
needs.detect-changes.outputs.ci-changed == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.GO_VERSION_FILE }}
cache: true
- name: Download dependencies
run: go mod download
- name: Build
run: go build -o /dev/null ./...
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 15
needs: detect-changes
if: |
needs.detect-changes.outputs.go-changed == 'true' ||
needs.detect-changes.outputs.ci-changed == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.GO_VERSION_FILE }}
cache: true
- name: Download dependencies
run: go mod download
- name: Run tests with race detection
run: go test -p 1 -race -v ./...
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
needs: detect-changes
if: |
needs.detect-changes.outputs.go-changed == 'true' ||
needs.detect-changes.outputs.ci-changed == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.GO_VERSION_FILE }}
cache: true
- name: Download dependencies
run: go mod download
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: latest
skip-cache: true
args: --timeout=5m
proto:
name: Proto
runs-on: ubuntu-latest
timeout-minutes: 10
needs: detect-changes
if: |
needs.detect-changes.outputs.proto-changed == 'true' ||
needs.detect-changes.outputs.ci-changed == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.GO_VERSION_FILE }}
cache: true
- name: Setup Buf
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint protos
run: buf lint
- name: Check for breaking changes
if: github.event_name == 'pull_request'
env:
BASE_REF: ${{ github.base_ref }}
run: |
git fetch origin $BASE_REF:$BASE_REF
buf breaking --against ".git#branch=${BASE_REF}"
- name: Verify generated code is up-to-date
run: |
buf generate
if [ -n "$(git status --porcelain api/proto/gen)" ]; then
echo "::error::Generated proto code is out of date. Run 'make proto' and commit."
git diff api/proto/gen
exit 1
fi
ci-complete:
name: CI Complete
runs-on: ubuntu-latest
needs: [detect-changes, build, test, lint, proto]
if: always()
steps:
- name: Check results
env:
CHANGES_RESULT: ${{ needs.detect-changes.result }}
BUILD_RESULT: ${{ needs.build.result }}
TEST_RESULT: ${{ needs.test.result }}
LINT_RESULT: ${{ needs.lint.result }}
PROTO_RESULT: ${{ needs.proto.result }}
run: |
echo "Detection: $CHANGES_RESULT"
echo "Build: $BUILD_RESULT"
echo "Test: $TEST_RESULT"
echo "Lint: $LINT_RESULT"
echo "Proto: $PROTO_RESULT"
# Fail if detection failed
if [ "$CHANGES_RESULT" == "failure" ]; then
echo "::error::Change detection failed"
exit 1
fi
# Check each job - 'skipped' is acceptable, 'failure' is not
for result in "$BUILD_RESULT" "$TEST_RESULT" "$LINT_RESULT" "$PROTO_RESULT"; do
if [ "$result" == "failure" ]; then
echo "::error::CI failed"
exit 1
fi
done
echo "✅ CI passed (some jobs may have been skipped based on changes)"