diff --git a/.gitignore b/.gitignore index 7ef70ad..f693c41 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ # Built artifacts /lstags /dist/* + +# Temporary "scratch" directory +/tmp/* diff --git a/Makefile b/Makefile index 4493535..75cf775 100644 --- a/Makefile +++ b/Makefile @@ -22,10 +22,30 @@ package-test: integration-test: go test -integration -v -shell-test: build +env: + env + +shell-test: build shell-test-alpine shell-test-wrong-image shell-test-pull-public shell-test-pull-private + +shell-test-alpine: ./lstags alpine | egrep "\salpine:latest" + +shell-test-wrong-image: ./lstags nobody/nothing &>/dev/null && exit 1 || true +shell-test-pull-public: DOCKERHUB_PUBLIC_REPO?=ivanilves/dummy +shell-test-pull-public: + ./lstags --pull ${DOCKERHUB_PUBLIC_REPO}~/latest/ + +shell-test-pull-private: DOCKER_JSON:=tmp/docker.json.private-repo +shell-test-pull-private: + mkdir -p tmp + if [[ -n "${DOCKERHUB_PRIVATE_REPO}" && -n "${DOCKERHUB_AUTH}" ]]; then\ + touch "${DOCKER_JSON}" && chmod 0600 "${DOCKER_JSON}" \ + && echo "{ \"auths\": { \"registry.hub.docker.com\": { \"auth\": \"${DOCKERHUB_AUTH}\" } } }" >"${DOCKER_JSON}"\ + && ./lstags -j "${DOCKER_JSON}" --pull ${DOCKERHUB_PRIVATE_REPO}~/latest/; else echo "DOCKERHUB_PRIVATE_REPO or DOCKERHUB_AUTH not set!";\ + fi + lint: ERRORS:=$(shell find . -name "*.go" ! -path "./vendor/*" | xargs -i golint {}) lint: fail-on-errors diff --git a/README.md b/README.md index 6b97d50..97e277e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ [![Build Status](https://travis-ci.org/ivanilves/lstags.svg?branch=master)](https://travis-ci.org/ivanilves/lstags) -# lstags +# 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.* @@ -47,6 +48,12 @@ My CI server is connected over crappy Internet link and pulling images in advanc There is also special `UNKNOWN` state, which means `lstags` failed to detect image state for some reason. +## Authentication +You can either: +* rely on `lstags` discovering credentials "automagically" :tophat: +* load credentials from any Docker JSON config file specified +* pass username and password explicitly, via the command line + ## Install: Binaries https://github.com/ivanilves/lstags/releases