#!/usr/bin/env bash # This can be run from e.g. the senta machines which have docker available. You # may need to run this script with sudo. # # Once you have booted into the image, you should be able to debug the core file: # $ gdb -q /ceph/teuthology-archive/.../coredump/1500013578.8678.core # # You may want to install other packages (yum) as desired. # # Once you're finished, please delete old images in a timely fashion. set -e CACHE="" FLAVOR="default" function run { printf "%s\n" "$*" "$@" } function main { eval set -- $(getopt --name "$0" --options 'h' --longoptions 'help,no-cache,flavor:' -- "$@") while [ "$#" -gt 0 ]; do case "$1" in -h|--help) printf '%s: [--no-cache] [:sha1] \n' "$0" exit 0 ;; --no-cache) CACHE="--no-cache" shift ;; --flavor) FLAVOR=$2 shift 2 ;; --) shift break ;; esac done if [ -z "$1" ]; then printf "specify the branch [default \"master:latest\"]: " read source if [ -z "$source" ]; then source=master:latest fi else branch="$1" fi if [ "${branch%%:*}" != "${branch}" ]; then sha=${branch##*:} else sha=latest fi branch=${branch%%:*} printf "branch: %s\nsha1: %s\n" "$branch" "$sha" if [ -z "$2" ]; then printf "specify the build environment [default \"centos:8\"]: " read env if [ -z "$env" ]; then env=centos:8 fi else env="$2" fi printf "env: %s\n" "$env" if [ -n "$SUDO_USER" ]; then user="$SUDO_USER" elif [ -n "$USER" ]; then user="$USER" else user="$(whoami)" fi tag="${user}:ceph-ci-${branch}-${sha}-${env/:/-}" T=$(mktemp -d) pushd "$T" repo_url="https://shaman.ceph.com/api/repos/ceph/${branch}/${sha}/${env/://}/flavors/${FLAVOR}/repo" if grep ubuntu <<<"$env" > /dev/null 2>&1; then # Docker makes it impossible to access anything outside the CWD : / cp -- /ceph/shaman/cephdev.asc . cat > Dockerfile <