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

Commit 80e81ea

Browse files
committed
Update CI
Add files and bluemix auth to bring repository up to date with current CI for our org
1 parent cb7ec95 commit 80e81ea

File tree

4 files changed

+49
-7
lines changed

4 files changed

+49
-7
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
language: bash
22
script: true
33
sudo: required
4-
before_install:
5-
- bash scripts/install.sh
4+
install:
5+
- "./scripts/install.sh"
6+
- "./scripts/bx_auth.sh"
67
group: stable
78
dist: precise
89
os: linux

scripts/bx_auth.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash -e
2+
3+
# This script is intended to be run by Travis CI. If running elsewhere, invoke
4+
# it with: TRAVIS_PULL_REQUEST=false [path to script]
5+
# If no credentials are provided at runtime, bx will use the environment
6+
# variable BLUEMIX_API_KEY. If no API key is set, it will prompt for
7+
# credentials.
8+
9+
# shellcheck disable=SC1090
10+
source "$(dirname "$0")"/../scripts/resources.sh
11+
12+
BLUEMIX_ORG="Developer Advocacy"
13+
BLUEMIX_SPACE="dev"
14+
15+
is_pull_request "$0"
16+
17+
echo "Authenticating to Bluemix"
18+
bx login -a https://api.ng.bluemix.net
19+
20+
echo "Targeting Bluemix org and space"
21+
bx target -o "$BLUEMIX_ORG" -s "$BLUEMIX_SPACE"
22+
23+
echo "Initializing Bluemix Container Service"
24+
bx cs init

scripts/install.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ tar -xvf Bluemix_CLI.tar.gz
1212
sudo ./Bluemix_CLI/install_bluemix_cli
1313
}
1414

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

187184

188185
install_bluemix_cli
189-
bluemix_auth
186+
install_kubectl
190187
cluster_setup
191188
initial_setup
192189
create_platform_services

scripts/resources.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# This script contains functions used by many of the scripts found in scripts/
4+
# and tests/.
5+
6+
test_failed(){
7+
echo -e >&2 "\033[0;31m$1 test failed!\033[0m"
8+
exit 1
9+
}
10+
11+
test_passed(){
12+
echo -e "\033[0;32m$1 test passed!\033[0m"
13+
}
14+
15+
is_pull_request(){
16+
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
17+
echo -e "\033[0;33mPull Request detected; not running $1!\033[0m"
18+
exit 0
19+
fi
20+
}

0 commit comments

Comments
 (0)