-
Notifications
You must be signed in to change notification settings - Fork 2
*.py files migrated from gardenlinux workflows #179
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
base: main
Are you sure you want to change the base?
*.py files migrated from gardenlinux workflows #179
Conversation
description: "Generated GitHub workflow flavors matrix" | ||
version: | ||
description: GardenLinux Python library version | ||
default: "0.10.0" |
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.
what is the use of this parameter? is this a temporary thing for development or a permanent thing?
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.
You can specify which python-gardenlinux-lib
to install using the version
input parameter for .github/actions/setup
. While this has advantages to select a known tested/working version for execution I do not see an benefit adding it to flavors_parse
or ''features_parse` GitHub actions as they provide an encapsulated result (matrix or GL canonical name) for example.
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.
Not sure I understand what you mean by encapsulated result. flavors_parse action installs python-gardenlinux-lib. I've added version input for all actions that install this library, because otherwise the version of the library is tied to the version of CI workflow code and I think these concerns should not be mixed.
description: "Generated GitHub workflow flavors matrix" | ||
version: | ||
description: GardenLinux Python library version | ||
default: "0.10.0" |
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.
You can specify which python-gardenlinux-lib
to install using the version
input parameter for .github/actions/setup
. While this has advantages to select a known tested/working version for execution I do not see an benefit adding it to flavors_parse
or ''features_parse` GitHub actions as they provide an encapsulated result (matrix or GL canonical name) for example.
@@ -37,11 +37,16 @@ gl-features-parse = "gardenlinux.features.__main__:main" | |||
gl-flavors-parse = "gardenlinux.flavors.__main__:main" | |||
gl-oci = "gardenlinux.oci.__main__:main" | |||
gl-s3 = "gardenlinux.s3.__main__:main" | |||
gl-gh = "gardenlinux.github.__main__:main" |
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.
While we are working with GitHub API for this executable I would recommend to leave it separate to any "generic" GitHub tooling we might need. Therefore the executable should be called something like gl-github-release
and call a gardenlinux/github/release_main.py
entrypoint.
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.
This file needs refactoring. There are too many generic / helper functions doing various things needed for later release content creation.
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.
Although I agree with that, it's not the focus of this PR.
I intentionally didn't change much in the existing code, just fixed the issues.
Let's first move the code away from the main gardenlinux repo, release the 0.10.0 and then improve or refactor it step-by-step in 0.10.x versions.
src/gardenlinux/github/__main__.py
Outdated
|
||
|
||
def _get_package_list(gardenlinux_version): | ||
(path, headers) = urllib.request.urlretrieve( |
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.
We use the Python package requests
earlier in this file. Why not reuse it here as well? Does it make sense to add this code in a generic way to e.g. GardenLinuxRepo
?
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.
Replaced urllib with requests.
sys.exit(1) | ||
|
||
|
||
def create_github_release(owner, repo, tag, commitish, body): |
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.
This code should be replaced by a third-party Python package providing support to talk to the GitHub API. If needed it may be encapsulated by one or more classes added to gardenlinux.github
.
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.
Bringing in another project dependency just to replace two simple http POST calls doesn't seem beneficial to me.
response.raise_for_status() | ||
|
||
|
||
def upload_to_github_release_page( |
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.
Same as for create_github_release()
.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #179 +/- ##
==========================================
- Coverage 92.95% 88.12% -4.83%
==========================================
Files 28 30 +2
Lines 1306 1794 +488
==========================================
+ Hits 1214 1581 +367
- Misses 92 213 +121 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What this PR does / why we need it: This consolidates python CI code from the main gardenlinux repository into the existing python module
Which issue(s) this PR fixes:
Fixes
Special notes for your reviewer:
Release creation code was tested on a gardenlinux repo fork: https://github.com/vivus-ignis/gardenlinux-dev/releases
As the bulk of the code was extracted from the gardenlinux/gardenlinux repository, this PR does not show what was changed there. Therefore attaching a diff here:
Diff
Release note: