copr-be: drop old scripts related to OpenStack
The OpenStack scripts wouldn't be used even if we had OpenStack; we can calmly use the 'copr-image' script we already use for Libvirt for now (in Red Hat Copr, we use that script to generate one - and the same - image both for OpenStack and Libvirt).
This commit is contained in:
parent
1644f93b5d
commit
64ae26c144
3 changed files with 0 additions and 154 deletions
|
@ -1,14 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Helper script to delete (protected) OpenStack image in one step.
|
||||
# See: https://docs.pagure.org/copr.copr/how_to_upgrade_builders.html
|
||||
|
||||
. /home/copr/cloud/keystonerc_proper_tenant
|
||||
|
||||
set +x
|
||||
|
||||
openstack image set \
|
||||
--unprotected \
|
||||
"$1"
|
||||
|
||||
openstack image delete "$1"
|
|
@ -1,15 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Once we have snapshot (builder image) in OpenStack, we need to make it public,
|
||||
# protected, and setup hw_rng_model attribute. This script simplifies the task.
|
||||
# See https://docs.pagure.org/copr.copr/how_to_upgrade_builders.html
|
||||
|
||||
. /home/copr/cloud/keystonerc_proper_tenant
|
||||
|
||||
set +x
|
||||
|
||||
openstack image set \
|
||||
--public \
|
||||
--protected \
|
||||
--property hw_rng_model=virtio \
|
||||
"$1"
|
|
@ -1,125 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Automatically create an updated virtual machine in OpenStack or AWS so we can
|
||||
# later create a snapshot (builder image) from it. See
|
||||
# https://docs.pagure.org/copr.copr/how_to_upgrade_builders.html
|
||||
|
||||
. /home/copr/cloud/keystonerc_proper_tenant
|
||||
|
||||
set -e
|
||||
|
||||
parse_first_argument()
|
||||
{
|
||||
old_IFS=$IFS
|
||||
IFS=:
|
||||
set -- $1
|
||||
if test -z $2; then
|
||||
# cloud not specified, default to openstack
|
||||
cloud=os
|
||||
arch=$1
|
||||
else
|
||||
cloud=$1
|
||||
arch=$2
|
||||
fi
|
||||
IFS=$old_IFS
|
||||
}
|
||||
|
||||
help_output()
|
||||
{
|
||||
cat >&2 <<EOF
|
||||
Usage: $0 CLOUD:ARCH [IMAGE]
|
||||
|
||||
Prepare image for spawning copr builder VM.
|
||||
|
||||
Valid values for CLOUD are 'os' (OpenStack) or 'aws' (Amazon Web Services).
|
||||
ARCH can be 'x86_64|aarch64' for CLOUD=aws, or 'x86_64|ppc64le' for CLOUD=os.
|
||||
|
||||
By default, each CLOUD:ARCH pair has it's own default image ID preconfigured,
|
||||
and we spinup the VM from that image. This can be overwritten by IMAGE
|
||||
argument, e.g. when migrating from Fedora N to Fedora N+1.
|
||||
EOF
|
||||
}
|
||||
|
||||
die() { echo "$*" >&2; echo >&2; help_output; exit 1; }
|
||||
|
||||
test -n "$1" || die "No CLOUD:ARCH specified."
|
||||
|
||||
parse_first_argument "$1"
|
||||
|
||||
|
||||
case $cloud:$arch in
|
||||
os:ppc64le) playbook=/home/copr/provision/builderpb_nova_ppc64le.yml ;;
|
||||
os:x86_64) playbook=/home/copr/provision/builderpb_nova.yml ;;
|
||||
aws:x86_64) playbook=/home/copr/provision/builderpb-aws-x86_64.yml ;;
|
||||
aws:aarch64) playbook=/home/copr/provision/builderpb-aws-aarch64.yml ;;
|
||||
*) die "bad cloud ($cloud) or architecture ($arch)" ;;
|
||||
esac
|
||||
|
||||
logfile="/tmp/prepare-image-os-$arch.log"
|
||||
|
||||
ansible_options=( -e prepare_base_image=1 )
|
||||
test -z "$2" || ansible_options+=( -e image_name="$2" )
|
||||
|
||||
ansible-playbook "$playbook" "${ansible_options[@]}" |& tee "$logfile"
|
||||
|
||||
vm_name=$(sed -n 's/.*vm_name=\([[:alnum:]_-]\+\).*/\1/p' "$logfile" | head -1)
|
||||
test -n "$vm_name"
|
||||
ip=$(sed -n 's/.*VM_IP=\([0-9\.]\+\).*/\1/p' "$logfile" | head -1)
|
||||
test -n "$ip"
|
||||
|
||||
fedora=$(ssh "fedora@$ip" 'rpm --eval %fedora')
|
||||
|
||||
new_volume_name="copr-builder-$arch-f$fedora-$(date +"%Y%m%d_%H%M%S")"
|
||||
|
||||
if test $cloud = os; then
|
||||
# we can not just do
|
||||
# $ nova-3 image-create "$vm_name" "$new_volume_name" --poll
|
||||
# because it throws error:
|
||||
# ERROR (ClientException): The server has either erred or is incapable of
|
||||
# performing the requested operation. (HTTP 500) (Request-ID:...)
|
||||
|
||||
nova-3 stop "$vm_name"
|
||||
|
||||
cat <<EOF
|
||||
Please go to https://fedorainfracloud.org/ page, log-in and find the instance
|
||||
|
||||
$vm_name
|
||||
|
||||
Check that it is in SHUTOFF state. Create a snapshot from that instance, name
|
||||
it "$new_volume_name". Once snapshot is saved, run:
|
||||
|
||||
$ copr-image-fixup-snapshot-os.sh $new_volume_name
|
||||
|
||||
And continue with
|
||||
https://docs.pagure.org/copr.copr/how_to_upgrade_builders.html#how-to-upgrade-builders
|
||||
EOF
|
||||
elif test $cloud = aws; then
|
||||
instance_id=$(aws ec2 describe-instances \
|
||||
--query "Reservations[].Instances[].InstanceId" \
|
||||
--filter Name=tag-key,Values=Name Name=tag-value,Values="$vm_name" \
|
||||
--output text
|
||||
)
|
||||
|
||||
# search results can be empty, and that would be error
|
||||
test -n "$instance_id"
|
||||
|
||||
image_id=$(aws ec2 create-image \
|
||||
--instance-id "$instance_id" \
|
||||
--name "$new_volume_name" \
|
||||
--output text
|
||||
)
|
||||
|
||||
# This makes the web-UI nicer (first field of AMI list)
|
||||
aws ec2 create-tags \
|
||||
--resources "$image_id" \
|
||||
--tags Key=Name,Value="$new_volume_name"
|
||||
|
||||
# This is required so fedora infra people won't delete the images
|
||||
# automatically
|
||||
aws ec2 create-tags \
|
||||
--resources "$image_id" \
|
||||
--tags Key=FedoraGroup,Value=copr
|
||||
|
||||
echo >&2 "The new image ID is: $image_id"
|
||||
echo >&2 "The new image Name is: $new_volume_name"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue