summaryrefslogtreecommitdiff
path: root/playbooks/roles/ci/templates/volumes
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-05-28 23:56:55 -0700
committerElizabeth Hunt <me@liz.coffee>2025-05-28 23:56:55 -0700
commit6d3cefc29d596fcce0d436391eb6feec16bf2018 (patch)
tree096b16849467669a3542ee2a3e76c57e4da827dd /playbooks/roles/ci/templates/volumes
parentb8ffbfe27eae919750ef4d3facf02393d1004287 (diff)
downloadinfra-6d3cefc29d596fcce0d436391eb6feec16bf2018.tar.gz
infra-6d3cefc29d596fcce0d436391eb6feec16bf2018.zip
CI part one
Diffstat (limited to 'playbooks/roles/ci/templates/volumes')
-rw-r--r--playbooks/roles/ci/templates/volumes/data/.gitkeep0
-rwxr-xr-xplaybooks/roles/ci/templates/volumes/laminar/jobs/build_image.run36
-rwxr-xr-xplaybooks/roles/ci/templates/volumes/laminar/jobs/playbook.run25
-rwxr-xr-xplaybooks/roles/ci/templates/volumes/laminar/scripts/get_secret35
-rwxr-xr-xplaybooks/roles/ci/templates/volumes/laminar/scripts/log3
5 files changed, 0 insertions, 99 deletions
diff --git a/playbooks/roles/ci/templates/volumes/data/.gitkeep b/playbooks/roles/ci/templates/volumes/data/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/playbooks/roles/ci/templates/volumes/data/.gitkeep
+++ /dev/null
diff --git a/playbooks/roles/ci/templates/volumes/laminar/jobs/build_image.run b/playbooks/roles/ci/templates/volumes/laminar/jobs/build_image.run
deleted file mode 100755
index ed7bf21..0000000
--- a/playbooks/roles/ci/templates/volumes/laminar/jobs/build_image.run
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-# usage: laminarc queue build_publish_image registry="oci.liz.coffee" \
-# repo="src/cgit" tag="latest" remote="ssh://src.liz.coffee:2222/cgit" \
-# rev="<sha>" image_file="Dockerfile"
-
-set -e
-
-declare -a args=("$registry" "$repo" "$tag" "$remote" "$rev" "$image_file")
-for arg in "${args[@]}"
-do
- if [[ ! "$arg" =~ ^[[:alnum:]:_\.\/\-]*$ ]]; then
- echo "Invalid argument format. Don't be sneaky snek (-_-)."
- exit 1
- fi
-done
-
-log "Logging into registry $registry"
-registry_username="$(get_secret $registry | jq -r ".login.username")"
-get_secret $registry | jq -r ".login.password" \
- | docker login --username "$registry_username" --password-stdin "$registry"
-
-log "Cloning remote $remote"
-r=$(echo "build-$(date --iso-8601=seconds)")
-git clone "$remote" "$r" && cd "$r"
-git checkout "$rev"
-
-image_tag="$registry/$repo:$tag"
-log "Building image $image_tag"
-env -i HOME="$HOME" bash -l -c "docker build . -t '$image_tag' -f '$image_file'"
-
-log "Pushing $image_tag"
-docker push "$image_tag"
-
-cd -
-rm -rf "$r"
-docker logout "$registry"
diff --git a/playbooks/roles/ci/templates/volumes/laminar/jobs/playbook.run b/playbooks/roles/ci/templates/volumes/laminar/jobs/playbook.run
deleted file mode 100755
index 181a050..0000000
--- a/playbooks/roles/ci/templates/volumes/laminar/jobs/playbook.run
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-# usage: laminarc queue playbook remote="ssh://src.liz.coffee:2222/infra" playbooks="deploy.yml playbooks/labdns.yml"
-
-set -e
-
-declare -a args=("$remote" "$playbooks")
-for arg in "${args[@]}"
-do
- if [[ ! "$arg" =~ ^[[:alnum:]:_\ \.\/\-]*$ ]]; then
- echo "Invalid argument format. Don't be sneaky snek (-_-)."
- exit 1
- fi
-done
-
-log "Cloning remote $remote"
-r=$(echo "ansible-$(date --iso-8601=seconds)")
-git clone "$remote" "$r" && cd "$r"
-
-get_secret "ansible_secrets" | jq -r '.notes' > secrets.yml
-private_key=$(get_secret "ssh_key" | jq -r '.notes')
-
-env -i HOME="$HOME" ssh-agent bash -c "ssh-add <(echo \"$private_key\") && ansible-playbook -e @secrets.yml $playbooks"
-
-cd -
-rm -rf "$r"
diff --git a/playbooks/roles/ci/templates/volumes/laminar/scripts/get_secret b/playbooks/roles/ci/templates/volumes/laminar/scripts/get_secret
deleted file mode 100755
index 2774651..0000000
--- a/playbooks/roles/ci/templates/volumes/laminar/scripts/get_secret
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-bw config server "https://{{ passwd_domain }}"
-bw login --apikey --quiet
-bw unlock --passwordenv BW_PASSWORD --quiet
-
-# https://github.com/bitwarden/clients/issues/3366
-function bw_get() {
- local pwd
- local count
- local organisation=${2:-notnull}
-
- count=$(bw list items --pretty --organizationid ${organisation} | jq -r '[.[] | select(.name=="'$1'")] | length')
-
- if [[ "$count" -gt 1 ]]; then
- echo "Multiple items found"
- return 1
- fi
-
- if [[ "$count" -lt 1 ]]; then
- echo "No items found"
- return 1
- fi
-
- pwd=$(bw list items --pretty --organizationid ${organisation} | jq -r '.[] | select(.name=="'$1'")')
- if [[ -z "$pwd" ]]; then
- echo "Password not found"
- return 1
- fi
-
- echo "$pwd"
-}
-
-bw_get $@
-bw --quiet lock
diff --git a/playbooks/roles/ci/templates/volumes/laminar/scripts/log b/playbooks/roles/ci/templates/volumes/laminar/scripts/log
deleted file mode 100755
index 180fa33..0000000
--- a/playbooks/roles/ci/templates/volumes/laminar/scripts/log
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-echo `date +"%d-%m-%Y %H:%M:%S"` " - " "${@}"