Skip to content

Commit

Permalink
Merge pull request #65 from Cray-HPE/release/1.8.1
Browse files Browse the repository at this point in the history
Release/1.8.1
  • Loading branch information
jesseviola-hpe committed Jan 30, 2023
2 parents 9682327 + dd0228c commit 85e6d86
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.8.1] - 2023-01-30

- CASMINST-5866: Adjust log levels for IUF CLI handling
- CASMINST-5866: Handle and skip non-semver branch names gracefully

## [1.8.0] - 2023-01-19

### Added
Expand Down Expand Up @@ -182,7 +187,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial implementation @rkleinman-hpe

[Unreleased]: https://github.com/Cray-HPE/cf-gitea-import/compare/v1.8.0...HEAD
[Unreleased]: https://github.com/Cray-HPE/cf-gitea-import/compare/v1.8.1...HEAD

[1.8.1]: https://github.com/Cray-HPE/cf-gitea-import/releases/tag/v1.8.1

[1.8.0]: https://github.com/Cray-HPE/cf-gitea-import/releases/tag/v1.8.0

Expand All @@ -192,7 +199,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

[1.6.1]: https://github.com/Cray-HPE/cf-gitea-import/releases/tag/v1.6.1


[1.6.0]: https://github.com/Cray-HPE/cf-gitea-import/releases/tag/v1.6.0

[1.5.7]: https://github.com/Cray-HPE/cf-gitea-import/releases/tag/v1.5.7
Expand Down
22 changes: 19 additions & 3 deletions import.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ def find_base_branch(base_branch, git_repo, gitea_repo, product_version, branch_
# current version
semver_branch_matches.sort(key=itemgetter(1))
for index, (branch_name, branch_semver) in enumerate(semver_branch_matches): # noqa: E501
compare = semver.compare(branch_semver, product_version)
try:
compare = semver.compare(branch_semver, product_version)
except ValueError:
LOGGER.warning(f"branch {branch_semver} is not a valid semver string", exc_info=True)
continue

# other version higher than product version (edge case)
if compare >= 0:
Expand Down Expand Up @@ -277,6 +281,15 @@ def _setup_logging():
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') # noqa: E501
handler.setFormatter(formatter)
LOGGER.addHandler(handler)

def _setup_iuf_logging():
""" Setup stdout IUF CLI logging for this script """
LOGGER.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(levelname)s - %(message)s') # noqa: E501
handler.setFormatter(formatter)
LOGGER.addHandler(handler)


def _report_environment():
Expand All @@ -292,8 +305,11 @@ def _report_environment():

# Main Program
if __name__ == "__main__":

_setup_logging()
iuf = os.getenv("IUF_LOGGING", 'False').lower() in ('true', '1', 't')
if iuf:
_setup_iuf_logging()
else:
_setup_logging()
_report_environment()

# Set required variables from environment
Expand Down

0 comments on commit 85e6d86

Please sign in to comment.