From 85fb5dd63a9daf91d61738c7d2baedfd780dbfbc Mon Sep 17 00:00:00 2001 From: Tung Nguyen Date: Tue, 22 Feb 2022 18:19:37 +0000 Subject: [PATCH] add codebuild project with acceptance test for terraspace all * also add codebuild project to the terraspace pipeline --- .cody/all/bin/build.sh | 33 +++++++++++++++++++++++++++++++++ .cody/all/buildspec.yml | 10 ++++++++++ .cody/all/project.rb | 2 ++ .cody/all/role.rb | 6 ++++++ .pipedream/pipeline.rb | 1 + 5 files changed, 52 insertions(+) create mode 100755 .cody/all/bin/build.sh create mode 100644 .cody/all/buildspec.yml create mode 100644 .cody/all/project.rb create mode 100644 .cody/all/role.rb diff --git a/.cody/all/bin/build.sh b/.cody/all/bin/build.sh new file mode 100755 index 00000000..36f426d8 --- /dev/null +++ b/.cody/all/bin/build.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -eu + +# will build from /tmp because terraspace/Gemfile may interfere +cd /tmp + +export PATH=~/bin:$PATH # ~/bin/terraspace wrapper + +set -x + +git clone https://github.com/boltops-tools/terraspace-graph-demo +cd terraspace-graph-demo + +# Rewrite the Gemfile to use the local terraspace gem for testing +cat << EOF > Gemfile +source "https://rubygems.org" +gem "terraspace", path: "$CODEBUILD_SRC_DIR", submodules: true +gem "rspec-terraspace", git: "https://github.com/boltops-tools/rspec-terraspace", branch: "master" +gem "terraspace_plugin_aws", git: "https://github.com/boltops-tools/terraspace_plugin_aws", branch: "master" +EOF +bundle + +# Uncomment to enable logger level debug +# cat << EOF > config/app.rb +# Terraspace.configure do |config| +# config.logger.level = :debug +# end +# EOF + +terraspace all up -y +terraspace clean all -y +terraspace all down -y diff --git a/.cody/all/buildspec.yml b/.cody/all/buildspec.yml new file mode 100644 index 00000000..755cca6e --- /dev/null +++ b/.cody/all/buildspec.yml @@ -0,0 +1,10 @@ +version: 0.2 + +phases: + install: + runtime-versions: + ruby: latest + build: + commands: + - .cody/shared/script/install.sh + - .cody/all/bin/build.sh diff --git a/.cody/all/project.rb b/.cody/all/project.rb new file mode 100644 index 00000000..6ba07cef --- /dev/null +++ b/.cody/all/project.rb @@ -0,0 +1,2 @@ +github_url("https://github.com/boltops-tools/terraspace.git") +linux_image("aws/codebuild/amazonlinux2-x86_64-standard:3.0") diff --git a/.cody/all/role.rb b/.cody/all/role.rb new file mode 100644 index 00000000..48a7d291 --- /dev/null +++ b/.cody/all/role.rb @@ -0,0 +1,6 @@ +iam_policy( + "dynamodb", + "logs", + "s3", + "ssm", +) diff --git a/.pipedream/pipeline.rb b/.pipedream/pipeline.rb index 396213c8..e8c583c7 100644 --- a/.pipedream/pipeline.rb +++ b/.pipedream/pipeline.rb @@ -9,6 +9,7 @@ stage "Build" do # in parallel codebuild( + "terraspace-all", "terraspace-aws", "terraspace-azurerm", "terraspace-google",