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

Add usernames to build parameters #511

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

fpoirotte
Copy link
Contributor

@fpoirotte fpoirotte commented Nov 27, 2024

This adds several parameters to the builds to reflect usernames, namely:

  • GERRIT_TOPIC_CHANGER_USERNAME
  • GERRIT_CHANGE_ABANDONER_USERNAME
  • GERRIT_CHANGE_OWNER_USERNAME
  • GERRIT_CHANGE_RESTORER_USERNAME
  • GERRIT_PATCHSET_UPLOADER_USERNAME
  • GERRIT_EVENT_ACCOUNT_USERNAME
  • GERRIT_SUBMITTER_USERNAME

Each parameter contains the Gerrit login for the related account, as a companion parameter for the already-existing GERRIT_*_NAME and GERRIT_*_EMAIL parameters.

The reason I added these parameters is because we want to send notifications to users when a build succeeds/fails and the notification tool we use requires users to be identified using their username.

Currently, the lack of this information forces us to do a separate HTTP query against the gerrit server to retrieve the username based on the value of the GERRIT_CHANGE_OWNER_EMAIL parameter. This additional query causes issues for us because the connection with the gerrit server is sometimes unstable.

Testing done

I updated src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerTest.java to include the new parameters and ran the tests in that file.

Unfortunately, I don't have access to a Jenkins installation where I could do detailed testing of this change at the moment.
However the additions are very similar to existing code and should be easy to audit if needed.

I also ran the checkstyle & findbugs targets.

Logs for each of the targets can be found as attachments :

checkstyle.txt
findbugs.txt
test.txt

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

Include GERRIT_*_USERNAME (Gerrit login) in build parameters,
similarly to GERRIT_*_NAME and GERRIT_*_EMAIL.
@rsandell rsandell merged commit a217bb8 into jenkinsci:master Nov 28, 2024
17 checks passed
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.

2 participants