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: Always create submission results for failed build jobs #8534

Merged
merged 15 commits into from
May 3, 2024

Conversation

laurenzfb
Copy link
Contributor

@laurenzfb laurenzfb commented May 2, 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

Previously, when a build error occurred, a build was cancelled or just timed out, LocalCI would not create a (failed) build result and would just send a notification, that there was no corresponding result.

image

In some cases, the client would just show an endless building animation, so the user would not know the state of the build job. If we create a failed build result for these cases, it would be much easier to comprehend the state of the build job and view logs.

Description

This PR adapts the CI functionality a bit so that build jobs that had an error, got cancelled etc. still create a Build Result und thus a submission result. In order for a build result to be converted into a submission result, it needs the correct assignment and test commit hash. Thus, we adapted the LocalCIBuildJobQueueItem to store these and retrieve them via the GitService before adding the job to the queue. In case of an error, we create a failed result (LocalCIBuildResult), which always be converted into a submission result. Additionally, we do not notify the user about no result being available so the client shows the correct information. Essentially the build jobs (error, cancelled, time out etc. ) will look like "build failed" result, e.g. if there was a syntax error in the code.

image

Steps for Testing

Prerequisites:

  • 1 Admin / Instructor
  • 1 Programming Exercise (Java)
  1. Participate in the programming exercise and make a submission without any code changes -> verify 0%, 0 out of 13 passed
  2. Remove a curly brace, submit -> 0% Build failed (you can view the logs by clicking on it)
  3. Add curly brace again, submit, then cancel the job in the build job view -> 0% Build failed (you can view the logs by clicking on it)
  4. Change the docker image of the exercise to a nonexisting image ("Customize build script"), submit -> 0% Build failed (you can view the logs by clicking on it)

Testserver States

Note

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






Review Progress

Performance Review

  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) labels May 2, 2024
@krusche krusche added this to the 7.0.3 milestone May 2, 2024
@laurenzfb laurenzfb marked this pull request as ready for review May 3, 2024 08:56
@laurenzfb laurenzfb requested a review from a team as a code owner May 3, 2024 08:56
Copy link

coderabbitai bot commented May 3, 2024

Walkthrough

The modifications primarily involve the integration and enhancement of the local CI and VC subsystems in the Artemis platform. Changes include the addition of new fields in BuildConfig, adjustments in method signatures, and improved handling of commit hashes across various services and tests.

Changes

Files Summary of Changes
.../localci/LocalCITriggerService.java
.../localvc/LocalVCServletService.java
Enhanced handling of different repository types and commit hash processing.
.../localci/dto/BuildConfig.java
.../programming/ProgrammingExerciseExportImportResource.java
Updated BuildConfig with new fields; added error handling in import method.
.../staticcodeanalysis/StaticCodeAnalysisParserUnitTest.java
.../exercise/programmingexercise/ProgrammingExerciseTestCaseServiceTest.java
Renamed test class; added new test setup with dummy hash.
.../AbstractSpringIntegrationLocalCILocalVCTest.java
.../localvcci/LocalVCLocalCIIntegrationTest.java
Updated test constants and improved mocking in integration tests.

Possibly related issues


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 5125fbf and 08eeed7.
Files selected for processing (1)
  • src/main/java/de/tum/in/www1/artemis/service/connectors/localvc/LocalVCServletService.java (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/java/de/tum/in/www1/artemis/service/connectors/localvc/LocalVCServletService.java

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.

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: 6

krusche
krusche previously approved these changes May 3, 2024
Copy link
Member

@krusche krusche left a comment

Choose a reason for hiding this comment

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

Tested locally for 2 cases:

  1. Docker not running (error message should be improved in a follow-up)
  2. Docker image does not exist
    In both cases, a result was shown, the loading animation did not take forever, and I could get the build logs in the submission page.

So this PR greatly improves error discovery for instructors and error handling 👍

rstief
rstief previously approved these changes May 3, 2024
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 ts1 works as expected. Code also LGTM 👍

coderabbitai[bot]
coderabbitai bot previously approved these changes May 3, 2024
# Conflicts:
#	src/main/java/de/tum/in/www1/artemis/service/connectors/localci/dto/BuildConfig.java
@krusche krusche dismissed stale reviews from coderabbitai, rstief, and themself via fef26b3 May 3, 2024 11:38
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 (4)
src/test/java/de/tum/in/www1/artemis/staticcodeanalysis/StaticCodeAnalysisParserUnitTest.java (4)

Line range hint 36-36: Consider adding a detailed Javadoc comment to explain the parameters and the expected behavior of the method.


Line range hint 48-48: Add a Javadoc comment to explain the purpose of this test method and the expected outcome when null is passed.


Line range hint 56-56: Add a Javadoc comment to clarify the parameters and expected behavior of this method.


Line range hint 64-64: Consider using assertThrows for a more idiomatic way of expecting exceptions in JUnit tests.

-        try {
-            testParserWithFile("checkstyle-result.xml", "checkstyle.txt");
-        }
-        catch (ParserException e) {
-            fail("Checkstyle parser failed with exception: " + e.getMessage());
-        }
+        assertThrows(ParserException.class, () -> testParserWithFile("checkstyle-result.xml", "checkstyle.txt"), "Checkstyle parser should throw an exception");

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: 5

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

@krusche krusche merged commit ee3d5f8 into develop May 3, 2024
27 of 31 checks passed
@krusche krusche deleted the feature/icl/create-results-for-failed-builds branch May 3, 2024 22:35
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!) priority:high 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

6 participants