Skip to content
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

gh: Added workflows to sync GitHub with Jira #17500

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

michael-redpanda
Copy link
Contributor

@michael-redpanda michael-redpanda commented Mar 29, 2024

This matches the current workflows found on the internal core repo

Adding a number of workflows to redpanda that will allow for some one-way syncing of GH Issues into Jira CORE.

These workflows perform the following actions:

  • On GH issue creation, create a new Jira issue
    • If kind/bug is a label present on GH issue creation, the created JIRA issue will be a bug, otherwise its a task
    • Add all labels on the Github Issue at creation to the Jira issue
    • Add a link in the Jira issue back to the GH issue
    • At the bottom of the GH issue body, add a link back to the Jira Issue
  • On GH issue comment addition, add comment to linked Jira issue
  • When a GH issue closes, close the corresponding Jira issue
  • When a GH issue is reopened either:
    • Reopen the linked Jira issue, or if one doesn't exist,
    • Create a new Jira issue, and add all comments from the GH Issue to the Jira Issue

Caveats:

  • Edits to issue body, comments, or comment deletions are not synced
  • If a GH PR is linked, that link is not carried over
  • Changes to labels are not synced
  • Changes in Jira issues are NOT synced with GH (not really a caveat more of a security 'feature')

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x

Release Notes

  • none

Adding a number of workflows to redpanda that will allow for some
one-way syncing of GH Issues into Jira CORE.

These workflows perform the following actions:

- On GH issue creation, create a new Jira issue
  - If kind/bug is a label present on GH issue creation, the created
    JIRA issue will be a bug, otherwise its a task
  - Add all labels on the Github Issue at creation to the Jira issue
  - Add a link in the Jira issue back to the GH issue
  - At the bottom of the GH issue body, add a link back to the Jira
    Issue
- On GH issue comment addition, add comment to linked Jira issue
- When a GH issue closes, close the corresponding Jira issue
- When a GH issue is reopened either:
  - Reopen the linked Jira issue, or if one doesn't exist,
  - Create a new Jira issue, and add all comments from the GH Issue
    to the Jira Issue

Caveats:
- Edits to issue body, comments, or comment deletions are not synced
- If a GH PR is linked, that link is not carried over
- Changes to labels are not synced
- Changes in Jira issues are NOT synced with GH (not really a caveat
  more of a security 'feature')

Signed-off-by: Michael Boquard <michael@redpanda.com>
@michael-redpanda michael-redpanda requested a review from a team as a code owner March 29, 2024 18:30
@michael-redpanda michael-redpanda requested review from andrewhsu and removed request for a team March 29, 2024 18:30
@michael-redpanda michael-redpanda self-assigned this Mar 29, 2024
@michael-redpanda
Copy link
Contributor Author

Blocked until https://redpandadata.atlassian.net/browse/PLATENG-26 is completed

Copy link
Contributor

@rockwotj rockwotj left a comment

Choose a reason for hiding this comment

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

Looks good, I would certainly suggest creating a composite action for the repeated bits.

Comment on lines +8 to +30
reopen_jira_issue:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
- name: install dependencies
env:
SCRIPT_DIR: ${{ github.workspace }}/.github/workflows/scripts
run: pip install -r ${SCRIPT_DIR}/requirements.txt
- name: Reopen JIRA Task
env:
SCRIPT_DIR: ${{ github.workspace }}/.github/workflows/scripts
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
JIRA_USER: ${{ secrets.JIRA_USER }}
ISSUE_URL: ${{ github.event.issue.html_url }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_LABELS: ${{ join(github.event.issue.labels.*.name) }}
run: python ${SCRIPT_DIR}/jira_helper.py REOPEN_ISSUE --verbose
Copy link
Contributor

Choose a reason for hiding this comment

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

Since all these workflows are the same thing but with slightly different environment variables and a different command, can we pull this out into a custom composite action?

Composite Actions: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds like a nice imporvement... on the backlog :)

"project": {
"key": f"{self._project_key}"
},
"customfield_10052": f"{issue_url}"
Copy link
Contributor

Choose a reason for hiding this comment

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

customfield_10052 I know exactly what this means 😎

Copy link
Contributor Author

Choose a reason for hiding this comment

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

External Github Issue Link

Copy link
Contributor

Choose a reason for hiding this comment

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

Well yes I figured that out, was more complaining about the JIRA API 😄

@michael-redpanda michael-redpanda merged commit 78aacc8 into dev Apr 2, 2024
17 checks passed
@michael-redpanda michael-redpanda deleted the add-jira-sync-workflows branch April 2, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants