Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
# Run st2 Integration tests
integration:
docker:
- image: circleci/python:2.7
- image: circleci/python:3.6
- image: mongo:4.0
- image: rabbitmq:3
working_directory: ~/st2
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
# Run st2 Lint Checks
lint:
docker:
- image: circleci/python:2.7
- image: circleci/python:3.6
- image: mongo:4.0
- image: rabbitmq:3
working_directory: ~/st2
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
resource_class: large
docker:
# The primary container is an instance of the first list image listed. Your build commands run in this container.
- image: circleci/python:2.7
- image: circleci/python:3.6
working_directory: ~/st2
environment:
- DISTROS: "xenial bionic el7 el8"
Expand Down
36 changes: 19 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ branches:
- master
- /^v[0-9]+\.[0-9]+$/

python:
- "3.6"
# - "3.7"
# - "3.8"
# - "3.9"

env:
global:
- IS_NIGHTLY_BUILD=$([ "${TRAVIS_EVENT_TYPE}" = "cron" ] && echo "yes" || echo "no")
Expand All @@ -22,8 +28,7 @@ env:
- NOSE_TIME=$([ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${IS_NIGHTLY_BUILD}" = "no" ] && echo "yes" || echo "no")
# Travis-specific st2.conf (with travis user instead of stanley)
- ST2_CONF=conf/st2.travis.conf
jobs:
include:
jobs:
# NOTE: We combine builds because Travis offers a maximum of 5 concurrent
# builds and having 6 tasks / builds means 1 tasks will need to wait for one
# of the other 5 tasks to finish before it can start
Expand All @@ -36,25 +41,22 @@ jobs:
# If you rename or reorder make targets in TASK, you may need to adjust:
# scripts/travis/install-requirements.sh
# scripts/travis/run-nightly-make-task-if-exists.sh
- name: "Unit Tests (Python 2.7 MongoDB 4.0)"
python: 2.7
env: TASK=ci-unit CACHE_NAME=py2 PYTHON_VERSION=python2.7 COMMAND_THRESHOLD=700
- TASK=ci-checks COMMAND_THRESHOLD=300

- TASK=compilepy3 COMMAND_THRESHOLD=300

- name: "Integration Tests (Python 2.7)"
python: 2.7
env: TASK=ci-integration CACHE_NAME=py2 PYTHON_VERSION=python2.7 COMMAND_THRESHOLD=700
- TASK=ci-packs-tests COMMAND_THRESHOLD=300

- name: "Lint Checks, Packs Tests (Python 3.6)"
python: 3.6
env: TASK="ci-checks ci-packs-tests" CACHE_NAME=py3 PYTHON_VERSION=python3.6 COMMAND_THRESHOLD=430
- TASK=ci-unit COMMAND_THRESHOLD=300

- name: "Unit Tests, Pack Tests (Python 3.6)"
python: 3.6
env: TASK="compilepy3 ci-py3-unit ci-py3-packs-tests" CACHE_NAME=py3 PYTHON_VERSION=python3.6 COMMAND_THRESHOLD=750
- TASK=ci-integration COMMAND_THRESHOLD=300

- name: "Integration Tests (Python 3.6)"
python: 3.6
env: TASK="ci-py3-integration" CACHE_NAME=py3 PYTHON_VERSION=python3.6 COMMAND_THRESHOLD=770
# jobs:
# fast_finish: true
# allow_failures:
# - python: "3.7"
# - python: "3.8"
# - python: "3.9"

addons:
apt:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Changed

Contributed by @hnanchahal

* Updated Travis CI and CircleCI builds to only use Python 3

Contributed by @blag

Fixed
~~~~~~~~~
* Added monkey patch fix to st2stream to enable it to work with mongodb via SSL. (bug fix) #5078 #5091
Expand Down
54 changes: 9 additions & 45 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ else
VIRTUALENV_COMPONENTS_DIR ?= virtualenv-components
endif

PYTHON_VERSION ?= $(shell if [ -z "`which python3.6`" ]; then echo "python2.7"; else echo "python3.6"; fi)

BINARIES := bin

# All components are prefixed by st2 and not .egg-info.
Expand Down Expand Up @@ -50,11 +48,7 @@ COMPONENTS_TEST_MODULES_COMMA := $(subst $(space_char),$(comma),$(COMPONENTS_TES
COVERAGE_GLOBS := .coverage.unit.* .coverage.integration.*
COVERAGE_GLOBS_QUOTED := $(foreach glob,$(COVERAGE_GLOBS),'$(glob)')

ifeq ($(PYTHON_VERSION),python2.7)
REQUIREMENTS := test-requirements-py27.txt requirements.txt
else
REQUIREMENTS := test-requirements.txt requirements.txt
endif
REQUIREMENTS := test-requirements.txt requirements.txt

# Pin common pip version here across all the targets
# Note! Periodic maintenance pip upgrades are required to be up-to-date with the latest pip security fixes and updates
Expand Down Expand Up @@ -112,7 +106,7 @@ all: requirements configgen check tests
# Target for debugging Makefile variable assembly
.PHONY: play
play:
@echo PYTHON_VERSION=$(PYTHON_VERSION)
@echo PYTHON_VERSION=$$(python --version)
@echo
@echo COVERAGE_GLOBS=$(COVERAGE_GLOBS_QUOTED)
@echo
Expand Down Expand Up @@ -233,7 +227,7 @@ check-python-packages:
@echo ""
@echo "================== CHECK PYTHON PACKAGES ===================="
@echo ""
test -f $(VIRTUALENV_COMPONENTS_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) $(VIRTUALENV_COMPONENTS_DIR) --no-download --system-site-packages
test -f $(VIRTUALENV_COMPONENTS_DIR)/bin/activate || $(PYTHON_VERSION) -m venv $(VIRTUALENV_COMPONENTS_DIR) --system-site-packages
@for component in $(COMPONENTS_WITHOUT_ST2TESTS); do \
echo "==========================================================="; \
echo "Checking component:" $$component; \
Expand All @@ -249,7 +243,7 @@ check-python-packages-nightly:
@echo "================== CHECK PYTHON PACKAGES ===================="
@echo ""

test -f $(VIRTUALENV_COMPONENTS_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) $(VIRTUALENV_COMPONENTS_DIR) --no-download
test -f $(VIRTUALENV_COMPONENTS_DIR)/bin/activate || $(PYTHON_VERSION) -m venv $(VIRTUALENV_COMPONENTS_DIR)
@for component in $(COMPONENTS_WITHOUT_ST2TESTS); do \
echo "==========================================================="; \
echo "Checking component:" $$component; \
Expand Down Expand Up @@ -381,7 +375,7 @@ flake8: requirements .flake8
@echo
@echo "==================== st2client install check ===================="
@echo
test -f $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) $(VIRTUALENV_ST2CLIENT_DIR) --no-download --system-site-packages
test -f $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate || $(PYTHON_VERSION) -m venv $(VIRTUALENV_ST2CLIENT_DIR) --system-site-packages

# Setup PYTHONPATH in bash activate script...
# Delete existing entries (if any)
Expand Down Expand Up @@ -424,17 +418,11 @@ lint: requirements .lint
.PHONY: clean
clean: .cleanpycs

.PHONY: compile
compile:
@echo "======================= compile ========================"
@echo "------- Compile all .py files (syntax check test - Python 2) ------"
@if python -c 'import compileall,re; compileall.compile_dir(".", rx=re.compile(r"/virtualenv|virtualenv-osx|virtualenv-py3|.tox|.git|.venv-st2devbox"), quiet=True)' | grep .; then exit 1; else exit 0; fi

.PHONY: compilepy3
compilepy3:
@echo "======================= compile ========================"
@echo "------- Compile all .py files (syntax check test - Python 3) ------"
@if python3 -c 'import compileall,re; compileall.compile_dir(".", rx=re.compile(r"/virtualenv|virtualenv-osx|virtualenv-py3|.tox|.git|.venv-st2devbox|./st2tests/st2tests/fixtures/packs/test"), quiet=True)' | grep .; then exit 1; else exit 0; fi
python3 -m compileall -f -q -x 'virtualenv|virtualenv-osx|virtualenv-py3|.tox|.git|.venv-st2devbox|./st2tests/st2tests/fixtures/packs/test' .

.PHONY: .cleanpycs
.cleanpycs:
Expand Down Expand Up @@ -591,7 +579,7 @@ virtualenv:
@echo
@echo "==================== virtualenv ===================="
@echo
test -f $(VIRTUALENV_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) $(VIRTUALENV_DIR) --no-download
test -f $(VIRTUALENV_DIR)/bin/activate || $(PYTHON_VERSION) -m venv $(VIRTUALENV_DIR)

# Setup PYTHONPATH in bash activate script...
# Delete existing entries (if any)
Expand Down Expand Up @@ -635,7 +623,7 @@ tests: pytests
pytests: compilepy3 requirements .flake8 .pylint .pytests-coverage

.PHONY: .pytests
.pytests: compile .configgen .generate-api-spec .unit-tests clean
.pytests: compilepy3 .configgen .generate-api-spec .unit-tests clean

.PHONY: .pytests-coverage
.pytests-coverage: .unit-tests-coverage-html clean
Expand Down Expand Up @@ -969,31 +957,7 @@ debs:
ci: ci-checks ci-unit ci-integration ci-packs-tests

.PHONY: ci-checks
ci-checks: compilepy3 .generated-files-check .pylint .flake8 check-requirements check-sdist-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:
@echo
@echo "==================== ci-py3-unit ===================="
@echo
NOSE_WITH_TIMER=$(NOSE_WITH_TIMER) tox -e py36-unit -vv

.PHONY: ci-py3-packs-tests
ci-py3-packs-tests:
@echo
@echo "==================== ci-py3-packs-tests ===================="
@echo
NOSE_WITH_TIMER=$(NOSE_WITH_TIMER) tox -e py36-packs -vv

.PHONY: ci-py3-integration
ci-py3-integration: requirements .ci-prepare-integration .ci-py3-integration

.PHONY: .ci-py3-integration
.ci-py3-integration:
@echo
@echo "==================== ci-py3-integration ===================="
@echo
NOSE_WITH_TIMER=$(NOSE_WITH_TIMER) tox -e py36-integration -vv
ci-checks: .generated-files-check .pylint .flake8 check-requirements check-sdist-requirements .st2client-dependencies-check .st2common-circular-dependencies-check circle-lint-api-spec .rst-check .st2client-install-check check-python-packages

.PHONY: .rst-check
.rst-check:
Expand Down
2 changes: 1 addition & 1 deletion st2actions/bin/st2actionrunner
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2actions/bin/st2notifier
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2actions/bin/st2resultstracker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2actions/bin/st2scheduler
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2actions/bin/st2workflowengine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2api/bin/st2api
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3

import sys
from st2api import cmd
Expand Down
2 changes: 1 addition & 1 deletion st2auth/bin/st2auth
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
6 changes: 3 additions & 3 deletions st2client/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# <<<< TO DEPRICATE
SHELL := /bin/bash
PY27 := /usr/bin/python2.7
PY3 := /usr/bin/python3
RPM_ROOT=~/rpmbuild
RPM_SOURCES_DIR := $(RPM_ROOT)/SOURCES/
RPM_SPECS_DIR := $(RPM_ROOT)/SPECS/
Expand All @@ -10,7 +10,7 @@ COMPONENTS := st2client

.PHONY: rpm
rpm:
$(PY27) setup.py bdist_rpm --python=$(PY27)
$(PY3) setup.py bdist_rpm --python=$(PY3)
mkdir -p $(RPM_ROOT)/RPMS/noarch
cp dist/$(COMPONENTS)*noarch.rpm $(RPM_ROOT)/RPMS/noarch/$(COMPONENTS)-$(VER)-$(RELEASE).noarch.rpm
mkdir -p $(RPM_ROOT)/SRPMS
Expand All @@ -19,7 +19,7 @@ rpm:

.PHONY: deb
deb:
$(PY27) setup.py --command-packages=stdeb.command bdist_deb
$(PY3) setup.py --command-packages=stdeb.command bdist_deb
mkdir -p ~/debbuild
cp deb_dist/python-$(COMPONENTS)*-1_all.deb ~/debbuild/$(COMPONENTS)_$(VER)-$(RELEASE)_amd64.deb
rm -Rf dist deb_dist $(COMPONENTS)-$(VER).tar.gz $(COMPONENTS).egg-info ChangeLog AUTHORS build
Expand Down
2 changes: 1 addition & 1 deletion st2client/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
Expand Down
2 changes: 1 addition & 1 deletion st2common/bin/paramiko_ssh_evenlets_tester.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
Expand Down
2 changes: 1 addition & 1 deletion st2common/bin/st2-bootstrap-rmq
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2common/bin/st2-cleanup-db
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2common/bin/st2-generate-schemas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
#
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
Expand Down
2 changes: 1 addition & 1 deletion st2common/bin/st2-register-content
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2common/bin/st2-validate-pack-config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2debug/bin/st2-submit-debug-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2exporter/bin/st2exporter
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3

import sys
from st2exporter.cmd import st2exporter_starter
Expand Down
2 changes: 1 addition & 1 deletion st2reactor/bin/st2-rule-tester
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2reactor/bin/st2-trigger-refire
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2reactor/bin/st2garbagecollector
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2reactor/bin/st2rulesengine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2reactor/bin/st2sensorcontainer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2reactor/bin/st2timersengine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand Down
2 changes: 1 addition & 1 deletion st2stream/bin/st2stream
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3

import sys
from st2stream import cmd
Expand Down
Loading