diff --git a/.local/bin/update-drone-docker b/.local/bin/update-drone-docker new file mode 100755 index 0000000..3e7e0ab --- /dev/null +++ b/.local/bin/update-drone-docker @@ -0,0 +1,71 @@ +#!/bin/bash + +DRONE_SERVER=${DRONE_SERVER:="https://ci.makerforce.io"} +DRONE_TOKEN=${DRONE_TOKEN:=""} + +echo +echo "This script updates Docker logins on all Drone repos" +echo + +path_to_httpie=$(which http) +if [ ! -x "$path_to_httpie" ] ; then + echo "HTTPie not installed. Please install it at (https://httpie.org/doc#installation)" +fi + +path_to_jq=$(which jq) +if [ ! -x "$path_to_jq" ] ; then + echo "JQ not installed. Please install it at (https://stedolan.github.io/jq/download/)" +fi + +if [ -z $DRONE_TOKEN ]; then + echo "Enter Drone token ($DRONE_SERVER/account/token)" + echo -n "> " + read DRONE_TOKEN + echo +fi + +echo "Enter Docker username" +echo -n "> " +read docker_username +echo + +echo "Enter Docker password" +echo -n "> " +read -s docker_password +echo +echo + +echo "Fetching repo list..." +repo_list=$(http GET $DRONE_SERVER/api/user/repos Authorization:"Bearer $DRONE_TOKEN" | jq .[].slug -r) +#repo_enabled_list=$(http GET $DRONE_SERVER/api/user/repos Authorization:"Bearer $DRONE_TOKEN" | jq .[].enabled -r) + +for r in $repo_list; do + + echo "Updating docker_username in $r..." + http --check-status -b PATCH \ + $DRONE_SERVER/api/repos/$r/secrets/docker_username \ + Authorization:"Bearer $DRONE_TOKEN" \ + data="$docker_username" \ + pull_request:=false \ + || http --check-status -b POST \ + $DRONE_SERVER/api/repos/$r/secrets \ + Authorization:"Bearer $DRONE_TOKEN" \ + name="docker_username" \ + data="$docker_username" \ + pull_request:=false + + echo "Updating docker_password in $r..." + http --check-status -b PATCH \ + $DRONE_SERVER/api/repos/$r/secrets/docker_password \ + Authorization:"Bearer $DRONE_TOKEN" \ + data="$docker_password" \ + pull_request:=false \ + || http --check-status -b POST \ + $DRONE_SERVER/api/repos/$r/secrets \ + Authorization:"Bearer $DRONE_TOKEN" \ + name="docker_password" \ + data="$docker_password" \ + pull_request:=false + +done + diff --git a/.local/bin/update-drone-slack b/.local/bin/update-drone-slack new file mode 100755 index 0000000..ba69700 --- /dev/null +++ b/.local/bin/update-drone-slack @@ -0,0 +1,52 @@ +#!/bin/bash + +DRONE_SERVER=${DRONE_SERVER:="https://ci.makerforce.io"} +DRONE_TOKEN=${DRONE_TOKEN:=""} + +echo +echo "This script updates Slack webhooks on all Drone repos" +echo + +path_to_httpie=$(which http) +if [ ! -x "$path_to_httpie" ] ; then + echo "HTTPie not installed. Please install it at (https://httpie.org/doc#installation)" +fi + +path_to_jq=$(which jq) +if [ ! -x "$path_to_jq" ] ; then + echo "JQ not installed. Please install it at (https://stedolan.github.io/jq/download/)" +fi + +if [ -z $DRONE_TOKEN ]; then + echo "Enter Drone token ($DRONE_SERVER/account/token)" + echo -n "> " + read DRONE_TOKEN + echo +fi + +echo "Enter Slack webhook URL" +echo -n "> " +read slack_webhook +echo +echo + +echo "Fetching repo list..." +repo_list=$(http GET $DRONE_SERVER/api/user/repos Authorization:"Bearer $DRONE_TOKEN" | jq .[].slug -r) + +for r in $repo_list; do + + echo "Updating slack_webhook in $r..." + http --check-status -b PATCH \ + $DRONE_SERVER/api/repos/$r/secrets/slack_webhook \ + Authorization:"Bearer $DRONE_TOKEN" \ + data="$slack_webhook" \ + pull_request:=false \ + || http --check-status -b POST \ + $DRONE_SERVER/api/repos/$r/secrets \ + Authorization:"Bearer $DRONE_TOKEN" \ + name="slack_webhook" \ + data="$slack_webhook" \ + pull_request:=false + +done + diff --git a/.local/bin/update-github-gitea-sync b/.local/bin/update-github-gitea-sync new file mode 100755 index 0000000..4a0abbd --- /dev/null +++ b/.local/bin/update-github-gitea-sync @@ -0,0 +1,3 @@ +#!/bin/sh + +# TODO: https://git.makerforce.io/api/swagger#/repository/repoMirrorSync diff --git a/.ssh/config b/.ssh/config index b078ebb..3d7443d 100644 --- a/.ssh/config +++ b/.ssh/config @@ -1,48 +1,17 @@ Host github.com Hostname ssh.github.com + User git Port 443 -Host goldenbarrel-dot - Hostname 27.104.131.21 - User ambrose - Port 80 - LocalForward 1853 1.1.1.1:853 - LocalForward 2853 1.0.0.1:853 - -Host goldenbarrel-sit-poly - Hostname 27.104.131.21 - User ambrose - Port 80 - -Host goldenbarrel-wan-test - Hostname makerforce.io - User ambrose - Port 2222 - DynamicForward 8000 - LocalForward 8080 localhost:8080 - RemoteForward 8180 localhost:8180 - -#Host goldenbarrel-wan-gpg -# Hostname makerforce.io -# User ambrose -# Port 2222 -# RemoteForward /home/ambrose/.gnupg/S.gpg-agent /Users/ambrose/.gnupg/S.gpg-agent.extra -# RemoteForward /home/ambrose/.gnupg/S.gpg-agent.ssh /Users/ambrose/.gnupg/S.gpg-agent.ssh - -Host goldenbarrel-wan - Hostname makerforce.io - User ambrose - Port 2222 - Host goldenbarrel Hostname goldenbarrel.cacti.makerforce.io User ambrose - Port 2222 + Port 22 Host saguaro Hostname saguaro.cacti.makerforce.io User root - Port 222 + Port 22 Host raspi Hostname raspi.cacti.makerforce.io