From 393504c8784dfde7b4eb682e898673cefc1290b8 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 12:30:17 -0700 Subject: [PATCH 01/46] use released version of centos images --- molecule/default/molecule.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index f3a6be1..6d3059c 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -13,10 +13,12 @@ platforms: image: docker.io/linuxsystemroles/centos-6 privileged: true - name: centos-7 - image: docker.io/linuxsystemroles/centos-7 + image: registry.centos.org/centos/systemd:latest volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro + command: /usr/sbin/init privileged: true + pre_build_image: true provisioner: name: ansible log: true From ce60fd9592f14a0a179907459245d24312986197 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 12:22:01 -0700 Subject: [PATCH 02/46] changes to gha tox.yml --- .github/workflows/tox.yml | 60 +++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 1e4f648..2615404 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -1,15 +1,63 @@ name: test with tox -on: +on: # yamllint disable-line rule:truthy - pull_request jobs: - build: + runtox: runs-on: ubuntu-latest + strategy: + matrix: + pyver: ['2.7', '3.6', '3.7', '3.8', '3.9'] steps: - name: checkout PR uses: actions/checkout@v2 - - name: Set up Python 3.8 + - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.8 - - name: Install dependencies - run: tox + python-version: ${{ matrix.pyver }} + - name: Install platform dependencies + run: | + set -euxo pipefail + .travis/preinstall + - name: Install pip, tox, python dependencies + run: | + set -euxo pipefail + python -m pip install --upgrade pip + pip install tox + - name: Run tox tests + run: | + set -euxo pipefail + .travis/runtox + env: + LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' + LSR_MSCENARIOS: default + runtox-py26: + runs-on: ubuntu-16.04 + steps: + - name: checkout PR + uses: actions/checkout@v2 + - name: Install python, dependencies + run: | + set -euo pipefail + curl -sSf --retry 5 -o python-2.6.tar.bz2 ${PY26URL} + sudo tar xjf python-2.6.tar.bz2 --directory / + source /home/travis/virtualenv/python2.6/bin/activate + set -x + python --version + pip --version + .travis/preinstall + sudo pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' + sudo pip list + env: + # yamllint disable-line rule:line-length + PY26URL: https://storage.googleapis.com/travis-ci-language-archives/python/binaries/ubuntu/14.04/x86_64/python-2.6.tar.bz2 + VIRTUAL_ENV_DISABLE_PROMPT: "true" + - name: Run tox tests + run: | + set -euo pipefail + source /home/travis/virtualenv/python2.6/bin/activate + set -x + .travis/runtox + env: + LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' + LSR_MSCENARIOS: default + VIRTUAL_ENV_DISABLE_PROMPT: "true" From a193cb93dc047c91707e99611f6467c78aed3f14 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 12:45:56 -0700 Subject: [PATCH 03/46] use tox-lsr --- .github/workflows/tox.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 2615404..511eecf 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -14,19 +14,17 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.pyver }} - - name: Install platform dependencies - run: | - set -euxo pipefail - .travis/preinstall - - name: Install pip, tox, python dependencies + - name: Install platform dependencies, python, tox, tox-lsr run: | set -euxo pipefail python -m pip install --upgrade pip - pip install tox + pip install tox configparser \ + git+https://github.com/linux-system-roles/tox-lsr@0.0.1 + lsr_travis_preinstall - name: Run tox tests run: | set -euxo pipefail - .travis/runtox + lsr_travis_runtox env: LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default From 9b4b9129150e3d5dcc6733db259f9762b6eec4fd Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 13:18:21 -0700 Subject: [PATCH 04/46] more --- .github/workflows/tox.yml | 4 +- molecule/default/molecule.yml | 6 +- tox.ini | 201 +--------------------------------- 3 files changed, 10 insertions(+), 201 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 511eecf..f9a9108 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -43,7 +43,9 @@ jobs: python --version pip --version .travis/preinstall - sudo pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' + sudo pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ + configparser \ + git+https://github.com/linux-system-roles/tox-lsr@0.0.1 sudo pip list env: # yamllint disable-line rule:line-length diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 6d3059c..8c5bee6 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -10,8 +10,12 @@ lint: config-file: .yamllint.yml platforms: - name: centos-6 - image: docker.io/linuxsystemroles/centos-6 + image: registry.centos.org/centos/centos:6 + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + command: /usr/sbin/init privileged: true + pre_build_image: true - name: centos-7 image: registry.centos.org/centos/systemd:latest volumes: diff --git a/tox.ini b/tox.ini index 6a220a4..703418d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,200 +1,3 @@ # SPDX-License-Identifier: MIT -[tox] -envlist = - black, pylint, flake8, yamllint - py{26,27,36,37,38}, - custom -skipsdist = true -skip_missing_interpreters = true - -[testenv] -passenv = * -basepython = python3 -changedir = {toxinidir}/tests -# List common dependencies for Python interpreters here: -setenv = - PYTHONPATH = {toxinidir}/library:{toxinidir}/module_utils - LC_ALL = C.UTF-8 - SRC_MODULE_UTILS_DIR = {envsitepackagesdir}/ansible/module_utils - DEST_MODULE_UTILS_DIR = {toxinidir}/module_utils -deps = - py{26,27,36,37,38}: pytest-cov - py{27,36,37,38}: pytest>=3.5.1 - py26: pytest - py{26,27,36,37,38}: -rpytest_extra_requirements.txt -whitelist_externals = - bash -commands = - bash {toxinidir}/.travis/runpytest.sh \ - --durations=5 \ - --cov={toxinidir}/library --cov={toxinidir}/module_utils \ - --cov-report=html:htmlcov-{envname} \ - --cov-report=term \ - {posargs} \ - unit - -[base] - -[testenv:py26] -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.6} -install_command = - pip install {opts} {packages} -list_dependencies_command = - pip freeze -basepython = python2.6 - -[testenv:py27] -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.7} -basepython = python2.7 - -[testenv:py36] -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.6} -basepython = python3.6 - -[testenv:py37] -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.7} -basepython = python3.7 - -[testenv:py38] -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.8} -basepython = python3.8 - -[testenv:black] -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:3.6} -basepython = python3.6 -passenv = RUN_BLACK_* -changedir = {toxinidir} -deps = - black -commands = - bash {toxinidir}/.travis/runblack.sh --check --diff . - -[testenv:pylint] -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.7} -basepython = python2.7 -passenv = RUN_PYLINT_* -changedir = {toxinidir} -deps = - ansible - colorama - pylint>=1.8.4 - -rpylint_extra_requirements.txt -commands = - bash {toxinidir}/.travis/runpylint.sh --errors-only {posargs} - -[testenv:flake8] -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.7} -basepython = python2.7 -passenv = RUN_FLAKE8_* -changedir = {toxinidir} -deps = - flake8>=3.5 -commands = - bash {toxinidir}/.travis/runflake8.sh {posargs} . - -[testenv:yamllint] -changedir = {toxinidir} -deps = yamllint -commands = yamllint . - -[testenv:coveralls] -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:coveralls} -passenv = TRAVIS TRAVIS_* -deps = - coveralls -commands = - bash {toxinidir}/.travis/runcoveralls.sh {posargs} - -[molecule_common] -changedir = {toxinidir} -deps = - ansible-lint==4.3.5 - {env:LSR_ANSIBLE_DEP:ansible} - docker - molecule<3 - selinux - wcwidth==0.1.9;python_version=="3.6" - -rmolecule_extra_requirements.txt -runsyspycmd = {toxinidir}/.travis/runsyspycmd.sh - -[testenv:molecule_version] -changedir = {[molecule_common]changedir} -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule} -deps = - {[molecule_common]deps} -commands = - bash {[molecule_common]runsyspycmd} molecule --version - bash {[molecule_common]runsyspycmd} ansible --version - -[testenv:molecule_lint] -changedir = {[molecule_common]changedir} -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule} -deps = - {[molecule_common]deps} -commands = - bash {[molecule_common]runsyspycmd} \ - molecule lint -s {env:LSR_MSCENARIO:default} {posargs} - -[testenv:molecule_syntax] -changedir = {[molecule_common]changedir} -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule} -deps = - {[molecule_common]deps} -commands = - bash {[molecule_common]runsyspycmd} \ - molecule syntax -s {env:LSR_MSCENARIO:default} {posargs} - -[testenv:molecule_test] -changedir = {[molecule_common]changedir} -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule} -deps = - {[molecule_common]deps} -commands = - bash {[molecule_common]runsyspycmd} \ - molecule test -s {env:LSR_MSCENARIO:default} {posargs} - -[testenv:molecule] -changedir = {[molecule_common]changedir} -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:molecule} -deps = - {[molecule_common]deps} -commands = - {[testenv:molecule_version]commands} - {[testenv:molecule_lint]commands} - {[testenv:molecule_syntax]commands} - {[testenv:molecule_test]commands} - -[testenv:custom] -changedir = {toxinidir} -envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:custom} -deps = - -rcustom_requirements.txt -commands = - bash {toxinidir}/.travis/custom.sh - -[pytest] -addopts = -rxs - -[flake8] -show_source = true -max-line-length = 88 -ignore = E402,W503 -exclude = .venv,.tox -statistics = true -#verbose = 3 - -[pylint] -max-line-length = 88 -disable = wrong-import-position - -[pycodestyle] -max-line-length = 88 - -[travis] -python = - 2.6: py26,coveralls,custom - 2.7: py27,coveralls,flake8,pylint,custom - 3.6: py36,coveralls,black,yamllint,custom - 3.7: py37,coveralls,custom - 3.8: py38,coveralls,custom - 3.8-dev: py38,coveralls,custom +[lsr_config] +lsr_enable = true From 4c5b8acb3fc1d6c07568837302f3e92f1e54af95 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 13:29:08 -0700 Subject: [PATCH 05/46] more --- .travis/config.sh | 49 ---------- .travis/custom.sh | 12 --- .travis/custom_pylint.py | 171 --------------------------------- .travis/preinstall | 35 ------- .travis/runblack.sh | 68 ------------- .travis/runcoveralls.sh | 95 ------------------- .travis/runflake8.sh | 31 ------ .travis/runpylint.sh | 38 -------- .travis/runpytest.sh | 66 ------------- .travis/runsyspycmd.sh | 29 ------ .travis/runtox | 45 --------- .travis/utils.sh | 199 --------------------------------------- tox.ini | 3 + 13 files changed, 3 insertions(+), 838 deletions(-) delete mode 100644 .travis/config.sh delete mode 100755 .travis/custom.sh delete mode 100644 .travis/custom_pylint.py delete mode 100755 .travis/preinstall delete mode 100755 .travis/runblack.sh delete mode 100755 .travis/runcoveralls.sh delete mode 100755 .travis/runflake8.sh delete mode 100755 .travis/runpylint.sh delete mode 100755 .travis/runpytest.sh delete mode 100755 .travis/runsyspycmd.sh delete mode 100755 .travis/runtox delete mode 100644 .travis/utils.sh diff --git a/.travis/config.sh b/.travis/config.sh deleted file mode 100644 index 7917d09..0000000 --- a/.travis/config.sh +++ /dev/null @@ -1,49 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Use this file to specify custom configuration for a project. Generally, this -# involves the modification of the content of LSR_* environment variables, see -# -# * .travis/preinstall: -# -# - LSR_EXTRA_PACKAGES -# -# * .travis/runtox: -# -# - LSR_ANSIBLES -# - LSR_MSCENARIOS -# -# * .travis/runcoveralls.sh: -# -# - LSR_PUBLISH_COVERAGE -# - LSR_TESTSDIR -# - function lsr_runcoveralls_hook -# -# Environment variables that not start with LSR_* but have influence on CI -# process: -# -# * .travis/runpylint.sh: -# -# - RUN_PYLINT_INCLUDE -# - RUN_PYLINT_EXCLUDE -# - RUN_PYLINT_DISABLED -# - RUN_PYLINT_SETUP_MODULE_UTILS -# -# * .travis/runblack.sh: -# -# - RUN_BLACK_INCLUDE -# - RUN_BLACK_EXCLUDE -# - RUN_BLACK_DISABLED -# - RUN_BLACK_EXTRA_ARGS -# -# * .travis/runflake8.sh: -# -# - RUN_FLAKE8_DISABLED -# - RUN_FLAKE8_EXTRA_ARGS -# -# * .travis/runsyspycmd.sh: -# -# - function lsr_runsyspycmd_hook -# -# * .travis/runpytest.sh: -# -# - RUN_PYTEST_SETUP_MODULE_UTILS diff --git a/.travis/custom.sh b/.travis/custom.sh deleted file mode 100755 index b8d9205..0000000 --- a/.travis/custom.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: MIT - -set -e - -ME=$(basename $0) -SCRIPTDIR=$(readlink -f $(dirname $0)) - -. ${SCRIPTDIR}/utils.sh -. ${SCRIPTDIR}/config.sh - -# Write your custom commands here that should be run when `tox -e custom`: diff --git a/.travis/custom_pylint.py b/.travis/custom_pylint.py deleted file mode 100644 index f45679b..0000000 --- a/.travis/custom_pylint.py +++ /dev/null @@ -1,171 +0,0 @@ -# -*- coding: utf-8 -*- -# SPDX-License-Identifier: MIT -# -# Copyright (c) 2019-2020 Red Hat, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# -""" -Probe directory tree for python files and pass them to pylint. - -Usage: python custom_pylint.py ARGUMENTS - -Run pylint with ARGUMENTS followed by the list of python files contained in the -working directory and its subdirectories. As a python file is recognized a -file that match INCPAT. Files and directories that match EXPAT are skipped. -Symbolic links are also skipped. It is assumed that files to be pylinted are -specified only with INCPAT and EXPAT. - -There are several cases when argument from ARGUMENTS is not passed to pylint -but it is handled by run_pylint.py instead: - - 1. if -h or --help is contained in ARGUMENTS, this help screen is printed to - the standard output and run_pylint.py exits with 0; - 2. if --include followed by a PATTERN is contained in ARGUMENTS, the PATTERN - is used instead of INCPAT to recognize whether the file is a python file - or not; - 3. if --exclude followed by a PATTERN is contained in ARGUMENTS, the PATTERN - is used instead of EXPAT to recognize whether the file or directory should - be skipped. - -Exclusion takes a priority over inclusion, i.e. if a file or directory can be -both included and excluded, it is excluded. - -The default value of INCPAT is .*\\.py[iw]?$. For EXPAT, it is ^\\..*. - -Environment variables: - - RUN_PYLINT_INCLUDE - overrides default value of INCPAT; - - RUN_PYLINT_EXCLUDE - overrides default value of EXPAT; - - RUN_PYLINT_DISABLED - if set to an arbitrary non-empty value, pylint will be not executed -""" - -import os -import re -import sys - -from colorama import Fore -from pylint.lint import Run - - -def blue(s): - """ - Return string `s` colorized to blue. - """ - - return "%s%s%s" % (Fore.BLUE, s, Fore.RESET) - - -def print_line(s): - """ - Write `s` followed by the line feed character to the standard output. - """ - - sys.stdout.write("%s\n" % s) - - -def probe_args(): - """ - Analyze the command line arguments and return a tuple containing a list of - pylint arguments, pattern string to recognize files to be included, and - pattern string to recognize files and directories to be skipped. - - Default values of pattern strings are taken from RUN_PYLINT_INCLUDE and - RUN_PYLINT_EXCLUDE environment variables. In the case they are not defined, - .*\\.py[iw]?$ and ^\\..* are used, respectively. - """ - - args = [] - include_pattern = os.getenv("RUN_PYLINT_INCLUDE", r".*\.py[iw]?$") - exclude_pattern = os.getenv("RUN_PYLINT_EXCLUDE", r"^\..*") - i, nargs = 1, len(sys.argv) - while i < nargs: - arg = sys.argv[i] - if arg == "--include": - i += 1 - assert i < nargs, "--include: missing PATTERN" - include_pattern = sys.argv[i] - elif arg == "--exclude": - i += 1 - assert i < nargs, "--exclude: missing PATTERN" - exclude_pattern = sys.argv[i] - else: - args.append(arg) - i += 1 - return args, include_pattern, exclude_pattern - - -def probe_dir(path, include_re, exclude_re): - """ - Recursively go through directory structure starting at `path`, collect - files that match `include_re`, skip files and directories that are either - symbolic links or match `exclude_re`. Return the list of collected files. - """ - - files = [] - for direntry in os.listdir(path): - fullpath = os.path.join(path, direntry) - if os.path.islink(fullpath) or exclude_re.match(direntry): - continue - elif os.path.isdir(fullpath): - files.extend(probe_dir(fullpath, include_re, exclude_re)) - elif os.path.isfile(fullpath) and include_re.match(direntry): - files.append(fullpath) - return files - - -def show_files(files): - """ - Print `files` to the standard output, one item per line, in a blue color. - """ - - print_line(blue("%s: files to be checked:" % sys.argv[0])) - for f in files: - print_line(blue(" %s" % f)) - - -def main(): - """ - Script entry point. Return exit code. - """ - - args, include_pattern, exclude_pattern = probe_args() - if "-h" in args or "--help" in args: - print_line(__doc__) - return 0 - if os.getenv("RUN_PYLINT_DISABLED", "") != "": - return 0 - files = probe_dir( - os.getcwd(), re.compile(include_pattern), re.compile(exclude_pattern) - ) - if not files: - return 0 - show_files(files) - args.extend(files) - sys.argv[0] = "pylint" - return Run(args, None, False).linter.msg_status - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/.travis/preinstall b/.travis/preinstall deleted file mode 100755 index 14445bd..0000000 --- a/.travis/preinstall +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: MIT - -# Install package specified by user in LSR_EXTRA_PACKAGES. Executed by Travis -# during before_install phase. -# -# LSR_EXTRA_PACKAGES, set by user in .travis/config.sh, is a space separated -# list of packages to be installed on the Travis build environment (Ubuntu). - -set -e - -SCRIPTDIR=$(readlink -f $(dirname $0)) - -. ${SCRIPTDIR}/utils.sh - -# Add python3-selinux package (needed by Molecule on selinux enabled systems, -# because Molecule is using `copy` and `file` Ansible modules to setup the -# container). -if lsr_venv_python_matches_system_python; then - LSR_EXTRA_PACKAGES='python3-selinux' -fi - -# extra packages needed with python 2.6 and ansible 2.6 -if lsr_check_python_version python -lt 2.7 ; then - LSR_EXTRA_PACKAGES="$LSR_EXTRA_PACKAGES libffi-dev libssl-dev" -fi - -. ${SCRIPTDIR}/config.sh - -# Install extra dependencies. -if [[ "${LSR_EXTRA_PACKAGES}" ]]; then - set -x - sudo apt-get update - sudo apt-get install -y ${LSR_EXTRA_PACKAGES} -fi diff --git a/.travis/runblack.sh b/.travis/runblack.sh deleted file mode 100755 index 2105cbb..0000000 --- a/.travis/runblack.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: MIT - -# A shell wrapper around black (Python formatter). The purpose of this wrapper -# is to get a user the opportunity to control black from config.sh via setting -# environment variables. - -# The given command line arguments are passed to black. - -# Environment variables: -# -# RUN_BLACK_INCLUDE -# a regular expression specifying files to be included; can be overridden -# from command line by --include; -# -# RUN_BLACK_EXCLUDE -# a regular expression specifying files to be excluded; can be overridden -# from command line by --exclude; -# -# RUN_BLACK_DISABLED -# if set to an arbitrary non-empty value, black will be not executed -# -# RUN_BLACK_EXTRA_ARGS -# extra cmd line args to pass to black - -set -e - -ME=$(basename $0) -SCRIPTDIR=$(readlink -f $(dirname $0)) - -. ${SCRIPTDIR}/utils.sh -. ${SCRIPTDIR}/config.sh - -if [[ "${RUN_BLACK_DISABLED}" ]]; then - lsr_info "${ME}: black is disabled. Skipping." - exit 0 -fi - -DEFAULT_INCLUDE='^[^.].*\.py$' -DEFAULT_EXCLUDE='/(\.[^.].*|tests/roles)/' - -INCLUDE_ARG="" -EXCLUDE_ARG="" -OTHER_ARGS=() - -while [[ $# -gt 0 ]]; do - case "$1" in - --include) - shift - INCLUDE_ARG="$1" - ;; - --exclude) - shift - EXCLUDE_ARG="$1" - ;; - *) - OTHER_ARGS+=( "$1" ) - ;; - esac - shift -done - -set -x -python -m black \ - --include "${INCLUDE_ARG:-${RUN_BLACK_INCLUDE:-${DEFAULT_INCLUDE}}}" \ - --exclude "${EXCLUDE_ARG:-${RUN_BLACK_EXCLUDE:-${DEFAULT_EXCLUDE}}}" \ - ${RUN_BLACK_EXTRA_ARGS:-} \ - "${OTHER_ARGS[@]}" diff --git a/.travis/runcoveralls.sh b/.travis/runcoveralls.sh deleted file mode 100755 index 4b3ad4e..0000000 --- a/.travis/runcoveralls.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: MIT - -# Reports coverage results using coveralls. The aim of this script is to -# provide a unified way to reporting coverage results across all linux system -# roles projects. - -# The given command line arguments are passed to coveralls. - -# Environment variables: -# -# LSR_PUBLISH_COVERAGE -# If the variable is unset or empty (the default), no coverage is published. -# Other valid values for the variable are: -# strict - the reporting is performed in strict mode, so situations -# like missing data to be reported are treated as errors -# debug - coveralls is run in debug mode (see coveralls debug --help) -# normal - coverage results will be reported normally -# LSR_TESTSDIR -# a path to directory where tests and tests artifacts are located; if unset -# or empty, this variable is set to ${TOPDIR}/tests; this path should -# already exists and be populated with tests artifacts before the script -# starts performing actions on it - -set -e - -ME=$(basename $0) -SCRIPTDIR=$(readlink -f $(dirname $0)) - -. ${SCRIPTDIR}/utils.sh -. ${SCRIPTDIR}/config.sh - -# Publish the results only if it is desired. -if [[ -z "${LSR_PUBLISH_COVERAGE}" ]]; then - lsr_info "${ME}: Publishing coverage report is not enabled. Skipping." - exit 0 -fi - -case "${LSR_PUBLISH_COVERAGE}" in - strict) : ;; - debug) : ;; - normal) : ;; - *) lsr_error Error: \"${LSR_PUBLISH_COVERAGE}\" is not a valid option ;; -esac - -LSR_TESTSDIR=${LSR_TESTSDIR:-${TOPDIR}/tests} - -# Ensure we are in $LSR_TESTSDIR. It is supposed that if a user wants to submit -# tests results, $LSR_TESTSDIR always exists. -cd ${LSR_TESTSDIR} - -# For simplicity, we suppose that coverage core data file has name .coverage -# and it is situated in $LSR_TESTSDIR. Similarly for .coveragerc. -COVERAGEFILE='.coverage' -COVERAGERCFILE='.coveragerc' - -# In case there is no $COVERAGEFILE, there is nothing to report. If we are -# running in strict mode, treat this situation as error. -if [[ ! -s ${COVERAGEFILE} ]]; then - NO_COVERAGEFILE_MSG="${COVERAGEFILE} is missing or empty" - if [[ "${LSR_PUBLISH_COVERAGE}" == "strict" ]]; then - lsr_error "${ME} (strict mode): ${NO_COVERAGEFILE_MSG}!" - fi - lsr_info "${ME}: ${NO_COVERAGEFILE_MSG}, nothing to publish." - exit 0 -fi - -# Create $COVERAGERCFILE file with a [paths] section. From the official docs: -# -# The first value must be an actual file path on the machine where the -# reporting will happen, so that source code can be found. The other values -# can be file patterns to match against the paths of collected data, or they -# can be absolute or relative file paths on the current machine. -# -# So in our $COVERAGERCFILE file we make both locations to point to the -# project's top directory. -cat > ${COVERAGERCFILE} <}:" \ - "Environment Python has no access to system Python libraries. Skipping." - exit 0 -fi - -COMMAND=$(command -v $1) -shift - -set -x -python ${COMMAND} "$@" diff --git a/.travis/runtox b/.travis/runtox deleted file mode 100755 index f017482..0000000 --- a/.travis/runtox +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: MIT - -# Run tox. Additionally, if LSR_MSCENARIOS is defined, run `tox -e molecule` -# for every scenario from LSR_MSCENARIOS and for every Ansible version from -# LSR_ANSIBLES. -# -# LSR_MSCENARIOS is a space separated list of molecule scenarios. -# LSR_ANSIBLES is a space separated list of Ansible package names with versions -# in pip format, i.e 'ansible ansible==2.6 ansible==2.7 ansible=2.8'. -# -# LSR_MSCENARIOS and LSR_ANSIBLES can be set in .travis/config.sh or as -# environment variables. - -ME=$(basename $0) -SCRIPTDIR=$(readlink -f $(dirname $0)) -BANNERSIZE=90 - -. ${SCRIPTDIR}/utils.sh -. ${SCRIPTDIR}/config.sh - -lsr_banner "tox" ${BANNERSIZE} -(set -x; tox); error_code=$? - -# Exit prematurely if the environment is not suitable for running -# Molecule tests. -if ! lsr_venv_python_matches_system_python; then - exit $error_code -fi - -for ansible_dependency in ${LSR_ANSIBLES}; do - for molecule_scenario in ${LSR_MSCENARIOS}; do - lsr_banner \ - "[${ansible_dependency}] tox -e molecule -- -s ${molecule_scenario}" \ - ${BANNERSIZE} - ( - set -x - LSR_ANSIBLE_DEP="${ansible_dependency}" \ - LSR_MSCENARIO=${molecule_scenario} \ - tox -e molecule - ) || error_code=$? - done -done - -exit $error_code diff --git a/.travis/utils.sh b/.travis/utils.sh deleted file mode 100644 index 4db8ffb..0000000 --- a/.travis/utils.sh +++ /dev/null @@ -1,199 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Auxiliary functions and variables. -# -# Usage: . utils.sh - -# All variables prefixed with __lsr_ are internal. - -# Code that prints the version of Python interpreter to standard output; it -# should be compatible across Python 2 and Python 3, the version is printed as -# "{major}.{minor}". -__lsr_get_python_version_py=' -import sys - -sys.stdout.write("%s.%s\n" % sys.version_info[:2]) -' - -# Colors for lsr_banner, lsr_info, and lsr_error. -__lsr_color_reset='\e[0m' -__lsr_color_red='\e[31m' -__lsr_color_blue='\e[34m' -__lsr_color_yellow='\e[1;33m' - -## -# lsr_banner $1 [$2] -# -# $1 - banner text -# $2 - number of columns to occupy (default: 79) -# -# Print banner (in yellow) with $1 to stdout. -function lsr_banner() { - local maxlen=${2:-79} - local fillchar='_' - local text=" ${1} " - local fillsize=$(( ${maxlen} - ${#text} )) - local line1 - local line2 - - if [[ ${fillsize} -lt 0 ]]; then - maxlen=${#text} - fillsize=0 - fi - - line1=$(printf "%*s" ${maxlen} "" | tr " " "${fillchar}") - - if [[ $(( ${fillsize} % 2 )) -eq 1 ]]; then - text="${text} " - fi - - line2=$(printf "%*s" $(( ${fillsize} / 2 )) "" | tr " " "${fillchar}") - line2="${line2}${text}${line2}" - - echo -e "${__lsr_color_yellow}${line1}${__lsr_color_reset}" - echo -e "${__lsr_color_yellow}${line2}${__lsr_color_reset}" -} - -## -# lsr_info ARGS -# -# Print ARGS (in blue) to stdout. -function lsr_info() { - echo -e "${__lsr_color_blue}$*${__lsr_color_reset}" -} - -## -# lsr_error ARGS -# -# Print ARGS (in red) to stderr and exit with exit code 1. -function lsr_error() { - echo -e "${__lsr_color_red}$*${__lsr_color_reset}" >&2 - exit 1 -} - -## -# lsr_get_python_version $1 -# -# $1 - command or full path to Python interpreter -# -# If $1 is installed, return its version. -function lsr_get_python_version() { - if command -v $1 >/dev/null 2>&1; then - $1 -c "${__lsr_get_python_version_py}" - fi -} - -## -# lsr_compare_versions $1 $2 $3 -# -# $1 - version string (see notes below) -# $2 - binary operation (see TEST(1)) -# $3 - version string (see notes below) -# -# Exit with 0 if `$1 $2 $3`. -# -# Notes: -# A version string is of the format [:digit:] "." [:digit:]. -function lsr_compare_versions() { - if [[ $# -lt 3 ]]; then - return 1 - fi - - test ${1//./} $2 ${3//./} -} - -## -# lsr_check_python_version $1 $2 $3 -# -# $1 - command or full path to Python interpreter -# $2 - binary operation (see TEST(1)) -# $3 - version string in [:digit:] "." [:digit:] format. -# -# Exit with 0 if `version($1) $2 $3`. -function lsr_check_python_version() { - if [[ $# -lt 3 ]]; then - return 1 - fi - - lsr_compare_versions $(lsr_get_python_version $1) $2 $3 -} - -## -# lsr_compare_pythons $1 $2 $3 -# -# $1 - command or full path to Python interpreter -# $2 - binary operation (see TEST(1)) -# $3 - command or full path to Python interpreter -# -# Exit with 0 if `version($1) $2 version($3)`. -function lsr_compare_pythons() { - if [[ $# -lt 3 ]]; then - return 1 - fi - - lsr_compare_versions \ - $(lsr_get_python_version $1) $2 $(lsr_get_python_version $3) -} - -## -# lsr_get_system_python -# -# Return the system python, or /usr/bin/python3 if nothing -# else can be found in a standard location. -function lsr_get_system_python() { - local syspython=$(command -pv python3) - if [[ -z "$syspython" ]]; then - syspython=$(command -pv python) - fi - if [[ -z "$syspython" ]]; then - syspython=$(command -pv python2) - fi - if [[ -z "$syspython" ]]; then - lsr_error Could not determine system python path - fi - echo $syspython -} - -## -# lsr_venv_python_matches_system_python [$1] [$2] -# -# $1 - command or full path to venv Python interpreter (default: python) -# $2 - command or full path to the system Python interpreter -# (default: system python as determined by lsr_get_system_python()) -# -# Exit with 0 if virtual environment Python version matches the system Python -# version. -function lsr_venv_python_matches_system_python() { - local syspython="${2:-$(lsr_get_system_python)}" - - lsr_compare_pythons ${1:-python} -eq $syspython -} - -## -# lsr_setup_module_utils [$1] [$2] -# -# $1 - path to the ansible/module_utils/ directory in the venv -# assumes ansible has been installed in the venv -# defaults to env var $SRC_MODULE_UTILS_DIR -# $2 - path to the local module_utils/ directory for the role -# defaults to env var $DEST_MODULE_UTILS_DIR -# -# Exit with 0 if virtual environment Python version matches the system Python -# version. -function lsr_setup_module_utils() { - local srcdir=${1:-$SRC_MODULE_UTILS_DIR} - local destdir=${2:-$DEST_MODULE_UTILS_DIR} - if [ -n "$srcdir" -a -d "$srcdir" -a -n "$destdir" -a -d "$destdir" ]; then - bash $TOPDIR/tests/setup_module_utils.sh "$srcdir" "$destdir" - fi -} - -# set TOPDIR -ME=${ME:-$(basename $0)} -SCRIPTDIR=${SCRIPTDIR:-$(readlink -f $(dirname $0))} -TOPDIR=$(readlink -f ${SCRIPTDIR}/..) - -# Local Variables: -# mode: Shell-script -# sh-basic-offset: 2 -# End: diff --git a/tox.ini b/tox.ini index 703418d..84a5ff4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,6 @@ # SPDX-License-Identifier: MIT [lsr_config] lsr_enable = true + +[lsr_ansible-lint] +configfile = {toxinidir}/.ansible-lint From f9a5e7962afa8c347c513ff92b297aa3892ac349 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 13:45:13 -0700 Subject: [PATCH 06/46] more --- tests/setup_module_utils.sh | 41 ------------------------------------- 1 file changed, 41 deletions(-) delete mode 100755 tests/setup_module_utils.sh diff --git a/tests/setup_module_utils.sh b/tests/setup_module_utils.sh deleted file mode 100755 index 18d6a00..0000000 --- a/tests/setup_module_utils.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: MIT - -set -euo pipefail - -if [ -n "${DEBUG:-}" ] ; then - set -x -fi - -if [ ! -d "${1:-}" ] ; then - echo Either ansible is not installed, or there is no ansible/module_utils - echo in $1 - Skipping - exit 0 -fi - -if [ ! -d "${2:-}" ] ; then - echo Role has no module_utils - Skipping - exit 0 -fi - -# we need absolute path for $2 -absmoddir=$( readlink -f "$2" ) - -# clean up old links to module_utils -for item in "$1"/* ; do - if lnitem=$( readlink "$item" ) && test -n "$lnitem" ; then - case "$lnitem" in - *"${2}"*) rm -f "$item" ;; - esac - fi -done - -# add new links to module_utils -for item in "$absmoddir"/* ; do - case "$item" in - *__pycache__) continue;; - *.pyc) continue;; - esac - bnitem=$( basename "$item" ) - ln -s "$item" "$1/$bnitem" -done From 7e0909aac86017eb06ca3a5a2ae65c293bb543b7 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 13:45:53 -0700 Subject: [PATCH 07/46] more --- .github/workflows/tox.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index f9a9108..25e74ab 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -42,7 +42,7 @@ jobs: set -x python --version pip --version - .travis/preinstall + lsr_travis_preinstall sudo pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ configparser \ git+https://github.com/linux-system-roles/tox-lsr@0.0.1 @@ -56,7 +56,7 @@ jobs: set -euo pipefail source /home/travis/virtualenv/python2.6/bin/activate set -x - .travis/runtox + lsr_travis_runtox env: LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default From 3d9b41c1c21a71b07f39eab216896acbf7766c1e Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 13:47:58 -0700 Subject: [PATCH 08/46] more --- .github/workflows/tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 25e74ab..3d6bf42 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -42,10 +42,10 @@ jobs: set -x python --version pip --version - lsr_travis_preinstall sudo pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ configparser \ git+https://github.com/linux-system-roles/tox-lsr@0.0.1 + lsr_travis_preinstall sudo pip list env: # yamllint disable-line rule:line-length From f146bb29137351ade51be5d3089d75d00dc97b74 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 14:41:54 -0700 Subject: [PATCH 09/46] moar --- .github/workflows/tox.yml | 7 +++++-- tox.ini | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 3d6bf42..09b54e8 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -38,15 +38,18 @@ jobs: set -euo pipefail curl -sSf --retry 5 -o python-2.6.tar.bz2 ${PY26URL} sudo tar xjf python-2.6.tar.bz2 --directory / + myuid=$(id -u) + mygid=$(id -g) + sudo chown -R $myuid:$mygid /home/travis/virtualenv source /home/travis/virtualenv/python2.6/bin/activate set -x python --version pip --version - sudo pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ + pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ configparser \ git+https://github.com/linux-system-roles/tox-lsr@0.0.1 lsr_travis_preinstall - sudo pip list + pip list env: # yamllint disable-line rule:line-length PY26URL: https://storage.googleapis.com/travis-ci-language-archives/python/binaries/ubuntu/14.04/x86_64/python-2.6.tar.bz2 diff --git a/tox.ini b/tox.ini index 84a5ff4..414c904 100644 --- a/tox.ini +++ b/tox.ini @@ -4,3 +4,6 @@ lsr_enable = true [lsr_ansible-lint] configfile = {toxinidir}/.ansible-lint + +[testenv:shellcheck] +commands = bash -c 'echo no shellscripts - skipping' From c2cc6c7937f0144ccf921478189f6210a0422bfb Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 14:51:11 -0700 Subject: [PATCH 10/46] have to install git --- .github/workflows/tox.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 09b54e8..9e2e6d9 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -18,6 +18,8 @@ jobs: run: | set -euxo pipefail python -m pip install --upgrade pip + sudo apt-get update + sudo apt-get install git pip install tox configparser \ git+https://github.com/linux-system-roles/tox-lsr@0.0.1 lsr_travis_preinstall @@ -45,6 +47,8 @@ jobs: set -x python --version pip --version + sudo apt-get update + sudo apt-get install git pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ configparser \ git+https://github.com/linux-system-roles/tox-lsr@0.0.1 From 81e15ba5ac8e4c8393c33ae14d1bd83791a71084 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 15:28:04 -0700 Subject: [PATCH 11/46] use tox-lsr 0.0.2 --- .github/workflows/tox.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 9e2e6d9..bb251cd 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -21,7 +21,7 @@ jobs: sudo apt-get update sudo apt-get install git pip install tox configparser \ - git+https://github.com/linux-system-roles/tox-lsr@0.0.1 + git+https://github.com/linux-system-roles/tox-lsr@0.0.2 lsr_travis_preinstall - name: Run tox tests run: | @@ -51,7 +51,7 @@ jobs: sudo apt-get install git pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ configparser \ - git+https://github.com/linux-system-roles/tox-lsr@0.0.1 + git+https://github.com/linux-system-roles/tox-lsr@0.0.2 lsr_travis_preinstall pip list env: @@ -63,7 +63,7 @@ jobs: set -euo pipefail source /home/travis/virtualenv/python2.6/bin/activate set -x - lsr_travis_runtox + tox -e py26,coveralls,custom env: LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default From 16a929ad7f4b0881a89fa22c757dc05b9ae7532f Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 15:44:38 -0700 Subject: [PATCH 12/46] debug --- .github/workflows/tox.yml | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index bb251cd..a3dc6f5 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -26,7 +26,7 @@ jobs: - name: Run tox tests run: | set -euxo pipefail - lsr_travis_runtox + bash -x `which lsr_travis_runtox` env: LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default diff --git a/tox.ini b/tox.ini index 414c904..568f65f 100644 --- a/tox.ini +++ b/tox.ini @@ -6,4 +6,4 @@ lsr_enable = true configfile = {toxinidir}/.ansible-lint [testenv:shellcheck] -commands = bash -c 'echo no shellscripts - skipping' +commands = bash -c 'echo no shell scripts - skipping' From efd32f2fb4a9121268639310296b2a3186ef74c7 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 15:52:15 -0700 Subject: [PATCH 13/46] debug tox failure --- .github/workflows/tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index a3dc6f5..d9717bf 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -26,7 +26,7 @@ jobs: - name: Run tox tests run: | set -euxo pipefail - bash -x `which lsr_travis_runtox` + tox -v env: LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default From 5d4849a5d202c64a876c48c9c0573065a013e355 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 16:00:11 -0700 Subject: [PATCH 14/46] debug more --- .github/workflows/tox.yml | 2 +- tox.ini | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index d9717bf..0567cdf 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -26,7 +26,7 @@ jobs: - name: Run tox tests run: | set -euxo pipefail - tox -v + tox -vv env: LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default diff --git a/tox.ini b/tox.ini index 568f65f..ca01750 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,7 @@ # SPDX-License-Identifier: MIT +[tox] +skip_missing_interpreters = true + [lsr_config] lsr_enable = true From e5b5f66a91302cc1325ab5588c71a29dbb5ff304 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 18:30:24 -0700 Subject: [PATCH 15/46] use tox-lsr 0.0.4 --- .github/workflows/tox.yml | 4 ++-- tox.ini | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 0567cdf..d2703af 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -21,7 +21,7 @@ jobs: sudo apt-get update sudo apt-get install git pip install tox configparser \ - git+https://github.com/linux-system-roles/tox-lsr@0.0.2 + git+https://github.com/linux-system-roles/tox-lsr@0.0.4 lsr_travis_preinstall - name: Run tox tests run: | @@ -51,7 +51,7 @@ jobs: sudo apt-get install git pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ configparser \ - git+https://github.com/linux-system-roles/tox-lsr@0.0.2 + git+https://github.com/linux-system-roles/tox-lsr@0.0.4 lsr_travis_preinstall pip list env: diff --git a/tox.ini b/tox.ini index ca01750..568f65f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,4 @@ # SPDX-License-Identifier: MIT -[tox] -skip_missing_interpreters = true - [lsr_config] lsr_enable = true From b5c8d5b202e53559c37c3af6ae5f543c6f3baaab Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 18:54:31 -0700 Subject: [PATCH 16/46] improve github status naming --- .github/workflows/tox.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index d2703af..a0b7669 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -1,8 +1,8 @@ -name: test with tox +name: tox on: # yamllint disable-line rule:truthy - pull_request jobs: - runtox: + python: runs-on: ubuntu-latest strategy: matrix: @@ -30,7 +30,7 @@ jobs: env: LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default - runtox-py26: + python-2.6: runs-on: ubuntu-16.04 steps: - name: checkout PR From c5a381c0c82211675bd37323e0cd47f5e82e0c5f Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 3 Dec 2020 18:55:44 -0700 Subject: [PATCH 17/46] improve github status naming --- .github/workflows/tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index a0b7669..bfb9d08 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -30,7 +30,7 @@ jobs: env: LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default - python-2.6: + python-26: runs-on: ubuntu-16.04 steps: - name: checkout PR From 94f8f910406dde01e3a025eda8392e2ec02dc774 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 14 Dec 2020 11:57:10 -0700 Subject: [PATCH 18/46] some refactoring --- .github/workflows/tox.yml | 54 ++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index bfb9d08..f667a8d 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -1,12 +1,18 @@ +# yamllint disable rule:line-length name: tox on: # yamllint disable-line rule:truthy - pull_request +env: + TOX_LSR: "git+https://github.com/richm/tox-lsr@gha-test" + LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' + LSR_MSCENARIOS: default + #LSR_EXTRA_PACKAGES: "libdbus-1-dev libgirepository1.0-dev python3-dev" jobs: python: runs-on: ubuntu-latest strategy: matrix: - pyver: ['2.7', '3.6', '3.7', '3.8', '3.9'] + pyver: ['2.7', '3.6', '3.7', '3.8'] steps: - name: checkout PR uses: actions/checkout@v2 @@ -20,51 +26,51 @@ jobs: python -m pip install --upgrade pip sudo apt-get update sudo apt-get install git - pip install tox configparser \ - git+https://github.com/linux-system-roles/tox-lsr@0.0.4 - lsr_travis_preinstall + pip install $TOX_LSR_DEPS "$TOX_LSR" + lsr_ci_preinstall - name: Run tox tests run: | set -euxo pipefail - tox -vv - env: - LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' - LSR_MSCENARIOS: default + toxpyver=$(echo "${{ matrix.pyver }}" | tr -d .) + toxenvs="py${toxpyver}" + case "$toxpyver" in + 27) toxenvs="${toxenvs},coveralls,flake8,pylint,custom" ;; + 36) toxenvs="${toxenvs},coveralls,black,yamllint,shellcheck,custom,collection" ;; + 37) toxenvs="${toxenvs},coveralls,custom" ;; + 38) toxenvs="${toxenvs},coveralls,custom" ;; + esac + TOXENV="$toxenvs" lsr_ci_runtox python-26: runs-on: ubuntu-16.04 + env: + PY26URL: https://storage.googleapis.com/travis-ci-language-archives/python/binaries/ubuntu/14.04/x86_64/python-2.6.tar.bz2 + PY26TARFILE: "python-2.6.tar.bz2" + PY26VENVPATH: "/home/travis/virtualenv/python2.6" + VIRTUAL_ENV_DISABLE_PROMPT: "true" steps: - name: checkout PR uses: actions/checkout@v2 - name: Install python, dependencies run: | set -euo pipefail - curl -sSf --retry 5 -o python-2.6.tar.bz2 ${PY26URL} - sudo tar xjf python-2.6.tar.bz2 --directory / + curl -sSf --retry 5 -o "$PY26TARFILE" "$PY26URL" + sudo tar xjf "$PY26TARFILE" --directory / myuid=$(id -u) mygid=$(id -g) - sudo chown -R $myuid:$mygid /home/travis/virtualenv - source /home/travis/virtualenv/python2.6/bin/activate + sudo chown -R $myuid:$mygid "$PY26VENVPATH" + source "$PY26VENVPATH/bin/activate" set -x python --version pip --version sudo apt-get update sudo apt-get install git pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ - configparser \ - git+https://github.com/linux-system-roles/tox-lsr@0.0.4 - lsr_travis_preinstall + $TOX_LSR_DEPS "$TOX_LSR" + lsr_ci_preinstall pip list - env: - # yamllint disable-line rule:line-length - PY26URL: https://storage.googleapis.com/travis-ci-language-archives/python/binaries/ubuntu/14.04/x86_64/python-2.6.tar.bz2 - VIRTUAL_ENV_DISABLE_PROMPT: "true" - name: Run tox tests run: | set -euo pipefail - source /home/travis/virtualenv/python2.6/bin/activate + source "$PY26VENVPATH/bin/activate" set -x tox -e py26,coveralls,custom - env: - LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' - LSR_MSCENARIOS: default - VIRTUAL_ENV_DISABLE_PROMPT: "true" From 5178ede8cf7070113d507d4c6a0dc48e8c4dd10a Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 14 Dec 2020 12:05:07 -0700 Subject: [PATCH 19/46] fix --- .github/workflows/tox.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index f667a8d..65b769b 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -26,7 +26,7 @@ jobs: python -m pip install --upgrade pip sudo apt-get update sudo apt-get install git - pip install $TOX_LSR_DEPS "$TOX_LSR" + pip install "$TOX_LSR" lsr_ci_preinstall - name: Run tox tests run: | @@ -65,7 +65,7 @@ jobs: sudo apt-get update sudo apt-get install git pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ - $TOX_LSR_DEPS "$TOX_LSR" + "$TOX_LSR" lsr_ci_preinstall pip list - name: Run tox tests From eef5ca1e6fe7ba704f48c382da2e0411afc1dbd0 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 14 Dec 2020 12:21:22 -0700 Subject: [PATCH 20/46] use correct chown command for links --- .github/workflows/tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 65b769b..e10f956 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -57,7 +57,7 @@ jobs: sudo tar xjf "$PY26TARFILE" --directory / myuid=$(id -u) mygid=$(id -g) - sudo chown -R $myuid:$mygid "$PY26VENVPATH" + sudo chown -H -R $myuid:$mygid "$PY26VENVPATH" source "$PY26VENVPATH/bin/activate" set -x python --version From fb0f51853d5d5e2d667eba009001407dba3ade52 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 14 Dec 2020 12:45:14 -0700 Subject: [PATCH 21/46] debug --- .github/workflows/tox.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index e10f956..787c7b3 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -39,6 +39,8 @@ jobs: 37) toxenvs="${toxenvs},coveralls,custom" ;; 38) toxenvs="${toxenvs},coveralls,custom" ;; esac + ls -alrtF + tox --version TOXENV="$toxenvs" lsr_ci_runtox python-26: runs-on: ubuntu-16.04 From 55abffff5b6f9f06002477f40e2d29b3028954a0 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 14 Dec 2020 13:07:48 -0700 Subject: [PATCH 22/46] try again --- .github/workflows/tox.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 787c7b3..e10f956 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -39,8 +39,6 @@ jobs: 37) toxenvs="${toxenvs},coveralls,custom" ;; 38) toxenvs="${toxenvs},coveralls,custom" ;; esac - ls -alrtF - tox --version TOXENV="$toxenvs" lsr_ci_runtox python-26: runs-on: ubuntu-16.04 From 17e5f7937c7e2fda6ec3681fb47eb4cde211b854 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 14 Dec 2020 13:31:39 -0700 Subject: [PATCH 23/46] use specific commit --- .github/workflows/tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index e10f956..3eff844 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -3,7 +3,7 @@ name: tox on: # yamllint disable-line rule:truthy - pull_request env: - TOX_LSR: "git+https://github.com/richm/tox-lsr@gha-test" + TOX_LSR: "git+https://github.com/richm/tox-lsr@e7540f3bc3a5eb5603b0b074b7398e4e312c8395" LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default #LSR_EXTRA_PACKAGES: "libdbus-1-dev libgirepository1.0-dev python3-dev" From 16f5db73f4207814f3407587d700e48db4b2e0e2 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 14 Dec 2020 13:44:25 -0700 Subject: [PATCH 24/46] try again --- .github/workflows/tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 3eff844..509e0c9 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -6,7 +6,7 @@ env: TOX_LSR: "git+https://github.com/richm/tox-lsr@e7540f3bc3a5eb5603b0b074b7398e4e312c8395" LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default - #LSR_EXTRA_PACKAGES: "libdbus-1-dev libgirepository1.0-dev python3-dev" + # LSR_EXTRA_PACKAGES: "libdbus-1-dev libgirepository1.0-dev python3-dev" jobs: python: runs-on: ubuntu-latest From aa5011f9eaa29689ea89f69063fc40b6156d3557 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 14 Dec 2020 15:12:58 -0700 Subject: [PATCH 25/46] upstart provides init --- molecule/default/Dockerfile.j2 | 2 +- molecule/default/molecule.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 index 7e0b78d..56d6094 100644 --- a/molecule/default/Dockerfile.j2 +++ b/molecule/default/Dockerfile.j2 @@ -9,7 +9,7 @@ FROM {{ item.image }} RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ - elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash upstart && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 8c5bee6..31b5236 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -13,7 +13,7 @@ platforms: image: registry.centos.org/centos/centos:6 volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init + command: /sbin/init privileged: true pre_build_image: true - name: centos-7 From 2936b72952e888c6e338d8a770ba7d2088f5d7db Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 14 Dec 2020 15:35:00 -0700 Subject: [PATCH 26/46] try pre_build_image: false --- molecule/default/molecule.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 31b5236..2d98349 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -15,7 +15,7 @@ platforms: - /sys/fs/cgroup:/sys/fs/cgroup:ro command: /sbin/init privileged: true - pre_build_image: true + pre_build_image: false - name: centos-7 image: registry.centos.org/centos/systemd:latest volumes: From 40c63db0456f748ad6df49409478f5ce72cde50f Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 15:00:29 -0600 Subject: [PATCH 27/46] test container --- .github/workflows/tox.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 509e0c9..13e9504 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -74,3 +74,24 @@ jobs: source "$PY26VENVPATH/bin/activate" set -x tox -e py26,coveralls,custom + python-26-cntnr: + runs-on: ubuntu-latest + container: + image: registry.centos.org/centos:6 + steps: + - name: checkout PR + uses: actions/checkout@v2 + - name: Install python, dependencies + run: | + set -euxo pipefail + python --version + pip --version + sudo yum -y install git + pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ + "$TOX_LSR" + lsr_ci_preinstall + pip list + - name: Run tox tests + run: | + set -euxo pipefail + tox -e py26,coveralls,custom From 49a8615d141520ff57a08ddef95dd19a22ba164a Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 15:45:25 -0600 Subject: [PATCH 28/46] try again --- .github/workflows/tox.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 13e9504..5a6de6a 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -76,12 +76,11 @@ jobs: tox -e py26,coveralls,custom python-26-cntnr: runs-on: ubuntu-latest - container: - image: registry.centos.org/centos:6 steps: - name: checkout PR uses: actions/checkout@v2 - name: Install python, dependencies + uses: docker://registry.centos.org/centos:6 run: | set -euxo pipefail python --version @@ -92,6 +91,7 @@ jobs: lsr_ci_preinstall pip list - name: Run tox tests + uses: docker://registry.centos.org/centos:6 run: | set -euxo pipefail tox -e py26,coveralls,custom From 372ff5bb253495c97236b467c6446f797d31cab5 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:01:41 -0600 Subject: [PATCH 29/46] try with local action --- .github/actions/py26/Dockerfile | 3 +++ .github/actions/py26/action.yml | 5 +++++ .github/actions/py26/entrypoint.sh | 18 ++++++++++++++++++ .github/workflows/tox.yml | 18 ++---------------- 4 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 .github/actions/py26/Dockerfile create mode 100644 .github/actions/py26/action.yml create mode 100644 .github/actions/py26/entrypoint.sh diff --git a/.github/actions/py26/Dockerfile b/.github/actions/py26/Dockerfile new file mode 100644 index 0000000..ea7b0be --- /dev/null +++ b/.github/actions/py26/Dockerfile @@ -0,0 +1,3 @@ +FROM registry.centos.org/centos:6 +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/py26/action.yml b/.github/actions/py26/action.yml new file mode 100644 index 0000000..c44d69e --- /dev/null +++ b/.github/actions/py26/action.yml @@ -0,0 +1,5 @@ +name: 'py26' +description: 'Run unit tests on python 2.6' +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh new file mode 100644 index 0000000..88489ef --- /dev/null +++ b/.github/actions/py26/entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash -l + +set -euxo pipefail + +for file in /etc/yum.repos.d/CentOS-*.repo; do + if ! grep '^baseurl=.*vault[.]centos[.]org' "$file"; then + sed -i -e 's,^mirrorlist,#mirrorlist,' \ + -e 's,^#baseurl=,baseurl=,' \ + -e 's,mirror.centos.org/centos/$releasever,vault.centos.org/6.10,' \ + "$file" + fi +done + +yum install -y epel-release +yum install -y python-pip +pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" +lsr_ci_preinstall +tox -e py26,coveralls,custom diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 5a6de6a..62df834 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -79,19 +79,5 @@ jobs: steps: - name: checkout PR uses: actions/checkout@v2 - - name: Install python, dependencies - uses: docker://registry.centos.org/centos:6 - run: | - set -euxo pipefail - python --version - pip --version - sudo yum -y install git - pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ - "$TOX_LSR" - lsr_ci_preinstall - pip list - - name: Run tox tests - uses: docker://registry.centos.org/centos:6 - run: | - set -euxo pipefail - tox -e py26,coveralls,custom + - name: Run LSR py26 job + uses: ./.github/actions/py26 From c68a05d49e01f3321ec9020b0adddc015d9aa612 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:02:40 -0600 Subject: [PATCH 30/46] make executable --- .github/actions/py26/entrypoint.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .github/actions/py26/entrypoint.sh diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh old mode 100644 new mode 100755 From a8a3e86d6ef9329afd81f3a5b5f341db7c8dcf55 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:04:29 -0600 Subject: [PATCH 31/46] add git --- .github/actions/py26/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index 88489ef..4c67fa8 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -11,7 +11,7 @@ for file in /etc/yum.repos.d/CentOS-*.repo; do fi done -yum install -y epel-release +yum install -y epel-release git yum install -y python-pip pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" lsr_ci_preinstall From d34a307099617ac107d979b22ad9ca51e43ce375 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:07:09 -0600 Subject: [PATCH 32/46] use main --- .github/workflows/tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 62df834..0fa2f62 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -3,7 +3,7 @@ name: tox on: # yamllint disable-line rule:truthy - pull_request env: - TOX_LSR: "git+https://github.com/richm/tox-lsr@e7540f3bc3a5eb5603b0b074b7398e4e312c8395" + TOX_LSR: "git+https://github.com/linux-system-roles/tox-lsr@main" LSR_ANSIBLES: 'ansible==2.7.* ansible==2.8.* ansible==2.9.*' LSR_MSCENARIOS: default # LSR_EXTRA_PACKAGES: "libdbus-1-dev libgirepository1.0-dev python3-dev" From e5e457aff2661fcec4837d39ca3477c004708647 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:13:43 -0600 Subject: [PATCH 33/46] debug --- .github/actions/py26/entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index 4c67fa8..1a2b7cc 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -13,6 +13,8 @@ done yum install -y epel-release git yum install -y python-pip +id -a +env pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" lsr_ci_preinstall tox -e py26,coveralls,custom From f419c336002d6ac00ee9d9e48b3a2edaef9791a1 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:21:46 -0600 Subject: [PATCH 34/46] try to upgrade pip --- .github/actions/py26/entrypoint.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index 1a2b7cc..0836b32 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -13,8 +13,7 @@ done yum install -y epel-release git yum install -y python-pip -id -a -env +pip install --upgrade pip pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" lsr_ci_preinstall tox -e py26,coveralls,custom From c21bba1e7d5a7b670241d65e7414507f15d84500 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:27:55 -0600 Subject: [PATCH 35/46] try to upgrade pip --- .github/actions/py26/entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index 0836b32..3020788 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -13,7 +13,9 @@ done yum install -y epel-release git yum install -y python-pip +ls -alrtF $HOME pip install --upgrade pip -pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" +ls -alrtF $HOME/.cache $HOME/.cache/pip || : +ip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" lsr_ci_preinstall tox -e py26,coveralls,custom From d574b9feb372c98e6e2d081df45b11ef250519ef Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:36:49 -0600 Subject: [PATCH 36/46] debug --- .github/actions/py26/entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index 3020788..a3a4d5d 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -2,6 +2,8 @@ set -euxo pipefail +exec 2>&1 + for file in /etc/yum.repos.d/CentOS-*.repo; do if ! grep '^baseurl=.*vault[.]centos[.]org' "$file"; then sed -i -e 's,^mirrorlist,#mirrorlist,' \ From d2dc749c7b0d1d6e070f079dde83e8f4064124df Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:37:09 -0600 Subject: [PATCH 37/46] debug --- .github/actions/py26/entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index a3a4d5d..c792594 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -15,8 +15,10 @@ done yum install -y epel-release git yum install -y python-pip +echo home ls -alrtF $HOME pip install --upgrade pip +echo more ls -alrtF $HOME/.cache $HOME/.cache/pip || : ip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" lsr_ci_preinstall From fa0fc123a63ee595b1534a0a4909784104f9d9fd Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:37:21 -0600 Subject: [PATCH 38/46] debug --- .github/actions/py26/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index c792594..7d4adfe 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -20,6 +20,6 @@ ls -alrtF $HOME pip install --upgrade pip echo more ls -alrtF $HOME/.cache $HOME/.cache/pip || : -ip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" +pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" lsr_ci_preinstall tox -e py26,coveralls,custom From bf296b29e101c6fd052ee7d2c11c77d800cb2abf Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:44:03 -0600 Subject: [PATCH 39/46] debug --- .github/actions/py26/entrypoint.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index 7d4adfe..812f596 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -17,9 +17,10 @@ yum install -y epel-release git yum install -y python-pip echo home ls -alrtF $HOME -pip install --upgrade pip +#pip install --upgrade pip echo more ls -alrtF $HOME/.cache $HOME/.cache/pip || : -pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" +mkdir -p $HOME/.cache/pip/http +pip -vv install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" lsr_ci_preinstall tox -e py26,coveralls,custom From a73e3c9379a05da7d72a95666c9f7f21f944776a Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 19:54:48 -0600 Subject: [PATCH 40/46] preinstall --- .github/actions/py26/entrypoint.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index 812f596..6560326 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -13,7 +13,9 @@ for file in /etc/yum.repos.d/CentOS-*.repo; do fi done -yum install -y epel-release git +LSR_EXTRA_PACKAGES_YUM="${LSR_EXTRA_PACKAGES_YUM:-} libffi-devel openssl-devel dbus-devel python-devel" + +yum install -y epel-release git $LSR_EXTRA_PACKAGES_YUM yum install -y python-pip echo home ls -alrtF $HOME @@ -22,5 +24,4 @@ echo more ls -alrtF $HOME/.cache $HOME/.cache/pip || : mkdir -p $HOME/.cache/pip/http pip -vv install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" -lsr_ci_preinstall tox -e py26,coveralls,custom From 72a3b9a54842b2242dd1c44067c04451312ba97d Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 5 Apr 2021 20:41:44 -0600 Subject: [PATCH 41/46] py 1.4 --- .github/actions/py26/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index 6560326..c02b018 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -23,5 +23,5 @@ ls -alrtF $HOME echo more ls -alrtF $HOME/.cache $HOME/.cache/pip || : mkdir -p $HOME/.cache/pip/http -pip -vv install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' "$TOX_LSR" +pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' 'py<1.5' "$TOX_LSR" tox -e py26,coveralls,custom From c41a83175ad7bafb0fd3ae837c4b79f764f156bc Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Tue, 6 Apr 2021 09:24:22 -0600 Subject: [PATCH 42/46] try that --- .github/actions/py26/entrypoint.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index c02b018..3ff2d6c 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -17,11 +17,8 @@ LSR_EXTRA_PACKAGES_YUM="${LSR_EXTRA_PACKAGES_YUM:-} libffi-devel openssl-devel d yum install -y epel-release git $LSR_EXTRA_PACKAGES_YUM yum install -y python-pip -echo home -ls -alrtF $HOME -#pip install --upgrade pip -echo more -ls -alrtF $HOME/.cache $HOME/.cache/pip || : mkdir -p $HOME/.cache/pip/http -pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' 'py<1.5' "$TOX_LSR" +# yum install python-pip brings in a very old version of setuptools - upgrade it first +pip install --upgrade 'setuptools==28.8.*' +pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' 'py<1.5' 'configparser<5' "$TOX_LSR" tox -e py26,coveralls,custom From 8477986fc1214755d8a4c25ef09b05bbfd0d327d Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Tue, 6 Apr 2021 10:05:28 -0600 Subject: [PATCH 43/46] move some stuff to dockerfile --- .github/actions/py26/Dockerfile | 11 +++++++++++ .github/actions/py26/entrypoint.sh | 16 +++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/actions/py26/Dockerfile b/.github/actions/py26/Dockerfile index ea7b0be..b5beccb 100644 --- a/.github/actions/py26/Dockerfile +++ b/.github/actions/py26/Dockerfile @@ -1,3 +1,14 @@ FROM registry.centos.org/centos:6 COPY entrypoint.sh /entrypoint.sh +RUN set -euo pipefail; \ + for file in /etc/yum.repos.d/CentOS-*.repo; do \ + if ! grep '^baseurl=.*vault[.]centos[.]org' "$file"; then \ + sed -i -e 's,^mirrorlist,#mirrorlist,' \ + -e 's,^#baseurl=,baseurl=,' \ + -e 's,mirror.centos.org/centos/$releasever,vault.centos.org/6.10,' \ + "$file"; \ + fi; \ + done; \ + yum -y install epel-release libffi-devel openssl-devel dbus-devel python-devel gcc git; \ + yum -y install python-pip ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index 3ff2d6c..4025203 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -4,19 +4,9 @@ set -euxo pipefail exec 2>&1 -for file in /etc/yum.repos.d/CentOS-*.repo; do - if ! grep '^baseurl=.*vault[.]centos[.]org' "$file"; then - sed -i -e 's,^mirrorlist,#mirrorlist,' \ - -e 's,^#baseurl=,baseurl=,' \ - -e 's,mirror.centos.org/centos/$releasever,vault.centos.org/6.10,' \ - "$file" - fi -done - -LSR_EXTRA_PACKAGES_YUM="${LSR_EXTRA_PACKAGES_YUM:-} libffi-devel openssl-devel dbus-devel python-devel" - -yum install -y epel-release git $LSR_EXTRA_PACKAGES_YUM -yum install -y python-pip +if [ -n "${LSR_EXTRA_PACKAGES_YUM:-}" ]; then + yum install -y $LSR_EXTRA_PACKAGES_YUM +fi mkdir -p $HOME/.cache/pip/http # yum install python-pip brings in a very old version of setuptools - upgrade it first pip install --upgrade 'setuptools==28.8.*' From 3bef4f9f90555bb0bbf1993ecd21195f1513f108 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Tue, 6 Apr 2021 10:29:56 -0600 Subject: [PATCH 44/46] cannot do yum install in Dockerfile --- .github/actions/py26/Dockerfile | 4 +--- .github/actions/py26/entrypoint.sh | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/py26/Dockerfile b/.github/actions/py26/Dockerfile index b5beccb..d2a7d1d 100644 --- a/.github/actions/py26/Dockerfile +++ b/.github/actions/py26/Dockerfile @@ -8,7 +8,5 @@ RUN set -euo pipefail; \ -e 's,mirror.centos.org/centos/$releasever,vault.centos.org/6.10,' \ "$file"; \ fi; \ - done; \ - yum -y install epel-release libffi-devel openssl-devel dbus-devel python-devel gcc git; \ - yum -y install python-pip + done ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh index 4025203..d9455ca 100755 --- a/.github/actions/py26/entrypoint.sh +++ b/.github/actions/py26/entrypoint.sh @@ -4,6 +4,8 @@ set -euxo pipefail exec 2>&1 +yum -y install epel-release libffi-devel openssl-devel dbus-devel python-devel gcc git +yum -y install python-pip if [ -n "${LSR_EXTRA_PACKAGES_YUM:-}" ]; then yum install -y $LSR_EXTRA_PACKAGES_YUM fi From 5e1284cd29fbf968e21b3fdeb7b92b81c4ab1ef4 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Tue, 6 Apr 2021 14:06:56 -0600 Subject: [PATCH 45/46] use real lsr-gha-py26 --- .github/actions/py26/Dockerfile | 12 ---------- .github/actions/py26/action.yml | 5 ---- .github/actions/py26/entrypoint.sh | 16 ------------- .github/workflows/tox.yml | 38 ++---------------------------- 4 files changed, 2 insertions(+), 69 deletions(-) delete mode 100644 .github/actions/py26/Dockerfile delete mode 100644 .github/actions/py26/action.yml delete mode 100755 .github/actions/py26/entrypoint.sh diff --git a/.github/actions/py26/Dockerfile b/.github/actions/py26/Dockerfile deleted file mode 100644 index d2a7d1d..0000000 --- a/.github/actions/py26/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM registry.centos.org/centos:6 -COPY entrypoint.sh /entrypoint.sh -RUN set -euo pipefail; \ - for file in /etc/yum.repos.d/CentOS-*.repo; do \ - if ! grep '^baseurl=.*vault[.]centos[.]org' "$file"; then \ - sed -i -e 's,^mirrorlist,#mirrorlist,' \ - -e 's,^#baseurl=,baseurl=,' \ - -e 's,mirror.centos.org/centos/$releasever,vault.centos.org/6.10,' \ - "$file"; \ - fi; \ - done -ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/py26/action.yml b/.github/actions/py26/action.yml deleted file mode 100644 index c44d69e..0000000 --- a/.github/actions/py26/action.yml +++ /dev/null @@ -1,5 +0,0 @@ -name: 'py26' -description: 'Run unit tests on python 2.6' -runs: - using: 'docker' - image: 'Dockerfile' diff --git a/.github/actions/py26/entrypoint.sh b/.github/actions/py26/entrypoint.sh deleted file mode 100755 index d9455ca..0000000 --- a/.github/actions/py26/entrypoint.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -l - -set -euxo pipefail - -exec 2>&1 - -yum -y install epel-release libffi-devel openssl-devel dbus-devel python-devel gcc git -yum -y install python-pip -if [ -n "${LSR_EXTRA_PACKAGES_YUM:-}" ]; then - yum install -y $LSR_EXTRA_PACKAGES_YUM -fi -mkdir -p $HOME/.cache/pip/http -# yum install python-pip brings in a very old version of setuptools - upgrade it first -pip install --upgrade 'setuptools==28.8.*' -pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' 'py<1.5' 'configparser<5' "$TOX_LSR" -tox -e py26,coveralls,custom diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 0fa2f62..e8326f8 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -41,43 +41,9 @@ jobs: esac TOXENV="$toxenvs" lsr_ci_runtox python-26: - runs-on: ubuntu-16.04 - env: - PY26URL: https://storage.googleapis.com/travis-ci-language-archives/python/binaries/ubuntu/14.04/x86_64/python-2.6.tar.bz2 - PY26TARFILE: "python-2.6.tar.bz2" - PY26VENVPATH: "/home/travis/virtualenv/python2.6" - VIRTUAL_ENV_DISABLE_PROMPT: "true" - steps: - - name: checkout PR - uses: actions/checkout@v2 - - name: Install python, dependencies - run: | - set -euo pipefail - curl -sSf --retry 5 -o "$PY26TARFILE" "$PY26URL" - sudo tar xjf "$PY26TARFILE" --directory / - myuid=$(id -u) - mygid=$(id -g) - sudo chown -H -R $myuid:$mygid "$PY26VENVPATH" - source "$PY26VENVPATH/bin/activate" - set -x - python --version - pip --version - sudo apt-get update - sudo apt-get install git - pip install 'tox<3' 'virtualenv==15.*' 'pluggy==0.5.*' \ - "$TOX_LSR" - lsr_ci_preinstall - pip list - - name: Run tox tests - run: | - set -euo pipefail - source "$PY26VENVPATH/bin/activate" - set -x - tox -e py26,coveralls,custom - python-26-cntnr: runs-on: ubuntu-latest steps: - name: checkout PR uses: actions/checkout@v2 - - name: Run LSR py26 job - uses: ./.github/actions/py26 + - name: Run LSR py26 action + uses: linux-system-roles/lsr-gh-action-py26@main From 5480c71fd85c743790c6f236b2dea26d0876d45a Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Tue, 6 Apr 2021 15:13:08 -0600 Subject: [PATCH 46/46] use 1.0.0 --- .github/workflows/tox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index e8326f8..d3f7430 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -46,4 +46,4 @@ jobs: - name: checkout PR uses: actions/checkout@v2 - name: Run LSR py26 action - uses: linux-system-roles/lsr-gh-action-py26@main + uses: linux-system-roles/lsr-gh-action-py26@1.0.0