microstack/tools/lxd_build.sh
Chris MacNaughton 902bd7c6c6 Migrate functional testing to third-parth CI
* enable running lint with the upstream linters job;
* Use numeric versions of OpenStack packages in the python-packages
  section of the openstack-projects part since the resolver change in
  recent versions of pip disallows for constraints dependencies of
  packages that come from a URL or a path.
  https://github.com/pypa/pip/issues/8210
  * The newest released version of pip is always used during builds
    since snapcraft uses venv to set up virtual environments and the
    ensurepip package is invoked such that a pip version shipped with
    the distro version of python is upgraded:
    https://github.com/python/cpython/blob/3.8/Lib/venv/__init__.py#L282-L289
          cmd = [context.env_exe, '-Im', 'ensurepip', '--upgrade',
                                                  '--default-pip']
  * Environment variables are ignored when pip is installed in the venv:
  https://docs.python.org/3/using/cmdline.html#id2 (-I option)
  So there is no way to use the old pip version resolver.

Change-Id: Id97dc7f14301ed0f6aed3e10f5c00e6dd7ac93d2
Co-Authored-By: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
2021-01-15 14:08:02 +03:00

33 lines
908 B
Bash
Executable File

#!/bin/bash
set -ex
export PATH=/snap/bin:$PATH
export http_proxy HTTP_PROXY https_proxy HTTPS_PROXY
sudo apt update
# install Firefox which will be used for Web UI testing in a headless mode.
sudo apt install -y firefox-geckodriver python3-petname python3-selenium
# Setup snapd and snapcraft
# Install snapd if it isn't installed yet (needed to install the snapd snap itself).
sudo apt install -y snapd
sudo snap install snapd
sudo snap install --classic snapcraft
# Purge the LXD apt package in case it is still there.
sudo apt purge -y lxd lxd-client
sudo snap install lxd
sudo usermod -a -G lxd ${USER}
# Since the current shell does not have the lxd group gid, use newgrp.
newgrp lxd << END
set -ex
lxd init --auto
snapcraft --use-lxd --http-proxy=$HTTP_PROXY --https-proxy=$HTTPS_PROXY
# Delete the build container to free the storage space on a test node.
lxc delete snapcraft-microstack
END