-
-
Notifications
You must be signed in to change notification settings - Fork 167
Add codefresh #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add codefresh #57
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7e4502d
Add tests
osterman 90312e5
Update README
osterman d70c5d9
delete .tf files from go imports
osterman 541c8c3
bump
osterman 22f84a8
do not test concurrent plan/apply/destroy
osterman 78405a7
Pass providers explicitly
osterman 2544c81
fmt
osterman 32fdc81
add wait step
osterman 13703d3
fix syntax
osterman 0200344
remove echo
osterman 840c3d0
remove comment
osterman d2d0d23
update pipeline name
osterman d74caf0
use variables
osterman ffaca23
fix test
osterman 0d02b26
fix test
osterman 72ae0a8
better wait
osterman 82ba646
better wait
osterman 7944ed2
better wait
osterman d557c7c
better wait
osterman eec3b12
drop comments
osterman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,73 @@ | ||
| version: '1.0' | ||
|
|
||
| stages: | ||
| - Prepare | ||
| - Test | ||
|
|
||
| steps: | ||
| wait: | ||
| title: Wait | ||
| stage: Prepare | ||
| image: codefresh/cli:latest | ||
| commands: | ||
| - codefresh get builds --pipeline=${{CF_REPO_NAME}} --status running --limit 1000 -o json | jq --arg id ${{CF_BUILD_ID}} -ser 'flatten|.[-1].id==$id' | ||
| retry: | ||
| maxAttempts: 10 | ||
| delay: 20 | ||
| exponentialFactor: 1.1 | ||
|
|
||
| main_clone: | ||
| title: "Clone repository" | ||
| type: git-clone | ||
| stage: Prepare | ||
| description: "Initialize" | ||
| repo: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}} | ||
| git: CF-default | ||
| revision: ${{CF_REVISION}} | ||
|
|
||
| clean_init: | ||
| title: Prepare build-harness and test-harness | ||
| image: ${{TEST_IMAGE}} | ||
| stage: Prepare | ||
| commands: | ||
| - cf_export PATH="/usr/local/terraform/0.11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
| - make init | ||
| - git -C build-harness checkout master | ||
| - make -C test/ clean init TEST_HARNESS_BRANCH=master | ||
| - make -C test/src clean init | ||
| - find test/src -name '*.tf' -delete | ||
|
|
||
| test: | ||
| type: "parallel" | ||
| title: "Run tests" | ||
| description: "Run all tests in parallel" | ||
| stage: Test | ||
| steps: | ||
| test_readme_lint: | ||
| title: "Test README.md updated" | ||
| stage: "Test" | ||
| image: ${{TEST_IMAGE}} | ||
| description: Test "readme/lint" | ||
| commands: | ||
| - make readme/lint | ||
|
|
||
| test_module: | ||
| title: Test module with bats | ||
| image: ${{TEST_IMAGE}} | ||
| stage: Test | ||
| commands: | ||
| - make -C test/ module | ||
|
|
||
| test_examples_complete: | ||
| title: Test "examples/complete" with bats | ||
| image: ${{TEST_IMAGE}} | ||
| stage: Test | ||
| commands: | ||
| - make -C test/ examples/complete | ||
|
|
||
| test_examples_complete_terratest: | ||
| title: Test "examples/complete" with terratest | ||
| image: ${{TEST_IMAGE}} | ||
| stage: Test | ||
| commands: | ||
| - make -C test/src |
This file contains hidden or 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 hidden or 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 @@ | ||
| max_availability_zones = 2 | ||
|
|
||
| region = "us-west-1" | ||
|
|
||
| availability_zones = ["us-west-1b", "us-west-1c"] | ||
|
|
||
| namespace = "eg" | ||
|
|
||
| name = "vpc" | ||
|
|
||
| stage = "test" |
This file contains hidden or 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 @@ | ||
| module "vpc" { | ||
| source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.3.4" | ||
|
|
||
| providers = { | ||
| aws = "aws" | ||
| } | ||
|
|
||
| namespace = "${var.namespace}" | ||
| stage = "${var.stage}" | ||
| name = "${var.name}" | ||
| cidr_block = "172.16.0.0/16" | ||
| } | ||
|
|
||
| module "subnets" { | ||
| source = "../../" | ||
|
|
||
| providers = { | ||
| aws = "aws" | ||
| } | ||
|
|
||
| availability_zones = "${var.availability_zones}" | ||
| namespace = "${var.namespace}" | ||
| stage = "${var.stage}" | ||
| name = "${var.name}" | ||
| vpc_id = "${module.vpc.vpc_id}" | ||
| igw_id = "${module.vpc.igw_id}" | ||
| cidr_block = "${module.vpc.vpc_cidr_block}" | ||
| nat_gateway_enabled = "true" | ||
| } |
This file contains hidden or 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,7 @@ | ||
| output "public_subnet_cidrs" { | ||
| value = "${module.subnets.public_subnet_cidrs}" | ||
| } | ||
|
|
||
| output "private_subnet_cidrs" { | ||
| value = "${module.subnets.private_subnet_cidrs}" | ||
| } |
This file contains hidden or 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,3 @@ | ||
| provider "aws" { | ||
| region = "${var.region}" | ||
| } |
This file contains hidden or 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,13 @@ | ||
| variable "max_availability_zones" {} | ||
|
|
||
| variable "region" {} | ||
|
|
||
| variable "availability_zones" { | ||
| type = "list" | ||
| } | ||
|
|
||
| variable "namespace" {} | ||
|
|
||
| variable "name" {} | ||
|
|
||
| variable "stage" {} |
This file contains hidden or 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,3 @@ | ||
| terraform { | ||
| required_version = "~> 0.11.7" | ||
| } | ||
This file contains hidden or 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 @@ | ||
| .test-harness |
This file contains hidden or 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,43 @@ | ||
| TEST_HARNESS ?= https://github.com/cloudposse/test-harness.git | ||
| TEST_HARNESS_BRANCH ?= master | ||
| TEST_HARNESS_PATH = $(realpath .test-harness) | ||
| BATS_ARGS ?= --tap | ||
| BATS_LOG ?= test.log | ||
|
|
||
| # Define a macro to run the tests | ||
| define RUN_TESTS | ||
| @echo "Running tests in $(1)" | ||
| @cd $(1) && bats $(BATS_ARGS) $(addsuffix .bats,$(addprefix $(TEST_HARNESS_PATH)/test/terraform/,$(TESTS))) | ||
| endef | ||
|
|
||
| default: all | ||
|
|
||
| -include Makefile.* | ||
|
|
||
| ## Provision the test-harnesss | ||
| .test-harness: | ||
| git clone --depth=1 -b $(TEST_HARNESS_BRANCH) $(TEST_HARNESS) $@ | ||
|
|
||
| ## Initialize the tests | ||
| init: .test-harness | ||
|
|
||
| ## Install all dependencies (OS specific) | ||
| deps:: | ||
| @exit 0 | ||
|
|
||
| ## Clean up the test harness | ||
| clean: | ||
| [ "$(TEST_HARNESS_PATH)" == "/" ] || rm -rf $(TEST_HARNESS_PATH) | ||
|
|
||
| ## Run all tests | ||
| all: module examples/complete | ||
|
|
||
| ## Run basic sanity checks against the module itself | ||
| module: export TESTS ?= installed lint get-modules module-pinning get-plugins provider-pinning validate terraform-docs input-descriptions output-descriptions | ||
| module: deps | ||
| $(call RUN_TESTS, ../) | ||
|
|
||
| ## Run tests against example | ||
| examples/complete: export TESTS ?= installed lint get-modules get-plugins validate | ||
| examples/complete: deps | ||
| $(call RUN_TESTS, ../$@) |
This file contains hidden or 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,5 @@ | ||
| ifneq (,$(wildcard /sbin/apk)) | ||
| ## Install all dependencies for alpine | ||
| deps:: init | ||
| @apk add --update terraform-docs@cloudposse json2hcl@cloudposse | ||
| endif |
This file contains hidden or 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,2 @@ | ||
| .gopath | ||
| vendor/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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,7 @@ | ||
| [[constraint]] | ||
| name = "github.com/stretchr/testify" | ||
| version = "1.2.2" | ||
|
|
||
| [prune] | ||
| go-tests = true | ||
| unused-packages = true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.