Skip to content

Commit

Permalink
Merge pull request #130 from ivanilves/kaizen
Browse files Browse the repository at this point in the history
6 steps of Kaizen
  • Loading branch information
ivanilves authored Mar 18, 2018
2 parents aebb5b6 + 90f1905 commit 3c11830
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 57 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ notifications:

language: go

go: 1.8.3
go: "1.10"

env:
global:
- MAKEFLAGS="-j"

before_install:
- sudo ln -nfs /bin/bash /bin/sh
Expand All @@ -22,15 +26,17 @@ before_script:
- git remote set-url --push origin https://${GITHUB_TOKEN}@github.com/ivanilves/lstags.git

script:
- make build
- make coverage
- if [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then make blackbox-integration-test; fi
- make lint
- make vet
- make docker-image DOCKER_TAG=release

after_script:
- sudo killall -v dockerd

before_deploy:
- make docker-image DOCKER_TAG=release
- make release

deploy:
Expand Down
14 changes: 7 additions & 7 deletions Gopkg.lock

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

22 changes: 9 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
API_VERSION:=$(shell cat API_VERSION)

.PHONY: default clean offline prepare dep test unit-test whitebox-integration-test coverage-report \
.PHONY: default clean offline prepare dep test unit-test whitebox-integration-test coverage \
blackbox-integration-test shell-test-alpine shell-test-wrong-image shell-test-docker-socket shell-test-docker-tcp \
lint vet fail-on-errors docker-image build xbuild changelog release validate-release deploy deploy-github deploy-docker \
wrapper install
Expand Down Expand Up @@ -42,11 +42,7 @@ coverage:
overalls -project=${PROJECT} -covermode=count \
&& if [[ -n "${COVERALLS_TOKEN}" ]]; then goveralls -coverprofile=overalls.coverprofile -service ${SERVICE}; fi

blackbox-integration-test: build \
shell-test-alpine \
shell-test-wrong-image \
shell-test-docker-socket \
shell-test-docker-tcp
blackbox-integration-test: shell-test-alpine shell-test-wrong-image shell-test-docker-socket shell-test-docker-tcp

shell-test-alpine:
./lstags alpine | egrep "\salpine:latest"
Expand Down Expand Up @@ -91,20 +87,20 @@ xbuild:
changelog: LAST_RELEASED_TAG:=$(shell git tag --sort=creatordate | tail -n1)
changelog: GITHUB_COMMIT_URL:=https://github.com/ivanilves/lstags/commit
changelog:
@echo "## Changelog"
@git log --oneline --reverse ${LAST_RELEASED_TAG}..HEAD | egrep -iv "^[0-9a-f]{7,} (Merge pull request |Merge branch |NORELEASE)" | \
@echo "## Changelog" \
&& git log --oneline --reverse ${LAST_RELEASED_TAG}..HEAD | egrep -iv "^[0-9a-f]{7,} (Merge pull request |Merge branch |NORELEASE)" | \
sed -r "s|^([0-9a-f]{7,}) (.*)|* [\`\1\`](${GITHUB_COMMIT_URL}/\1) \2|"

release: clean
release: LAST_BUILD_NUMBER:=$(shell git tag --sort=creatordate | tail -n1 | sed 's/^v.*\.//')
release: THIS_BUILD_NUMBER:=$(shell expr ${LAST_BUILD_NUMBER} + 1)
release: THIS_RELEASE_NAME:=v${API_VERSION}.${THIS_BUILD_NUMBER}
release:
mkdir -p ./dist/release ./dist/assets
sed -i "s/CURRENT/${THIS_RELEASE_NAME}/" ./version.go && ${MAKE} xbuild && git checkout ./version.go
echo ${THIS_RELEASE_NAME} > ./dist/release/NAME && echo ${THIS_RELEASE_NAME} > ./dist/release/TAG
${MAKE} --no-print-directory changelog > ./dist/release/CHANGELOG.md
cp README.md ./dist/assets/
mkdir -p ./dist/release ./dist/assets \
&& sed -i "s/CURRENT/${THIS_RELEASE_NAME}/" ./version.go && ${MAKE} xbuild && git checkout ./version.go \
&& echo ${THIS_RELEASE_NAME} > ./dist/release/NAME && echo ${THIS_RELEASE_NAME} > ./dist/release/TAG \
&& ${MAKE} --no-print-directory changelog > ./dist/release/CHANGELOG.md \
&& cp README.md ./dist/assets/

validate-release:
test -s ./dist/release/TAG && test -s ./dist/release/NAME
Expand Down
46 changes: 12 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@

# L/S tags

* *Compare local Docker images with ones present in registry.*
* *Sync your local Docker images with ones from the registry.*
* *Get insights on changes in watched Docker registries, easily.*
* *Facilitate maintenance of your own local "proxy" registries.*

**NB!** [Issues](https://github.com/ivanilves/lstags/issues) are welcome, [pull requests](https://github.com/ivanilves/lstags/pulls) are even more welcome! :smile:
`lstags` is a utility and **API** to manipulate (analyze, synchronize and aggregate) images across different Docker registries.

### Example invocation
```
Expand All @@ -24,15 +19,16 @@ CHANGED sha256:0d82f2f4b464452aac758c77debfff138 f64255f97787 2017-09-
PRESENT sha256:129a7f8c0fae8c3251a8df9370577d9d6 074d602a59d7 2017-09-13T16:32:20 alpine:3.5
PRESENT sha256:f006ecbb824d87947d0b51ab8488634bf 76da55c8019d 2017-09-13T16:32:26 alpine:3.6
```
**NB!** You can specify many images to list or pull: `lstags nginx~/^1\\.13/ mesosphere/chronos alpine~/^3\\./`
**NB!** You can specify many images to operate on, e.g: `lstags nginx~/^1\\.13/ mesosphere/chronos alpine~/^3\\./`

## Why would someone use this?
You could use `lstags`, if you ...
* ... continuously pull Docker images from some public or private registry to speed-up Docker run.
* ... poll registry for the new images pushed (to take some action afterwards, run CI for example).
* ... compare local images with registry ones (e.g. know, if image tagged "latest" was re-pushed).
* ... aggregate images from different external registries into your own registry for **speed and locality** reasons.
* ... compare images present locally with the registry ones (e.g.: know if image tagged "latest" was re-pushed).
* ... continuously pull Docker images from some public or private registry to speed-up Docker run on your system.

... pull Ubuntu 14.04 & 16.04, all the Alpine images and Debian "stretch" to have latest software to play with:
### How?
... pull Ubuntu 14.04 & 16.04, all the Alpine images and Debian "stretch" to have the latest software to play with:
```sh
lstags --pull ubuntu~/^1[46]\\.04$/ alpine debian~/stretch/
```
Expand All @@ -43,12 +39,12 @@ lstags -P /quay -r registry.company.io quay.io/coreos/hyperkube quay.io/coreos/f
**NB!** In case you use private registry with authentication, make sure your Docker client knows how to authenticate against it!
`lstags` will reuse credentials saved by Docker client in its `config.json` file, one usually found at `~/.docker/config.json`

## Image state
`lstags` distinguishes four states of Docker image:
## Possible image states
`lstags` distinguishes five states of Docker image:
* `ABSENT` - present in registry, but absent locally
* `PRESENT` - present in registry, present locally, with local and remote digests being equal
* `CHANGED` - present in registry, present locally, but with **different** local and remote digests
* `ASSUMED` - present in registry, not exposed to search but "injected" (assumed) manually by user
* `ASSUMED` - **maybe** present in registry, not discovered by search, its presence assumed by user
* `LOCAL-ONLY` - present locally, absent in registry

There is also special `UNKNOWN` state, which means `lstags` failed to detect image state for some reason.
Expand Down Expand Up @@ -112,26 +108,8 @@ Application Options:
registry (See 'push-registry') [$PUSH]
-r, --push-registry= [Re]Push pulled images to a specified remote
registry [$PUSH_REGISTRY]
-R, --push-prefix= [Re]Push pulled images with a specified repo path
prefix [$PUSH_PREFIX]
-U, --push-update Update our pushed images if remote image digest
changes [$PUSH_UPDATE]
-c, --concurrent-requests= Limit of concurrent requests to the registry
(default: 32) [$CONCURRENT_REQUESTS]
-I, --insecure-registry-ex= Expression to match insecure registry hostnames
[$INSECURE_REGISTRY_EX]
-T, --trace-requests Trace Docker registry HTTP requests
[$TRACE_REQUESTS]
-N, --do-not-fail Do not fail on non-critical errors (could be
dangerous!) [$DO_NOT_FAIL]
-V, --version Show version and exit
Help Options:
-h, --help Show this help message
Arguments:
REPO1 REPO2 REPOn: Docker repositories to operate on, e.g.: alpine
nginx~/1\.13\.5$/ busybox~/1.27.2/
--- OUTPUT WAS CUT HERE TO SAVE SPACE ---
```

### Analyze an image
Expand Down
2 changes: 1 addition & 1 deletion scripts/github-create-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pushd "${RELEASE_PATH}"
declare -r TAG="$(cat TAG)"
declare -r NAME="$(cat NAME)"
declare -r BODY="$(sed 's/$/\\n/' CHANGELOG.md | tr -d '\n' | sed 's/\"/\\"/g')"
declare -r DATA="{\"tag_name\":\"${TAG}\", \"target_commitish\": \"master\",\"name\": \"${NAME}\", \"body\": \"${BODY}\", \"draft\": false, \"prerelease\": false}"
declare -r DATA="{\"tag_name\":\"${TAG}\", \"target_commitish\": \"master\",\"name\": \"${NAME}\", \"body\": \"${BODY}\", \"draft\": false, \"prerelease\": false, \"prerelease\": true}"

curl -f -X POST -H "Content-Type:application/json" \
-H "Authorization: Token ${GITHUB_TOKEN}" "${API_URL}" \
Expand Down

0 comments on commit 3c11830

Please sign in to comment.