SSL Checker: Add custom domains to check + circle configuration

This commit is contained in:
Jonatan Castro 2020-11-26 17:24:32 +11:00
parent 0cbfb56286
commit a9c3b8f109
3 changed files with 84 additions and 0 deletions

33
.circleci/config.yml Normal file
View File

@ -0,0 +1,33 @@
version: 2
jobs:
backup:
docker:
- image: circleci/python:3.8.0-node
working_directory: ~/repo
steps:
- checkout
- run:
name: Check SSL Certificates
command: |
DATE=`date "+%Y%m%d-%H%M"`
.circleci/slack-message.sh "*Checking SSL Certificates*: Begin" "MASTER" $DATE "#ffff00"
docker build -t ssl-checker .
docker run -it --rm -v $(pwd):/data ssl-checker -f /data/hosts_to_check
.circleci/slack-message.sh "*Checked SSL Certificates*: Finished :key:" "MASTER" $DATE "#008000"
workflows:
version: 2
backup:
triggers:
- schedule:
cron: "0 22 * * 1"
filters:
branches:
only:
- master
jobs:
- backup:
context: github-backup
filters:
branches:
only: master

34
.circleci/slack-message.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
set -xue
DEFAULT_TEXT=$1
DEPLOY_ENV=${2:-DEV}
VERSION_NUMBER=$3
COLOR=$4
COMMIT_MSG="$(git rev-list --format=%B --max-count=1 $CIRCLE_SHA1)"
TS=$(date +"%s")
SLACK_MESSAGE='{
"text": "'$DEFAULT_TEXT'",
"attachments": [
{
"text":"*Version:* '$VERSION_NUMBER'\n*Environment:* '$DEPLOY_ENV'",
"color":"'$COLOR'"
},
{
"title": "Commits",
"color":"'$COLOR'",
"title_link": "'$CIRCLE_COMPARE_URL'",
"text": "'$COMMIT_MSG'",
"author_name": "'$CIRCLE_USERNAME'",
"author_link":"https://github.com/'$CIRCLE_USERNAME'",
"author_icon":"https://avatars.githubusercontent.com/'$CIRCLE_USERNAME'",
"footer":"<https://circleci.com/workflow-run/'$CIRCLE_WORKFLOW_ID'|See it on *CircleCI*>",
"ts": '$TS'
}
]
}'
curl -X POST -H 'Content-Type: application/json' --data "$SLACK_MESSAGE" $SLACK_HOOK_URL

17
hosts_to_check Normal file
View File

@ -0,0 +1,17 @@
test.rivalbet.com.au
get.rivalbet.com.au
ios.rivalbet.com.au
android.rivalbet.com.au
mobile-web.rivalbet.com.au
app.rivalbet.com.au
app.dev.rivalbet.com.au
get.dev.rivalbet.com.au
ios.dev.rivalbet.com.au
android.dev.rivalbet.com.au
admin-dashboard.rivalbet.com.au
admin-dashboard.dev.rivalbet.com.au
rvlbt.com
scraper.dev.rivalbet.com.au
scraper.prod.rivalbet.com.au
rivaltar.prod.rivalbet.com.au
rivaltar.dev.rivalbet.com.au