From 0e83301d8cfe639326130240c9e5e96315226395 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Wed, 25 Apr 2018 22:40:29 -0400 Subject: [PATCH 1/2] build_library: drop oracle_oci_qcow image format Images have been published to the release buckets, but never to OCI. --- build_library/vm_image_util.sh | 6 ------ jenkins/formats-amd64-usr.txt | 1 - 2 files changed, 7 deletions(-) diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index cf14d51a56..9bef8ed77e 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -12,7 +12,6 @@ VALID_IMG_TYPES=( iso openstack openstack_mini - oracle_oci_qcow qemu qemu_uefi qemu_uefi_secure @@ -53,7 +52,6 @@ VALID_OEM_PACKAGES=( exoscale gce hyperv - oracle-oci rackspace rackspace-onmetal vagrant @@ -245,10 +243,6 @@ IMG_gce_CONF_FORMAT=gce IMG_gce_OEM_PACKAGE=oem-gce IMG_gce_OEM_ACI=gce -## Oracle OCI -IMG_oracle_oci_qcow_DISK_FORMAT=qcow2 -IMG_oracle_oci_qcow_OEM_PACKAGE=oem-oracle-oci - ## rackspace IMG_rackspace_OEM_PACKAGE=oem-rackspace IMG_rackspace_vhd_DISK_FORMAT=vhd diff --git a/jenkins/formats-amd64-usr.txt b/jenkins/formats-amd64-usr.txt index 1dd707e801..9f98a63209 100644 --- a/jenkins/formats-amd64-usr.txt +++ b/jenkins/formats-amd64-usr.txt @@ -16,7 +16,6 @@ hyperv niftycloud openstack openstack_mini -oracle_oci_qcow packet parallels rackspace From e752c40b906a5d8085dc6bde2c90715258a7b3ba Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Wed, 25 Apr 2018 22:44:20 -0400 Subject: [PATCH 2/2] oem/oracle: drop utility scripts --- oem/oracle/common.sh | 40 ------------ oem/oracle/get-console-output | 35 ---------- oem/oracle/launch-instance | 118 ---------------------------------- oem/oracle/upload-image | 75 --------------------- 4 files changed, 268 deletions(-) delete mode 100644 oem/oracle/common.sh delete mode 100755 oem/oracle/get-console-output delete mode 100755 oem/oracle/launch-instance delete mode 100755 oem/oracle/upload-image diff --git a/oem/oracle/common.sh b/oem/oracle/common.sh deleted file mode 100644 index 36c4a6a16a..0000000000 --- a/oem/oracle/common.sh +++ /dev/null @@ -1,40 +0,0 @@ -# Get the tenancy ID, which is also the ID of the root compartment. -# Unconditionally uses the first profile in the conffile. -get_tenancy_id() { - local line=$(grep -m 1 "^tenancy=" "$HOME/.oraclebmc/config") - echo "${line#*=}" -} - -# Pick an availability domain by listing them and choosing the first one. -get_availability_domain() { - local compartment="$1" - bmcs iam availability-domain list \ - -c "${compartment}" | jq -r ".data[0].name" -} - -# Pick a subnet ID by picking the first VCN and then the first subnet in the -# specified availability domain. -get_subnet_id() { - local compartment="$1" - local availability_domain="$2" - local vcn=$(bmcs network vcn list \ - -c "${compartment}" | jq -r ".data[0].id") - bmcs network subnet list \ - -c "${compartment}" \ - --vcn-id "${vcn}" | jq -r ".data[] | select(.[\"availability-domain\"] == \"${availability_domain}\").id" -} - -# Get the object storage namespace ID. -get_namespace_id() { - bmcs os ns get | jq -r ".data" -} - -# Get the ID of some arbitrary image. Useful for iPXE boot, which requires -# an image ID but doesn't seem to use it. -get_an_image_id() { - local compartment="$1" - bmcs compute image list \ - -c "${compartment}" \ - --operating-system "CentOS" \ - --operating-system-version 7 | jq -r '.data[0].id' -} diff --git a/oem/oracle/get-console-output b/oem/oracle/get-console-output deleted file mode 100755 index c18ffccf0b..0000000000 --- a/oem/oracle/get-console-output +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -set -e -o pipefail - -# Parse args -usage="Usage: $0 [args] -i instance-id -Options: - -i INSTANCE-ID Instance ID - -h This ;-) -" -while getopts "i:h" OPTION -do - case "${OPTION}" in - i) instance_id="${OPTARG}" ;; - h) echo "${usage}"; exit 2 ;; - *) exit 2 ;; - esac -done - -if [[ -z "${instance_id}" ]]; then - echo "Instance ID is required." >&2 - exit 2 -fi - -id=$(bmcs compute console-history capture --instance-id "${instance_id}" | jq -r .data.id) -trap 'bmcs compute console-history delete --instance-console-history-id "${id}" --force' EXIT -while true; do - state=$(bmcs compute console-history get --instance-console-history-id "${id}" | jq -r '.data["lifecycle-state"]') - if [[ "${state}" = SUCCEEDED ]]; then - break - fi - sleep 1 -done -# Default length is 10 KB; maximum is 1 MB. Request at least that much. -bmcs compute console-history get-content --instance-console-history-id "${id}" --file - --length 2000000 diff --git a/oem/oracle/launch-instance b/oem/oracle/launch-instance deleted file mode 100755 index 804ffe0786..0000000000 --- a/oem/oracle/launch-instance +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash - -set -e -o pipefail - -. common.sh - -# Initialize vars -compartment=$(get_tenancy_id) -availability_domain=$(get_availability_domain "${compartment}") -image_id=$(get_an_image_id "${compartment}") -subnet_id=$(get_subnet_id "${compartment}" "${availability_domain}") -name= -shape="VM.Standard1.1" -ipxe=0 -ignition= -keyfile="$HOME/.ssh/id_rsa.pub" -baseurl="http://alpha.release.core-os.net/amd64-usr/current" -bucket_base="users.developer.core-os.net/$USER/bmcs" -kargs= - -if [[ ! -f "$keyfile" ]]; then - keyfile="" -fi - -# Parse args -usage="Usage: $0 [args] -n name -Options: - -c COMPARTMENT Compartment ID (default: ${compartment}) - -a AVAIL-DOMAIN Availability domain ID (default: ${availability_domain}) - -n NAME Instance name - -s SHAPE Instance shape (default: ${shape}) - -S SUBNET-ID Subnet ID to use (default: ${subnet_id}) - -i IGNITION Path to Ignition config - -A SSH-KEYS Path to SSH keys (default: ${keyfile}) - -p Boot with iPXE - -I IMAGE-ID Image ID to use; only relevant for non-iPXE (default: ${image_id}) - -b BASEURL URL to the image mirror; only relevant for iPXE (default: ${baseurl}) - -B BUCKET-BASE GS bucket and relative path for iPXE script (default: ${bucket_base}) - -k ARGS Additional kernel command line arguments for iPXE script - -h This ;-) -" -while getopts "c:a:n:s:S:i:A:pI:b:B:k:h" OPTION -do - case "${OPTION}" in - c) compartment="${OPTARG}" ;; - a) availability_domain="${OPTARG}" ;; - n) name="${OPTARG}" ;; - s) shape="${OPTARG}" ;; - S) subnet_id="${OPTARG}" ;; - i) ignition="${OPTARG}" ;; - A) keyfile="${OPTARG}" ;; - p) ipxe=1 ;; - I) image_id="${OPTARG}" ;; - b) baseurl="${OPTARG}" ;; - B) bucket_base="${OPTARG}" ;; - k) kargs="${OPTARG}" ;; - h) echo "${usage}"; exit 2 ;; - *) exit 2 ;; - esac -done - -if [[ -z "${name}" ]]; then - echo "Instance name is required." >&2 - exit 2 -fi - -launch_args=() - -if [[ "${ipxe}" = 1 ]]; then - # Make scratch dir - tmpdir=$(mktemp -d bmcs-XXXXXX) - trap "rm -rf '${tmpdir}'" EXIT - - if [[ -n "${ignition}" ]]; then - # Generate OEM image - mkdir -p "${tmpdir}/usr/share/oem" - cp "${ignition}" "${tmpdir}/usr/share/oem/ign.ign" - pushd "${tmpdir}" >/dev/null - find usr | cpio -o -H newc --quiet | gzip -c > oem.cpio.gz - popd >/dev/null - - # Upload it. Don't delete it afterward, since the instance could - # reboot at any point and need the OEM image again. - oempath="${bucket_base}/$(mktemp -u XXXXXXX)" - gsutil -q cp "${tmpdir}/oem.cpio.gz" "gs://${oempath}" - - ignition_initrd_args="initrd=ignition coreos.config.url=oem:///ign.ign" - ignition_initrd_cmd="initrd --name ignition http://${oempath}" - fi - - # Create iPXE script - cat >"${tmpdir}/ipxe" <&2 - exit 2 -fi - -if [[ -z "${path}" ]]; then - echo "Image file is required." >&2 - exit 2 -fi - -object=$(mktemp -u XXXXXXXXXXXXXXXX) - -# Upload object -bmcs os object put \ - --namespace "${namespace}" \ - --bucket-name "${bucket}" \ - --file "${path}" \ - --name "${object}" -trap 'bmcs os object delete \ - --namespace "${namespace}" \ - --bucket-name "${bucket}" \ - --name "${object}" \ - --force' EXIT - -# Initiate import -image_id=$(bmcs compute image import from-object \ - --compartment-id "${compartment}" \ - --display-name "${display_name}" \ - --namespace "${namespace}" \ - --bucket-name "${bucket}" \ - --name "${object}" | jq -r .data.id) - -# Wait for import -echo "Waiting for import..." -state=IMPORTING -while [[ "$state" = IMPORTING ]]; do - sleep 10 - state=$(bmcs compute image get --image-id "${image_id}" | jq -r '.data["lifecycle-state"]') -done -echo "${state} ${image_id}"