tflint の aws 向けの rule set は pluggable になっており、新規 rule 追加がしやすくなっています。本発表では DB Instance の engine が valid のテストを追加する PR を元に、Contribution の方法と、その lint の仕組みを解説します。
Lead Software Engineer, Site Reliability at Quipper
| # Retry a command up to a specific numer of times until it exits successfully, | |
| # with exponential back off. | |
| # | |
| # $ retry 5 echo Hello | |
| # Hello | |
| # | |
| # $ retry 5 false | |
| # Retry 1/5 exited 1, retrying in 1 seconds... | |
| # Retry 2/5 exited 1, retrying in 2 seconds... | |
| # Retry 3/5 exited 1, retrying in 4 seconds... |
| #!/bin/bash | |
| # docker for ubuntu 18.04 | |
| # https://docs.docker.com/install/linux/docker-ce/ubuntu/ | |
| sudo apt-get remove docker docker-engine docker.io | |
| sudo apt-get install \ | |
| apt-transport-https \ | |
| ca-certificates \ | |
| curl \ | |
| software-properties-common -y | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| #!/bin/bash | |
| set -eux | |
| set -o pipefail | |
| user=$1 | |
| # for ubuntu | |
| adduser ${user} | |
| gpasswd -a ${user} wheel | |
| sudo -u ${user} mkdir /home/${user}/.ssh |
| #!/bin/bash | |
| PECO_CMD="peco" | |
| KUBECTL_CMD="kubectl" | |
| if ! hash "${PECO_CMD}" 2> /dev/null; then | |
| >&2 echo "error: ${PECO_CMD} is not installed" | |
| >&2 echo "see https://github.com/peco/peco" | |
| exit 1 | |
| fi |
| #!/bin/bash | |
| set -x | |
| readonly URL="https://api.github.com/search/issues" | |
| usage() { | |
| cat <<EOS >&2 | |
| Usage: $0 -u <user> -s YYYY-MM-DD -e YYYY-MM-DD | |
| -u: your github user name | |
| -s: start date to get your contribution |
| aws autoscaling describe-auto-scaling-groups |\ | |
| jq -r '.AutoScalingGroups[].AutoScalingGroupName' |\ | |
| peco |\ | |
| xargs -I{} aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names {} |\ | |
| jq -r '.AutoScalingGroups[]|.Instances[]|select(.LifecycleState == "InService")|select(.HealthStatus == "Healthy")|.InstanceId' |\ | |
| xargs aws ec2 describe-instances --instance-ids |\ | |
| jq -r '.Reservations[].Instances[]|select(.State.Name == "running")|.PrivateIpAddress' |
| #!/bin/bash | |
| LABELS="enhancement improvement" | |
| MILESTONE="v0.2.0" | |
| REPO="kamontia/qs" | |
| for LABEL in $LABELS | |
| do | |
| echo "# ${LABEL}" | |
| curl -sS https://api.github.com/search/issues?q=repo:"$REPO"+label:"$LABEL"+milestone:"$MILESTONE" \ | |
| | jq -c '.items[] | {title,html_url} | .html_url |= . + "\n" ' \ |
| #!/bin/bash | |
| set -eux | |
| set -o pipefail | |
| if [ "$(id -un)" != "root" ]; then | |
| echo "You should run with sudo." 1>&2 | |
| echo "-------------------------" | |
| exit 1 | |
| fi |
| #!/bin/bash | |
| touch /tmp/trap.$$ | |
| trap 'echo "trapped"; rm /tmp/trap.$$; exit 1' 2 | |
| while : | |
| do | |
| echo "loop" | |
| sleep 10 |