Skip to content

Commit

Permalink
Optimizing ado.sh (#510)
Browse files Browse the repository at this point in the history
* check python version

* add new change

* ad new

* for test

* check python version

* update ado.sh

* add new change

* add new change

* Perfect the ado.sh

* fix sanity 2.7 error

* delete virtual env set

* fix small

* revert virtual env change

* fixing update account_enabled bug in azure_rm_aduser.py (#524)

* fixing ad related auth issue when using service pricinpal. (#525)

* change class name of azure_rm_aduser (#526)

* class are worngly named. fixed.

* fixing sanity errors.

Co-authored-by: haiyuan_zhang <haiyuan.zhang1982@gmail.com>
  • Loading branch information
Fred-sun and haiyuazhang authored May 13, 2021
1 parent b8e394d commit 25d7180
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 58 deletions.
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
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

0 comments on commit 25d7180

Please sign in to comment.