Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.

Update CI #33

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
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
language: bash
script: true
sudo: required
before_install:
- bash scripts/install.sh
install:
- "./scripts/install.sh"
- "./scripts/bx_auth.sh"
group: stable
dist: precise
os: linux
Expand Down
24 changes: 24 additions & 0 deletions scripts/bx_auth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash -e

# This script is intended to be run by Travis CI. If running elsewhere, invoke
# it with: TRAVIS_PULL_REQUEST=false [path to script]
# If no credentials are provided at runtime, bx will use the environment
# variable BLUEMIX_API_KEY. If no API key is set, it will prompt for
# credentials.

# shellcheck disable=SC1090
source "$(dirname "$0")"/../scripts/resources.sh

BLUEMIX_ORG="Developer Advocacy"
BLUEMIX_SPACE="dev"

is_pull_request "$0"

echo "Authenticating to Bluemix"
bx login -a https://api.ng.bluemix.net

echo "Targeting Bluemix org and space"
bx target -o "$BLUEMIX_ORG" -s "$BLUEMIX_SPACE"

echo "Initializing Bluemix Container Service"
bx cs init
7 changes: 2 additions & 5 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ tar -xvf Bluemix_CLI.tar.gz
sudo ./Bluemix_CLI/install_bluemix_cli
}

function bluemix_auth() {
echo "Authenticating with Bluemix"
echo "1" | bx login -a https://api.ng.bluemix.net --apikey $BLUEMIX_AUTH
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
function install_kubectl() {
bx plugin install container-service -r Bluemix
echo "Installing kubectl"
chmod +x ./kubectl
Expand Down Expand Up @@ -186,7 +183,7 @@ done


install_bluemix_cli
bluemix_auth
install_kubectl
cluster_setup
initial_setup
create_platform_services
Expand Down
20 changes: 20 additions & 0 deletions scripts/resources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# This script contains functions used by many of the scripts found in scripts/
# and tests/.

test_failed(){
echo -e >&2 "\033[0;31m$1 test failed!\033[0m"
exit 1
}

test_passed(){
echo -e "\033[0;32m$1 test passed!\033[0m"
}

is_pull_request(){
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
echo -e "\033[0;33mPull Request detected; not running $1!\033[0m"
exit 0
fi
}