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: Add support for new Docker based test servers with GitHub deployment #6492

Merged
merged 50 commits into from
May 19, 2023

Conversation

Hialus
Copy link
Member

@Hialus Hialus commented Apr 26, 2023

Checklist

General

Motivation and Context

This PR builds upon the work done in #5915.
In that PR we reworked the docker compose setup of Artemis to be production ready, so that it could be used for the test servers.
We want to restructure the test servers so they use Docker for everything and to use GitHub instead of Bamboo for deployments to them. This will make maintenance of them easier an allows for more flexibility.
This PR addresses both issues.

Description

For now this PR adds the ability to deploy to the new test servers 4, 5, and 6. They are available under the URLs:

Note the cit.tum.de instead of in.tum.de. The old/legacy test servers will remain available under in.tum.de until the new setup is deemed stable enough.
They all use Atlassian-Prelive and MySQL for now, so they are pretty much identical. In the future they will likely be replaced by different setups, once TS1, TS2, and TS3 are moved to the new system.
The deployment works the same as for the old TS5 via GitHub environments and workflows that have to be approved. Instead of having to reserve a test server on Slack you can now use the lock:artemis-testX labels. They are set by the workflow and ensure that only one PR is deployed at any given time on one test server. Once you are done testing you have to manually remove this label.

List of all changes:

  • Labels for deployment (deploy:artemis-testX)
  • Add deployment-error label if any error occurs
  • For some errors, comments will be added, explaining what went wrong
  • Improved the prevention of manually setting test server locks
  • Remove lock labels when the PR is closed
  • Added docker deploying capability to artemis-server-cli
  • Extract deployment into its own file

How the deployment pipeline works:

  1. Triggered on labeling of PR
  2. Checks if the added label is a deployment label
    • If no: Skip workflow
  3. Checks if the docker build is already done for the latest commit
    • If no: Fail workflow and add comment
  4. Uses a matrix job to determine which test servers should be deployed to
  5. Creates a valid matrix JSON from step 4 output to be used in step 6
  6. Deploy to the test servers:
    1. Remove deploy label for TS
    2. Check if TS is already locked
      • If yes: Fail workflow and add comment
    3. Set up SSH keys
    4. Deploy using artemis-server-cli
  7. If any error occurred add the deployment-error label

Steps for Testing

Testing this PR is obviously tricky. There are two things you can do:

  1. Deploy this PR and go to the test servers and play around with them to find any bugs with them.
    You can also push empty(!) commits to this PR to test edge cases if you want.
  2. Test your own PR on the test servers. See below how to do this:

Prerequisites:

  • A PR of your own or just use this PR
  1. Merge this branch into your branch
  2. Wait for the Build & Deploy job to run through
  3. Add one or multiple of the deploy:artemis-test4, deploy:artemis-test5, deploy:artemis-test6 labels
  4. Wait for the deployment pipeline to run through
  5. Test your PR
  6. Remove the lock label
  7. Revert the merge

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2
  • Test 3
  • Test 4

Exam Mode Test

  • Test 1
  • Test 2

Screenshots

Example error message:
grafik

@Hialus Hialus self-assigned this Apr 26, 2023
@artemis-bot artemis-bot added this to In progress in Artemis Development Apr 26, 2023
@Hialus Hialus had a problem deploying to artemis-test1.artemis.cit.tum.de April 26, 2023 22:32 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test2.artemis.cit.tum.de April 26, 2023 22:32 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test3.artemis.cit.tum.de April 26, 2023 22:32 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test4.artemis.cit.tum.de April 26, 2023 22:32 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test6.artemis.cit.tum.de April 26, 2023 22:32 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test7.artemis.cit.tum.de April 26, 2023 22:32 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test8.artemis.cit.tum.de April 26, 2023 22:32 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test9.artemis.cit.tum.de April 26, 2023 22:32 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test10.artemis.cit.tum.de April 26, 2023 22:32 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test1.artemis.cit.tum.de April 27, 2023 10:04 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test2.artemis.cit.tum.de April 27, 2023 10:04 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test3.artemis.cit.tum.de April 27, 2023 10:04 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test4.artemis.cit.tum.de April 27, 2023 10:04 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test6.artemis.cit.tum.de April 27, 2023 10:04 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test7.artemis.cit.tum.de April 27, 2023 10:04 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test8.artemis.cit.tum.de April 27, 2023 10:04 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test9.artemis.cit.tum.de April 27, 2023 10:04 — with GitHub Actions Error
@Hialus Hialus had a problem deploying to artemis-test10.artemis.cit.tum.de April 27, 2023 10:04 — with GitHub Actions Error
Copy link

