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: Allow all filenames in programming exercise templates #8684

Merged

Conversation

magaupp
Copy link
Contributor

@magaupp magaupp commented May 28, 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.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I documented the Java code using JavaDoc style.

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

Programming exercise templates cannot include files without file extensions (Makefile) and .gitignore/.gitattributes without the use of a workaround. Directories with dots in their name (.config/) are not possible at all. The workaround requires the template author to use an alternative name which is replaced with the required name from a set of predefined translations (Makefile.file => Makefile).

This makes the authoring of programming exercise templates error-prone and more difficult than necessary.

Description

.gitignore and .gitattributes are removed from gradle's default excludes.

The ResourceLoaderService is modified to remove directories from the results. This is what all use-cases expect.

The ant pattern meaning to represent all files is adjusted to not include a dot.

Steps for Testing

These instructions use a C programming language template which does not support GitlabCI.
Deploy to a test server which uses the Integrated Code Lifecycle if you follow them.

Prerequisites:

  • 1 Instructor
  • 1 Course
  1. Log in to Artemis
  2. Navigate to Course Administration of the Course
  3. Create a new Programming Exercise
  4. Select C for the programming language
  5. Select GCC for the project type
  6. Fill out the remaining fields
  7. Save the exercise
  8. Clone the exercise repository
  9. The repository should contain the .gitignore, .gitattributes and Makefile files

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

Test Coverage

Server

Class/File Line Coverage Confirmation (assert/expect)
FileService.java 89%
ResourceLoaderService.java 89%

magaupp added 4 commits May 28, 2024 14:52
.gitattributes and .gitignore are ignored usually ignored by gradle, but we need them to be included for programming exercise templates.
This only applies to methods returning multiple Resources using a pattern. All use-cases expect non-directories only.
@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) labels May 28, 2024
@magaupp magaupp marked this pull request as ready for review May 28, 2024 18:59
@magaupp magaupp requested a review from a team as a code owner May 28, 2024 18:59
Copy link

coderabbitai bot commented May 28, 2024

Walkthrough

The recent updates primarily involve renaming methods and constants in ResourceLoaderService.java to enhance clarity and consistency. Additionally, the settings.gradle file now includes configurations for the 'Artemis' project and modifications to handle .gitattributes and .gitignore files. Several service classes and test files have been updated to reflect these changes, ensuring that resource loading operations align with the new method names.

Changes

File Path Change Summary
settings.gradle Added import org.apache.tools.ant.DirectoryScanner and configurations for 'Artemis' project.
src/main/java/.../ResourceLoaderService.java Renamed methods and constants for clarity; added a new private method for filtering file resources.
src/main/java/.../BuildScriptProviderService.java Updated cacheOnBoot method to use getFileResources instead of getResources.
src/main/java/.../AeolusTemplateService.java Modified cacheOnBoot method to use getFileResources instead of getResources.
src/main/java/.../JavaTemplateUpgradeService.java Changed getTemplateResources method to use getFileResources instead of getResources.
src/main/java/.../ProgrammingExerciseRepositoryService.java Replaced getResources calls with getFileResources for resource loading operations.
src/test/java/.../FileServiceTest.java Removed testRenameSpecialFilename; updated copyResources method to use getFileResources.
src/test/java/.../ResourceLoaderServiceTest.java Renamed method calls to align with updated method names; added new test methods for resource loading scenarios.

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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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 28, 2024
@magaupp
Copy link
Contributor Author

magaupp commented May 28, 2024

Administrators who made use of the filename translations in template overrides could experience issues. However, this translation behavior was never mentioned in the documentation. How should we handle this?

@b-fein
Copy link
Contributor

b-fein commented May 29, 2024

Administrators who made use of the filename translations in template overrides could experience issues. However, this translation behavior was never mentioned in the documentation. How should we handle this?

It is only possible since release 7.0.1 (#8380) to override such files. Before that only files in templates/jenkins/** could be overridden in the filesystem.

Since this feature does not exist for long, I don’t assume this feature to be widely used (if at all). I think breaking this without backwards compatibility is therefore fine.

b-fein
b-fein previously approved these changes May 29, 2024
Copy link
Contributor

@b-fein b-fein left a comment

Choose a reason for hiding this comment

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

That’s a nice improvement. Thanks for implementing this.

Code looks good. 👍

@github-actions github-actions bot added deployment-error Added by deployment workflows if an error occured and removed deploy:artemis-test1 labels May 29, 2024
@sarpsahinalp sarpsahinalp added deploy:artemis-test2 and removed deployment-error Added by deployment workflows if an error occured labels May 29, 2024
@github-actions github-actions bot added deployment-error Added by deployment workflows if an error occured and removed deploy:artemis-test2 labels May 29, 2024
@magaupp magaupp dismissed stale reviews from b-fein and coderabbitai[bot] via 4130317 May 29, 2024 21:49
coderabbitai[bot]
coderabbitai bot previously approved these changes May 29, 2024
@edkaya
Copy link
Contributor

edkaya commented Jun 18, 2024

I can not change the programming language to C, it only shows Java and Empty. Am I doing something wrong?
Screenshot 2024-06-18 at 20 57 25

@magaupp
Copy link
Contributor Author

magaupp commented Jun 20, 2024

@edkaya Test Server 5 uses GitlabCI which is only supported by these 2 templates.

The Java template has the git files but no extension-less files you could check for.

Copy link
Contributor

@kaancayli kaancayli 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. Code looks good 👍🏻. Can verify that the cloned repository includes Makefile, .gitignore and .gitattributes files

Copy link
Contributor

@DominikRemo DominikRemo left a comment

Choose a reason for hiding this comment

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

Tested in testing session on ts4. LGTM

Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

Tested during testing session 👍

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 during testing session, the repositories include files starting with . and Makefile

Copy link
Contributor

@EneaGore EneaGore left a comment

Choose a reason for hiding this comment

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

Tested during testing session in ts4.

@krusche krusche merged commit 20db0bd into develop Jun 27, 2024
62 of 63 checks passed
@krusche krusche deleted the chore/programming-exercises/allow-all-template-filenames branch June 27, 2024 18:23
@krusche krusche added this to the 7.3.1 milestone Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge server Pull requests that update Java code. (Added Automatically!) template tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.