Reading — step 1 of 5
Read
~1 min readWorkflow Definition
Job Dependencies (DAG)
Jobs can DEPEND on others:
jobs:
build:
runs-on: ubuntu-latest
steps: [...]
test:
needs: build
runs-on: ubuntu-latest
steps: [...]
deploy:
needs: [build, test]
runs-on: ubuntu-latest
steps: [...]
The pipeline is a directed acyclic graph (DAG). CI runner topologically sorts: build first, then test (parallel with anything else), then deploy (needs both).
Why?
- Reuse build artifacts: build once, test in N parallel matrix jobs.
- Skip downstream on failure: don't deploy if tests failed.
- Parallel independent paths: lint + build can run together if they don't depend on each other.
Failure semantics:
- A job fails → all
needs:-dependent jobs are SKIPPED. - Other independent jobs may continue (if
fail-fast: false). - Workflow status is "failure" if any job failed.
Modern systems also have:
- Conditional needs:
if: success()vsif: failure()vsif: always(). - Concurrency groups: prevent two pipelines from running for same branch (
concurrency: deploy-prod).
python
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…