@SolizerCodes SolizerCodes left a comment

Choose a reason for hiding this comment

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

Tested the Exam Mode with a Test Exam (couldn't get normal exam to work, most likely my fault) and that worked as expected

Copy link

@SabrinaGlatz SabrinaGlatz left a comment

Choose a reason for hiding this comment

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

I tested the Exam Mode on the testing server. It works as expected.

@fschoenberger
Copy link

At some points the code could be simplified by using GitHub's Environments feature. Right now, the test environments are hardcoded in the pipeline:

filter-matrix:
    needs: [ get-labels, check-build-status ]
    runs-on: ubuntu-latest
    strategy:
      matrix:
        include:
          # Commented out environments are not yet available and will be enabled in the future

          #- environment: artemis-test2.artemis.cit.tum.de
          #  label-identifier: artemis-test2
          #  url: https://artemis-test2.artemis.cit.tum.de
          #  user: deployment
          #  hosts: artemis-test2.artemis.cit.tum.de
          #  folder: /opt/artemis
          #  host_keys: |
          #    artemis-test2.artemis.cit.tum.de ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDUqNIPYUJBuItIfGzVu8jtpNWerFoqNq34cPU/+w5biwCrQA/RMIRt0H49ETc4vgc3rN85//FJ9j2x4jGfyS3jxj/ind6PX1QIBjGl09s2TFz53Z8OwcAw9iXJrtKqZGfxr8sbVfboDGa/kyr8E+YUJo+6bPusLQPSAJn8GUGgcNKHQSX7A4sEIeq2uU1RqGKDWJSxyECUxyubfNB6LCZd3ezEP1MPDnvhoF/5cEP4QxeTsVIkwIIAE8oVxNM7Ni8xqkl8sUM//SdzglFsK2gE5eSZ5OpQ5h/Cc3Oo1z7LnwlMwo8fGnhAcoUpDjuKD/2AdIhkyW0B4xUKbKVO94kVSuBUXErYqF4bHByGgjkzR0JTEwk5+shlUjoEA6DBxBO08CudJcTDUhk5+8fRwOzxfSTakr8sOfakgo7W6fBl3P4lHSdsd7VqKINcR3A9QYSXeiEeqliXnTkDSsZw4ux9JyuLle1DHPbTuH8f+vEosdxda+djm3FeijYTe4QS87k=
          #    artemis-test2.artemis.cit.tum.de ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDRCF0zH3u38zVPNUhJI7zIDsXa3ONiU0GeCv/ybjawkh4alBPnlXtdH0cG1JPtR/Jz/gau92dcqiIFtqdDCDkg=
          #    artemis-test2.artemis.cit.tum.de ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMV70ACU6GdLtf1MwUklNltC78UoOPsasZruYh0Ord6n

          # ...

If these values were put into environments this would allow for more flexibility:

  • It'd be possible to add and remove test servers without having to change the pipeline
  • If someone forks the repository they wouldn't have to change this file (which would always cause conflicts)
  • The file would be easier to maintain and more readable.

An example of deploying with labels and environment can be seen here.

It boilds down to using the createDeployment API Call.

@Hialus
Copy link
Member Author

Hialus commented May 16, 2023

Thanks a lot for your detailed message @fschoenberger!
I'll definitley have a look if this is something we can use for Artemis. Though since this would take quite a while, this would be done in a separate PR.

Copy link
Member

@Mtze Mtze left a comment

Choose a reason for hiding this comment

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

Thank you for implementing this 👍 Changes are looking good to me

@Mtze Mtze added the maintainer-approved The feature maintainer has approved the PR label May 19, 2023
@bassner bassner added this to the 6.1.8 milestone May 19, 2023
@bassner bassner changed the title General: Add support for new Docker based test servers with GitHub deployment Development: Add support for new Docker based test servers with GitHub deployment May 19, 2023
@bassner bassner merged commit 26fcca0 into develop May 19, 2023
127 of 130 checks passed
@bassner bassner deleted the feature/new-test-servers branch May 19, 2023 08:08
Mtze pushed a commit that referenced this pull request Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer-approved The feature maintainer has approved the PR ready for review ready to merge
Projects
No open projects
Artemis Development
  
Ready for review
Development

Successfully merging this pull request may close these issues.

None yet