Artemis icon indicating copy to clipboard operation
Artemis copied to clipboard

`Programming exercises`: Build Plan API

Open bensofficial opened this issue 2 years ago • 2 comments

Checklist

General

Server

  • [x] I followed the coding and design guidelines.
  • [x] I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • [x] I added @PreAuthorize and checked the course groups for all new REST Calls (security).
  • [x] I implemented the changes with a good performance and prevented too many database calls.
  • [ ] 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

In GitLab CI the build configuration can be an external URL (https://docs.gitlab.com/ee/ci/pipelines/settings.html#specify-a-custom-cicd-configuration-file). This PR adds the corresponding API endpoint to access the build plan for a programming exercise.

Description

  1. Database change according to #5259
  2. On creation of a programming exercise the corresponding template build plan is added to the exercise. In GitLab CI the URL to the new API endpoint is stored. For each execution of the CI the build plan is fetched from the API.

Steps for Testing

! Please test this PR locally !

Prerequisites:

  • Local GitLab instance with a Runner (See #4881 for setup)
  • MySQL database
  1. Generate a personal access token with all scopes under http://localhost/-/profile/personal_access_tokens
  2. Create application-local.yml and adapt the password and the access token
artemis:
    course-archives-path: ./exports/courses
    repo-clone-path: ./repos
    repo-download-clone-path: ./repos-download
    encryption-password: artemis_admin           # LEGACY: arbitrary password for encrypting database values
    bcrypt-salt-rounds: 11  # The number of salt rounds for the bcrypt password hashing. Lower numbers make it faster but more unsecure and vice versa.
    # Please use the bcrypt benchmark tool to determine the best number of rounds for your system. https://github.com/ls1intum/bcrypt-Benchmark
    user-management:
        use-external: false
        internal-admin:
            username: artemis_admin
            password: artemis_admin
        accept-terms: false
        login:
            account-name: TUM
    version-control:
        url: http://172.17.0.1:80
        user: root
        password: artemis_admin # Change here!
        token: artemis-gitlab-token # Change here!
    git:
        name: Artemis
        email: [email protected]
server:
    port: 8080
    url: http://172.17.0.1:8080 # `http://host.docker.internal:8080` for Windows

  1. Start Artemis with the gitlabci profile. Use Artemis (Server, GitLabCI & Gitlab) in IntelliJ.
  2. Open Artemis in your browser and create a new course.
  3. Generate a new programming exercise (with default configuration).
  4. Open the template, solution and test repository. In the template and solution repository CI should be enabled and configured. Go to Settings > CI/CD > General Pipelines and open the URL from CI/CD configuration file. This should be one of the template build configurations (Java, Empty)
  5. Create another exercise with the same programming language. Check in the database, that the build plan is stored only once and referenced by both exercises (SELECT p.id, p.build_plan_id FROM programming_exercise_details p; and SELECT * FROM build_plan;).
  6. Push a change to the template or solution repository. Make sure GitLab CI successfully fetched the build plan from the API.

Review Progress

Code Review

  • [ ] Review 1
  • [ ] Review 2

Manual Tests

  • [ ] Test 1
  • [ ] Test 2

Test Coverage

Class/File Branch Line

bensofficial avatar Sep 09 '22 12:09 bensofficial

@jpbernius @Mtze The PR is now ready for review.

bensofficial avatar Sep 10 '22 17:09 bensofficial

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 Sep 21 '22 12:09 github-actions[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 Oct 02 '22 12:10 github-actions[bot]