Artemis icon indicating copy to clipboard operation
Artemis copied to clipboard

`Development`: Add automatic Migration from Bamboo to LocalCI

Open reschandreas opened this issue 1 year ago • 2 comments

[!IMPORTANT]
This PR can not be reviewed by deploying it to a testserver, review the code and if you have an atlassian setup, try it out or reach out to me. Also this migration is not intended to be merged into develop but used to migrate our production environment with roughly 3-4k exercises and +800k repositories.

Checklist

General

Server

  • [x] Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • [x] I followed the coding and design guidelines.
  • [x] 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 Test Server 1 (Atlassian Suite).
  • [ ] I tested all changes and their related features with all corresponding user types on Test Server 2 (Jenkins and Gitlab).

Motivation and Context

The TUM Artemis instance currently uses the Atlassian software stack to provide programming exercises to its students, this PR adds a partial automatic migration away from it. With this change, we migrate all build plans of existing exercises from Bamboo to LocalCI using Aeolus, generate bash script and store them within Artemis.

Description

The Migration will run once, if all required profiles (bamboo and localci and aeolus) are active and directly migrate all solution buld plans during startup of Artemis. The migration of this PR is expected to be executed after #7842 and is a stacked PR.

Steps for Testing

Prerequisites:

  • 1 Artemis Setup with Bamboo configured
  • 1 Aeolus container running, see step 3 on how to set it up
  1. Backup your database
  2. Start Aeolus with docker compose -f docker/aeolus.yml up -d
  3. Add the following lines to your application-local.yml to let Artemis know where to find Aeolus
aeolus:
  url: http://localhost:8090
  1. Start Artemis with the profiles bamboo, localci and aeolus, you can also use the new run configuration in this PR that includes all necessary profiles.
  2. Wait for all build plans to be migrated and for Artemis to run
  3. Stop Artemis and check if build plans are stored in the database select build_script from programming_exercise_details\G
  4. Start Artemis with the normal localvc and localci setup, you have to deactivate bamboo profile for the following to work.
  5. Check if the builds of programming exercises still work as expected

Review Progress

Performance Review

  • [ ] I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance
  • [ ] 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

Exam Mode Test

  • [ ] Test 1
  • [ ] Test 2

Test Coverage

Screenshots

Summary by CodeRabbit

  • New Features
    • Introduced a new run configuration named "Artemis" for Spring Boot applications.
    • Added migration services for transitioning from Bitbucket to a local version control system.
    • Implemented new migration entries for programming exercises, including efficient batch processing and error handling.
    • Enhanced build plan translation and script generation for programming exercises using Aeolus.
  • Enhancements
    • Improved ordering of results in ProgrammingExerciseStudentParticipationRepository.
    • Added method to check if the profile is active for Bitbucket in ProfileService.
    • Enhanced GitService with a new condition check and method for clearing cached repositories.
    • Introduced a method to set the author for windfiles, updating metadata accordingly.
  • Bug Fixes
    • Corrected annotations for local CI and VC services to support bamboo to local CI migration more effectively.

reschandreas avatar Jan 07 '24 14:01 reschandreas

Walkthrough

The recent updates introduce a comprehensive migration strategy from Bitbucket and Bamboo to local version control and continuous integration systems. This includes the addition of new migration entries, enhancements in service classes to support the migration, and updates to ensure efficient processing and error handling. The changes aim to streamline the migration process, optimize configurations for new tech stacks, and improve the overall system's adaptability and performance.

Changes

File(s) Change Summary
.idea/runConfigurations/Artemis__Server__LocalVC___LocalCI___Atlassian.xml New run configuration file for Spring Boot application named "Artemis".
.../migration/MigrationRegistry.java Added MigrationEntry20240103_143700 and MigrationEntry20240104_195600 to the constructor.
.../migration/entries/BitbucketLocalVCMigrationService.java Introduced a class for migration services from Bitbucket to a local VCS.
.../migration/entries/MigrationEntry20230808_203400.java, .../migration/entries/MigrationEntry20230920_181600.java Moved UriService initialization to constructor parameters.
.../migration/entries/MigrationEntry20240103_143700.java, .../migration/entries/MigrationEntry20240104_195600.java Implemented migration entries for programming exercises, including cloning repositories, migrating participations, and handling error logging.
.../ProgrammingExerciseStudentParticipationRepository.java Added ORDER BY p.id DESC clause in findAllWithBuildPlanId SQL query.
.../ProfileService.java Added a method to check if Bitbucket profile is active.
.../GitService.java Added condition to check non-Bitbucket URIs and a method to clear cached repositories.
.../service/connectors/aeolus/AeolusBuildPlanService.java, .../service/connectors/aeolus/AeolusBuildScriptGenerationService.java Added methods to translate Bamboo build plans into Windfiles.
.../service/connectors/aeolus/Windfile.java Added a method to set the author for the windfile.
.../service/connectors/bitbucket/BitbucketService.java Added a method to get the base path of the Bitbucket server.
.../service/connectors/localci/LocalCIProgrammingLanguageFeatureService.java, .../service/connectors/localci/LocalCIResultService.java, .../service/connectors/localci/LocalCIService.java, .../service/connectors/localci/LocalCITriggerService.java, .../service/connectors/localvc/LocalVCService.java Added @Primary annotation for bamboo to local CI migration.

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

coderabbitai[bot] avatar Jan 07 '24 14:01 coderabbitai[bot]

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

github-actions[bot] avatar Jan 22 '24 12:01 github-actions[bot]