-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BBL-440 | ci pre-commit + slack notif + makefile-lib versioned
- Loading branch information
1 parent
466b883
commit 1e05602
Showing
4 changed files
with
192 additions
and
7 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 |
---|---|---|
|
@@ -2,7 +2,7 @@ version: 2.1 | |
|
||
jobs: | ||
# | ||
# Test 1 & Test 2 | ||
# Automated Tests | ||
# | ||
test-static-code-and-linting: | ||
machine: | ||
|
@@ -26,8 +26,27 @@ jobs: | |
git update-index --assume-unchanged "Makefile" | ||
- run: | ||
name: test1-terraform-format | ||
command: make format-check | ||
name: test-terraform-format-and-docs | ||
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 tests | ||
make pre-commit | ||
- run: | ||
name: Install awscli | ||
|
@@ -55,9 +74,79 @@ jobs: | |
cp /home/circleci/.aws/config /home/circleci/.aws/bb/config | ||
- run: | ||
name: test2-terraform-linting | ||
name: test-terraform-linting | ||
command: make tflint-deep | ||
|
||
- slack/notify: | ||
event: fail | ||
mentions: '@leverage-support' | ||
custom: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "Failed Pipeline! :rotating_light::fire::bash-fire::bangbang::video-games-doom-mad::stopp:", | ||
"emoji": true | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": ":negative_squared_cross_mark: *Project*: $CIRCLE_PROJECT_REPONAME \n :negative_squared_cross_mark: *User*: $CIRCLE_USERNAME \n :negative_squared_cross_mark: *Job*: $CIRCLE_JOB in *repo* $CIRCLE_PROJECT_REPONAME \n :negative_squared_cross_mark: *Branch:* $CIRCLE_BRANCH \n :negative_squared_cross_mark: *PR:* $CIRCLE_PULL_REQUEST \n :negative_squared_cross_mark: *Last Commit:* $CIRCLE_SHA1" | ||
}, | ||
"accessory": { | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":arrow_forward: View Job in CircleCi", | ||
"emoji": true | ||
}, | ||
"value": "click_me_123", | ||
"url": "$CIRCLE_BUILD_URL", | ||
"action_id": "button-action" | ||
} | ||
} | ||
] | ||
} | ||
channel: 'tools-ci' | ||
- slack/notify: | ||
event: pass | ||
custom: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "Successful Pipeline! :checkered_flag: :video-games-star: :video-games-mario-luigi-dance: :tada: :binbash::bb-leverage: :heart: :open-source:", | ||
"emoji": true | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": ":heavy_check_mark: *Project*: $CIRCLE_PROJECT_REPONAME \n :heavy_check_mark: *User*: $CIRCLE_USERNAME \n :heavy_check_mark: *Job*: $CIRCLE_JOB in *repo* $CIRCLE_PROJECT_REPONAME \n :heavy_check_mark: *Branch:* $CIRCLE_BRANCH \n :heavy_check_mark: *PR:* $CIRCLE_PULL_REQUEST \n :heavy_check_mark: *Last Commit:* $CIRCLE_SHA1" | ||
}, | ||
"accessory": { | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":arrow_forward: View Job in CircleCi", | ||
"emoji": true | ||
}, | ||
"value": "click_me_123", | ||
"url": "$CIRCLE_BUILD_URL", | ||
"action_id": "button-action" | ||
} | ||
} | ||
] | ||
} | ||
channel: 'tools-ci' | ||
|
||
# | ||
# Test 3 | ||
# | ||
|
@@ -154,12 +243,83 @@ jobs: | |
echo "===============================================================================================" | ||
fi | ||
- slack/notify: | ||
event: fail | ||
mentions: '@leverage-support' | ||
custom: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "Failed Pipeline! :rotating_light::fire::bash-fire::bangbang::video-games-doom-mad::stopp:", | ||
"emoji": true | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": ":negative_squared_cross_mark: *Project*: $CIRCLE_PROJECT_REPONAME \n :negative_squared_cross_mark: *User*: $CIRCLE_USERNAME \n :negative_squared_cross_mark: *Job*: $CIRCLE_JOB in *repo* $CIRCLE_PROJECT_REPONAME \n :negative_squared_cross_mark: *Branch:* $CIRCLE_BRANCH \n :negative_squared_cross_mark: *PR:* $CIRCLE_PULL_REQUEST \n :negative_squared_cross_mark: *Last Commit:* $CIRCLE_SHA1" | ||
}, | ||
"accessory": { | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":arrow_forward: View Job in CircleCi", | ||
"emoji": true | ||
}, | ||
"value": "click_me_123", | ||
"url": "$CIRCLE_BUILD_URL", | ||
"action_id": "button-action" | ||
} | ||
} | ||
] | ||
} | ||
channel: 'tools-ci' | ||
- slack/notify: | ||
event: pass | ||
custom: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "Successful Pipeline! :checkered_flag: :video-games-star: :video-games-mario-luigi-dance: :tada: :binbash::bb-leverage: :heart: :open-source:", | ||
"emoji": true | ||
} | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": ":heavy_check_mark: *Project*: $CIRCLE_PROJECT_REPONAME \n :heavy_check_mark: *User*: $CIRCLE_USERNAME \n :heavy_check_mark: *Job*: $CIRCLE_JOB in *repo* $CIRCLE_PROJECT_REPONAME \n :heavy_check_mark: *Branch:* $CIRCLE_BRANCH \n :heavy_check_mark: *PR:* $CIRCLE_PULL_REQUEST \n :heavy_check_mark: *Last Commit:* $CIRCLE_SHA1" | ||
}, | ||
"accessory": { | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":arrow_forward: View Job in CircleCi", | ||
"emoji": true | ||
}, | ||
"value": "click_me_123", | ||
"url": "$CIRCLE_BUILD_URL", | ||
"action_id": "button-action" | ||
} | ||
} | ||
] | ||
} | ||
channel: 'tools-ci' | ||
|
||
# | ||
# CircleCI orbs are open-source, shareable packages of parameterizable reusable | ||
# configuration elements, including jobs, commands, and executors. | ||
# | ||
orbs: | ||
sumologic: circleci/[email protected] | ||
slack: circleci/[email protected] | ||
|
||
# | ||
# Jobs workflow | ||
|
@@ -188,5 +348,3 @@ workflows: | |
- master | ||
- sumologic/workflow-collector: | ||
context: binbashar-org-global-context | ||
requires: | ||
- release-version-with-changelog |
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 |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
!/.github | ||
!*.gitkeep | ||
!*.editorconfig | ||
!*.pre-commit-config.yaml | ||
|
||
# SSH keys # | ||
############ | ||
|
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,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 |
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