Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -865,9 +865,7 @@ jobs:
- name: Run integration tests
run: sudo -E env "PATH=$PATH" python3 /usr/local/submitty/test_suite/integrationTests/run.py


ansible-install:
name: Ansible Install
ansible-ci:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand All @@ -884,11 +882,40 @@ jobs:
shell: bash
run: |
cd .setup/ansible
ansible-playbook --private-key /home/runner/.ssh/id_rsa -e 'ansible_user=runner' -i inventory/submitty playbooks/submitty_install.yml
ansible-playbook --private-key /home/runner/.ssh/id_rsa -e 'ansible_user=runner submitty_install_submitty_version=${{ github.head_ref }} submitty_install_github_url=https://github.com/${{ github.repository }}.git' -i inventory/submitty playbooks/submitty_install.yml
ansible-playbook --private-key /home/runner/.ssh/id_rsa -e 'ansible_user=runner' -i inventory/submitty playbooks/submitty_course_creation.yml

- name: Set perms
shell: bash
run: |
sudo chmod -R a+rwx ${SUBMITTY_INSTALL_DIR}
sudo chmod -R a+rwx /tmp/

- name: Install node dependencies
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site
run: |
npm ci

- name: Validate image
run: curl --show-error --fail --include http://localhost/authentication/login
run: |
curl --show-error --fail --include http://localhost/authentication/login

- name: Run Ansible cypress test
uses: cypress-io/github-action@v6
with:
config: baseUrl=http://localhost
spec: cypress/e2e/Cypress-Ansible/ansible-course.spec.js
working-directory: ${{env.SUBMITTY_REPOSITORY}}/site
browser: chrome

- uses: actions/upload-artifact@v4
if: failure()
with:
name: install-log
path: /usr/local/submitty/install.log
name: Cypress-Ansible-Screenshots
path: ${{env.SUBMITTY_REPOSITORY}}/site/cypress/screenshots

- uses: actions/upload-artifact@v4
if: failure()
with:
name: Cypress-Ansible-Videos
path: ${{env.SUBMITTY_REPOSITORY}}/site/cypress/videos
30 changes: 25 additions & 5 deletions .setup/ansible/playbooks/submitty_course_creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@
submitty_term_creation_start_date: 01/01/2024
submitty_term_creation_end_date: 06/07/2024

- name: Add instructor
ansible.builtin.include_role:
name: submitty_add_user
vars:
submitty_add_user_username: instructor
submitty_add_user_firstname: instructor
submitty_add_user_lastname: Quinn
submitty_add_user_email: email
submitty_add_user_password: instructor

- name: Add instructor
ansible.builtin.include_role:
name: submitty_add_user
vars:
submitty_add_user_username: runner
submitty_add_user_firstname: instructor
submitty_add_user_lastname: Quinn
submitty_add_user_email: email
submitty_add_user_password: instructor

- name: Course Creation
ansible.builtin.include_role:
name: submitty_course_creation
Expand All @@ -38,7 +58,7 @@
submitty_course_add_instructor_firstname: firstname
submitty_course_add_instructor_lastname: lastname
submitty_course_add_instructor_email: email
submitty_course_add_instructor_password: password
submitty_course_add_instructor_password: instructor2

- name: Add Users
ansible.builtin.include_role:
Expand All @@ -56,16 +76,16 @@
firstname: firstname
lastname: lastname
email: email
password: password
- username: bitddle
password: aphacker
- username: bitdiddle
firstname: firstname
lastname: lastname
email: email
password: password
password: bitdiddle
- username: adamsg
firstname: firstname
lastname: lastname
email: email
password: password
password: adamsg
loop_control:
loop_var: user
14 changes: 14 additions & 0 deletions .setup/ansible/roles/submitty_add_user/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Add student to submitty users.
ansible.builtin.expect:
command: ./adduser.py "{{ submitty_add_user_username }}"
chdir: /usr/local/submitty/sbin/
echo: true
responses:
(?m)^User givenname: "{{ submitty_add_user_username }}"
(?m)^User preferred name: "{{ submitty_add_user_firstname }}"
(?m)^User familyname: "{{ submitty_add_user_lastname }}"
(?m)^User email: "{{ submitty_add_user_email }}"
(?m)^User password: "{{ submitty_add_user_password }}"
become: true
become_user: root
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
submitty_course_add_user_user_group: 4
submitty_course_add_user_registration_section: None
3 changes: 2 additions & 1 deletion .setup/ansible/roles/submitty_course_add_user/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
ansible.builtin.command:
cmd: ./adduser_course.py "{{ submitty_course_add_user_username }}"
"{{ submitty_course_add_user_term }}" "{{ submitty_course_add_user_course }}"
"{{ submitty_course_add_user_user_group }}"
"{{ submitty_course_add_user_registration_section }}"
--user_group "{{ submitty_course_add_user_user_group }}"
chdir: /usr/local/submitty/sbin/
register: add_user_result
become: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
submitty_course_creation_user_group: 1
submitty_course_creation_registration_section: None
3 changes: 2 additions & 1 deletion .setup/ansible/roles/submitty_course_creation/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
ansible.builtin.command:
cmd: ./adduser_course.py "{{ submitty_course_creation_username }}"
"{{ submitty_course_creation_term }}" "{{ submitty_course_creation_course }}"
"{{ submitty_course_creation_user_group }}"
"{{ submitty_course_creation_registration_section }}"
--user_group "{{ submitty_course_creation_user_group }}"
chdir: /usr/local/submitty/sbin/
become: true
become_user: root
Expand Down
1 change: 1 addition & 0 deletions .setup/ansible/roles/submitty_install/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
submitty_install_submitty_version: main
submitty_install_github_url: https://github.com/Submitty/Submitty.git
submitty_install_db_host: localhost
submitty_install_db_port: 5432
submitty_install_submitty_dbuser: submitty_dbuser
Expand Down
2 changes: 1 addition & 1 deletion .setup/ansible/roles/submitty_install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

- name: Checkout specific version of the submitty git repo
ansible.builtin.git:
repo: https://github.com/Submitty/Submitty.git
repo: "{{ submitty_install_github_url }}"
dest: /usr/local/submitty/GIT_CHECKOUT/Submitty
version: "{{ submitty_install_submitty_version }}"
force: true
Expand Down
6 changes: 6 additions & 0 deletions site/cypress/e2e/Cypress-Ansible/ansible-course.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
describe('Testing website when created by ansible scripts', () => {
it('Should be able to login and see the course', () => {
cy.login('instructor');
cy.visit('term', 'course');
});
});
Loading