Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizing ado.sh #510

Merged
merged 20 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pr-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ parameters:
default: 'all'
values:
- 'all'
- 'sanity'
- "azure_rm_acs"
- "azure_rm_aduser"
- "azure_rm_aks"
Expand Down
2 changes: 1 addition & 1 deletion sanity-requirements-azure.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
voluptuous==0.11.7
pycodestyle==2.6.0
yamllint==1.24.2
pylint==2.5.3
cryptography==3.3.2
pylint==2.5.3
80 changes: 23 additions & 57 deletions tests/utils/ado/ado.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,87 +9,52 @@ group="${args[0]}"

command -v python
python -V

if [ "$2" = "2.7" ]
then
command -v pip
pip --version
pip list --disable-pip-version-check
echo "The specified environment is Python2.7"
else
if [ "$2" = "3.8" ]
then
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python"$2" -y
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
fi

command -v pip3
pip3 --version
pip3 list --disable-pip-version-check
alias pip='pip3'
sudo apt update
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you check if "$UID" -eq "0" here instead of always performing sudo? It would be nice to be able to run this easily from inside a Docker container

sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python"$2" -y
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python"$2" 1
fi

command -v pip
pip --version
pip list --disable-pip-version-check

export PATH="${PWD}/bin:${PATH}"
export PYTHONIOENCODING="UTF-8"
export LC_ALL="en_US.utf-8"

if [ "$2" = "2.7" ]
then
pip install virtualenv
virtualenv --python /usr/bin/python2.7 ~/ansible-venv
else
pip3 install virtualenv
virtualenv --python /usr/bin/python"$2" ~/ansible-venv
fi
pip install virtualenv
virtualenv --python /usr/bin/python"$2" ~/ansible-venv

set +ux
. ~/ansible-venv/bin/activate
set -ux

if [ "$2" = "2.7" ]
git clone https://github.com/ansible/ansible.git
cd "ansible"
if [ "$3" = "devel" ]
then
if [ "$3" = "devel" ]
then
pip install git+https://github.com/ansible/ansible.git@devel --disable-pip-version-check
else
git clone https://github.com/ansible/ansible.git
cd "ansible"
git checkout "stable-$3"
source hacking/env-setup
pip install paramiko PyYAML Jinja2 httplib2 six
fi
echo "The branch is devel"
else
if [ "$3" = "devel" ]
then
pip3 install git+https://github.com/ansible/ansible.git@devel --disable-pip-version-check
else
git clone https://github.com/ansible/ansible.git
cd "ansible"
git checkout "stable-$3"
source hacking/env-setup
pip3 install paramiko PyYAML Jinja2 httplib2 six
fi
git checkout "stable-$3"
fi
source hacking/env-setup
pip install paramiko PyYAML Jinja2 httplib2 six

TEST_DIR="${HOME}/.ansible/ansible_collections/azure/azcollection"
mkdir -p "${TEST_DIR}"
cp -aT "${SHIPPABLE_BUILD_DIR}" "${TEST_DIR}"
cd "${TEST_DIR}"
mkdir -p shippable/testresults

if [ "$2" = "2.7" ]
then
pip install --upgrade pip
pip install -I -r "${TEST_DIR}/requirements-azure.txt"
pip3 install setuptools
pip3 install -I -r "${TEST_DIR}/sanity-requirements-azure.txt"
pip3 list
else
pip3 install -I -r "${TEST_DIR}/requirements-azure.txt"
pip3 install -I -r "${TEST_DIR}/sanity-requirements-azure.txt"
pip3 list
fi
pip install -I -r "${TEST_DIR}/requirements-azure.txt"
pip install -I -r "${TEST_DIR}/sanity-requirements-azure.txt"

timeout=60

Expand All @@ -110,6 +75,7 @@ else
done
fi
echo '--------------------------------------------'
pip list
ansible --version
echo '--------------------------------------------'

Expand Down