Q: Your GitHub Actions workflow is taking 18 minutes because it uploads a 4GB test artifact to GitHub Artifacts storage after every run, even for PRs that fail. How do you reduce pipeline cost and duration with minimal code changes?
Two immediate improvements:
#CI/CD #๐ Supply Chain Security & Advanced CI/CD #L2 #DevOps #Automation #Pipelines
๐๏ธ Candidate Opening & Architectural Context
""In our delivery pipeline supporting multiple engineering squads, pipeline reliability was paramount. The interviewer is testing: Conditional artifact uploads, artifact retention policies.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
๐ ๏ธ Production Runbook & Step-by-Step Resolution
1๏ธโฃ
Initial Diagnostics & Root Cause Analysis
Two immediate improvements:
- Conditional upload: Only upload artifacts when the job actually passes or when specifically triggered on
main: - Reduce artifact size: Archive only the failed test reports, not the entire output directory. For a 4 GB binary artifact, push it to S3 directly from the workflow instead of GitHub Artifacts storage โ it's 10ร cheaper and not subject to GitHub's storage quotas.
- Set
retention-days: 7on all artifacts to prevent indefinite storage accumulation.
2๏ธโฃ
Remediation & Permanent Safeguards
- uses: actions/upload-artifact@v4
if: success() && github.ref == 'refs/heads/main'
with:
name: test-results
path: ./results/
retention-days: 7
๐ก The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Conditional upload: Only upload artifacts when the job actually passes or when specifically triggered on main:."
โก 60-Second Elevator Pitch Talking Points
- Conditional upload: Only upload artifacts when the job actually passes or when specifically trigg...
- Reduce artifact size: Archive only the failed test reports, not the entire output directory. For ...
- Set retention-days: 7 on all artifacts to prevent indefinite storage accumulation.
Advertisement