Test-gated image build

A test-gated image build makes successful CI verification a prerequisite for building and publishing container images. In this course, the build job depends on the test job through GitHub Actions needs, preventing a failed test run from publishing new API or worker images.

Minimal example

yaml
build:
  needs: test
  if: github.event_name == 'push' && github.ref == 'refs/heads/main'

Learn this concept

Lesson 7.3 · Gated CI image publishing

Used in exercises

Exercise 7.4 · Backend CI workflow
Prerequisite conceptsGitHub ActionsIntegration test