-
Notifications
You must be signed in to change notification settings - Fork 319
Development
: Switch postgres e2e setup to Jenkins/Gitlab
#6948
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
Merged
krusche
merged 14 commits into
develop
from
test/cypress/switch-postgres-to-jenkins-gitlab
Jul 25, 2023
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2047884
Switch Postgres Setup to Jenkins/Gitlab
TheZoker 9d8336c
Add local user management
TheZoker 8c2b533
Change jenkins user exist error from throw to warn
TheZoker 6467001
Change user email
TheZoker 8bd0621
Add user to logout test course
TheZoker 7498ebe
Fix internal URL
TheZoker f0d6956
Add gitlab health token to .env file
TheZoker 530d9be
Give Exam Assessment more time
TheZoker 79b393c
Support gitlab health check token
TheZoker 8a139ad
Fix migration postgres file path
TheZoker 819d539
Make health token optional
TheZoker 2912b41
Add health-api-token to server tests
TheZoker 9300280
Adjust user exists in CI test
TheZoker 2673202
Fix naming according to teamscale
TheZoker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
docker/artemis/config/cypress.env → docker/artemis/config/cypress-mysql.env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# Artemis configurations for Postgres setups | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
|
||
SPRING_PROFILES_ACTIVE="artemis,scheduling,jenkins,gitlab,prod,docker" | ||
|
||
SPRING_DATASOURCE_URL="jdbc:postgresql://artemis-postgresql:5432/Artemis?sslmode=disable" | ||
SPRING_DATASOURCE_USERNAME="postgres" | ||
SPRING_DATASOURCE_PASSWORD="" | ||
SPRING_DATASOURCE_HIKARI_MAXIMUMPOOLSIZE="100" | ||
|
||
SPRING_JPA_DATABASE_PLATFORM="org.hibernate.dialect.PostgreSQL10Dialect" | ||
SPRING_JPA_DATABASE="POSTGRESQL" | ||
SPRING_JPA_HIBERNATE_CONNECTION_CHARSET="utf8mb4" | ||
SPRING_JPA_HIBERNATE_CONNECTION_CHARACTERENCODING="utf8mb4" | ||
SPRING_JPA_HIBERNATE_CONNECTION_USEUNICODE="true" | ||
|
||
SPRING_PROMETHEUS_MONITORINGIP="131.159.89.160" | ||
|
||
# for bamboo and bitbucket notifications on /api/programming-exercises/new-result it seems like port | ||
# 54321 is internally open for the bamboo agents | ||
# also can't use SSL for this as the hostnames are not integrated in the self-signed certificate | ||
SERVER_URL="http://${HOST_HOSTNAME}:54321" | ||
|
||
# We don't need secure passwords for testing. Lower rounds will speed up tests. 4 is the lowest | ||
ARTEMIS_BCRYPTSALTROUNDS="4" | ||
|
||
ARTEMIS_USERMANAGEMENT_USEEXTERNAL="false" | ||
ARTEMIS_USERMANAGEMENT_INTERNALADMIN_USERNAME="${bamboo_artemis_admin_username}" | ||
ARTEMIS_USERMANAGEMENT_INTERNALADMIN_PASSWORD="${bamboo_artemis_admin_password}" | ||
ARTEMIS_USERMANAGEMENT_LOGIN_ACCOUNTNAME="TUM" | ||
|
||
ARTEMIS_VERSIONCONTROL_URL="https://gitlab-test.artemis.in.tum.de" | ||
ARTEMIS_VERSIONCONTROL_USER="${bamboo_gitlab_admin_user}" | ||
ARTEMIS_VERSIONCONTROL_PASSWORD="${bamboo_gitlab_admin_password}" | ||
ARTEMIS_VERSIONCONTROL_TOKEN="${bamboo_gitlab_token_secret}" | ||
ARTEMIS_VERSIONCONTROL_CITOKEN="${bamboo_jenkins_token_secret}" | ||
ARTEMIS_VERSIONCONTROL_HEALTHAPITOKEN="${bamboo_gitlab_health_token_secret}" | ||
|
||
ARTEMIS_CONTINUOUSINTEGRATION_URL="https://jenkins-test.artemis.in.tum.de" | ||
ARTEMIS_CONTINUOUSINTEGRATION_USER="${bamboo_jenkins_admin_user}" | ||
ARTEMIS_CONTINUOUSINTEGRATION_PASSWORD="${bamboo_jenkins_admin_password}" | ||
ARTEMIS_CONTINUOUSINTEGRATION_SECRETPUSHTOKEN="${bamboo_jenkins_secret_push_token}" | ||
ARTEMIS_CONTINUOUSINTEGRATION_VCSCREDENTIALS="${bamboo_jenkins_vcs_credentials_secret}" | ||
ARTEMIS_CONTINUOUSINTEGRATION_ARTEMISAUTHENTICATIONTOKENKEY="${bamboo_jenkins_artemis_ci_authentication_token_key_secret}" | ||
ARTEMIS_CONTINUOUSINTEGRATION_ARTEMISAUTHENTICATIONTOKENVALUE="${bamboo_jenkins_artemis_ci_authentication_token_value_secret}" | ||
ARTEMIS_CONTINUOUSINTEGRATION_EMPTYCOMMITNECESSARY="true" | ||
ARTEMIS_CONTINUOUSINTEGRATION_BUILDTIMEOUT="30" | ||
|
||
ARTEMIS_APOLLON_CONVERSIONSERVICEURL="https://apollon.ase.in.tum.de/api/converter" | ||
|
||
# Token is valid 3 days | ||
JHIPSTER_SECURITY_AUTHENTICATION_JWT_TOKENVALIDITYINSECONDS="259200" | ||
# Token is valid 30 days | ||
JHIPSTER_SECURITY_AUTHENTICATION_JWT_TOKENVALIDITYINSECONDSFORREMEMBERME="2592000" | ||
|
||
# Properties to be exposed on the /info management endpoint | ||
|
||
INFO_IMPRINT="https://ase.in.tum.de/lehrstuhl_1/component/content/article/179-imprint" | ||
INFO_TESTSERVER="true" | ||
INFO_TEXTASSESSMENTANALYTICSENABLED="true" | ||
INFO_STUDENTEXAMSTORESESSIONDATA="true" | ||
|
||
LOGGING_FILE_NAME="/opt/artemis/data/artemis.log" | ||
|
||
MANAGEMENT_METRICS_EXPORT_PROMETHEUS_ENABLED="true" | ||
|
||
JENKINS_INTERNALURLS_CIURL="https://jenkins-test.artemis.in.tum.de" | ||
JENKINS_INTERNALURLS_VCNURL="https://gitlab-test.artemis.in.tum.de" |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
import { admin, instructor, studentOne, studentThree, studentTwo, tutor } from '../support/users'; | ||
import { userManagementRequest } from '../support/requests/ArtemisRequests'; | ||
import { USER_ID, USER_ROLE, admin, instructor, studentOne, studentThree, studentTwo, tutor, users } from '../support/users'; | ||
|
||
it('Logs in once with all required users', () => { | ||
// If Artemis hasn't imported the required users from Jira we have to force this by logging in with these users once | ||
cy.login(admin); | ||
cy.login(instructor); | ||
cy.login(tutor); | ||
cy.login(studentOne); | ||
cy.login(studentTwo); | ||
cy.login(studentThree); | ||
describe('Setup users', () => { | ||
if (Cypress.env('createUsers')) { | ||
before('Creates all required users', () => { | ||
cy.login(admin); | ||
for (const userKey in USER_ID) { | ||
const user = users.getUserWithId(USER_ID[userKey]); | ||
userManagementRequest.createUser(user.username, user.password, USER_ROLE[userKey]); | ||
} | ||
}); | ||
} | ||
|
||
it('Logs in once with all required users', () => { | ||
// If Artemis hasn't imported the required users from Jira we have to force this by logging in with these users once | ||
cy.login(admin); | ||
cy.login(instructor); | ||
cy.login(tutor); | ||
cy.login(studentOne); | ||
cy.login(studentTwo); | ||
cy.login(studentThree); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { CourseManagementRequests } from './CourseManagementRequests'; | ||
import { UserManagementRequests } from './UserManagementRequest'; | ||
|
||
/** | ||
* A class which encapsulates all cypress requests, which can be sent to Artemis. | ||
*/ | ||
export class ArtemisRequests { | ||
courseManagement = new CourseManagementRequests(); | ||
userManagement = new UserManagementRequests(); | ||
} | ||
|
||
export const courseManagementRequest = new CourseManagementRequests(); | ||
export const userManagementRequest = new UserManagementRequests(); |
29 changes: 29 additions & 0 deletions
29
src/test/cypress/support/requests/UserManagementRequest.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { BASE_API, POST } from '../constants'; | ||
import { UserRole } from '../users'; | ||
|
||
/** | ||
* A class which encapsulates all cypress requests related to course management. | ||
*/ | ||
export class UserManagementRequests { | ||
/** | ||
* Creates a new user | ||
* @param username the username of the new user | ||
* @param password the password of the new user | ||
* @param role the role of the new user | ||
*/ | ||
createUser(username: string, password: string, role: UserRole) { | ||
const user = { | ||
login: username, | ||
password, | ||
firstName: username, | ||
lastName: username, | ||
email: username + '@example.com', | ||
authorities: [role], | ||
}; | ||
return cy.request({ | ||
url: BASE_API + 'admin/users', | ||
method: POST, | ||
body: user, | ||
}); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.