+++ /dev/null
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-function get_ec2_metadata() {
- # Pulled from instance metadata endpoint for EC2
- # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
- category=$1
- curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
-}
-
-echo "ami-id: $(get_ec2_metadata ami-id)"
-echo "instance-id: $(get_ec2_metadata instance-id)"
-echo "instance-type: $(get_ec2_metadata instance-type)"
NUM_TEST_SHARDS: !{{ num_test_shards }}
CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }}
steps:
- - name: Log in to ECR
- run: |
- aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
- bash /tmp/ecr-login.sh
- rm /tmp/ecr-login.sh
- - name: Chown workspace
- run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- - name: Checkout PyTorch
- uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
- with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
- submodules: recursive
- !{{ common.display_ec2_information() }}
+ !{{ common.setup_ec2_linux() }}
+ !{{ common.checkout_pytorch("recursive") }}
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
path:
test-reports-*.zip
!{{ common.upload_test_statistics(build_environment) }}
- - name: Clean up docker images
- if: always()
- run: |
- # Prune all of the docker images
- docker system prune -af
+ !{{ common.teardown_ec2_linux() }}
{%- endblock %}
- name: Display EC2 information
shell: bash
run: |
- .github/scripts/display_ec2_information.sh
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
{%- endmacro -%}
{%- macro parse_ref() -%}
python3 -m pip install boto3==1.16.34
python3 -m tools.stats.print_test_stats --upload-to-s3 --compare-with-s3 test
{%- endmacro -%}
+
+{%- macro setup_ec2_linux() -%}
+ !{{ display_ec2_information() }}
+ - name: Log in to ECR
+ run: |
+ aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
+ bash /tmp/ecr-login.sh
+ rm /tmp/ecr-login.sh
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
+{%- endmacro -%}
+
+{%- macro teardown_ec2_linux() -%}
+ - 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: Kill containers, clean up images
+ if: always()
+ run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
+ # Prune all of the docker images
+ docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+{%- endmacro -%}
+
+{%- macro checkout_pytorch(submodules) -%}
+ - name: Checkout PyTorch
+ uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
+ with:
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
+ submodules: !{{ submodules }}
+{%- endmacro -%}
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
- - name: Log in to ECR
- run: |
- aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
- bash /tmp/ecr-login.sh
- rm /tmp/ecr-login.sh
- - name: Chown workspace
- run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- - name: Clean workspace
- run: |
- rm -rf "${GITHUB_WORKSPACE:?}/*"
- rm -f ~/.ssh/authorized_keys
- - name: Checkout PyTorch
- uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
- with:
- # deep clone, to allow use of git merge-base
- fetch-depth: 0
- !{{ common.display_ec2_information() }}
+ !{{ common.setup_ec2_linux() }}
+ !{{ common.checkout_pytorch("false") }}
- name: Calculate docker image tag
id: calculate-tag
run: |
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
JOB_BASE_NAME: !{{ build_environment }}-build
steps:
- - name: Log in to ECR
- run: |
- aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
- bash /tmp/ecr-login.sh
- rm /tmp/ecr-login.sh
- - name: Chown workspace
- run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- - 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: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
- with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
- submodules: recursive
- !{{ common.display_ec2_information() }}
+ !{{ common.setup_ec2_linux() }}
+ !{{ common.checkout_pytorch("recursive") }}
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Build PyTorch
run: |
docker run \
path:
artifacts.zip
{%- endif %}
+ !{{ common.teardown_ec2_linux() }}
- name: Hold runner for 2 hours or until ssh sessions have drained
# Always hold for active ssh sessions
if: always()
PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }}
CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }}
steps:
- - name: Log in to ECR
- run: |
- aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
- bash /tmp/ecr-login.sh
- rm /tmp/ecr-login.sh
- - name: Chown workspace
- run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- - 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: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
- with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
- submodules: recursive
- !{{ common.display_ec2_information() }}
+ !{{ common.setup_ec2_linux() }}
+ !{{ common.checkout_pytorch("recursive") }}
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- name: Output disk space left
run: |
sudo df -H
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Test PyTorch
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
test-reports-*.zip
!{{ common.parse_ref() }}
!{{ common.upload_test_statistics(build_environment) }}
- - 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: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- # Prune all of the docker images
- docker system prune -af
+ !{{ common.teardown_ec2_linux() }}
{% endblock %}
{%- endif -%}
{%- if enable_doc_jobs %}
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
DOCS_TYPE: ${{ matrix.docs_type }}
steps:
- - name: Log in to ECR
- run: |
- aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
- bash /tmp/ecr-login.sh
- rm /tmp/ecr-login.sh
- - name: Chown workspace
- run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- - 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: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
- with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
- submodules: recursive
- !{{ common.display_ec2_information() }}
+ !{{ common.setup_ec2_linux() }}
+ !{{ common.checkout_pytorch("recursive") }}
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- uses: seemethere/download-artifact-s3@0504774707cbc8603d7dca922e8026eb8bf3b47b
name: Download PyTorch Build Artifacts
with:
name: docs_${{ matrix.docs_type }}
path: docs_${{ matrix.docs_type }}.zip
if-no-files-found: error
- - 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: |
- # Prune all of the docker images
- docker system prune -af
+ !{{ common.teardown_ec2_linux() }}
{%- endif -%}
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
# deep clone, to allow use of git merge-base
fetch-depth: 0
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
+ submodules: false
- name: Calculate docker image tag
id: calculate-tag
run: |
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
JOB_BASE_NAME: libtorch-linux-xenial-cuda10.2-py3.6-gcc7-build
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Build PyTorch
run: |
docker run \
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
+ - name: Kill containers, clean up images
+ if: always()
+ run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
+ # Prune all of the docker images
+ docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: |
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
# deep clone, to allow use of git merge-base
fetch-depth: 0
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
+ submodules: false
- name: Calculate docker image tag
id: calculate-tag
run: |
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
JOB_BASE_NAME: libtorch-linux-xenial-cuda11.3-py3.6-gcc7-build
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Build PyTorch
run: |
docker run \
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
+ - name: Kill containers, clean up images
+ if: always()
+ run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
+ # Prune all of the docker images
+ docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: |
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
# deep clone, to allow use of git merge-base
fetch-depth: 0
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
+ submodules: false
- name: Calculate docker image tag
id: calculate-tag
run: |
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
JOB_BASE_NAME: linux-bionic-cuda10.2-py3.9-gcc7-build
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Build PyTorch
run: |
docker run \
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
+ - name: Kill containers, clean up images
+ if: always()
+ run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
+ # Prune all of the docker images
+ docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: |
PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }}
CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- name: Clean workspace
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- name: Output disk space left
run: |
sudo df -H
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Test PyTorch
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
- - name: Clean up docker images
+ - name: Kill containers, clean up images
if: always()
run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
# Prune all of the docker images
docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
# deep clone, to allow use of git merge-base
fetch-depth: 0
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
+ submodules: false
- name: Calculate docker image tag
id: calculate-tag
run: |
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
JOB_BASE_NAME: linux-bionic-py3.8-gcc9-coverage-build
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Build PyTorch
run: |
docker run \
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
+ - name: Kill containers, clean up images
+ if: always()
+ run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
+ # Prune all of the docker images
+ docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: |
PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }}
CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- name: Clean workspace
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- name: Output disk space left
run: |
sudo df -H
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Test PyTorch
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
- - name: Clean up docker images
+ - name: Kill containers, clean up images
if: always()
run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
# Prune all of the docker images
docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
# deep clone, to allow use of git merge-base
fetch-depth: 0
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
+ submodules: false
- name: Calculate docker image tag
id: calculate-tag
run: |
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
JOB_BASE_NAME: linux-xenial-cuda10.2-py3.6-gcc7-build
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Build PyTorch
run: |
docker run \
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
+ - name: Kill containers, clean up images
+ if: always()
+ run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
+ # Prune all of the docker images
+ docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: |
PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }}
CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- name: Clean workspace
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- name: Output disk space left
run: |
sudo df -H
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Test PyTorch
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
- - name: Clean up docker images
+ - name: Kill containers, clean up images
if: always()
run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
# Prune all of the docker images
docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
# deep clone, to allow use of git merge-base
fetch-depth: 0
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
+ submodules: false
- name: Calculate docker image tag
id: calculate-tag
run: |
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
JOB_BASE_NAME: linux-xenial-cuda11.3-py3.6-gcc7-build
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Build PyTorch
run: |
docker run \
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
+ - name: Kill containers, clean up images
+ if: always()
+ run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
+ # Prune all of the docker images
+ docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: |
PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }}
CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- name: Clean workspace
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- name: Output disk space left
run: |
sudo df -H
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Test PyTorch
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
- - name: Clean up docker images
+ - name: Kill containers, clean up images
if: always()
run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
# Prune all of the docker images
docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
# deep clone, to allow use of git merge-base
fetch-depth: 0
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
+ submodules: false
- name: Calculate docker image tag
id: calculate-tag
run: |
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
JOB_BASE_NAME: linux-xenial-py3.6-gcc5.4-build
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Build PyTorch
run: |
docker run \
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
+ - name: Kill containers, clean up images
+ if: always()
+ run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
+ # Prune all of the docker images
+ docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: |
PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }}
CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- name: Clean workspace
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- name: Output disk space left
run: |
sudo df -H
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Test PyTorch
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
- - name: Clean up docker images
+ - name: Kill containers, clean up images
if: always()
run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
# Prune all of the docker images
docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
pytorch_doc_build:
runs-on: linux.2xlarge
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
DOCS_TYPE: ${{ matrix.docs_type }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
rm -f ~/.ssh/authorized_keys
- - name: "[FB EMPLOYEES] Enables SSH (Click me for login details)"
+ - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- uses: seemethere/download-artifact-s3@0504774707cbc8603d7dca922e8026eb8bf3b47b
name: Download PyTorch Build Artifacts
with:
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
- - name: Clean up docker images
+ - name: Kill containers, clean up images
if: always()
run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
# Prune all of the docker images
docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
# deep clone, to allow use of git merge-base
fetch-depth: 0
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
+ submodules: false
- name: Calculate docker image tag
id: calculate-tag
run: |
NUM_TEST_SHARDS: 1
CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
python3 -m pip install -r requirements.txt
python3 -m pip install boto3==1.16.34
python3 -m tools.stats.print_test_stats --upload-to-s3 --compare-with-s3 test
- - name: Clean up docker images
+ - 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: Kill containers, clean up images
if: always()
run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
# Prune all of the docker images
docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
# deep clone, to allow use of git merge-base
fetch-depth: 0
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
+ submodules: false
- name: Calculate docker image tag
id: calculate-tag
run: |
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
JOB_BASE_NAME: periodic-libtorch-linux-xenial-cuda11.1-py3.6-gcc7-build
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Build PyTorch
run: |
docker run \
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
+ - name: Kill containers, clean up images
+ if: always()
+ run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
+ # Prune all of the docker images
+ docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: |
outputs:
docker_image: ${{ steps.calculate-tag.outputs.docker_image }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
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: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
# deep clone, to allow use of git merge-base
fetch-depth: 0
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
+ submodules: false
- name: Calculate docker image tag
id: calculate-tag
run: |
DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }}
JOB_BASE_NAME: periodic-linux-xenial-cuda11.1-py3.6-gcc7-build
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Build PyTorch
run: |
docker run \
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
+ - name: Kill containers, clean up images
+ if: always()
+ run: |
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
+ # Prune all of the docker images
+ docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ - 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: |
PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }}
CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }}
steps:
+ - name: Display EC2 information
+ shell: bash
+ run: |
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Log in to ECR
run: |
aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh
bash /tmp/ecr-login.sh
rm /tmp/ecr-login.sh
- name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
run: |
# Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- name: Clean workspace
run: |
rm -rf "${GITHUB_WORKSPACE:?}/*"
uses: seemethere/add-github-ssh-key@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Preserve github env variables for use in docker
+ run: |
+ env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Checkout PyTorch
uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9
with:
- fetch-depth: 0 # deep clone, to allow sharding to use git rev-list
+ # deep clone, to allow use of git merge-base
+ fetch-depth: 0
submodules: recursive
- - name: Display EC2 information
- shell: bash
- run: |
- .github/scripts/display_ec2_information.sh
- name: Pull docker image
run: |
docker pull "${DOCKER_IMAGE}"
- name: Output disk space left
run: |
sudo df -H
- - name: Preserve github env variables for use in docker
- run: |
- env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}"
- name: Test PyTorch
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
# Always hold for active ssh sessions
if: always()
run: .github/scripts/wait_for_ssh_to_drain.sh
- - name: Clean up docker images
+ - name: Kill containers, clean up images
if: always()
run: |
- # Ensure the working directory gets chowned back to the current user
- docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
+ # ignore expansion of "docker ps -q" since it could be empty
+ # shellcheck disable=SC2046
+ docker stop $(docker ps -q) || true
# Prune all of the docker images
docker system prune -af
+ - name: Chown workspace
+ env:
+ ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine"
+ run: |
+ # Ensure the working directory gets chowned back to the current user
+ docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" .
- name: Display EC2 information
shell: bash
run: |
- .github/scripts/display_ec2_information.sh
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Install Visual Studio 2019 toolchain
shell: powershell
run: |
- name: Display EC2 information
shell: bash
run: |
- .github/scripts/display_ec2_information.sh
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
uses: seemethere/add-github-ssh-key@v1
with:
- name: Display EC2 information
shell: bash
run: |
- .github/scripts/display_ec2_information.sh
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Install Visual Studio 2019 toolchain
shell: powershell
run: |
- name: Display EC2 information
shell: bash
run: |
- .github/scripts/display_ec2_information.sh
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
uses: seemethere/add-github-ssh-key@v1
with:
- name: Display EC2 information
shell: bash
run: |
- .github/scripts/display_ec2_information.sh
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Install Visual Studio 2019 toolchain
shell: powershell
run: |
- name: Display EC2 information
shell: bash
run: |
- .github/scripts/display_ec2_information.sh
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
uses: seemethere/add-github-ssh-key@v1
with:
- name: Display EC2 information
shell: bash
run: |
- .github/scripts/display_ec2_information.sh
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: Install Visual Studio 2019 toolchain
shell: powershell
run: |
- name: Display EC2 information
shell: bash
run: |
- .github/scripts/display_ec2_information.sh
+ set -euo pipefail
+ function get_ec2_metadata() {
+ # Pulled from instance metadata endpoint for EC2
+ # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+ category=$1
+ curl -fsSL "http://169.254.169.254/latest/meta-data/${category}"
+ }
+ echo "ami-id: $(get_ec2_metadata ami-id)"
+ echo "instance-id: $(get_ec2_metadata instance-id)"
+ echo "instance-type: $(get_ec2_metadata instance-type)"
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
uses: seemethere/add-github-ssh-key@v1
with: