Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update "make clean" to remove Redash dev Docker images #6847

Merged
merged 1 commit into from
Apr 7, 2024

Conversation

justinclift
Copy link
Member

@justinclift justinclift commented Apr 3, 2024

What type of PR is this?

  • Other

Description

At present, when a Redash developer wants to remove the locally built Redash Docker images, they need to do it manually.

This PR extends the existing make clean command to remove those images as well.

For example, here is the list of local Redash docker images after building and testing Redash:

$ docker image ls
REPOSITORY                    TAG            IMAGE ID       CREATED         SIZE
cypress-server                latest         886733b012fe   6 minutes ago   1.86GB
cypress-worker                latest         0c2ae5331bc2   6 minutes ago   1.86GB
cypress-scheduler             latest         56c23cf1e0e5   6 minutes ago   1.86GB
redash-server                 latest         fa489f5321f3   6 minutes ago   1.86GB
redash-worker                 latest         af38f423e314   6 minutes ago   1.86GB
redash-scheduler              latest         adebad4fd82a   6 minutes ago   1.86GB
redis                         7-alpine       435993df2c8d   2 months ago    41MB
pgautoupgrade/pgautoupgrade   15-alpine3.8   1834e13b7bda   4 months ago    365MB
maildev/maildev               latest         8a920dba53d6   8 months ago    199MB

With this PR, the make clean command will remove the Redash ones:

$ make clean
docker compose down && docker compose rm && \
docker image rm --force \
        cypress-server:latest cypress-worker:latest cypress-scheduler:latest \
        redash-server:latest redash-worker:latest redash-scheduler:latest
No stopped containers
Untagged: cypress-server:latest
Deleted: sha256:886733b012fec29a0fe1f7f04b2d12e8fe2710201956dcfc50e2187265c71ac0
Untagged: cypress-worker:latest
Deleted: sha256:0c2ae5331bc257e4f2e70ff03f27afefd2906378aa89312b97a4eeb753ff0cd8
Untagged: cypress-scheduler:latest
Deleted: sha256:56c23cf1e0e5ed1dc1118a2ba676714b917dde61fc75cefc07ae2d33c727867b
Untagged: redash-server:latest
Deleted: sha256:fa489f5321f3aaff9f27ef848bdc8cb577756f0bca83789f61fd6c64bd46ef77
Untagged: redash-worker:latest
Deleted: sha256:af38f423e3140172f3658a33bfc512d75b6b46f764be15bc3c8828a7b5c4afcd
Untagged: redash-scheduler:latest
Deleted: sha256:adebad4fd82a999a9650f11960c206478fdb266b1c147e8bc59f7421fd4d4e21

With the result:

$ docker image ls
REPOSITORY                    TAG            IMAGE ID       CREATED        SIZE
redis                         7-alpine       435993df2c8d   2 months ago   41MB
pgautoupgrade/pgautoupgrade   15-alpine3.8   1834e13b7bda   4 months ago   365MB
maildev/maildev               latest         8a920dba53d6   8 months ago   199MB

Also added a make clean-all command, which also removes the above redis, pgautoupgrade, and maildev images too. That one's probably only rarely useful however. 😄

How is this tested?

  • Manually

This was tested by building the Redash images (make compose_build, yarn cypress build), then running the updated make clean command and verifying the result.

Copy link

codecov bot commented Apr 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.82%. Comparing base (15e6583) to head (ae89066).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6847   +/-   ##
=======================================
  Coverage   63.82%   63.82%           
=======================================
  Files         161      161           
  Lines       13060    13060           
  Branches     1803     1803           
=======================================
  Hits         8335     8335           
  Misses       4425     4425           
  Partials      300      300           

Makefile Show resolved Hide resolved
Makefile Outdated
docker compose --project-name cypress down
docker compose rm --stop --force
docker compose --project-name cypress rm --stop --force
docker compose rm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking more complete, but I think we do not need docker compose rm since this is already done by docker compose rm --stop --force.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh Heh Heh. Ok, I'll take another pass at it... 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at it now, yeah you're right. Not sure how I doubled that up. Must have been really tired or something. 😄

Copy link
Member Author

@justinclift justinclift Apr 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k, I've just pushed an updated commit that removes the doubling up, and verified it's still all working as intended. It cleanly removes the running redash and cypress containers, and removes the corresponding image files as well.

Copy link
Member Author

@justinclift justinclift Apr 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I've just rebased this on master too while I'm at it, so its easier to merge.

@justinclift justinclift force-pushed the make_clean_v1 branch 2 times, most recently from 73e0e04 to 3ecbf70 Compare April 7, 2024 01:00
Makefile Outdated
docker image prune --force
docker volume prune --force

clean-all:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd want to add this target to the .PHONY section... most of the rules in this makefile do not create a target file.

Then add it as a dependency

clean-all: clean

Or maybe not? I wouldn't mind typing make clean; make clean-all

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @eradman. I'm clearly still coming up to speed with this stuff again. 😇

Looking at that bit now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'd rather keep the clean-all target incorporating the clean one. But I'm not even sure if we really need it. 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k, updated. clean-all added to the .PHONY list, and clean added as a dependency of clean-all so it doesn't need embedding as make clean.

In testing, make clean is removing both the redash and cypress containers + dev images, with make clean-all removing them plus the associated images (redis, pgautoupgrade, last redash release).

Also added a "make clean-all" target to remove the related containers
Copy link
Collaborator

@eradman eradman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with this; docker does not always track dependencies correctly, so it is necessary sometimes to force a rebuild.

@justinclift
Copy link
Member Author

Thanks heaps @eradman, merging it now. 😄

@justinclift justinclift merged commit af0773c into master Apr 7, 2024
16 checks passed
@justinclift justinclift deleted the make_clean_v1 branch April 7, 2024 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants