Skip to content

Commit

Permalink
Merge pull request #168 from stepchowfun/v0.20.0
Browse files Browse the repository at this point in the history
Release v0.20.0
  • Loading branch information
stepchowfun authored Aug 2, 2021
2 parents b6dc704 + b77ab71 commit cf18caa
Show file tree
Hide file tree
Showing 8 changed files with 351 additions and 286 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.20.0] - 2021-07-15

### Added
- Added the `--keep` flag to prevent Docuum from deleting certain images.

## [0.19.2] - 2021-07-14

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "docuum"
version = "0.19.2"
version = "0.20.0"
authors = ["Stephan Boyer <[email protected]>"]
edition = "2018"
description = "LRU eviction of Docker images."
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ OPTIONS:
Prints help information
-k, --keep <REGEX>...
Prevents deletion of repository:tag images that match the provided <REGEX>
Prevents deletion of images for which repository:tag matches <REGEX>
-t, --threshold <THRESHOLD>
Sets the maximum amount of space to be used for Docker images (default: 10 GB)
Expand Down
30 changes: 21 additions & 9 deletions integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ done

# Start Docuum in the background.
echo 'Starting Docuum…'
/docuum-x86_64-unknown-linux-musl --threshold 13MB &
/docuum-x86_64-unknown-linux-musl --threshold '20 MB' --keep 'alpine:keep' &
DOCUUM_PID="$!"

# This function waits for Docuum to start sleeping by checking the process state. The process could
Expand All @@ -29,28 +29,40 @@ wait_for_docuum() {
wait_for_docuum

# This image uses ~5.5 MB.
echo 'Using an image…'
echo "Using an image we don't want to delete…"
docker run alpine@sha256:52a197664c8ed0b4be6d3b8372f1d21f3204822ba432583644c9ce07f7d6448f \
true
docker tag alpine@sha256:52a197664c8ed0b4be6d3b8372f1d21f3204822ba432583644c9ce07f7d6448f \
alpine:keep

# This image also uses ~5.5 MB.
echo 'Using another image…'
docker run alpine@sha256:4716d67546215299bf023fd80cc9d7e67f4bdc006a360727fd0b0b44512c45db true

# This image also uses ~5.5 MB.
echo 'Using another image…'
docker run alpine@sha256:fef20cf0221c5c0eaae2d8f59081b07cd351a94ac83cdc74109b17ec90ce0a82 true

# This image also uses ~5.5 MB. Now we should be above the 13 MB threshold.
echo 'Using a third image…'
# This image also uses ~5.5 MB. Now we should be above the 20 MB threshold.
echo 'Using another image…'
docker run alpine@sha256:6b987122c635cd4bf46e52d85bca765732c7a224866501742c549ccc852f8c53 true

wait_for_docuum

# Assert the two most recently used images are still present.
echo 'Checking that the last two images are still present…'
docker inspect alpine@sha256:6b987122c635cd4bf46e52d85bca765732c7a224866501742c549ccc852f8c53 > \
# Assert that the image protected by the `--keep` flag is still present.
echo 'Checking that the protected image is still present…'
docker inspect alpine@sha256:52a197664c8ed0b4be6d3b8372f1d21f3204822ba432583644c9ce07f7d6448f > \
/dev/null 2>&1

# Assert that the last two images are still present.
echo 'Checking that the last two images are still present…'
docker inspect alpine@sha256:fef20cf0221c5c0eaae2d8f59081b07cd351a94ac83cdc74109b17ec90ce0a82 > \
/dev/null 2>&1
docker inspect alpine@sha256:6b987122c635cd4bf46e52d85bca765732c7a224866501742c549ccc852f8c53 > \
/dev/null 2>&1

# Assert the first image was deleted.
echo 'Checking that the first image was deleted…'
# Assert that the first non-protected image was deleted.
echo 'Checking that the first non-protected image was deleted…'
if docker inspect alpine@sha256:4716d67546215299bf023fd80cc9d7e67f4bdc006a360727fd0b0b44512c45db \
> /dev/null 2>&1
then
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fn settings() -> io::Result<Settings> {
.long(KEEP_OPTION)
.multiple(true)
.number_of_values(1)
.help("Prevents deletion of repository:tag images that match the provided <REGEX>"),
.help("Prevents deletion of images for which repository:tag matches <REGEX>"),
)
.get_matches();

Expand Down
Loading

0 comments on commit cf18caa

Please sign in to comment.