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

Development: Directly access Jenkins REST API for all interactions #10084

Merged
merged 42 commits into from
Jan 17, 2025

Conversation

krusche
Copy link
Member

@krusche krusche commented Dec 27, 2024

Summary

This PR unifies the interaction with the Jenkins REST API by removing the dependency on the outdated Jenkins client library. Instead, it implements a streamlined and more modern approach to interact directly with the REST API.

Key Changes

  1. Removal of the Jenkins Client Library:
    • Eliminates the need for the outdated Jenkins client library, reducing external dependencies and improving maintainability.
    • Removes the stored JAR file from the Git repository, simplifying repository management and reducing clutter.
  2. Direct Integration with Jenkins REST API:
    • Replaces the legacy client library with a direct integration using HTTP-based interactions.
    • Provides a cleaner, more transparent, and customizable implementation for API requests.
  3. Improved Maintainability:
    • Simplifies future updates and enhancements by reducing reliance on a specific library version.
    • Ensures compatibility with the latest Jenkins API features without waiting for third-party library updates.

Benefits

  • Code Simplicity: Reduces unnecessary complexity by avoiding reliance on an additional library.
  • Flexibility: Allows fine-tuned control over API calls, enabling easier customization and debugging.
  • Performance: Removes potential overhead introduced by the client library, leading to more efficient API interactions.
  • Repository Cleanliness: No longer requires storing binary dependencies in the Git repository, promoting better repository hygiene.

Impact

This change is backward-compatible. Extensive testing has been conducted to ensure seamless integration and consistent functionality.

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) and too complex database calls.
  • I strictly followed the principle of data economy for all database calls.
  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I documented the Java code using JavaDoc style.

Changes affecting Programming Exercises

  • I tested all changes and their related features with all corresponding user types on a test server configured with Gitlab and Jenkins.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 2 Students
  • 1 Programming Exercise
  1. Create a programming exercise on a Jenkins test server
  2. Participate and check that everything still works correctly

Exam Mode Testing

Prerequisites:

  • 1 Instructor
  • 2 Students
  • 1 Exam with a Programming Exercise
  1. Create an exam programming exercise on a Jenkins test server
  2. Participate and check that everything still works correctly

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

@coderabbitai ignore

also exclude a few now unused dependencies
try out RestClient instead of RestTemplate for Apollon
@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) core Pull requests that affect the corresponding module exam Pull requests that affect the corresponding module exercise Pull requests that affect the corresponding module modeling Pull requests that affect the corresponding module programming Pull requests that affect the corresponding module labels Dec 27, 2024
@github-actions github-actions bot added the lecture Pull requests that affect the corresponding module label Dec 27, 2024
@github-actions github-actions bot added the config-change Pull requests that change the config in a way that they require a deployment via Ansible. label Dec 27, 2024
@krusche krusche modified the milestones: 7.8.3, 7.8.4 Jan 12, 2025
coderabbitai[bot]

This comment was marked as duplicate.

coderabbitai[bot]

This comment was marked as duplicate.

It was an identical copy of
testImportBuildPlansThrowsExceptionOnGivePermissions before that had
absolutely nothing to do with deleting.
If we send an invalid XML to the API endpoint, then an exception is
thrown. The type-system enforces already that the exception is caught
and wrapped into some exception that bubbles up all the way. I don’t
think it makes sense to test this behaviour here.
@b-fein b-fein removed the deployment-error Added by deployment workflows if an error occured label Jan 17, 2025
@krusche krusche changed the title Development: Remove jenkins client and access Jenkins REST API directly Development: Directly access Jenkins REST API for all interactions Jan 17, 2025
@krusche krusche added ready to merge maintainer-approved The feature maintainer has approved the PR labels Jan 17, 2025
Copy link

@HawKhiem HawKhiem left a comment

Choose a reason for hiding this comment

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

Reapprove

@krusche krusche merged commit edc2cb0 into develop Jan 17, 2025
40 of 44 checks passed
@krusche krusche deleted the chore/jenkins-rest branch January 17, 2025 13:23
Copy link

@vinceclifford vinceclifford left a comment

Choose a reason for hiding this comment

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

Re-approval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config-change Pull requests that change the config in a way that they require a deployment via Ansible. core Pull requests that affect the corresponding module exam Pull requests that affect the corresponding module exercise Pull requests that affect the corresponding module lecture Pull requests that affect the corresponding module maintainer-approved The feature maintainer has approved the PR modeling Pull requests that affect the corresponding module programming Pull requests that affect the corresponding module ready for review ready to merge server Pull requests that update Java code. (Added Automatically!) tests
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

8 participants