Galaxy CI #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Galaxy CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- 'roles/galaxy_post_install/**' | |
- 'roles/pulp_devel/tasks/galaxy_ui.yml' | |
- 'roles/pulp_webserver/files/**' | |
- '.github/workflows/galaxy_ci.yml' | |
- 'molecule/release-galaxy/**' | |
- 'molecule/source-galaxy/**' | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '15 2 * * *' | |
jobs: | |
molecule: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
test_type: ["source-galaxy", "release-galaxy"] | |
ansible: ["ansible-core"] | |
steps: | |
- uses: actions/checkout@v2.3.1 | |
- name: Configure the kernel to allow containers to talk to eachother | |
run: | | |
sudo sysctl net.bridge.bridge-nf-call-iptables=0 | |
sudo sysctl net.bridge.bridge-nf-call-arptables=0 | |
sudo sysctl net.bridge.bridge-nf-call-ip6tables=0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- name: Upgrade pip | |
run: | | |
pip install --upgrade pip | |
- name: Install LDAP requirements | |
run: sudo apt-get install -y libsasl2-dev python3-dev libldap2-dev libssl-dev build-essential | |
- name: Get pulpcore version (release) | |
if: matrix.test_type == 'release-galaxy' | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
pip install galaxy_ng | |
PULPCORE_VERSION=$(pip show pulpcore | sed -n -e "s/Version: //p") | |
echo "PULPCORE_VERSION=$PULPCORE_VERSION" | |
sed -i "s/PLACEHOLDER/$PULPCORE_VERSION/" molecule/release-galaxy/group_vars/all | |
deactivate | |
rm -rf venv | |
- name: Get pulpcore version (source) | |
if: matrix.test_type == 'source-galaxy' | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
pip install git+https://github.com/ansible/galaxy_ng.git | |
PULPCORE_VERSION=$(pip show pulpcore | sed -n -e "s/Version: //p") | |
echo "PULPCORE_VERSION=$PULPCORE_VERSION" | |
sed -i "s/PULPCORE_PLACEHOLDER/$PULPCORE_VERSION/" molecule/source-galaxy/group_vars/all | |
PULPANSIBLE_VERSION=$(pip show pulp_ansible | sed -n -e "s/Version: //p") | |
echo "PULPANSIBLE_VERSION=$PULPANSIBLE_VERSION" | |
sed -i "s/ANSIBLE_PLACEHOLDER/$PULPANSIBLE_VERSION/" molecule/source-galaxy/group_vars/all | |
PULPCONTAINER_VERSION=$(pip show pulp_container | sed -n -e "s/Version: //p") | |
echo "PULPCONTAINER_VERSION=$PULPCONTAINER_VERSION" | |
sed -i "s/CONTAINER_PLACEHOLDER/$PULPCONTAINER_VERSION/" molecule/source-galaxy/group_vars/all | |
IMPORTER_VERSION=$(pip show galaxy-importer | sed -n -e "s/Version: //p") | |
echo "IMPORTER_VERSION=v$IMPORTER_VERSION" | |
sed -i "s/IMPORTER_PLACEHOLDER/v$IMPORTER_VERSION/" molecule/source-galaxy/group_vars/all | |
deactivate | |
rm -rf venv | |
sed -i 's/localhost\/pulp/localhost\/api\/galaxy\/pulp/g' molecule/scenario_resources/tests/testinfra_default.py | |
- name: Install Ansible, Molecule & molecule-docker | |
run: | | |
sudo apt remove ansible | |
pip install docker molecule molecule-docker ${{ matrix.ansible }} | |
# Stable release 0.3.3 does not support Ansible 6 / ansible-core 2.13. | |
# Stable releases 0.2.z support Ansible 2.9, but not with collections support. | |
- name: Install mitogen (Ansible 2.10+) | |
if: matrix.ansible != 'ansible~=2.9.0' | |
run: | | |
cd .. | |
git clone https://github.com/mitogen-hq/mitogen.git | |
pip install ./mitogen | |
shell: bash | |
- name: Setting pulp.pulp_installer collection | |
# Downloading dependencies sometimes fails the 1st time, so retry | |
run: | | |
make vendor || make vendor | |
make install || make install | |
rm playbooks/resize_disk.yaml | |
ansible-galaxy collection install -p build/collections --force community.docker || | |
ansible-galaxy collection install -p build/collections --force community.docker | |
shell: bash | |
- name: Molecule dependency | |
# Downloading dependencies sometimes fails the 1st time | |
run: | | |
ansible --version | |
molecule dependency --scenario-name ${{ matrix.test_type }} | |
env: | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
shell: bash | |
- name: Molecule create & prepare | |
# Pulling images (for upgrades) sometimes fails the 1st time. | |
run: | | |
ansible --version | |
molecule create --scenario-name ${{ matrix.test_type }} || | |
molecule create --scenario-name ${{ matrix.test_type }} | |
env: | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
shell: bash | |
- name: Molecule converge | |
run: | | |
ansible --version | |
set +e | |
MITOGEN_LOCATION=$(pip show mitogen | grep Location | cut -f 2 -d " ") | |
set -e | |
if [ "$MITOGEN_LOCATION" != ""]; then | |
STRATEGY=mitogen_linear | |
MITOGEN_PATH=$MITOGEN_LOCATION/ansible_mitogen/plugins/strategy/ | |
else | |
STRATEGY=linear # The default | |
fi | |
ANSIBLE_STRATEGY=${STRATEGY} ANSIBLE_STRATEGY_PLUGINS=${MITOGEN_PATH} molecule converge --scenario-name ${{ matrix.test_type }} | |
env: | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
shell: bash | |
- name: Molecule idempotence | |
run: | | |
ansible --version | |
molecule idempotence --scenario-name ${{ matrix.test_type }} | |
env: | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
shell: bash | |
- name: Molecule verify | |
run: | | |
ansible --version | |
molecule verify --scenario-name ${{ matrix.test_type }} | |
env: | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
shell: bash |