• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Teardown Windows
2
3description: Set up Docker workspace on linux
4
5inputs:
6  extra-delete-dir:
7    description: If set, cleaning up the workspace will delete this too
8    required: false
9    default: ""
10
11runs:
12  using: composite
13  steps:
14    - name: Wait until all sessions have drained
15      shell: powershell
16      if: always()
17      run: |
18        .github\scripts\wait_for_ssh_to_drain.ps1
19
20    - name: Kill active ssh sessions if still around (Useful if workflow was cancelled)
21      shell: powershell
22      if: always()
23      run: |
24        .github\scripts\kill_active_ssh_sessions.ps1
25
26    - name: Clean up leftover processes on non-ephemeral Windows runner
27      uses: pytorch/test-infra/.github/actions/cleanup-runner@main
28
29    # Cleaning up Windows workspace sometimes fails flakily with device or resource busy
30    # error, meaning one or more processes haven't stopped completely yet. So trying to
31    # retry this step several time similar to how checkout-pytorch GHA does
32    - name: Cleanup workspace
33      if: always()
34      uses: nick-fields/retry@v3.0.0
35      env:
36        EXTRA_DELETE_DIR: ${{ inputs.extra-delete-dir }}
37      with:
38        shell: bash
39        timeout_minutes: 5
40        max_attempts: 3
41        retry_wait_seconds: 90
42        command: |
43          set +e
44          set -x
45
46          if [ -n "${EXTRA_DELETE_DIR}" ]; then
47            # It's ok to fail to clean up the extra directory on Windows as it only contains
48            # the build artifacts and doesn't take up much space, i.e. /c/5053411580/build-results
49            rm -rf "${EXTRA_DELETE_DIR}" || true
50          fi
51
52          rm -rf ./*
53
54    - name: Print all processes locking the runner workspace
55      continue-on-error: true
56      shell: powershell
57      run: |
58        handle C:\actions-runner\_work\
59