Skip to content

Conversation

@nforro
Copy link
Member

@nforro nforro commented Nov 26, 2025

No description provided.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for the SKIP_SETTING_JIRA_FIELDS environment variable to prevent updates to Jira fields, similar to the existing DRY_RUN variable. The implementation is straightforward. My review includes a suggestion to refactor the condition for checking environment variables to improve readability and reduce duplication. I've also noted that a test case for the new functionality is missing and should be added to ensure the change is properly verified.

Copy link
Member

@lbarcziova lbarcziova left a comment

Choose a reason for hiding this comment

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

🙏

@nforro
Copy link
Member Author

nforro commented Nov 26, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a SKIP_SETTING_JIRA_FIELDS environment variable to bypass updating Jira fields, similar to the existing DRY_RUN functionality. The implementation is straightforward. My review includes a suggestion to make the environment variable check more robust and a recommendation to add test coverage for the new logic branch to ensure correctness.

flexmock(os).should_receive("getenv").with_args("JIRA_URL").and_return("http://jira")
flexmock(os).should_receive("getenv").with_args("JIRA_TOKEN").and_return("12345")
flexmock(os).should_receive("getenv").with_args("DRY_RUN", "False").and_return("false")
flexmock(os).should_receive("getenv").with_args("SKIP_SETTING_JIRA_FIELDS", "False").and_return("false")
Copy link
Contributor

Choose a reason for hiding this comment

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

high

While this change correctly mocks the new environment variable for existing tests, the new functionality itself is not tested. A new test case should be added to verify that when SKIP_SETTING_JIRA_FIELDS is set to a truthy value, the set_jira_fields function returns the expected skip message and does not attempt to make any API calls to Jira. Untested code paths can introduce regressions in the future.

"""
Updates the specified Jira issue, setting only the fields that are currently empty/unset.
"""
if os.getenv("SKIP_SETTING_JIRA_FIELDS", "False").lower() == "true":
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Checking for boolean environment variables by comparing to just 'true' can be brittle, as users might intuitively use other truthy values like '1' or 'yes'. It's more robust to check against a set of common truthy string values. This improvement could also be applied to the DRY_RUN check that follows.

Suggested change
if os.getenv("SKIP_SETTING_JIRA_FIELDS", "False").lower() == "true":
if os.getenv("SKIP_SETTING_JIRA_FIELDS", "False").lower() in ("true", "1", "yes"):

@nforro nforro merged commit 116dd54 into packit:main Nov 26, 2025
7 checks passed
@nforro nforro deleted the fixes branch November 26, 2025 13:53
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