Skip to content

Commit

Permalink
.github: Enable SSH to linux runners
Browse files Browse the repository at this point in the history
Enables SSH to linux GHA runners for FB employees while on the FB VPN

SSH keys will be added to runners when the label "with-ssh" is applied to
your pull request.

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>

ghstack-source-id: 6ee7575b239737570e264f3a5d16c3cde7f2432e
Pull Request resolved: #62280

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
  • Loading branch information
seemethere committed Aug 3, 2021
1 parent b7ac286 commit 6502a4a
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/scripts/wait_for_ssh_to_drain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -eou pipefail

echo "Holding runner for 2 hours until all ssh sessions have logged out"
for _ in $(seq 1440); do
# Break if no ssh session exists anymore
if [ "$(who)" = "" ]; then
break
fi
echo "."
sleep 5
done
28 changes: 28 additions & 0 deletions .github/templates/linux_ci_workflow.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
- name: Clean workspace
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
rm -f ~/.ssh/authorized_keys
- name: Checkout PyTorch
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -153,6 +154,11 @@ jobs:
- name: Clean workspace
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
rm -f ~/.ssh/authorized_keys
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout PyTorch
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -231,6 +237,10 @@ jobs:
path:
artifacts.zip
{%- endif %}
- name: Hold runner for 2 hours or until ssh sessions have drained
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
- name: Clean up docker images
if: always()
run: |
Expand Down Expand Up @@ -294,6 +304,11 @@ jobs:
- name: Clean workspace
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
rm -f ~/.ssh/authorized_keys
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout PyTorch
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -400,6 +415,10 @@ jobs:
if-no-files-found: error
path:
test-reports-*.zip
- name: Hold runner for 2 hours or until ssh sessions have drained
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
- name: Clean up docker images
if: always()
run: |
Expand Down Expand Up @@ -496,6 +515,11 @@ jobs:
- name: Clean workspace
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
rm -f ~/.ssh/authorized_keys
- name: "[FB EMPLOYEES] Enables SSH (Click me for login details)"
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout PyTorch
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -564,6 +588,10 @@ jobs:
name: pytorch_github_io
if-no-files-found: error
path: pytorch_github_io.zip
- name: Hold runner for 2 hours or until ssh sessions have drained
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
- name: Clean up docker images
if: always()
run: |
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .github/workflows/generated-linux-bionic-py3.8-gcc9-coverage.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6502a4a

Please sign in to comment.