-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from josegonzalez/master
Upgrade to support 0.4.x
- Loading branch information
Showing
7 changed files
with
144 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
root = true | ||
|
||
[*] | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[Makefile] | ||
insert_final_newline = true | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.mk] | ||
insert_final_newline = true | ||
indent_style = tab | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sudo: required | ||
language: bash | ||
env: | ||
- DOKKU_VERSION=master | ||
before_install: make setup | ||
script: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright (C) 2015 AGCO | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
shellcheck: | ||
ifeq ($(shell shellcheck > /dev/null 2>&1 ; echo $$?),127) | ||
ifeq ($(shell uname),Darwin) | ||
brew install shellcheck | ||
else | ||
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse' | ||
sudo apt-get update -qq && sudo apt-get install -qq -y shellcheck | ||
endif | ||
endif | ||
|
||
bats: | ||
ifeq ($(shell bats > /dev/null 2>&1 ; echo $$?),127) | ||
ifeq ($(shell uname),Darwin) | ||
brew install shellcheck | ||
else | ||
sudo add-apt-repository ppa:duggan/bats --yes | ||
sudo apt-get update -qq && sudo apt-get install -qq -y bats | ||
endif | ||
endif | ||
|
||
ci-dependencies: shellcheck bats | ||
|
||
lint: | ||
# these are disabled due to their expansive existence in the codebase. we should clean it up though | ||
# SC2046: Quote this to prevent word splitting. - https://github.com/koalaman/shellcheck/wiki/SC2046 | ||
# SC2068: Double quote array expansions, otherwise they're like $* and break on spaces. - https://github.com/koalaman/shellcheck/wiki/SC2068 | ||
# SC2086: Double quote to prevent globbing and word splitting - https://github.com/koalaman/shellcheck/wiki/SC2086 | ||
@echo linting... | ||
@$(QUIET) find ./ -maxdepth 1 -not -path '*/\.*' | xargs file | egrep "shell|bash" | awk '{ print $$1 }' | sed 's/://g' | xargs shellcheck -e SC2046,SC2068,SC2086 | ||
|
||
setup: | ||
$(MAKE) ci-dependencies | ||
|
||
test: setup lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,56 @@ | ||
#!/bin/bash | ||
#set -e; | ||
#!/usr/bin/env bash | ||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x | ||
|
||
case "$1" in | ||
|
||
registry:login) | ||
shift | ||
echo "$@" | ||
docker login "$@" | ||
;; | ||
shift | ||
echo "$@" | ||
docker login "$@" | ||
;; | ||
|
||
registry:push) | ||
mkdir -p /home/dokku/checkout | ||
cd /home/dokku/checkout | ||
UUID=$(uuidgen) | ||
git clone "$2" "$UUID" | ||
cd "$UUID" | ||
dokku apps:create "$UUID" | ||
DOCKERFILE=$(ls -l | grep Dockerfile | wc -l ) | ||
if [ $((DOCKERFILE)) -eq 1 ]; then | ||
IMAGE_TYPE="dockerfile" | ||
else | ||
IMAGE_TYPE="herokuish" | ||
fi | ||
tar c . | dokku build "$UUID" "$IMAGE_TYPE" | ||
docker tag "dokku/$UUID" "$3" | ||
docker push "$3" | ||
dokku delete "$UUID" | ||
rm -rf /home/dokku/checkout/"$UUID" | ||
;; | ||
mkdir -p /home/dokku/checkout | ||
cd /home/dokku/checkout | ||
UUID=$(uuidgen) | ||
git clone "$2" "$UUID" | ||
cd "$UUID" | ||
dokku apps:create "$UUID" | ||
if [[ -f "$UUID/Dockerfile" ]]; then | ||
IMAGE_TYPE="dockerfile" | ||
else | ||
IMAGE_TYPE="herokuish" | ||
fi | ||
tar c . | dokku build "$UUID" "$IMAGE_TYPE" | ||
docker tag "dokku/$UUID" "$3" | ||
docker push "$3" | ||
dokku delete "$UUID" | ||
rm -rf /home/dokku/checkout/"$UUID" | ||
;; | ||
|
||
registry:pull) | ||
APP=$2 | ||
DOCKER_REGISTRY_IMAGE=$3 | ||
mkdir -p "$DOKKU_ROOT/$APP" | ||
docker pull $DOCKER_REGISTRY_IMAGE | ||
docker tag $DOCKER_REGISTRY_IMAGE "dokku/$APP" | ||
dokku release $APP | ||
dokku deploy $APP | ||
;; | ||
|
||
help) | ||
APP=$2; DOCKER_REGISTRY_IMAGE=$3 | ||
mkdir -p "$DOKKU_ROOT/$APP" | ||
docker pull "$DOCKER_REGISTRY_IMAGE" | ||
docker tag "$DOCKER_REGISTRY_IMAGE" "dokku/$APP" | ||
dokku release "$APP" | ||
dokku deploy "$APP" | ||
;; | ||
|
||
cat && cat<<EOF | ||
registry:login <docker login args> Login to a docker registry | ||
registry:push <git_url> <docker_registry_image> Clone a git url, exec buildstep and push the resulting Docker image to the logged on registry | ||
registry:pull <app> <docker_registry_image> Pull a Docker image (produced with buildstep) from the logged on registry and deploy | ||
help | registry:help) | ||
HELP=$(cat<<EOF | ||
registry:login <docker login args>, Login to a docker registry | ||
registry:push <git_url> <docker_registry_image>, Clone a git url, exec buildstep and push the resulting Docker image to the logged on registry | ||
registry:pull <app> <docker_registry_image>, Pull a Docker image (produced with buildstep) from the logged on registry and deploy | ||
EOF | ||
) | ||
if [[ -n $DOKKU_API_VERSION ]]; then | ||
echo "$HELP" | ||
else | ||
cat && echo "$HELP" | ||
fi | ||
;; | ||
|
||
*) | ||
exit $DOKKU_NOT_IMPLEMENTED_EXIT | ||
;; | ||
esac | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[plugin] | ||
description = "manage dokku application releases similar to heroku's pipeline" | ||
version = "1.0.0" | ||
[plugin.config] |