Skip to content

-s/--service flag on Zest Run #51

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Zest is to assist with docker-driven workflow in both a local dev environment an

## Requirements
Zest requires `zest`, `_zester`, `docker`, and `docker-compose` (v1.12 or newer, see below)
to be installed in your PATH. The Docker daemon must be running.
to be installed in your PATH. The Docker daemon must be running.

You must have docker-compose >= 1.12 installed. It is included in Docker for Mac edge since 17.04.
The latest version of Docker for Mac stable (17.03) does not yet bundle this version.
Either use https://github.com/axiomzen/zest/commit/d6afabaa7100b56b326abab55fa11c4e4b71c4b1
or [update docker-compose](https://docs.docker.com/compose/install/).
The latest version of Docker for Mac stable (17.03) does not yet bundle this version.
Either use https://github.com/axiomzen/zest/commit/d6afabaa7100b56b326abab55fa11c4e4b71c4b1
or [update docker-compose](https://docs.docker.com/compose/install/).

## Installation
To install things system wide use `sudo make install`, which will attempt to copy the binaries and relevant configs into `/usr/local` as well as the users `~/.zest` directories.
Expand Down Expand Up @@ -50,7 +50,7 @@ Command | Result
--------|--------
init-project | Creates the prerequisite files for the current directory to be a zestable project
integrate | Run integration tests on a project
run | Start the environment with docker-compose
run | Start the environment with docker-compose. Use flag `-s` or `--service SERVICENAME` to run an individual service along with its dependencies
stop | clean up the docker-compose environment
all | build, test, bundle all folders in the pwd that are services, then integrate

Expand Down
3 changes: 2 additions & 1 deletion example/Peelfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ run: example
integrate: integrater
project: example
compose: docker-compose.yml
compose-integrate: docker-compose.integrate.yml
compose-integrate: docker-compose.integrate.yml
compose-development: docker-compose.dev.yml
15 changes: 10 additions & 5 deletions zest
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ _zest_run() {
_fatal "Not a zest project"
fi

RUN_SERVICE=`grep -E -i "^run: " Peelfile | awk '{print $2}'`
RUN_SERVICE="${SERVICE_ARG:-`grep -E -i "^run: " Peelfile | awk '{print $2}'`}"

if [[ "$RUN_SERVICE" == "" ]]; then
_fatal "run: not specified in Peelfile"
fi
_fatal "run: not specified in Peelfile nor in --service"
fi

_info "Running service $RUN_SERVICE"

Expand All @@ -174,7 +174,7 @@ _zest_stop() {
fi

_info "Stopping project"

docker-compose -f $COMPOSE_FILE $DOCKER_VERBOSE down --rmi local
}

Expand Down Expand Up @@ -437,7 +437,7 @@ _zest_test() {
SERVICE_NAME=$SERVICE
_debug "SERVICE_NAME not set, using $SERVICE"
fi

# Build in the container
_info "Testing service $SERVICE in $TEST_CONTAINER"
docker run --rm -v $(pwd):$MOUNT_DIR/$SERVICE -w $MOUNT_DIR/$SERVICE -v $ZESTER_PATH:/usr/bin/zester:ro $(_zest_cache_volumes) $TEST_CONTAINER zester test --name $SERVICE_NAME
Expand Down Expand Up @@ -716,6 +716,7 @@ DEFAULT_VERSION=true
BUILD_ARGS=
DOCKER_VERBOSE=
GO_VERBOSE=
SERVICE_ARG=

while [[ $# -gt 0 ]]; do
case $1 in
Expand All @@ -730,6 +731,10 @@ while [[ $# -gt 0 ]]; do
-b|--build-args)
shift && BUILD_ARGS="$1"
;;
-s|--service)
shift && SERVICE_ARG="$1"
;;

esac
shift
done
Expand Down