Add --no-cache flag for deployments#93
Open
emanuelefaja wants to merge 1 commit intoletsdiscodev:mainfrom
Open
Add --no-cache flag for deployments#93emanuelefaja wants to merge 1 commit intoletsdiscodev:mainfrom
emanuelefaja wants to merge 1 commit intoletsdiscodev:mainfrom
Conversation
Allow users to trigger Docker builds without cache via the deploy API. Adds `noCache` field to the deployment request body, persists it on the Deployment model, and passes `--no-cache` to `docker build` when set. Includes Alembic migration to add the `no_cache` column.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
noCachefield to the deployment POST request bodyDeploymentmodel (newno_cacheboolean column)DeploymentInfo→build_images()→docker.build_image()--no-cachetodocker buildwhen the flag is setMotivation
When debugging build issues or dealing with stale cached layers, there's no way to force a clean Docker build through Disco. The only workaround is SSH-ing into the server and running
docker builder prune, which affects all projects.This adds per-deployment cache control via
disco deploy --project <name> --no-cache.Companion PR
CLI side: letsdiscodev/cli#116
Files changed
disco/models/deployment.pyno_cacheboolean columndisco/endpoints/deployments.pynoCachein request body, pass tocreate_deployment()disco/utils/deployments.pyno_cacheparam throughcreate_deployment()disco/utils/deploymentflow.pyDeploymentInfodataclass, pass to bothbuild_image()call sitesdisco/utils/docker.pyno_cacheparam, insert--no-cacheinto docker build argsdisco/alembic/versions/a1b2c3d4e5f6_add_no_cache.pyTest plan
noCache: false(default) — should behave identically to current behaviornoCache: true— docker build output should show layers being rebuilt (noCACHEDlines)no_cache = false