forked from Azure/terraform-azurerm-loadbalancer
-
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.
Enable Rake workflow for loadbalancer module (Azure#8)
* Enable Rake workflow for loadbalancer module * Added newlines per PR comments * Removed the unused TERRAFORM_VERSION variable * Added terraform runtime version support to docker image * Fixed build-arg typo
- Loading branch information
Showing
6 changed files
with
153 additions
and
11 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
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,15 +1,24 @@ | ||
sudo: true | ||
dist: trusty | ||
# Build matrix / environment variable are explained on: | ||
# http://about.travis-ci.org/docs/user/build-configuration/ | ||
# This file can be validated on: | ||
# http://lint.travis-ci.org/ | ||
sudo: required | ||
|
||
language: ruby | ||
|
||
rvm: | ||
- 2.3 | ||
|
||
services: | ||
- docker | ||
|
||
env: | ||
- TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-loadbalancer-module | ||
|
||
jobs: | ||
include: | ||
- stage: rake build | ||
install: true | ||
script: | ||
- docker run -v $PWD:/tf-test/module --rm microsoft/terraform-test rake -f ../Rakefile build | ||
- docker build --build-arg BUILD_TERRAFORM_VERSION=${TERRAFORM_VERSION} -t ${IMAGE_NAME} . | ||
- docker run ${IMAGE_NAME} rake build |
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,27 @@ | ||
# Pull the base image with passed terraform runtime version | ||
ARG BUILD_TERRAFORM_VERSION="0.11.1" | ||
FROM microsoft/terraform-test:${BUILD_TERRAFORM_VERSION} | ||
|
||
ARG MODULE_NAME="terraform-azurerm-loadbalancer" | ||
|
||
# Declare default environment variable values for terraform runtime. | ||
ARG BUILD_ARM_SUBSCRIPTION_ID="" | ||
ARG BUILD_ARM_CLIENT_ID="" | ||
ARG BUILD_ARM_CLIENT_SECRET="" | ||
ARG BUILD_ARM_TENANT_ID="" | ||
ARG BUILD_ARM_TEST_LOCATION="WestEurope" | ||
ARG BUILD_ARM_TEST_LOCATION_ALT="WestUS" | ||
|
||
# Set environment variables for terraform runtime. | ||
ENV ARM_SUBSCRIPTION_ID=${BUILD_ARM_SUBSCRIPTION_ID} | ||
ENV ARM_CLIENT_ID=${BUILD_ARM_CLIENT_ID} | ||
ENV ARM_CLIENT_SECRET=${BUILD_ARM_CLIENT_SECRET} | ||
ENV ARM_TENANT_ID=${BUILD_ARM_TENANT_ID} | ||
ENV ARM_TEST_LOCATION=${BUILD_ARM_TEST_LOCATION} | ||
ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT} | ||
|
||
RUN mkdir /usr/src/${MODULE_NAME} | ||
COPY . /usr/src/${MODULE_NAME} | ||
|
||
WORKDIR /usr/src/${MODULE_NAME} | ||
RUN ["bundle", "install", "--gemfile", "./Gemfile"] |
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,11 @@ | ||
ruby "~> 2.3.0" | ||
|
||
source 'https://rubygems.org/' | ||
|
||
group :test do | ||
git 'https://github.com/Azure/terramodtest.git' do | ||
gem 'terramodtest', :tag => 'v0.1.0' | ||
end | ||
gem 'test-kitchen', '1.16.0' | ||
gem 'kitchen-terraform', '3.0.0' | ||
end |
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
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,40 @@ | ||
# Official gems. | ||
require 'colorize' | ||
require 'rspec/core/rake_task' | ||
|
||
# Git repo gems. | ||
require 'bundler/setup' | ||
require 'terramodtest' | ||
|
||
namespace :presteps do | ||
task :clean_up do | ||
clean_up_kitchen | ||
clean_up_terraform | ||
end | ||
end | ||
|
||
namespace :static do | ||
task :style do | ||
style_tf | ||
end | ||
task :lint do | ||
lint_tf | ||
end | ||
task :format do | ||
format_tf | ||
end | ||
end | ||
|
||
task :prereqs => [ 'presteps:clean_up' ] | ||
|
||
task :validate => [ 'static:style', 'static:lint' ] | ||
|
||
task :format => [ 'static:format' ] | ||
|
||
task :build => [ 'prereqs', 'validate' ] | ||
|
||
task :unit => [] | ||
|
||
task :default => [ 'build' ] | ||
|
||
task :full => [ 'build'] |