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

Integrated code lifecycle: Trim docker image name to avoid white space issues #8518

Merged
merged 19 commits into from
May 3, 2024

Conversation

krusche
Copy link
Member

@krusche krusche commented May 1, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I strictly followed the server coding and design guidelines.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data.
  • I strictly followed the client coding and design guidelines.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).

Motivation and Context

It can happen that the docker image has a leading or trailing whitespace which will lead to build errors that are currently hard to detect for instructors

Description

We make sure to trim the docker image name in several places to avoid issues with existing database entries and to prevent new database entries with unnecessary whitespace

Additionally, this PR improves a couple of code quality issues:

  • Unify the use of ObjectMapper (instead of Gson) to avoid maintaining multiple libraries in the context of programming exercises
  • Convert DTOs to records (and add additional TODOs for other cases)
  • Use consistent Json annotations for DTOs
  • Prefer Strings.isNullOrEmpty(string) over string.isBlank() to avoid null pointer exceptions

Steps for Testing

Prerequisites:

  • 1 Instructor
  1. Create a new programming exercise, customize the build and add a trailing or leading white space into the docker image --> Save
  2. The build should still occur. There should be no whitespace in the database (buildConfiguration json) and if you edit again, there should be no white space

Testserver States

Note

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






Review Progress

Performance Review

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) labels May 1, 2024
@krusche krusche added this to the 7.0.3 milestone May 1, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes May 1, 2024
@krusche krusche marked this pull request as ready for review May 1, 2024 18:50
@krusche krusche requested a review from a team as a code owner May 1, 2024 18:50
Copy link

coderabbitai bot commented May 1, 2024

Walkthrough

This update primarily involves transitioning JSON serialization from Gson to Jackson's ObjectMapper in various Java services within the Artemis platform. This transition enhances exception handling by incorporating JsonProcessingException. Additionally, there's a shift from traditional classes to records for more efficient data handling. These changes aim to improve data processing and error management across multiple services and components.

Changes

Files Affected Change Summary
AeolusBuildPlanService.java, AeolusBuildScriptGenerationService.java, BuildScriptGenerationService.java, ContinuousIntegrationService.java, LocalCIService.java, ProgrammingExerciseImportService.java, ProgrammingExerciseService.java, ProgrammingExerciseResource.java, JenkinsService.java Transitioned from Gson to ObjectMapper for JSON serialization. Added throws JsonProcessingException to method signatures.
AeolusRepository.java, AeolusResult.java Refactored from traditional classes to record structures, simplifying the codebase.
Various components handling Docker configurations Added .trim() to string processing methods for cleaner Docker image names and paths.
AeolusService.java, ApplePushNotificationService.java, FirebasePushNotificationService.java, PushNotificationService.java Enhanced logging and error handling. Shifted from Gson to ObjectMapper for JSON serialization.

Possibly related issues


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 1, 2024
Strohgelaender
Strohgelaender previously approved these changes May 1, 2024
@krusche krusche dismissed stale reviews from Strohgelaender and coderabbitai via aaa41b8 May 2, 2024 07:17
@github-actions github-actions bot added the tests label May 2, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes May 2, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes May 2, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Out of diff range and nitpick comments (1)
src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java (1)

Line range hint 433-455: Ensure Docker image names are trimmed before use in build scripts.

- String script = buildScriptGenerationService.get().getScript(programmingExercise);
+ // Ensure Docker image names are trimmed to avoid build issues
+ String script = buildScriptGenerationService.get().getScript(programmingExercise.trimDockerImageName());

This change ensures that Docker image names are trimmed of any leading or trailing whitespace before they are used to generate build scripts, aligning with the PR's objectives to avoid build errors related to Docker image name formatting.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 2, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

coderabbitai[bot]
coderabbitai bot previously approved these changes May 3, 2024
Hialus
Hialus previously approved these changes May 3, 2024
Copy link
Member

@Hialus Hialus left a comment

Choose a reason for hiding this comment

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

Code still looks good. Just found two possible nitpicks.

pzdr7
pzdr7 previously approved these changes May 3, 2024
@krusche krusche dismissed stale reviews from pzdr7, Hialus, and coderabbitai via c34d8a8 May 3, 2024 08:50
Copy link
Contributor

@coolchock coolchock left a comment

Choose a reason for hiding this comment

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

tested on ts4, works as expected. Trailing and leading whitespaces were removed.

Copy link
Contributor

@rstief rstief left a comment

Choose a reason for hiding this comment

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

tested on ts4 with a variety of whitespace characters, as well as for leading and trailing whitespaces. Works as expected (no whitespace is displayed after submitting and build runs through). Of course, I could not check the database on the test server.

Copy link
Member

@julian-christl julian-christl left a comment

Choose a reason for hiding this comment

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

Code looks good; I think the title might be in need of an update, though, as the scope is way more extensive than the PR title suggests

Copy link
Contributor

@az108 az108 left a comment

Choose a reason for hiding this comment

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

Tested it on t4, with leading trails and whitespaces, also tried it in edit mode for the exercise after creating it and it still worked. And tried the steps again after deleting the exercise.
Code looks good to me

@krusche
Copy link
Member Author

krusche commented May 3, 2024

Code looks good; I think the title might be in need of an update, though, as the scope is way more extensive than the PR title suggests

The title reflects the user facing changes. All others are internal and do not really affect end users. I agree that a separation into multiple PRs would have been better, but doing this now would be too much work. However, I add some details into the PR description

@krusche krusche merged commit db96364 into develop May 3, 2024
15 of 22 checks passed
@krusche krusche deleted the bugfix/trim-docker-image branch May 3, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) ready for review server Pull requests that update Java code. (Added Automatically!) tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

8 participants