diff --git a/.github/workflows/save_vm.yaml b/.github/workflows/save_vm.yaml index 9d81d908854..b5f391e2805 100644 --- a/.github/workflows/save_vm.yaml +++ b/.github/workflows/save_vm.yaml @@ -4,12 +4,12 @@ on: schedule: - cron: '0 0 * * 0' workflow_dispatch: - + pull_request: permissions: contents: read jobs: - vagrant-up: + vagrant-up-virtualbox: runs-on: macos-13 steps: - uses: actions/checkout@v4 @@ -30,27 +30,45 @@ jobs: run: CI=1 vagrant up - name: Validate image run: curl --show-error --fail --include http://localhost:1511 - - name: Save image - run: vagrant package --output submitty.box - - name: Publish image + # - name: Save image + # run: vagrant package --output submitty.box + # - name: Publish image + # run: | + # vagrant cloud auth login --token ${{ secrets.VAGRANT_CLOUD_TOKEN }} + # vagrant cloud publish SubmittyBot/ubuntu22-dev ${{ steps.get-version.outputs.version }}.$(date +"%y%m%d%H%M") virtualbox submitty.box --release --force + # vagrant cloud auth logout + # - name: Acquire Job ID + # if: failure() + # id: get-job-id + # env: + # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: | + # jobs=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id}}/attempts/${{ github.run_attempt }}/jobs) + # job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id') + # echo "job_id=$job_id" >> $GITHUB_OUTPUT + # - name: Send zulip message on failure + # if: failure() + # run: >- + # curl -X POST https://submitty.zulipchat.com/api/v1/messages -u ${{ secrets.ZULIP_AUTHENTICATION }} + # --data-urlencode 'type=stream' + # --data-urlencode 'to=Submitty Developer Studio' + # --data-urlencode 'topic=Vagrant Up Failures' + # --data-urlencode 'content=The Package Vagrant VM Github Action has failed for Virtual-Box, this means the VM is not saved, and requires attention. View here: https://github.com/Submitty/Submitty/actions/runs/${{ github.run_id }}/job/${{ steps.get-job-id.outputs.job_id }}' + + vagrant-up-qemu: + runs-on: macos-13 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install QEMU and Vagrant run: | - vagrant cloud auth login --token ${{ secrets.VAGRANT_CLOUD_TOKEN }} - vagrant cloud publish SubmittyBot/ubuntu22-dev ${{ steps.get-version.outputs.version }}.$(date +"%y%m%d%H%M") virtualbox submitty.box --release --force - vagrant cloud auth logout - - name: Acquire Job ID - if: failure() - id: get-job-id - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + brew install qemu vagrant + vagrant plugin install vagrant-qemu + # sudo softwareupdate --install-rosetta --agree-to-license + qemu-system-aarch64 -accel hvf + - name: Build ARM64 Vagrant Box run: | - jobs=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id}}/attempts/${{ github.run_attempt }}/jobs) - job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id') - echo "job_id=$job_id" >> $GITHUB_OUTPUT - - name: Send zulip message on failure - if: failure() - run: >- - curl -X POST https://submitty.zulipchat.com/api/v1/messages -u ${{ secrets.ZULIP_AUTHENTICATION }} - --data-urlencode 'type=stream' - --data-urlencode 'to=Submitty Developer Studio' - --data-urlencode 'topic=Vagrant Up Failures' - --data-urlencode 'content=The Package Vagrant VM Github Action has failed, this means the VM is not saved, and requires attention. View here: https://github.com/Submitty/Submitty/actions/runs/${{ github.run_id }}/job/${{ steps.get-job-id.outputs.job_id }}' + sudo pwpolicy -u runner -sethashtypes SMB-NT on + CI=1 vagrant up --provider=qemu + \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile index 730ab118f38..0296d47aa9c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -39,18 +39,18 @@ def gen_script(machine_name, worker: false, base: false) reinstall = ENV.has_key?('VAGRANT_BOX') || base extra = ENV.fetch('EXTRA', '') setup_cmd = 'bash ${GIT_PATH}/.setup/' - if reinstall || ON_CI - if worker - setup_cmd += 'install_worker.sh' - else - setup_cmd += 'vagrant/setup_vagrant.sh' - if no_submissions - setup_cmd += ' --no_submissions' - end - end - else - setup_cmd += 'install_success_from_cloud.sh' - end + # if reinstall || ON_CI + # if worker + # setup_cmd += 'install_worker.sh' + # else + # setup_cmd += 'vagrant/setup_vagrant.sh' + # if no_submissions + # setup_cmd += ' --no_submissions' + # end + # end + # else + setup_cmd += 'install_success_from_cloud.sh' + # end unless extra.empty? setup_cmd += " #{extra}" end @@ -83,13 +83,13 @@ def mount_folders(config, mount_options) # vagrant group so that they can write to this shared folder, primarily just for the log files owner = 'root' group = 'vagrant' - config.vm.synced_folder '.', '/usr/local/submitty/GIT_CHECKOUT/Submitty', create: true, owner: owner, group: group, mount_options: mount_options, smb_host: '10.0.2.2', smb_username: `whoami`.chomp + config.vm.synced_folder '.', '/usr/local/submitty/GIT_CHECKOUT/Submitty', create: true, owner: owner, group: group, mount_options: mount_options, smb_host: '10.0.2.2', smb_username: `whoami`.chomp, smb_password: `whoami`.chomp, disabled: true optional_repos = %w(AnalysisTools AnalysisToolsTS Lichen RainbowGrades Tutorial CrashCourseCPPSyntax LichenTestData) optional_repos.each {|repo| repo_path = File.expand_path("../" + repo) if File.directory?(repo_path) - config.vm.synced_folder repo_path, "/usr/local/submitty/GIT_CHECKOUT/" + repo, owner: owner, group: group, mount_options: mount_options, smb_host: '10.0.2.2', smb_username: `whoami`.chomp + config.vm.synced_folder repo_path, "/usr/local/submitty/GIT_CHECKOUT/" + repo, owner: owner, group: group, mount_options: mount_options, smb_host: '10.0.2.2', smb_username: `whoami`.chomp, smb_password: `whoami`.chomp, disabled: true end } end @@ -240,11 +240,12 @@ Vagrant.configure(2) do |config| config.vm.provider "qemu" do |qe, override| unless custom_box - if apple_silicon + if apple_silicon || ON_CI override.vm.box = base_boxes[:arm_mac_qemu] end end - + + # qe.qemu_dir = "/usr/local/share/qemu" qe.memory = "2G" qe.smp = 2