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
FROM ubuntu:latest | |
ARG PLATFORM_ARCH= | |
RUN case "$(uname -m)" in \ | |
x86_32) export PLATFORM_ARCH='386' ;; \ | |
x86_64) export PLATFORM_ARCH='amd64' ;; \ | |
amd64) export PLATFORM_ARCH='amd64' ;; \ | |
armhf) export PLATFORM_ARCH='arm' ;; \ | |
armv7) export PLATFORM_ARCH='arm' ;; \ |
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
URL="http://stackoverflow.com/" | |
# store the whole response with the status at the and | |
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL) | |
# extract the body | |
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g') | |
# extract the status | |
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://') |
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
# More information can be found at https://docs.gitlab.com/ee/user/infrastructure/#gitlab-managed-terraform-state | |
terraform { | |
backend "http" { | |
} | |
} |
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
#!/bin/sh | |
ORGANIZATION_NAME=`cat backend.tf | grep "organization" | cut -f2 -d'=' | tr -d ' ' | tr -d '"'` | |
WORKSPACE_NAME=`cat backend.tf | grep ' name = "' | cut -f2 -d'=' | tr -d ' ' | tr -d '"'` | |
TERRAFORM_CLOUD_TOKEN=${TERRAFORM_CLOUD_TOKEN:-""} | |
while IFS= read -r VARIABLE; do | |
PAYLOAD='' read -r -d '' String <<"EOF" | |
{ | |
"data": { |
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
#!/bin/sh | |
GOOGLE_KMS_BIN="./google-kms-x509-macos-amd64-v1.1.0" | |
command -v "$GOOGLE_KMS_BIN" >/dev/null 2>&1 || { echo >&2 "I require $(basename "$GOOGLE_KMS_BIN") but it's not installed. Aborting."; echo >&2 "You can install from: https://github.com/ericnorris/google-kms-x509"; exit 1; } | |
[ -z "$GOOGLE_APPLICATION_CREDENTIALS" ] && { echo >&2 "Please set GOOGLE_APPLICATION_CREDENTIALS to point to service account JSON"; exit 1; } | |
COUNTRY=${CA_COUNTRY:-"USA"} | |
PROVINCE=${CA_PROVINCE:-""} | |
ORGANIZATION=${CA_ORGANIZATION:-"Widgets Inc"} |
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
#!/usr/bin/env bash | |
set -e | |
get_arch() { | |
local myArch | |
unameArch="$(uname -m)"; | |
case "$unameArch" in | |
armhf) | |
myArch='arm' |
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
#!/usr/bin/env bash | |
SSH_SCAN_HOSTNAMES=${1:-"${SSH_SCAN_HOSTNAMES}"} | |
SSH_SCAN_HOSTNAMES=${SSH_SCAN_HOSTNAMES:-"github.com gitlab.com"} | |
SSH_DIR="$HOME/.ssh" | |
command -v ssh-keyscan >/dev/null 2>&1 || { echo >&2 "I require ssh-keygen but it's not installed. Aborting."; exit 1; } | |
command -v tee >/dev/null 2>&1 || { echo >&2 "I require tee but it's not installed. Aborting."; exit 1; } | |
for SSH_SCAN_HOSTNAME in $SSH_SCAN_HOSTNAMES; do |
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
#!/usr/bin/env bash | |
# Read a single char from /dev/tty, prompting with "$*" | |
# Note: pressing enter will return a null string. Perhaps a version terminated with X and then remove it in caller? | |
# See https://unix.stackexchange.com/a/367880/143394 for dealing with multi-byte, etc. | |
function get_keypress { | |
local REPLY IFS= | |
>/dev/tty printf '%s' "$*" | |
[[ $ZSH_VERSION ]] && read -rk1 # Use -u0 to read from STDIN | |
# See https://unix.stackexchange.com/q/383197/143394 regarding '\n' -> '' |
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
#!/usr/bin/env bash | |
########################### | |
# Validate .gitlab-ci.yml # | |
# by Peter Weinert # | |
########################### | |
lif [[ "$OSTYPE" == "darwin"* ]]; then | |
SED_BIN="gsed" | |
command -v "gsed" >/dev/null 2>&1 || { echo >&2 "I require gsed but it's not installed. Install with 'brew install gnu-sed'. Aborting."; exit 1; } |
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
#!/usr/bin/env bash | |
[ "$EUID" -ne 0 ] && { echo >&2 "Please run as root or with sudo"; exit 2; } | |
INSTALL_LOCATION="/usr/local/bin/docker-machine" | |
REPO=docker/machine | |
VERSION=`curl -s "https://github.com/${REPO}/releases/latest/download" 2>&1 | grep -Po [0-9]+\.[0-9]+\.[0-9]+` | |
[ -z "$VERSION" ] && echo >&2 "Could not get latest version from ${REPO}!" | |
if command -v docker-machine >/dev/null 2>&1; then |