Skip to content
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

Add new travis job for prebuilt images #111

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
26 changes: 6 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,12 @@ before_script:
# install aws CLI
- (sudo pip install -q awscli; which aws > /dev/null) &

script:
# fail fast
- set -e
- export MAKE_ARGS=--no-print-directory
# Open SSH
# - echo travis:$sshpassword | sudo chpasswd
# - sudo sed -i 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config
# - sudo service ssh restart
# - sudo apt-get install sshpass
# - sshpass -p $sshpassword ssh -R 9999:localhost:22 -o StrictHostKeyChecking=no travis@$bouncehostip
# compile and build Docker images
- glide -q install
- make $MAKE_ARGS docker-build-base
- make $MAKE_ARGS gen-certs
- make $MAKE_ARGS build
- make $MAKE_ARGS docker-build
# deploy services
- make $MAKE_ARGS deploy
# submit a test job
- make $MAKE_ARGS test-submit-minikube-ci
jobs:
include:
- stage: test
script: ./bin/travis_scripts/test-local-built-images.sh
- if: type IN (push, api, cron)
script: ./bin/travis_scripts/test-prebuilt-images.sh

notifications:
email: false
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ PUBLIC_IP ?= 127.0.0.1
CI_MINIKUBE_VERSION ?= v0.25.1
CI_KUBECTL_VERSION ?= v1.9.4

TRAVIS_IMAGE_VERSION ?= v0.1
TEST_IMAGES = $(addprefix $(DOCKER_NAMESPACE)/, $(TEST_IMAGES_SUFFIX))
TEST_IMAGES_SUFFIX = ffdl-lcm ffdl-trainer ffdl-metrics ffdl-databroker_s3 ffdl-ui ffdl-restapi ffdl-jobmonitor ffdl-controller log_collector ffdl-databroker_objectstorage tensorboard_extract

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be pulled from a config file? Makes it easier to extend.....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can put these into a config file.


AWS_ACCESS_KEY_ID ?= test
AWS_SECRET_ACCESS_KEY ?= test

Expand Down Expand Up @@ -617,6 +621,17 @@ test-s3:
echo "s3cmd=$$s3cmd"; \
$$s3cmd ls

pull-prebuilt-images: ## Pull FfDL images from dockerhub
pull-prebuilt-images: $(addprefix pull-, $(TEST_IMAGES))

$(addprefix pull-, $(TEST_IMAGES)): pull-%: %
@TRAVIS_IMAGE=$< make .pull-prebuilt-images

$(TEST_IMAGES): ; # Make targets

.pull-prebuilt-images:
docker pull $(TRAVIS_IMAGE):$(TRAVIS_IMAGE_VERSION)


.build-service:
(cd ./$(SERVICE_NAME)/ && (test ! -e main.go || CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o bin/$(BINARY_NAME)))
Expand Down
20 changes: 20 additions & 0 deletions bin/travis_scripts/test-local-built-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# fail fast
set -e
export MAKE_ARGS=--no-print-directory
# Open SSH
# - echo travis:$sshpassword | sudo chpasswd
# - sudo sed -i 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config
# - sudo service ssh restart
# - sudo apt-get install sshpass
# - sshpass -p $sshpassword ssh -R 9999:localhost:22 -o StrictHostKeyChecking=no travis@$bouncehostip
# compile and build Docker images
glide -q install
make $MAKE_ARGS docker-build-base
make $MAKE_ARGS gen-certs
make $MAKE_ARGS build
make $MAKE_ARGS docker-build
# deploy services
make $MAKE_ARGS deploy
# submit a test job
make $MAKE_ARGS test-submit-minikube-ci

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that test environment is still minikube - what all we are not able to test here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory we could, but putting everything into one single job will take longer time to finish. Also, it's easier to debug the 2 different environment if we run them in parallel.

11 changes: 11 additions & 0 deletions bin/travis_scripts/test-prebuilt-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# fail fast
set -e
export MAKE_ARGS=--no-print-directory
# get pre-built images
make $MAKE_ARGS pull-prebuilt-images
export IMAGE_TAG=$TRAVIS_IMAGE_VERSION
# deploy services
make $MAKE_ARGS deploy
# submit a test job
make $MAKE_ARGS test-submit-minikube-ci