-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Chris Hupman <[email protected]>
- Loading branch information
Chris Hupman
committed
Mar 6, 2019
1 parent
88a059b
commit c50d0f0
Showing
2 changed files
with
58 additions
and
20 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 |
---|---|---|
@@ -1,26 +1,35 @@ | ||
language: python | ||
|
||
python: | ||
- "2.7" | ||
|
||
# Install terraform | ||
before_install: | ||
- curl -sLo terraform.zip https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip | ||
- curl -sLo ibm.zip https://github.com/IBM-Cloud/terraform-provider-ibm/releases/download/v0.14.1/linux_amd64.zip | ||
- mkdir bin | ||
- mkdir -p ~/.terraform.d/plugins/ | ||
- unzip terraform.zip -d bin | ||
- unzip ibm.zip -d ~/.terraform.d/plugins/ | ||
- export PATH="${PATH}:$(pwd)/bin" | ||
- touch ~/.ssh/id_rsa | ||
- touch ~/.ssh/id_rsa.pub | ||
matrix: | ||
include: | ||
- name: "Ansible Tests" | ||
python: "2.7" | ||
env: TEST_TYPE="ansible" | ||
- name: "Terraform Tests" | ||
python: "2.7" | ||
env: TEST_TYPE="terraform" | ||
|
||
install: | ||
- pip install -r requirements.txt | ||
- cd reference_cluster | ||
- terraform init | ||
- cd ../ | ||
- if [ "${TEST_TYPE}" == "ansible" ]; then | ||
echo "Install Ansible requirements"; | ||
pip install -r requirements.txt; | ||
elif [ "${TEST_TYPE}" == "terraform" ]; then | ||
echo "Setting up Terraform and IBM provider"; | ||
./setup_terraform.sh ci; | ||
else | ||
echo "TEST_TYPE is not set. Please check your matrix settings in .travis.yml"; | ||
fi | ||
|
||
script: | ||
- ansible-lint reference_cluster/ansible/playbook.yml | ||
- cd reference_cluster; terraform validate -check-variables=true; | ||
- if [ "${TEST_TYPE}" == "ansible" ]; then | ||
echo "Running Ansible linting"; | ||
ansible-lint reference_cluster/ansible/playbook.yml; | ||
elif [ "${TEST_TYPE}" == "terraform" ]; then | ||
export PATH="${PATH}:$(pwd)/bin"; | ||
echo "Running Terraform validation"; | ||
cd reference_cluster; | ||
terraform init; | ||
terraform validate -check-variables=true; | ||
else | ||
echo "TEST_TYPE is not set. Please check your matrix settings in .travis.yml"; | ||
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,29 @@ | ||
#!/bin/bash | ||
|
||
echo "Creating the Terraform plugins directory in ~/.terraform.d/plugins/ so Terraform can find the IBM provider" | ||
mkdir -p ~/.terraform.d/plugins/ | ||
|
||
# This is for the Terraform validation done in Travis CI which expects these files to exist. | ||
if [[ "$@" == "ci" ]]; then | ||
touch ~/.ssh/id_rsa | ||
touch ~/.ssh/id_rsa.pub | ||
|
||
echo "Downloading Terraform and the IBM Terraform provider" | ||
curl -sLo terraform.zip https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip | ||
curl -sLo ibm-tf-provider.zip https://github.com/IBM-Cloud/terraform-provider-ibm/releases/download/v0.14.1/linux_amd64.zip | ||
|
||
echo "Unzipping the Terraform and IBM provider binaries into their appropriate directories." | ||
mkdir bin | ||
unzip terraform.zip -d bin | ||
unzip ibm-tf-provider.zip -d ~/.terraform.d/plugins/ | ||
else | ||
echo "Downloading Terraform and the IBM Terraform provider" | ||
curl -sLo /tmp/terraform.zip https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip | ||
curl -sLo /tmp/ibm-tf-provider.zip https://github.com/IBM-Cloud/terraform-provider-ibm/releases/download/v0.14.1/linux_amd64.zip | ||
|
||
echo "Unzipping the Terraform binary to /usr/local/bin/ and the IBM provider binary to ~/.terraform.d/plugins/" | ||
unzip /tmp/terraform.zip -d /usr/local/bin/ | ||
unzip /tmp/ibm-tf-provider.zip -d ~/.terraform.d/plugins/ | ||
fi | ||
|
||
echo "Setup complete. Run 'terraform init' in your Terraform directory to initialize the IBM provider" |