Skip to content

Conversation

casibbald
Copy link
Collaborator

Fix: Improve Workflow Dependencies and Helm Chart Publishing

Overview

This PR fixes critical issues in the CI/CD workflow that were preventing proper sequential execution and helm chart publishing to ghcr.io.

Problems Solved

1. Job Dependency Issues

  • Problem: The release job was depending on build-docs which only runs on PRs, causing release jobs to hang indefinitely
  • Problem: Jobs were running concurrently instead of sequentially (test → build → release)
  • Solution: Fixed job dependencies to create proper sequential flow

2. Missing Helm Chart Publishing

  • Problem: Helm charts weren't being published to ghcr.io because required environment variables were missing
  • Problem: The IMG variable wasn't set during helm chart generation, causing incorrect image references
  • Solution: Added proper environment variables for helm chart publishing

Changes Made

Workflow Dependencies

# Before: Jobs ran concurrently with problematic dependencies
release:
  needs: [build, test, build-docs, release-please]  # build-docs only runs on PRs!

# After: Sequential execution with correct dependencies  
test: # runs first
build:
  needs: [test]  # runs after test passes
release:
  needs: [build, test, release-please]  # runs after build/test, only when release created

Environment Variables for Helm Publishing

# Added missing variables for proper helm chart publishing
- name: Build and publish Helm chart
  run: make publish-helm-chart
  env:
    VERSION: ${{ steps.get_version.outputs.VERSION }}
    IMG: ghcr.io/weaveworks/gitopssets-controller:${{ steps.get_version.outputs.VERSION }}
    CHART_REGISTRY: ghcr.io/weaveworks/charts

Expected Behavior After Fix

Sequential Workflow Execution

  1. test job runs first (unit tests, e2e tests)
  2. build job runs after test passes (builds and pushes container image)
  3. release job runs only when:
    • release-please creates a release (conventional commits merged to main)
    • AND test/build jobs complete successfully

Helm Chart Publishing

  • Helm charts will be properly generated with correct image references
  • Charts will be pushed to ghcr.io/weaveworks/charts/gitopssets-controller
  • Chart versions will match the release version

Container Image Publishing

  • Images continue to be pushed to ghcr.io/weaveworks/gitopssets-controller
  • Release manifests will reference the correct versioned images

Testing

  • Workflow syntax is valid
  • Job dependencies are correctly structured
  • Environment variables are properly set
  • Makefile targets work with provided variables

Impact

  • ✅ Fixes hanging release jobs
  • ✅ Enables automatic helm chart publishing
  • ✅ Ensures proper sequential execution (no wasted resources)
  • ✅ Maintains backward compatibility with existing release process

Related Issues

This addresses the issue where release-please was creating releases but the actual release job wasn't executing due to dependency problems.

- Make build depend on test completion (sequential flow)
- Remove build-docs dependency from release job
- Add missing IMG and CHART_REGISTRY environment variables for helm publishing
- Ensure helm charts are properly pushed to ghcr.io/weaveworks/charts
@casibbald casibbald merged commit 0e6debf into main Jul 7, 2025
5 checks passed
@casibbald casibbald deleted the fix/simplify-release-workflow branch July 7, 2025 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant