Skip to content

Conversation

@andrewg-mira
Copy link
Contributor

@andrewg-mira andrewg-mira commented Dec 12, 2025

DEVOPS-853 - Update Jenkinslib -- Jira API for querying issues is deprecated

@github-actions github-actions bot changed the title DEVOPS-853 check jira issue DEVOPS-853: check jira issue Dec 12, 2025
@andrewg-mira andrewg-mira requested a review from sebhmg December 12, 2025 18:04
- name: Check issue key
if: ${{ !steps.jira_key_from_title.outputs.issue_key }}
run: |
echo "Could not determine Jira issue from PR title"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably TODO: add exceptions for Dependabot etc PRs.

@sebhmg sebhmg force-pushed the DEVOPS-853-check-jira-issue branch from 10650e3 to 4d59de0 Compare December 12, 2025 19:22
Copy link
Contributor

@sebhmg sebhmg left a comment

Choose a reason for hiding this comment

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

see suggestion to merge workflows, and use a more specific pattern

Copy link
Contributor

Choose a reason for hiding this comment

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

it might run too soon. Somehow, we want it executed after pr_add_jira_summary
Possibly just have "Check issue status" as an extra step in pr_add_jira_summary.
However, "Check issue status" must reran at every push (e.g. to error out when pushing to a closed issue).

My suggesting: merge the two workflow into one "Check Jira Status", with "Check JIRA issue status" step last:

  • if trigger by pull_request[opened], run all steps
  • if trigger is pull_request[synchronize, reopened, ready_for_review], only run steps:
    • Find JIRA issue key from title
    • Check JIRA issue status

Not finding JIRA from title is not an error.
Possible, use a secret to configure the pattern of supported key, e.g. "\b(NI|SHRUB|BEAST|AARG|SWALLOW|TIM|BRIDGE)[-# ]*([0-9]+)"

Copy link
Contributor

@sebhmg sebhmg left a comment

Choose a reason for hiding this comment

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

please, see questions and suggestions

if: ${{ !steps.jira_key_from_title.outputs.issue_key }}
run: |
echo "Could not determine Jira issue from PR title"
exit 1
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: do not make it a failure. Skipping following steps with condition is enough

exit 1
fi
echo "response was: $(echo $response|jq)"
Copy link
Contributor

Choose a reason for hiding this comment

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

question: logging the response can be a big chunk in log. Could this be done only if running workflow in debug mode?

Comment on lines 139 to 142
if [ $? -ne 0 ]; then
echo "Jira API: error"
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: instead use set -e at the top of the script

although, it might be interesting to see the response. Will it show in stderror in any case?

echo "Checking if issue is In Progress"
status=$(echo $response| jq -r '.issues[0].fields.statusCategory.name')
if [ "$status" != "In Progress" ]; then
error="$error Error: Jira issue is not In Progress"
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: have a line break between errors

error="$error\n Error: Jira issue is not In Progress"

"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/${{ github.event.pull_request.number }}"
> /dev/null
check_jira_issue:
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: upon PR opened, must ensure this jobs runs after add_jira_summary

So the JIRA issue number is in the title. Or use the same logic to fetch the jira issue: title plus branch name

Copy link
Contributor

Choose a reason for hiding this comment

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

alternatively have a single job, where steps runs only upon opened, except for jira_key_from_title and "Check issue status" which also run

Comment on lines 110 to 120
- name: Find JIRA issue key from title
id: jira_key_from_title
if: ${{ !steps.jira_summary_from_branch.outputs.summary }}
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: >
echo "issue_key=$(
echo $PR_TITLE | grep -osiE "^\s*\[?\s*$JIRA_PATTERN"
| head -n1 | sed -E "s/\W*$JIRA_PATTERN/\1-\2/i"
| tr [:lower:] [:upper:]
)" >> $GITHUB_OUTPUT
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: make this a reusable action to use in both jobs

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.

3 participants