Focuses on building code, versioning, branching strategies, and ensuring every commit is validated properly.
- Clean Build Environments
- Git & Branch Policies
- Testing from Dev/Personal Branches (Version Bump Avoidance)
- Code Validation in CI
- Git Flow vs OneFlow
- Unit / Integration / E2E Tests
- Scenario: Slow Build Times
- Scenario: Double-Build Problem in Docker CI Pipeline
- Scenario: Docker Build Time Optimization in CI/CD
Question (Scenario):
Your builds sometimes fail because leftover files from previous runs cause unexpected results. How would you make sure each build runs in a clean, consistent environment?
Hints / Key Points
- Containerized or ephemeral build agents ensure no leftover files or dependencies.
- Reproducible environment: each run starts fresh.
- Avoid “works on my machine” issues by isolating dependencies.
Question:
When setting up a new Git repository for a service, how do you make sure collaboration and merging are done in a controlled, high-quality way?
Hints / Key Points
- Require pull requests to merge into
main. - Use branch protections: code reviews, mandatory checks, or tests.
- Adopt a branching strategy (Git Flow, OneFlow, or trunk-based).
Question:
You want developers to build and test code on a personal branch without bumping the official app version. How do you do that?
Hints / Key Points
- Only bump the version if building from
main(after merging). - Use ephemeral tags (like
dev-<commit-hash>) for personal branches. - This prevents cluttering your production semver with test builds.
Question:
What kind of checks do you usually include in a CI pipeline to keep code quality high?
Hints / Key Points
- Linting and static analysis for code style and potential security flaws.
- Unit tests to verify logic.
- Optional checks: integration tests, code coverage, or style checks.
Question:
Explain the main differences between Git Flow and OneFlow, and give an example of when you might pick one over the other.
Hints / Key Points
- Git Flow:
- Has a
developbranch and separaterelease/branches. - Good for scheduled releases or big features that need isolation.
- Has a
- OneFlow:
- Fewer branches; merges features straight into
main. - Easier for continuous delivery or smaller teams who release often.
- Fewer branches; merges features straight into
Question (Scenario):
A new developer asks how different types of tests fit into the CI pipeline. Can you explain the roles of unit, integration, and end-to-end tests?
Hints / Key Points
- Unit tests: Check individual pieces of code in isolation.
- Integration tests: Validate how services or components interact (e.g., API to DB).
- E2E tests: Full user flow from start to finish, mirroring real production usage.
Question (Scenario):
The CI builds are getting slower and slower, which annoys developers. What could you do to speed things up?
Hints / Key Points
- Caching dependencies so you don’t rebuild or re-download everything on each run.
- Splitting large monolithic builds into smaller jobs or microservices.
- Using multi-stage Docker builds or ephemeral agents to reduce overhead.
Question:
You notice your CI pipeline builds a Docker image twice—once for security scanning (e.g., Trivy) and again for deployment. This doubles build time and resource usage.
How would you troubleshoot and resolve this?
Hints / Key Points
- Identify where each build step is triggered; check pipeline definitions or separate workflows.
- Consolidate scanning and deployment into one pipeline stage, or reuse the built image artifact.
- Push a single built image to a temporary registry, run scans on that image, then deploy if it’s clean.
Question (Scenario):
Your Docker builds in CI/CD are taking longer than expected, especially for a .NET or Java app with large dependencies.
What can you do to improve the build time?
Hints / Key Points
- Optimize your Dockerfile structure: place static dependency installation steps at the top for caching.
- Use multi-stage builds to keep final images small.
- Possibly store a “build cache” or layer cache between runs so you don’t rebuild everything from scratch each time.