-
Notifications
You must be signed in to change notification settings - Fork 11
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 #10 from GRIDAPPSD/releases/2019.03.0
2019.03.0 release
- Loading branch information
Showing
4 changed files
with
152 additions
and
0 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,15 @@ | ||
# make use of vm's | ||
sudo: 'required' | ||
|
||
# have the docker service set up (we'll | ||
# update it later) | ||
services: | ||
- 'docker' | ||
|
||
# prepare the machine before any code | ||
# installation scripts | ||
before_install: | ||
- './.travis/main.sh' | ||
|
||
script: | ||
- './.travis/build-docker.sh' |
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,70 @@ | ||
#!/bin/bash | ||
|
||
TAG="${TRAVIS_BRANCH//\//_}" | ||
|
||
ORG=`echo $DOCKER_PROJECT | tr '[:upper:]' '[:lower:]'` | ||
ORG="${ORG:+${ORG}/}" | ||
IMAGE="${ORG}sample_app" | ||
TIMESTAMP=`date +'%y%m%d%H'` | ||
GITHASH=`git log -1 --pretty=format:"%h"` | ||
|
||
BUILD_VERSION="${TIMESTAMP}_${GITHASH}${TRAVIS_BRANCH:+:$TRAVIS_BRANCH}" | ||
echo "BUILD_VERSION $BUILD_VERSION" | ||
|
||
# Pass gridappsd tag to docker-compose | ||
docker build --build-arg TIMESTAMP="${BUILD_VERSION}" -t ${IMAGE}:${TIMESTAMP}_${GITHASH} . | ||
status=$? | ||
if [ $status -ne 0 ]; then | ||
echo "Error: status $status" | ||
exit 1 | ||
fi | ||
|
||
# To have `DOCKER_USERNAME` and `DOCKER_PASSWORD` | ||
# filled you need to either use `travis`' cli | ||
# (https://github.com/travis-ci/travis.rb) | ||
# and then `travis set ..` or go to the travis | ||
# page of your repository and then change the | ||
# environment in the settings pannel. | ||
|
||
if [ -n "$DOCKER_USERNAME" -a -n "$DOCKER_PASSWORD" ]; then | ||
|
||
echo " " | ||
echo "Connecting to docker" | ||
|
||
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin | ||
status=$? | ||
if [ $status -ne 0 ]; then | ||
echo "Error: status $status" | ||
exit 1 | ||
fi | ||
|
||
if [ -n "$TAG" -a -n "$ORG" ]; then | ||
# Get the built container name | ||
CONTAINER=`docker images --format "{{.Repository}}:{{.Tag}}" ${IMAGE}` | ||
|
||
echo "docker push ${CONTAINER}" | ||
docker push "${CONTAINER}" | ||
status=$? | ||
if [ $status -ne 0 ]; then | ||
echo "Error: status $status" | ||
exit 1 | ||
fi | ||
|
||
echo "docker tag ${CONTAINER} ${IMAGE}:$TAG" | ||
docker tag ${CONTAINER} ${IMAGE}:$TAG | ||
status=$? | ||
if [ $status -ne 0 ]; then | ||
echo "Error: status $status" | ||
exit 1 | ||
fi | ||
|
||
echo "docker push ${IMAGE}:$TAG" | ||
docker push ${IMAGE}:$TAG | ||
status=$? | ||
if [ $status -ne 0 ]; then | ||
echo "Error: status $status" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
fi |
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,62 @@ | ||
#!/bin/bash | ||
|
||
# Set an option to exit immediately if any error appears | ||
set -o errexit | ||
|
||
# Main function that describes the behavior of the | ||
# script. | ||
# By making it a function we can place our methods | ||
# below and have the main execution described in a | ||
# concise way via function invocations. | ||
main() { | ||
setup_dependencies | ||
update_docker_configuration | ||
|
||
echo "SUCCESS: | ||
Done! Finished setting up Travis machine. | ||
" | ||
} | ||
|
||
# Prepare the dependencies that the machine need. | ||
# Here I'm just updating the apt references and then | ||
# installing both python and python-pip. This allows | ||
# us to make use of `pip` to fetch the latest `docker-compose` | ||
# later. | ||
# We also upgrade `docker-ce` so that we can get the | ||
# latest docker version which allows us to perform | ||
# image squashing as well as multi-stage builds. | ||
setup_dependencies() { | ||
echo "INFO: | ||
Setting up dependencies. | ||
" | ||
|
||
sudo apt update -y | ||
sudo apt install realpath -y | ||
#python python-pip -y | ||
sudo apt install --only-upgrade docker-ce -y | ||
|
||
sudo pip install docker-compose || true | ||
|
||
docker info | ||
docker-compose --version | ||
} | ||
|
||
# Tweak the daemon configuration so that we | ||
# can make use of experimental features (like image | ||
# squashing) as well as have a bigger amount of | ||
# concurrent downloads and uploads. | ||
update_docker_configuration() { | ||
echo "INFO: | ||
Updating docker configuration | ||
" | ||
|
||
echo '{ | ||
"experimental": true, | ||
"storage-driver": "overlay2", | ||
"max-concurrent-downloads": 50, | ||
"max-concurrent-uploads": 50 | ||
}' | sudo tee /etc/docker/daemon.json | ||
sudo service docker restart | ||
} | ||
|
||
main |
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