-
Notifications
You must be signed in to change notification settings - Fork 305
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
: Add pre-generated bash scripts for LocalCI
#7811
Conversation
# Conflicts: # src/main/webapp/app/exercises/programming/manage/update/update-components/programming-exercise-custom-build-plan.component.html
# Conflicts: # src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New code changes lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files ignored due to filter (1)
- src/main/resources/config/liquibase/master.xml
Files selected for processing (2)
- src/main/java/de/tum/in/www1/artemis/service/connectors/GenericBuildScriptGenerationService.java (1 hunks)
- src/main/java/de/tum/in/www1/artemis/service/connectors/aeolus/AeolusBuildScriptGenerationService.java (1 hunks)
Additional comments: 5
src/main/java/de/tum/in/www1/artemis/service/connectors/GenericBuildScriptGenerationService.java (2)
16-17: The
@Profile
annotation specifies that this service is active when theaeolus
profile is not active and thelocalci
profile is. This is consistent with the PR's objective to support LocalCI.27-28: The constructor is correctly using dependency injection to obtain a
BuildScriptProvider
. This follows the best practice of constructor injection for dependencies.src/main/java/de/tum/in/www1/artemis/service/connectors/aeolus/AeolusBuildScriptGenerationService.java (3)
- 15-17: The
@Profile
annotation specifies that this service is active when bothaeolus
andlocalci
profiles are active. This seems to be a change from the previous version and should be verified to ensure it aligns with the intended behavior.Verification successful
The review comment is correct. The
AeolusBuildScriptGenerationService
is intended to be active only when bothaeolus
andlocalci
profiles are active, as confirmed by the@Profile("aeolus && localci")
annotation in the codebase.* 33-38: The constructor is correctly using dependency injection for `BuildScriptProvider`, `AeolusBuildPlanService`, `AeolusTemplateService`, and `ProfileService`. This follows the best practice of constructor injection for dependencies.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the AeolusBuildScriptGenerationService is intended to be active only when both aeolus and localci profiles are active. grep -R '@Profile' --include=*.javaLength of output: 19395
- 41-56: The
getScript
method now includes logic to handle the case when thelocalci
profile is not active by returningnull
. It also handles the case when awindfile
is not present by attempting to get a default one. The previous comment about returningnull
still stands, and it would be better to throw a custom exception instead of returningnull
.- return null; + throw new BuildScriptNotAvailableException("Local CI profile is not active or windfile is not present.");
...main/java/de/tum/in/www1/artemis/service/connectors/GenericBuildScriptGenerationService.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- src/main/java/de/tum/in/www1/artemis/service/connectors/aeolus/AeolusBuildScriptGenerationService.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/main/java/de/tum/in/www1/artemis/service/connectors/aeolus/AeolusBuildScriptGenerationService.java
# Conflicts: # src/main/java/de/tum/in/www1/artemis/service/ProfileService.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (2)
- src/main/java/de/tum/in/www1/artemis/service/ProfileService.java (2 hunks)
- src/main/java/de/tum/in/www1/artemis/service/connectors/aeolus/AeolusBuildPlanService.java (5 hunks)
Additional comments: 4
src/main/java/de/tum/in/www1/artemis/service/ProfileService.java (1)
- 25-25: The refactoring of
isLocalVcsCi()
to use the new methodsisLocalVcs()
andisLocalCi()
is a good example of clean code and improves readability.src/main/java/de/tum/in/www1/artemis/service/connectors/aeolus/AeolusBuildPlanService.java (3)
19-20: The addition of imports for
LinkedMultiValueMap
andMultiValueMap
is necessary for the newgenerateBuildScript
method. Ensure that these classes are used appropriately within the method.43-43: Renaming the
LOGGER
variable tolog
aligns with the common Java logging convention and improves readability.92-92: The error handling in the
publishBuildPlan
method has been updated to use thelog
variable. Ensure that the logging statements provide enough context for debugging in case of errors.Also applies to: 111-112
src/main/java/de/tum/in/www1/artemis/service/connectors/aeolus/AeolusBuildPlanService.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationLocalCILocalVCTest.java (1 hunks)
Files skipped from review due to trivial changes (1)
- src/test/java/de/tum/in/www1/artemis/AbstractSpringIntegrationLocalCILocalVCTest.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes are looking good to me - Thanks for taking care!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approve after code changes 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes look good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code changes lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm
Checklist
General
Server
Client
Motivation and Context
In order to remove hardcoded scripts within the Java code, we add the generated bash scripts of all aeolus templates to the resources. This allows us to have a good baseline for build scripts.
Now the UI changes a bit for Programming Exercises, if you start Artemis with the profile aeolus, you will be greeted with the existing UI. With localci as a profile, the UI changes to show a single code editor that contains the generated build plan.
Description
I added the class
BuildScriptProvider
and the abstract classBuildScriptGenerationService
. TheAeolusBuildScriptGenerationService
extends the abstract service to provide a code generation from the windfile. If Aeolus is not active, theBuildScriptProvider
will provide the pregenerated bash scripts added by this PR.In addition to the new classes, we no cache all scripts on the startup of Artemis.
The bash scripts are generated using the new
bash
scriptsupporting_scripts/generate-aeolus-scripts.sh
using Aeolus. To ensure that the windfiles and bash scripts always up-to-date, I added a new workflow that checks and complains if the source and the generated content does not match.Database revert
In the unlikely case my database change makes problems, use
alter table programming_exercise_details drop column build_script;
to revert itSteps for Testing
Prerequisites:
Testserver States
Note
These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Review Progress
Performance Review
Code Review
Manual Tests
Test Coverage
Client
Server
Screenshots
Summary by CodeRabbit
New Features
buildScript
attribute for programming exercises to handle build configurations.Enhancements
ProfileService
with refactored methods for profile checks.ProgrammingExerciseService
with integration ofBuildScriptGenerationService
.Bug Fixes
Documentation
Tests
Chores
Refactor
Style
Revert