distro_test #5335
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: distro_test | |
on: | |
push: | |
paths-ignore: | |
- 'docs/**' | |
pull_request: | |
# Run the functional tests every 8 hours. | |
# This will help to identify faster if | |
# there is a CI failure related to a | |
# change in any dependency. | |
schedule: | |
- cron: '0 */8 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [3.9] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Update package manager first, the runner could reference stale repos | |
run: sudo apt-get update -y | |
- name: Remove any existing podman installation | |
run: | | |
sudo apt remove podman -y | |
sudo apt autoclean && sudo apt autoremove | |
- name: Build kubeinit/kubeinit container | |
run: docker build -t kubeinit/kubeinit . | |
- name: Setup ssh | |
run: | | |
ssh-keygen -t rsa -b 4096 -N '' -C "distro_test $(whoami)@$(hostname)" -f ~/.ssh/id_rsa | |
cat ~/.ssh/id_rsa.pub | tee -a ~/.ssh/authorized_keys | |
chmod 600 ~/.ssh/authorized_keys | |
- name: Mimic behavior of using kubeinit/kubeinit container to perform kubeinit setup | |
run: | | |
ssh-keygen -t rsa -b 4096 -N '' -C "kubeinit-setup $(whoami)@$(hostname)" -f ~/.ssh/kubeinit_id_rsa | |
cat ~/.ssh/kubeinit_id_rsa.pub | tee -a ~/.ssh/authorized_keys | |
sudo su <<EOF | |
cat $HOME/.ssh/kubeinit_id_rsa.pub | tee -a ~/.ssh/authorized_keys | |
EOF | |
echo "Host nyctea" > ~/.ssh/config | |
echo " Hostname $(hostname)" >> ~/.ssh/config | |
echo " IdentityFile ~/.ssh/kubeinit_id_rsa" >> ~/.ssh/config | |
echo " UserKnownHostsFile /dev/null" >> ~/.ssh/config | |
echo " StrictHostKeyChecking accept-new" >> ~/.ssh/config | |
- name: Run a deployment from the kubeinit/kubeinit container | |
run: | | |
mkdir ~/.ssh/secrets | |
cp ~/.ssh/kubeinit_id_rsa ~/.ssh/secrets/kubeinit-ssh-key | |
sudo chown -R 1001:0 ~/.ssh/secrets | |
{ | |
docker run \ | |
--name=kubeinit_ci_job \ | |
--oom-kill-disable \ | |
--memory=20g \ | |
--cpus=".5" \ | |
--memory-swap=-1 \ | |
--rm \ | |
--network host \ | |
--volume ~/.ssh/secrets:/run/secrets:ro \ | |
kubeinit/kubeinit:latest \ | |
-v \ | |
--user root \ | |
-e hypervisor_hosts_spec="[{'host':'hypervisor-01','ansible_host':'nyctea','ssh_hostname':$(hostname)}]" \ | |
-e kubeinit_spec=k8s-libvirt-1-0-1-c \ | |
-e kubeinit_stop_after_task='task-create-network' \ | |
-e kubeinit_libvirt_create_cloud_user=true \ | |
-e kubeinit_hosted_deployment=true \ | |
-e kubeinit_ignore_validation_checks=true \ | |
-i kubeinit/inventory.yml \ | |
kubeinit/playbook.yml | |
} || { | |
docker ps -a | |
docker inspect kubeinit_ci_job | |
exit 1 | |
} |