Skip to content

Add JIRA_ISSUES_SIZE to the JiraEnvironmentVariableBuilder#707

Merged
rantoniuk merged 15 commits intojenkinsci:masterfrom
rantoniuk:mupakoz-pr-119-fix-conflicts
Jun 20, 2025
Merged

Add JIRA_ISSUES_SIZE to the JiraEnvironmentVariableBuilder#707
rantoniuk merged 15 commits intojenkinsci:masterfrom
rantoniuk:mupakoz-pr-119-fix-conflicts

Conversation

@rantoniuk
Copy link
Member

@rantoniuk rantoniuk commented Jun 6, 2025

Contributed by @mupakoz in #119

Adds JiraIssuesSizeEnvironmentVariableBuilder build step which enables saving number of issues matching a JQL query in a environment variable of specified name.

I came up with this idea for a new feature when I wanted to fail the build in case there are issues on JIRA that were resolved but still untested. Thanks to the plugin we can save the number of issues we are interested in and then use it in the next steps (for example a shell script or a conditional step).

Pawel Kozikowski and others added 3 commits March 10, 2017 15:27
* master: (627 commits)
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release jira-3.17
  fully remove changelist from  maven.config [skip ci]
  revert maven.config change [skip ci]
  fix: remove custom VersionComparator logic
  Bump the jenkins group with 2 updates (jenkinsci#705)
  Add Jira site property to configure max number of returned Jira issues (jenkinsci#665)
  tests: code coverage for VersionCreator
  docs: add info about failing the build when version already exists
  VersionCreator tests and logging fixes
  use Optional for null safety and add a test for null  versions coming from API
  remove prefix from version naming scheme [skip ci]
  Set semver format for incrementals
  Add null check for getFixVersions()
  add pre-commit config [skip ci]
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release jira-3.16
  fix remaining MAX_VALUE instances in the codebase
  Add support for jira issue parameter in pipelines (jenkinsci#652)
  Add support for jira version parameter in pipelines (jenkinsci#651)
  ...
@rantoniuk rantoniuk requested a review from a team as a code owner June 6, 2025 12:55
@rantoniuk rantoniuk requested review from Copilot and removed request for a team June 6, 2025 12:55

This comment was marked as outdated.

@rantoniuk rantoniuk requested a review from Copilot June 17, 2025 22:12

This comment was marked as outdated.

@rantoniuk rantoniuk force-pushed the mupakoz-pr-119-fix-conflicts branch 4 times, most recently from 0f28983 to b866a0f Compare June 19, 2025 21:47
@rantoniuk rantoniuk force-pushed the mupakoz-pr-119-fix-conflicts branch from b866a0f to 2ff5668 Compare June 19, 2025 21:50
@rantoniuk rantoniuk changed the title Add JiraIssuesSizeEnvironmentVariableBuilder build step Save number of related Jira issues into JIRA_ISSUES_SIZE variable Jun 19, 2025
@rantoniuk rantoniuk changed the title Save number of related Jira issues into JIRA_ISSUES_SIZE variable Add JIRA_ISSUES_SIZE to the JiraEnvironmentVariableBuilder Jun 19, 2025
…conflicts

* origin/master:
  add crowdin badges (jenkinsci#709)
  Use Crowdin translations (jenkinsci#712)
  add i18n CrowdIn info to README (jenkinsci#709) [skip ci]
  fix CrowdIn GHA version (jenkinsci#709)
  Add CrowdIn GHA workflow (jenkinsci#709)
  add CrowdIn import config (jenkinsci#709)
  fix: fixVersion field was not pulled from Jira (jenkinsci#710)
  Add option to show only released versions (jenkinsci#708)
  chore: Update pull_request_template.md [skip ci]
@rantoniuk rantoniuk requested a review from Copilot June 19, 2025 23:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for a new environment variable (JIRA_ISSUES_SIZE) that captures the count of issues matching a JQL query.

  • Builder (JiraEnvironmentVariableBuilder) now computes and logs issue count and passes it to the action
  • Contributing action (JiraEnvironmentContributingAction) stores and exposes the new size variable
  • Tests and help documentation updated to cover JIRA_ISSUES_SIZE

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/java/hudson/plugins/jira/JiraEnvironmentVariableBuilder.java Compute idListSize, log "JIRA_ISSUES_SIZE" update, and pass size into action
src/main/java/hudson/plugins/jira/JiraEnvironmentContributingAction.java Add issuesSize field, getter, constructor parameter, and contribute it to the environment
src/main/resources/hudson/plugins/jira/JiraEnvironmentVariableBuilder/help.html Document new JIRA_ISSUES_SIZE variable
src/test/java/hudson/plugins/jira/JiraEnvironmentVariableBuilderTest.java Update tests to handle builder’s new boolean return and size logging
src/test/java/hudson/plugins/jira/JiraEnvironmentContributingActionTest.java Update tests to expect three env vars (ISSUES, SIZE, URL)
src/main/java/hudson/plugins/jira/versionparameter/JiraVersionParameterDefinition.java Adjust constructor to call setDescription after super(name)
Comments suppressed due to low confidence (3)

src/test/java/hudson/plugins/jira/JiraEnvironmentVariableBuilderTest.java:98

  • The new JIRA_ISSUES_SIZE log message isn’t asserted in testPerformAddsAction. Consider adding a verify(listener.getLogger()).println(...) check for the size update to ensure full coverage of the new behavior.
        boolean result = builder.perform(build, launcher, listener);

src/main/java/hudson/plugins/jira/versionparameter/JiraVersionParameterDefinition.java:40

  • [nitpick] If the parent class provides a super(name, description) constructor, consider using it directly instead of calling super(name) followed by setDescription(description) for clearer intent and less boilerplate.
        super(name);

src/test/java/hudson/plugins/jira/JiraEnvironmentContributingActionTest.java:20

  • [nitpick] The test methods were made public, whereas other JUnit Jupiter tests in this module remain package-private. Consider reverting to package-private for consistency with the existing style.
    public void buildEnvVarsEnvIsNull() {

rantoniuk and others added 3 commits June 20, 2025 01:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rantoniuk rantoniuk merged commit 73d0e36 into jenkinsci:master Jun 20, 2025
15 of 16 checks passed
Copilot AI pushed a commit that referenced this pull request Jun 20, 2025
* Add configurable JIRA_ISSUES_SIZE to the JiraEnvironmentVariableBuilder

---------
Co-authored-by: Pawel Kozikowski <pawel.kozikowski@atos.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants