Skip to content

default-kitchen

default-kitchen #140

---
name: default-kitchen
on:
push:
pull_request:
workflow_dispatch:
schedule: # run weekly, every Wednesday 06:00
- cron: '0 6 * * 3'
permissions: {}
jobs:
build:
permissions:
contents: read
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
include:
- distribution: ubuntu
version: '22.04'
version2: 2204
suite: default
experimental: true
- distribution: ubuntu
version: '20.04'
version2: 2004
suite: default
experimental: false
env:
ANSIBLE_CALLBACKS_ENABLED: profile_tasks
ANSIBLE_EXTRA_VARS: ""
ANSIBLE_ROLE: juju4.remnux
steps:
- uses: actions/checkout@v4
with:
path: ${{ env.ANSIBLE_ROLE }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install ansible-lint flake8 yamllint
which ansible
pip3 install ansible
pip3 show ansible
ls -l $HOME/.local/bin || true
ls -l /opt/hostedtoolcache/Python/3.9.1/x64/bin || true
echo "/opt/hostedtoolcache/Python/3.9.1/x64/bin" >> $GITHUB_PATH
which ansible
ansible --version
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE
[ -f get-dependencies.sh ] && sh -x get-dependencies.sh
{ echo '[defaults]'; echo 'callbacks_enabled = profile_tasks, timer'; echo 'roles_path = ../'; echo 'ansible_python_interpreter: /usr/bin/python3'; } >> ansible.cfg
- name: Environment
run: |
pwd
env
find -ls
- name: Install lxd requirements
run: |
set -x
sudo apt-get update -qq
sudo apt-get -y install acl dnsmasq-base zfsutils-linux -q
sudo snap install lxd
whoami
grep lxd /etc/group
echo "# remote list"
lxc remote list
echo "# image list"
sudo lxc image list
echo "# download image"
[ ${{ matrix.distribution }} == ubuntu ] || sudo lxc image copy images:${{ matrix.distribution }}/${{ matrix.version }}/amd64 local: --alias=${{ matrix.distribution }}-${{ matrix.version }}-nossh || true
[ ${{ matrix.distribution }} == ubuntu ] && sudo lxc image copy ubuntu:${{ matrix.version }} local: --alias=${{ matrix.distribution }}-${{ matrix.version }} || true
echo "# image list"
sudo lxc image list
## configure network
ifconfig -a || true
ip addr || true
sudo lxc info
sudo lxc network list
sudo lxc network create lxdbr0
sudo lxc network show lxdbr0
sudo lxc network attach-profile lxdbr0 default ens4
sudo lxc profile device get default ens4 nictype || true
sudo service lxd restart || true
ps ax | grep dnsmasq
systemctl status -l --no-pager lxd || true
cat /etc/network/interfaces.d/50-cloud-init.cfg || true
sudo lxc network list
# configure storage pool
sudo lxc storage list
sudo lxc storage create pool1 zfs
sudo lxc storage list
sudo zpool list
sudo lxc profile device add default root disk path=/ pool=pool1
sudo lxc profile show default
[ "X${{ matrix.distribution }}" == "Xcentos" ] && cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE && sudo sh -x ./test/lxd/centos-ssh-image.sh ${{ matrix.version }} || true
- name: Install kitchen requirements
run: |
sudo gem install test-kitchen --version "=1.25.0"
sudo gem install kitchen-ansible
sudo gem install kitchen-sync
sudo gem install kitchen-lxd_cli
sudo apt-get install -y libsodium23
sudo gem install rbnacl --version 4.0.2
sudo gem install bcrypt_pbkdf rbnacl-libsodium
sudo -H ssh-keygen -t ed25519 -f /root/.ssh/id_rsa -P ""
sudo ls -lA /root/.ssh/
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE && sudo kitchen diagnose --all
# https://github.com/actionshub/test-kitchen
- name: Install Chef
uses: actionshub/chef-install@main
- name: Kitchen Converge
run: |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE && sudo kitchen converge ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -l debug
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: $GITHUB_WORKSPACE/$ANSIBLE_ROLE/.kitchen.yml
TERM: xterm-256color
- name: Kitchen Verify
run: |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE && sudo kitchen verify ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }}
env:
CHEF_LICENSE: accept-no-persist
KITCHEN_LOCAL_YAML: $GITHUB_WORKSPACE/$ANSIBLE_ROLE/.kitchen.yml
TERM: xterm-256color
- name: On failure
run: |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ansible -i inventory --connection=local -m setup localhost' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'systemctl -l --no-pager status' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'systemctl -l --no-pager --failed' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ls -l /usr/bin/ | egrep "(python|pip|ansible)"' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'pip freeze' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'pip3 freeze' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ip addr' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'cat /etc/resolv.conf' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'host www.google.com' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ping -c 1 www.google.com' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ping -c 1 8.8.8.8' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'curl -v https://www.google.com > /dev/null' || true
if: ${{ failure() }}
continue-on-error: true
- name: After script - python
run: |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE
set -x
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'which pip' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'pip freeze' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'which pip3' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'pip3 install pipdeptree' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'pip3 freeze' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'pipdeptree -r' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c '/usr/local/env-remnux/bin/python --version' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c '/usr/local/env-remnux/bin/pip install pipdeptree' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c '/usr/local/env-remnux/bin/pipdeptree -r' || true
if: ${{ always() }}
continue-on-error: true
- name: After script - files
run: |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ls -lA /home/remnux' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ls -lA /home/remnux/Desktop' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ls -lA /usr/local/bin'
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ls -lA /usr/share/remnux'
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ls -lA /usr/local/env-remnux' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ls -lA /usr/local/env-remnux/bin' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ls -lA /usr/local/env-remnux/local/bin' || true
if: ${{ always() }}
continue-on-error: true
- name: After script - logs
run: |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'tail -100 /var/log/syslog'
if: ${{ always() }}
continue-on-error: true
- name: After script - apt
run: |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'dpkg -l | grep remnux' || true
if: ${{ always() }}
continue-on-error: true
- name: After script - system
run: |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'netstat -anp' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'ss -nlp' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'systemctl -l --no-pager status apache2' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'systemctl -l --no-pager status httpd' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'systemctl -l --no-pager status httpd-init' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'systemctl -l --no-pager status'
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'journalctl -xe --no-pager'
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'cat /etc/locale.conf'
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'localectl status'
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'localectl --no-pager list-locales'
if: ${{ always() }}
continue-on-error: true
- name: After script - docker
run: |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'docker image ls' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'docker run --rm -it remnux/radare2 r2 -v' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'docker run --rm -it remnux/thug cat /etc/hosts' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'docker run --rm -it remnux/thug cat /etc/resolv.conf' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'docker run --rm -it remnux/thug host www.google.com' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'docker run --rm -it remnux/thug ping localhost' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'docker run --rm -it remnux/thug ping www.google.com' || true
sudo kitchen exec ${{ matrix.suite }}-${{ matrix.distribution }}-${{ matrix.version2 }} -c 'docker run --rm -it -v /tmp:/tmp remnux/thug thug -FZM -u win7ie90 -w 10 -T 60 -n /tmp/thuglogdir -o /tmp/thuglog.txt "http://www.google.com"' || true
if: ${{ always() }}
continue-on-error: true