Skip to content

Commit

Permalink
fixes debug v1
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbazhenoff committed Apr 7, 2024
1 parent 818bdb4 commit 9d19979
Showing 1 changed file with 90 additions and 88 deletions.
178 changes: 90 additions & 88 deletions .github/workflows/ansible_molecule_teststing.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,92 @@
---
#name: Molecule Testsing
#on: # yamllint disable-line rule:truthy
# push: null
# pull_request:
# branches:
# - main
# - master
#permissions: read-all
#
#concurrency:
# group: >-
# ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
# cancel-in-progress: true
#
#env:
# PREINSTALL_MOLECULE_REQUIREMENTS: 'true'
# PREINSTALL_MOLECULE_REQUIREMENTS_YAML_PATH: roles/requirements.yml
# ANSIBLE_GALAXY_SERVER_TIMEOUT: 300
# ANSIBLE_GALAXY_SERVER: https://old-galaxy.ansible.com
## See: https://docs.ansible.com/ansible/latest/reference_appendices/config.html
#
#jobs:
# test_bareos:
# runs-on: ubuntu-latest
# container:
# image: ubuntu:latest
# volumes:
# - "/sys/fs/cgroup:/sys/fs/cgroup:rw"
# options: --privileged --cap-add SYS_ADMIN --security-opt apparmor=unconfined
# permissions:
# statuses: write
## strategy:
## fail-fast: false
## matrix:
## role:
## - bareos
## - something
# steps:
# - name: Install docker
# uses: papodaca/install-docker-action@v1
# - name: Install other apt packages
# run: apt-get install dbus-user-session systemd gnupg2 rsync dbus podman openssh-client openssh-server -y
# - name: Checkout
# uses: actions/checkout@v4
# - name: Install python
# uses: actions/setup-python@v5
# with:
# python-version: '3.10'
# - name: Install and configure Poetry
# uses: snok/install-poetry@v1
# with:
# virtualenvs-create: true
# virtualenvs-in-project: true
# - name: Poetry install dependecies
# run: |
# export PATH="/github/home/.local/bin:$PATH"
# ls -lha
# poetry install --no-root --no-cache --ansi --no-interaction
# - name: Show installed versions
# run: |
# poetry run python --version
# poetry --version || true
# ESC="$(printf "\033")"
# printf "Packages:\n%s\n \n" "$(poetry --ansi run pip list | sed -e "s/ /${ESC}[1;35m /g; s/$/${ESC}[0m/g")"
# # Use 'debug' word in commit message to debug molecule testing, use debug v[1..6] to enable verbose logging.
# - name: Molecule test
# shell: bash
# run: |
# systemctl is-system-running || true
# systemctl is-active docker || true
# ls -lha /proc/1/cgroup || true
# bash .github/workflows/docker_ps.sh &
# printf "[defaults]\nremote_tmp = /tmp/.ansible-\${USER}/tmp" > $HOME/.ansible.cfg
# DEBUG_OPT=$([[ "$COMMIT_MSG" =~ .(debug) ]] && echo "--debug")
# VERB_OPT=$([[ "$COMMIT_MSG" =~ .(debug).v([1-6]) ]] && (printf "-" && printf "%*s" ${COMMIT_MSG/*debug v/} | \
# tr ' ' 'v'))
# echo "DEBUG_OPT: $DEBUG_OPT"
# echo "VERB_OPT: $VERB_OPT"
# set -x
# if $PREINSTALL_MOLECULE_REQUIREMENTS && [[ -f "$PREINSTALL_MOLECULE_REQUIREMENTS_YAML_PATH" ]]; then
# poetry --ansi run ansible-galaxy install -r "$PREINSTALL_MOLECULE_REQUIREMENTS_YAML_PATH" $VERB_OPT
# fi
# cd roles/bareos
# poetry --ansi run molecule $DEBUG_OPT $VERB_OPT test
# env:
# PY_COLORS: '1'
# ANSIBLE_FORCE_COLOR: '1'
# COMMIT_MSG: ${{ github.event.head_commit.message }}
name: Molecule Testsing
on: # yamllint disable-line rule:truthy
push: null
pull_request:
branches:
- main
- master
permissions: read-all

concurrency:
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

env:
PREINSTALL_MOLECULE_REQUIREMENTS: 'true'
PREINSTALL_MOLECULE_REQUIREMENTS_YAML_PATH: roles/requirements.yml
ANSIBLE_GALAXY_SERVER_TIMEOUT: 300
ANSIBLE_GALAXY_SERVER: https://old-galaxy.ansible.com
# See: https://docs.ansible.com/ansible/latest/reference_appendices/config.html

jobs:
test_bareos:
runs-on: ubuntu-latest
container:
image: ubuntu:latest
volumes:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
options: --privileged --cap-add SYS_ADMIN --security-opt apparmor=unconfined
permissions:
statuses: write
# strategy:
# fail-fast: false
# matrix:
# role:
# - bareos
# - something
steps:
- name: Install docker
uses: papodaca/install-docker-action@v1
- name: Install other apt packages
run: |
apt-get install gcc libc-dev libffi-dev make musl-dev dbus-user-session systemd gnupg2 rsync dbus podman \
openssh-client openssh-server -y
- name: Checkout
uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Poetry install dependecies
run: |
export PATH="/github/home/.local/bin:$PATH"
ls -lha
poetry install --no-root --no-cache --ansi --no-interaction
- name: Show installed versions
run: |
poetry run python --version
poetry --version || true
ESC="$(printf "\033")"
printf "Packages:\n%s\n \n" "$(poetry --ansi run pip list | sed -e "s/ /${ESC}[1;35m /g; s/$/${ESC}[0m/g")"
# Use 'debug' word in commit message to debug molecule testing, use debug v[1..6] to enable verbose logging.
- name: Molecule test
shell: bash
run: |
systemctl is-system-running || true
systemctl is-active docker || true
ls -lha /proc/1/cgroup || true
bash .github/workflows/docker_ps.sh &
printf "[defaults]\nremote_tmp = /tmp/.ansible-\${USER}/tmp" > $HOME/.ansible.cfg
DEBUG_OPT=$([[ "$COMMIT_MSG" =~ .(debug) ]] && echo "--debug")
VERB_OPT=$([[ "$COMMIT_MSG" =~ .(debug).v([1-6]) ]] && (printf "-" && printf "%*s" ${COMMIT_MSG/*debug v/} | \
tr ' ' 'v'))
echo "DEBUG_OPT: $DEBUG_OPT"
echo "VERB_OPT: $VERB_OPT"
set -x
if $PREINSTALL_MOLECULE_REQUIREMENTS && [[ -f "$PREINSTALL_MOLECULE_REQUIREMENTS_YAML_PATH" ]]; then
poetry --ansi run ansible-galaxy install -r "$PREINSTALL_MOLECULE_REQUIREMENTS_YAML_PATH" $VERB_OPT
fi
cd roles/bareos
poetry --ansi run molecule $DEBUG_OPT $VERB_OPT test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
COMMIT_MSG: ${{ github.event.head_commit.message }}

0 comments on commit 9d19979

Please sign in to comment.