-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronize files from linux-system-roles/template #133
Conversation
@i386x "Files copied on wrong place " - is this a bug in the script or in the template? |
The custom command fails on Travis: https://travis-ci.com/linux-system-roles/network/jobs/258652534#L272 |
3.6: py36,black,coveralls,custom | ||
3.7: py37,coveralls,custom | ||
3.7-dev: py37,coveralls,custom | ||
3.8-dev: py38,coveralls,custom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it correct to remove python 3.8 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need both 3.7-dev and 3.8-dev ? also, do we need coveralls in multiple places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merged the python version change in #137 for travis.yml. 3.8-dev does not need to be mentioned here (not sure if it really works) because 3.8 also matches the development version for 3.8:
https://travis-ci.com/linux-system-roles/network/jobs/263414315
|
This was a bug in sync script. It should be fixed now. |
This puzzles me most, the absolute path |
.travis/custom.sh
Outdated
@@ -23,5 +23,5 @@ shift 2 | |||
|
|||
# Write your custom commands here that should be run when `tox -e custom`: | |||
if [[ -z "${TRAVIS}" ]] || lsr_check_python_version ${ENVPYTHON} -eq '3.6'; then | |||
(set -x; cd ${TOPDIR}/tests && ${ENVPYTHON} ./ensure_non_running_provider.py) | |||
(set -x; cd ${TOPDIR}/tests; ${ENVPYTHON} ./ensure_non_running_provider.py) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change? you don't care whether cd has succeeded or failed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set -e
should handle this (exit immediately if a command exits with a non-zero status).
mv ${TOPDIR}/.coverage ${TOPDIR}/.coverage.merge | ||
${ENVPYTHON} -m coverage combine --append ${TOPDIR} | ||
mv ${TOPDIR}/.coverage ${TOPDIR}/.coverage.merge || : | ||
${ENVPYTHON} -m coverage combine --append ${TOPDIR} || : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tyll can you please review the Coveralls bits?
Not bash, but tox-dev/tox@43d65b17#diff-57c0f90ac19d5a79d6495ab22fab6539R247-R258 is the source of problem (luckily, workaround should be easy). |
Is this behavior of tox documented? Should it be reported as a bug if not? |
I file issue on tox-dev/tox for it: tox-dev/tox#1463 |
Why is conversion of absolute to relative path even a problem? The result should be equivalent, no? |
The problem is a little bit complex. Seeing the logs, sometimes the path to virtual env interpreter is absolute and sometimes it is relative. Moreover, the path shortening feature can be changed or reverted in the future so it is good to not rely on it. |
shift | ||
|
||
DEFAULT_INCLUDE='^[^.].*\.py$' | ||
DEFAULT_EXCLUDE='/(\.[^.].*|tests/roles)/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to run black for the python scripts in the tests dir as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python scripts in tests/
should be analyzed by black. The tests/roles
part of regexp excludes directory containing symlinks.
24d8352
to
bedf279
Compare
I merged some changes in #136 to demonstrate what I would wish the commits look like. |
.travis/runtox
Outdated
tox "$@" | ||
for X in ${LSR_MSCENARIOS}; do | ||
LSR_MSCENARIO=${X} tox -e molecule | ||
for X in ${LSR_ANSIBLES}; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO it would be better to avoid variables like X
and Y
and use for example ansible_dependency
and scenario
.
.travis/preinstall
Outdated
# Include library. | ||
. ${SCRIPTDIR}/utils.sh | ||
|
||
# Add python3-selinux package (it turned out that in some circumstances, i.e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIU this is because molecule is using the copy or file Ansible modules on a selinux enabled system to setup the container. It has nothing to do with the tests itself but with setting up the test environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank You for noting this, I will mention it in the comment.
.travis/preinstall
Outdated
fi | ||
|
||
# Include config. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the comments about including config or utils could be removed because the actual code to do this is simple enough that the comments do not explain something new.
This prevents a surprise when default building environment bumps.
c7e05a3
to
c19eb5e
Compare
@@ -2,6 +2,10 @@ | |||
--- | |||
dist: xenial | |||
language: python | |||
env: | |||
global: | |||
- LSR_ANSIBLES='ansible==2.6.* ansible==2.7.* ansible==2.8.*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this configured in travis.yml and not in config.sh? In case somone wants to run molecule outside of travis, this needs to be defined as well, doesn't it? This also affects the variable on the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config.sh
should contain only parts that may vary across repositories. Running molecule outside Travis can be performed via LSR_ANSIBLE_DEP=<ansible-dep> LSR_MSCENARIO=<molecule scenario> tox -e molecule
(just tox -e molecule
runs molecule with the newest Ansible Python package installed and with the default scenario). Furthermore, running molecule for all supported Ansible versions and for all supported scenarios outside of Travis by one command will be imho possible only by introducing a shell script that wraps tox
command (this possibility is worth of discussion). Maybe it should be good to write a documentation for our Travis and tox
based CI and put it to file named like TOX.INI.README.md
.
#!/bin/bash | ||
# SPDX-License-Identifier: MIT | ||
|
||
# Run black (the Python formatter). The first script argument is a path to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add the reason why we need this wrapper to the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #145.
#!/bin/bash | ||
# SPDX-License-Identifier: MIT | ||
|
||
# Run flake8. The first script argument is a path to Python interpreter, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add the reason why we need this wrapper to the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #147.
#!/bin/bash | ||
# SPDX-License-Identifier: MIT | ||
|
||
# Wrapper around pytest. First argument is a path to environment python, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add the reason why we need this wrapper to the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #144.
This PR propagates files from linux-system-roles/template which should be in sync across linux-system-roles repos. In case of changing affected files via pushing to this PR, please do not forget also to push the changes to linux-system-roles/template repo.
CC: @i386x, @pcahyna.