Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
294d895
Include requirements.txt files for all the Python packages.
Kami Jul 29, 2019
a9166d8
Make sure all the components include __version__ attribute.
Kami Jul 29, 2019
0414b6e
Add make check which verifies that all the components Python packages
Kami Jul 29, 2019
24492da
Don't run setup.py develop steps, sdist and bdist_wheel steps are
Kami Jul 29, 2019
39b8a5b
Exclude exporter, fail correctly on sub-shell failure.
Kami Jul 29, 2019
93b8251
Prevent cross virtualenv pollution and use dedicated virtualenv for
Kami Jul 29, 2019
76e1209
Make check more robust - also check if import works.
Kami Jul 29, 2019
744d2f2
Fix a race in run_command() on timeout.
Kami Jul 29, 2019
bb3e607
Improve comment.
Kami Jul 29, 2019
2737064
Revert change which was accidentaly added.
Kami Jul 29, 2019
9d36ed7
Merge branch 'master' into include_requirements_txt_for_all_packages
Kami Jul 29, 2019
c919ff9
Update dist_utils.py so only check_pip_version() function relies on pip
Kami Jul 30, 2019
e2ae1a6
Add tests for other dist_utils functions.
Kami Jul 30, 2019
8bb8673
Fix test failure inder Python 3.
Kami Jul 30, 2019
bfb3189
Run more complete checks as part of a nightly build.
Kami Jul 30, 2019
e7df5c0
Configure nightly build in travis config.
Kami Jul 30, 2019
bc22785
Don't enable coverage for nightly builds since it's redundant because it
Kami Jul 30, 2019
97facf6
As part of make play, also print value of travis_event_type env
Kami Jul 30, 2019
a38ef10
Make travis config more readable by introducing IS_NIGHTLY_BUILD env
Kami Jul 30, 2019
fdf5e96
Test a nightly build.
Kami Jul 30, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
*.sqlite
*.swp
*.log
*/requirements.txt
!st2client/requirements.txt
.stamp*

# C extensions
Expand All @@ -28,6 +26,8 @@ virtualenv-py3
virtualenv-osx
virtualenv-st2client
virtualenv-st2client-osx
virtualenv-components
virtualenv-components-osx
.venv-st2devbox

# Installer logs
Expand Down
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ branches:

