8000 Include requirements.txt files for all the components Python packages by Kami · Pull Request #4751 · StackStorm/st2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Include requirements.txt files for all the components Python packages #4751

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

Merged
merged 20 commits into from
Jul 30, 2019

Conversation

Kami
Copy link
Member
@Kami Kami commented Jul 29, 2019

This pull request updates all the component Python packages so we include requirements.txt files.

This is needed to make all the components valid Python packages so they can be re-used outside of the StackStorm/st2 context.

Before that change, only st2common and st2client + all the runners were valid Python packages.

In addition to that, we also need to include __version__ attribute as part of all the Python package __init__.py file. This will be handled by StackStorm/st2cd workflow.

NOTE: This is similar to the change I made in the past to make action runners valid Python packages.

TODO

This way Python packages are valid and can be re-used from other places.
Kami added 8 commits July 29, 2019 17:53
This makes them valid Python packages.
If kill_func() is called there is a possible race where run_command()
will return before kill_func() finishes and as such, process.returncode
won't be set.

This happens because kill_func is async.
@Kami
Copy link
Member Author
Kami commented Jul 29, 2019

As a "bonus", I also fixed intermediate test failure / race which has been happening for a long time - https://gist.github.com/Kami/83ee1d430a2366b3656fa2d28286f810.

This race happens because kill_func() is async and it means run_command() could return before that function returns and before process.returncode is set. As such, we need to set the return code twice to account for both scenarios (async kill_func() and non async process.kill()).

I confirmed the fix locally by running the offending test 100 times - it didn't fail even a single time. Without that change, it fails quite often.

@Kami
Copy link
Member Author
Kami commented Jul 30, 2019

@armab I initially missed this in #4750 - c919ff9.

Now pip is only needed for check_pip_version function so we only perform that check when check_pip_version is called.

While at it, I also added test cases for other functions in that file - e2ae1a6.

I included this change as part of this PR since it's also related to components Python packages and distribution.

Sadly it means I will need to port this change to other repos again.

touch $(VIRTUALENV_COMPONENTS_DIR)/bin/activate
chmod +x $(VIRTUALENV_COMPONENTS_DIR)/bin/activate

@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

Copy link
Member
@arm4b arm4b left a comment

Choose a reason for hiding this comment

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

LGTM,
considering all tests pass (Travis is not yet happy).

@Kami
Copy link
Member Author
8000
Kami commented Jul 30, 2019

@armab Correct, but st2client checks are a bit more extensive since we also install dependencies there (aka use python setup.py install).

So in a sense, tests which run as part of this next task are a subset of the existing st2client tests.

We run additional ci-checks-nightly as part of a nightly (cron) build.
@Kami
Copy link
Member Author
Kami commented Jul 30, 2019

Per discussion with @Arma, I moved some of the more extensive checks to a nightly (cron) build - e7df5c0.

Any additional nightly checks now run as part of the Lint Checks, Packs Tests (Python 2.7) job during the nightly build.

Sadly Travis CI doesn't allow infrastructure as code (aka via travis config) approach to configure nightly builds so I needed to configure it in their WebUI.

Screenshot from 2019-07-30 17-41-10

In the future, we can utilize the same pattern to offload any additional and slower checks to a nightly build (so we speed up master branch merge and PR builds).

This doesn't mean we can just offload everything to the nightly build though (as much as possible should run as part of the every PR build). We should still practice diligence and always look for ways to speed up PR and master builds :)

@Kami
Copy link
Member Author
Kami commented Jul 30, 2019

Confirmed nightly build is working correctly by "emulating" one (fdf5e96) - https://travis-ci.org/StackStorm/st2/builds/565579951, https://travis-ci.org/StackStorm/st2/jobs/565579954#L3504.

@Kami Kami merged commit 9eb2cfc into master Jul 30, 2019
@Kami Kami deleted the include_requirements_txt_for_all_packages branch July 30, 2019 17:28
@Kami Kami mentioned this pull request Jul 30, 2019
arm4b pushed a commit that referenced this pull request Apr 27, 2020
Follow-up to #4751 where regression was introduced

Release automation fix: StackStorm/st2cd#435
@arm4b
Copy link
Member
arm4b commented Apr 27, 2020

FYI this broke the package build for 3.2.0 release as automation missed updating __init__.py files with the stable version.

Fixed via StackStorm/st2cd#435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0