-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Feature/BBL-440 | ci improvement #1
Changes from 15 commits
729f946
49fc58e
f1124d0
6678aaf
3f9b3a2
40ff4fe
9a3f292
e317b4a
a0fee0e
658cb1f
0b84e52
aabebb6
a75acfa
b916380
add06df
1934bfc
e68b9d6
62d725d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,34 @@ jobs: | |
git update-index --assume-unchanged "Makefile" | ||
|
||
- run: | ||
name: Validate Terraform format | ||
command: make format-check | ||
name: test-dependencies | ||
command: | | ||
# | ||
# Install pre-commit | ||
pip install pre-commit | ||
# | ||
# Install terraform | ||
sudo apt-get install unzip | ||
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VER}/terraform_${TERRAFORM_VER}_linux_amd64.zip | ||
unzip terraform_${TERRAFORM_VER}_linux_amd64.zip | ||
sudo mv terraform /usr/local/bin/ | ||
terraform --version | ||
# | ||
# Install terraform-docs | ||
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | ||
curl -Lo ./terraform-docs https://github.com/terraform-docs/terraform-docs/releases/download/v0.10.1/terraform-docs-v0.10.1-$(uname | tr '[:upper:]' '[:lower:]')-amd64 | ||
chmod +x ./terraform-docs | ||
sudo mv ./terraform-docs /usr/local/bin/terraform-docs | ||
|
||
- run: | ||
name: test1-terraform-format-and-docs-mod-a | ||
command: | | ||
cd modules/delegated-admin && make pre-commit | ||
|
||
- run: | ||
name: test1-terraform-format-and-docs-mod-b | ||
command: | | ||
cd modules/multiaccount-setup && make pre-commit | ||
|
||
- run: | ||
name: Install awscli | ||
|
@@ -55,9 +81,24 @@ jobs: | |
cp /home/circleci/.aws/config /home/circleci/.aws/bb/config | ||
|
||
- run: | ||
name: Lint Terraform code | ||
command: make tflint-deep | ||
name: test2-terraform-linting-mod-a | ||
command: | | ||
cd modules/delegated-admin && make tflint-deep | ||
|
||
- run: | ||
name: test2-terraform-linting-mod-b | ||
command: | | ||
cd modules/multiaccount-setup && make tflint-deep | ||
|
||
- slack/notify: | ||
event: fail | ||
mentions: '@leverage-support' | ||
template: basic_fail_1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @exequielrafaela Just curious, are these templates defined in CircleCI's project configuration? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @diego-ojeda-binbash OJ you can find them here -> https://github.com/CircleCI-Public/slack-orb/tree/master/src/message_templates |
||
channel: 'tools-ci' | ||
- slack/notify: | ||
event: pass | ||
template: success_tagged_deploy_1 | ||
channel: 'tools-ci' | ||
|
||
# | ||
# Release | ||
|
@@ -101,12 +142,23 @@ jobs: | |
echo "===============================================================================================" | ||
fi | ||
|
||
- slack/notify: | ||
event: fail | ||
mentions: '@leverage-support' | ||
template: basic_fail_1 | ||
channel: 'tools-ci' | ||
- slack/notify: | ||
event: pass | ||
template: success_tagged_deploy_1 | ||
channel: 'tools-ci' | ||
|
||
# | ||
# CircleCI orbs are open-source, shareable packages of parameterizable reusable | ||
# configuration elements, including jobs, commands, and executors. | ||
# | ||
orbs: | ||
sumologic: circleci/sumologic@1.0.6 | ||
slack: circleci/slack@4.1.1 | ||
|
||
# | ||
# Jobs workflow | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# we have to set line endings to LF for all bash scripts, otherwise, if you save | ||
# a script on Windows, it would have CRLF line breaks, which doesn’t work on | ||
# Linux. This is achieved by a combination of ‘.editorconfig’ defining how the | ||
# code is displayed in a text editor, and ‘.gitatttributes’, which controls how | ||
# the file is saved in source control. | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file && 2 space indentation | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 80 | ||
trim_trailing_whitespace = true | ||
|
||
# Unix-style newlines with a newline ending every file && 2 space indentation | ||
[*.sh] | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# Unix-style newlines with a newline ending every file && 2 space indentation | ||
[*.py] | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{tf,tfvars}] | ||
indent_size = 2 | ||
indent_style = space | ||
|
||
[*.md] | ||
max_line_length = 0 | ||
trim_trailing_whitespace = false | ||
|
||
# Tab indentation && 2 space indentation | ||
[Makefile] | ||
tab_width = 2 | ||
indent_style = tab | ||
|
||
[COMMIT_EDITMSG] | ||
max_line_length = 0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# https://github.com/awslabs/git-secrets | ||
*README.md | ||
examples/configure-guardduty/main.tf |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
!/.github | ||
!*.gitkeep | ||
!*.editorconfig | ||
!*.pre-commit-config.yaml | ||
|
||
# SSH keys # | ||
############ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
default_language_version: | ||
# force all unspecified python hooks to run python3 | ||
python: python3 | ||
|
||
repos: | ||
- repo: git://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.2.0 | ||
hooks: | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-yaml | ||
- id: detect-private-key | ||
- id: pretty-format-json | ||
args: | ||
- --autofix | ||
- id: trailing-whitespace | ||
args: | ||
- --markdown-linebreak-ext=md | ||
|
||
- repo: git://github.com/antonbabenko/pre-commit-terraform | ||
rev: v1.43.0 | ||
hooks: | ||
- id: terraform_fmt | ||
- id: terraform_docs |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,5 @@ No requirements. | |
## Outputs | ||
|
||
No output. | ||
|
||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MAKEFILES_DIR := ../../@bin/makefiles | ||
|
||
-include ${MAKEFILES_DIR}/terratest13/terratest13.mk | ||
-include ${MAKEFILES_DIR}/terraform13/terraform13.mk |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,5 @@ No requirements. | |
## Outputs | ||
|
||
No output. | ||
|
||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
MAKEFILES_DIR := ../../@bin/makefiles | ||
|
||
-include ${MAKEFILES_DIR}/terratest13/terratest13.mk | ||
-include ${MAKEFILES_DIR}/terraform13/terraform13.mk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@exequielrafaela Just a couple of concerns regarding the names of these steps:
1- I would suggest not to use test1, test2, and so on. Perhaps just
test
is good enough to indicate the general purpose of the step.2- I would also suggest not to use mod-a, mod-b, and so on. I think it would be more helpful to use either the name of the module under test or part of it, so that when we receive notifications we can tell which tests of which module failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diego-ojeda-binbash OJ agreed ✅ Thanks for your feedback :)