env:
global:
- TRAVIS_EVENT_TYPE=cron
- IS_NIGHTLY_BUILD=$([ "${TRAVIS_EVENT_TYPE}" = "cron" ] && echo "yes" || echo "no")
# NOTE: We only enable coverage for master builds and not pull requests
# since it has huge performance overhead (etests are 50% or so slower)
- ENABLE_COVERAGE=$([ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "yes" || echo "no")
# since it has huge performance overhead (tests are 50% or so slower)
- ENABLE_COVERAGE=$([ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${IS_NIGHTLY_BUILD}" = "no" ] && echo "yes" || echo "no")
# We need to explicitly specify terminal width otherwise some CLI tests fail on container
# environments where small terminal size is used.
- COLUMNS=120
- PYLINT_CONCURRENCY=2
# We only run tests with "--with-timer" flag on master and not for PRs since it adds 1-2
# # minutes of overhead to each build.
- NOSE_TIME=$([ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "yes" || echo "no")
- NOSE_TIME=$([ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${IS_NIGHTLY_BUILD}" = "no" ] && echo "yes" || echo "no")
matrix:
include:
# NOTE: We combine builds because Travis offers a maximum of 5 concurrent
Expand Down Expand Up @@ -132,7 +134,9 @@ script:
# Clean up egg-info directories which get created when installing runners
# NOTE: We enable code coverage and per test timing information on master so build can take twice
# as long as PR builds
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then COMMAND_THRESHOLD=$(expr ${COMMAND_THRESHOLD} \* 2); fi; ./scripts/travis/time-command.sh "make ${TASK}" ${COMMAND_THRESHOLD}
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${IS_NIGHTLY_BUILD}" = "no" ]; then COMMAND_THRESHOLD=$(expr ${COMMAND_THRESHOLD} \* 2); fi; ./scripts/travis/time-command.sh "make ${TASK}" ${COMMAND_THRESHOLD}
# Run any additional nightly checks only as part of a nightly (cron) build
- if [ "${IS_NIGHTLY_BUILD}" = "yes" ] && [ "${TASK}" = "ci-checks ci-packs-tests" ]; then make ci-checks-nightly; fi
# NOTE: We only generate and submit coverage report for master and version branches
# NOTE: We put this here and not after_success so build is marked as failed if this step fails
# See https://docs.travis-ci.com/user/customizing-the-build/#breaking-the-build
Expand All @@ -143,4 +147,4 @@ script:
# See: https://docs.travis-ci.com/user/caching/#Pull-request-builds-and-caches
# Alternative: use strict pip pinning, including git-based pip packages
before_cache:
- if [ ${TRAVIS_PULL_REQUEST} = 'false' ]; then rm -rf virtualenv/; fi
- if [ ${TRAVIS_PULL_REQUEST} = 'false' ] && [ "${IS_NIGHTLY_BUILD}" = "no" ]; then rm -rf virtualenv/; fi
47 changes: 46 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ OS := $(shell uname)
ifeq ($(OS),Darwin)
VIRTUALENV_DIR ?= virtualenv-osx
VIRTUALENV_ST2CLIENT_DIR ?= virtualenv-st2client-osx
VIRTUALENV_COMPONENTS_DIR ?= virtualenv-components-osx
else
VIRTUALENV_DIR ?= virtualenv
VIRTUALENV_ST2CLIENT_DIR ?= virtualenv-st2client
VIRTUALENV_COMPONENTS_DIR ?= virtualenv-components
endif

PYTHON_VERSION ?= python2.7
Expand All @@ -20,6 +22,7 @@ BINARIES := bin
# All components are prefixed by st2 and not .egg-info.
COMPONENTS := $(shell ls -a | grep ^st2 | grep -v .egg-info)
COMPONENTS_RUNNERS := $(wildcard contrib/runners/*)
COMPONENTS_WITHOUT_ST2TESTS := $(shell ls -a | grep ^st2 | grep -v .egg-info | grep -v st2tests | grep -v st2exporter)

COMPONENTS_WITH_RUNNERS := $(COMPONENTS) $(COMPONENTS_RUNNERS)

Expand Down Expand Up @@ -120,6 +123,8 @@ play:
@echo
@echo TRAVIS_PULL_REQUEST=$(TRAVIS_PULL_REQUEST)
@echo
@echo TRAVIS_EVENT_TYPE=$(TRAVIS_EVENT_TYPE)
@echo
@echo NOSE_OPTS=$(NOSE_OPTS)
@echo
@echo ENABLE_COVERAGE=$(ENABLE_COVERAGE)
Expand Down Expand Up @@ -159,6 +164,44 @@ check-requirements: requirements
git status -- *requirements.txt */*requirements.txt | grep -q "nothing to commit"
@echo "All requirements files up-to-date!"

.PHONY: check-python-packages
check-python-packages:
# Make target which verifies all the components Python packages are valid
@echo ""
@echo "================== CHECK PYTHON PACKAGES ===================="
@echo ""

test -f $(VIRTUALENV_COMPONENTS_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) --no-site-packages $(VIRTUALENV_COMPONENTS_DIR) --no-download
@for component in $(COMPONENTS_WITHOUT_ST2TESTS); do \
echo "==========================================================="; \
echo "Checking component:" $$component; \
echo "==========================================================="; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/python setup.py --version) || exit 1; \
done

.PHONY: check-python-packages-nightly
check-python-packages-nightly:
# NOTE: This is subset of check-python-packages target.
# We run more extensive and slower tests as part of the nightly build to speed up PR builds
@echo ""
@echo "================== CHECK PYTHON PACKAGES ===================="
@echo ""

test -f $(VIRTUALENV_COMPONENTS_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) --no-site-packages $(VIRTUALENV_COMPONENTS_DIR) --no-download
@for component in $(COMPONENTS_WITHOUT_ST2TESTS); do \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only complain that iterating over all services includes st2client, which duplicates .st2client-install-check that already ran during the make ci-checks

echo "==========================================================="; \
echo "Checking component:" $$component; \
echo "==========================================================="; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/python setup.py --version) || exit 1; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/python setup.py sdist bdist_wheel) || exit 1; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/python setup.py develop --no-deps) || exit 1; \
($(VIRTUALENV_COMPONENTS_DIR)/bin/python -c "import $$component") || exit 1; \
(set -e; cd $$component; rm -rf dist/; rm -rf $$component.egg-info) || exit 1; \
done

.PHONY: ci-checks-nightly
ci-checks-nightly: check-python-packages-nightly

.PHONY: checklogs
checklogs:
@echo
Expand Down Expand Up @@ -758,6 +801,8 @@ packs-tests: requirements .packs-tests
@echo
@echo "==================== packs-tests ===================="
@echo
# Install st2common to register metrics drivers
(cd ${ROOT_DIR}/st2common; ${ROOT_DIR}/$(VIRTUALENV_DIR)/bin/python setup.py develop --no-deps)
. $(VIRTUALENV_DIR)/bin/activate; find ${ROOT_DIR}/contrib/* -maxdepth 0 -type d -print0 | xargs -0 -I FILENAME ./st2common/bin/st2-run-pack-tests -c -t -x -p FILENAME


Expand Down Expand Up @@ -862,7 +907,7 @@ debs:
ci: ci-checks ci-unit ci-integration ci-mistral ci-packs-tests

.PHONY: ci-checks
ci-checks: compile .generated-files-check .pylint .flake8 check-requirements .st2client-dependencies-check .st2common-circular-dependencies-check circle-lint-api-spec .rst-check .st2client-install-check
ci-checks: compile .generated-files-check .pylint .flake8 check-requirements .st2client-dependencies-check .st2common-circular-dependencies-check circle-lint-api-spec .rst-check .st2client-install-check check-python-packages

.PHONY: ci-py3-unit
ci-py3-unit:
Expand Down
31 changes: 22 additions & 9 deletions scripts/dist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,8 @@

GET_PIP = 'curl https://bootstrap.pypa.io/get-pip.py | python'

try:
import pip
except ImportError as e:
print('Failed to import pip: %s' % (text_type(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)


__all__ = [
'check_pip_is_installed',
'check_pip_version',
'fetch_requirements',
'apply_vagrant_workaround',
Expand All @@ -49,17 +41,38 @@
]


def check_pip_is_installed():
"""
Ensure that pip is installed.
"""
try:
import pip # NOQA
except ImportError as e:
print('Failed to import pip: %s' % (text_type(e)))
print('')
print('Download pip:\n%s' % (GET_PIP))
sys.exit(1)

return True


def check_pip_version(min_version='6.0.0'):
"""
Ensure that a minimum supported version of pip is installed.
"""
check_pip_is_installed()

import pip

if StrictVersion(pip.__version__) < StrictVersion(min_version):
print("Upgrade pip, your version '{0}' "
"is outdated. Minimum required version is '{1}':\n{2}".format(pip.__version__,
min_version,
GET_PIP))
sys.exit(1)

return True


def fetch_requirements(requirements_file_path):
"""
Expand Down
17 changes: 17 additions & 0 deletions st2actions/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Don't edit this file. It's generated automatically!
apscheduler==3.6.0
eventlet==0.24.1
git+https://github.com/Kami/logshipper.git@stackstorm_patched#egg=logshipper
git+https://github.com/StackStorm/python-mistralclient.git#egg=python-mistralclient
gitpython==2.1.11
jinja2==2.10.1
kombu==4.5.0
lockfile==0.12.2
oslo.config<1.13,>=1.12.1
oslo.utils<=3.37.0,>=3.36.2
pyinotify==0.9.6
python-dateutil==2.8.0
python-json-logger
pyyaml==5.1
requests[security]<2.23.0,>=2.22.0
six==1.12.0
15 changes: 15 additions & 0 deletions st2actions/st2actions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '3.2dev'
11 changes: 11 additions & 0 deletions st2api/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Don't edit this file. It's generated automatically!
eventlet==0.24.1
git+https://github.com/StackStorm/python-mistralclient#egg=python-mistralclient
gunicorn==19.9.0
jsonschema==2.6.0
kombu==4.5.0
mongoengine==0.17.0
oslo.config<1.13,>=1.12.1
oslo.utils<=3.37.0,>=3.36.2
pymongo==3.7.2
six==1.12.0
15 changes: 15 additions & 0 deletions st2api/st2api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '3.2dev'
10 changes: 10 additions & 0 deletions st2auth/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Don't edit this file. It's generated automatically!
bcrypt==3.1.6
eventlet==0.24.1
git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file
gunicorn==19.9.0
oslo.config<1.13,>=1.12.1
passlib==1.7.1
pymongo==3.7.2
six==1.12.0
stevedore==1.30.1
15 changes: 15 additions & 0 deletions st2auth/st2auth/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '3.2dev'
9 changes: 7 additions & 2 deletions st2common/st2common/util/green/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,20 @@ def on_timeout_expired(timeout):
# Command has timed out, kill the process and propagate the error.
# Note: We explicitly set the returncode to indicate the timeout.
LOG.debug('Command execution timeout reached.')

# NOTE: It's important we set returncode twice - here and below to avoid race in this
# function because "kill_func()" is async and "process.kill()" is not.
process.returncode = TIMEOUT_EXIT_CODE

if kill_func:
LOG.debug('Calling kill_func.')
kill_func(process=process)
else:
LOG.debug('Killing process.')
process.kill()

# NOTE: It's imporant to set returncode here, since call to kill()
# sets it and overwrites it if we set it earlier
# NOTE: It's imporant to set returncode here as well, since call to process.kill() sets
# it and overwrites it if we set it earlier.
process.returncode = TIMEOUT_EXIT_CODE

if read_stdout_func and read_stderr_func:
Expand Down
16 changes: 16 additions & 0 deletions st2common/tests/fixtures/version_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '1.2.3'
Loading