Skip to content

Commit 6796475

Browse files
authored
Merge pull request #1718 from shiftstack/gce-image
🌱 ci: Several CI fixes
2 parents 6ca0be6 + 575dae0 commit 6796475

File tree

5 files changed

+20
-50
lines changed

5 files changed

+20
-50
lines changed

hack/ci/create_devstack.sh

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,32 +77,26 @@ function retry {
7777
function ensure_openstack_client {
7878
if ! command -v openstack;
7979
then
80-
# We are running in a Debian Buster image with python 3.7. Python 3.7
81-
# is starting to show its age in upstream support. Ideally we would
82-
# move to a newer image with a newer python version.
83-
#
84-
# Until then, this script tries to carefully navigate around current
85-
# issues running openstack client on python 3.7.
86-
#
87-
# We explicitly pin the yoga version of openstackclient. This is the
88-
# last version of openstackclient which will support python 3.7.
89-
9080
# Install virtualenv to install the openstack client and curl to fetch
9181
# the build constraints.
9282
apt-get install -y python3-virtualenv curl
9383
python3 -m virtualenv -p $(which python3) /tmp/openstack-venv
9484
VIRTUAL_ENV_DISABLE_PROMPT=1 source /tmp/openstack-venv/bin/activate
9585

96-
# openstackclient has never actually supported python 3.7, only 3.6 and
97-
# 3.8. Here we download the yoga constraints file and modify all the
98-
# 3.8 constraints to be 3.7 constraints.
99-
curl -L https://releases.openstack.org/constraints/upper/yoga -o /tmp/yoga-constraints
100-
sed -i "s/python_version=='3.8'/python_version=='3.7'/" /tmp/yoga-constraints
86+
# We explicitly pin to the stable branch version of openstackclient.
87+
curl -L https://releases.openstack.org/constraints/upper/${OPENSTACK_RELEASE} -o /tmp/openstack-constraints
88+
89+
# Hack for yoga only: wrapt <1.14 doesn't support python 3.11
90+
[ "${OPENSTACK_RELEASE}" == "yoga" ] || exit 1 # Delete this hack
91+
sed -i "s/^wrapt===1\.13.*/wrapt===1.14.1/" /tmp/openstack-constraints
10192

102-
pip install -c /tmp/yoga-constraints \
93+
pip install -c /tmp/openstack-constraints \
10394
python-openstackclient python-cinderclient \
10495
python-glanceclient python-keystoneclient \
10596
python-neutronclient python-novaclient python-octaviaclient
97+
98+
# Ensure openstack cli can load fully including all plugins
99+
openstack help >/dev/null
106100
fi
107101
}
108102

hack/ci/gce-project.sh

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,37 +85,17 @@ function create_vm {
8585
local machine_type="GCP_MACHINE_TYPE_${name}"
8686
machine_type=${!machine_type}
8787
local servername="${CLUSTER_NAME}-${name}"
88-
local diskname="${CLUSTER_NAME}-disk"
89-
local imagename="${servername}-image"
9088

9189
# Loop over all zones in the GCP region to ignore a full zone.
9290
# We are not able to use 'gcloud compute zones list' as the gcloud.compute.zones.list permission is missing.
9391
for GCP_ZONE in "${GCP_REGION}-a" "${GCP_REGION}-b" "${GCP_REGION}-c"; do
94-
# Check if image was already created.
95-
# Images are not zone specific, but the disk is.
96-
if ! gcloud compute images describe "$imagename" --project "$GCP_PROJECT" >/dev/null; then
97-
# Create the base disk image based on the public Ubuntu 22.04 LTS cloud image
98-
# Note that this has also been verified to work with CentOS 8 as of
99-
# 2021-01-12, but this is not tested regularly.
100-
# To use CentOS 8:
101-
# --image-project centos-cloud --image-family centos-stream-8
102-
if ! gcloud compute disks describe "$diskname" --project "$GCP_PROJECT" --zone "$GCP_ZONE" >/dev/null; then
103-
gcloud compute disks create "$diskname" \
104-
--project "$GCP_PROJECT" \
105-
--image-project ubuntu-os-cloud --image-family ubuntu-2204-lts \
106-
--zone "$GCP_ZONE"
107-
fi
108-
gcloud compute images create "$imagename" \
109-
--project "$GCP_PROJECT" \
110-
--source-disk "$diskname" --source-disk-zone "$GCP_ZONE" \
111-
--licenses "https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"
112-
fi
113-
11492
if ! gcloud compute instances describe "$servername" --project "$GCP_PROJECT" --zone "$GCP_ZONE" >/dev/null; then
11593
if gcloud compute instances create "$servername" \
11694
--project "$GCP_PROJECT" \
11795
--zone "$GCP_ZONE" \
118-
--image "$imagename" \
96+
--enable-nested-virtualization \
97+
--image-project ubuntu-os-cloud \
98+
--image-family ubuntu-2004-lts \
11999
--boot-disk-size 200G \
120100
--boot-disk-type pd-ssd \
121101
--can-ip-forward \

hack/ensure-kubectl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ verify_kubectl_version() {
4040
fi
4141

4242
local kubectl_version
43-
IFS=" " read -ra kubectl_version <<< "$(kubectl version --client --short)"
43+
IFS=" " read -ra kubectl_version <<< "$(kubectl version --client)"
4444
if [[ "${MINIMUM_KUBECTL_VERSION}" != $(echo -e "${MINIMUM_KUBECTL_VERSION}\n${kubectl_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) ]]; then
4545
cat <<EOF
4646
Detected kubectl version: ${kubectl_version[2]}.

scripts/ci-conformance.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ cleanup() {
4545
}
4646
trap cleanup EXIT
4747

48-
# Ensure that python3-pip is installed.
4948
apt-get update -y
50-
apt-get install -y python3-pip
49+
# Install requests module explicitly for HTTP calls.
50+
# libffi required for pip install cffi (yoga dependency)
51+
apt-get install -y python3-requests libffi-dev
5152
rm -rf /var/lib/apt/lists/*
5253

53-
# Install/upgrade pip and requests module explicitly for HTTP calls.
54-
python3 -m pip install --upgrade pip requests
55-
5654
# If BOSKOS_HOST is set then acquire a resource of type ${RESOURCE_TYPE} from Boskos.
5755
if [ -n "${BOSKOS_HOST:-}" ]; then
5856
# Check out the account from Boskos and store the produced environment

scripts/ci-e2e.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,12 @@ cleanup() {
4646
}
4747
trap cleanup EXIT
4848

49-
# Ensure that python3-pip is installed.
5049
apt-get update -y
51-
apt-get install -y python3-pip
50+
# Install requests module explicitly for HTTP calls.
51+
# libffi required for pip install cffi (yoga dependency)
52+
apt-get install -y python3-requests libffi-dev
5253
rm -rf /var/lib/apt/lists/*
5354

54-
# Install/upgrade pip and requests module explicitly for HTTP calls.
55-
python3 -m pip install --upgrade pip requests
56-
5755
# If BOSKOS_HOST is set then acquire a resource of type ${RESOURCE_TYPE} from Boskos.
5856
if [ -n "${BOSKOS_HOST:-}" ]; then
5957
# Check out the account from Boskos and store the produced environment

0 commit comments

Comments
 (0)