Skip to content

Commit

Permalink
#12775: Cleanup docker run action
Browse files Browse the repository at this point in the history
   - Remove unnecessary arch parameter of the docker run action
   - Add a parameter to installing the wheel
   - Remove LD_LIBRARY env variable since it is not used in the wheel environments
   - Remove Github username since it is accessible inside of the custom Action
   - Incorproate the new learning of not needing to delete the folders and also mount the required files for permissions
   - Set HOME variable so that the packagaes would not be installed in the /home/ubuntu/.local folder
  • Loading branch information
dimitri-tenstorrent committed Sep 24, 2024
1 parent 239671d commit cef5730
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
33 changes: 28 additions & 5 deletions .github/actions/docker-run/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ inputs:
docker_username:
description: docker login username
required: true
default: ${{ github.actor }}
docker_password:
description: docker login password
required: true
Expand All @@ -25,13 +26,23 @@ inputs:
default: |
-v /dev/hugepages-1G:/dev/hugepages-1G
--device /dev/tenstorrent
install_wheel:
description: "Install the wheel that contains all of the Python environment. The artifact needs to be present."
type: boolean
required: false
default: false
runs:
using: "composite"
steps:
- name: Determine docker image tag
uses: ./.github/actions/generate-docker-tag
with:
image: ${{ inputs.docker_os_arch }}
- name: Set
shell: bash
run: |
echo "RUNNER_UID=$(id -u)" >> $GITHUB_ENV
echo "RUNNER_GID=$(id -g)" >> $GITHUB_ENV
- name: Docker login
uses: docker/login-action@v3
with:
Expand All @@ -49,16 +60,28 @@ runs:
password: ${{ inputs.docker_password }}
registry: ghcr.io
image: ${{ env.TT_METAL_DOCKER_IMAGE_TAG }}
# The most important option below is `--rm`. The machines will fill up with containers.
# The most important option below is `--rm`. Otherwise, the machines will fill up with undeleted containers.
# The mounting of /etc/passwd, /etc/shadow, and /etc/bashrc is required in order for the correct file permissions
# for newly created files.
# Passing HOME variable is necessary to avoid Python lib installation into /home/ubuntu/.local folder which
# may not be writable by the RUNNER_UID user.
options: |
-u ${{ env.RUNNER_UID }}:${{ env.RUNNER_GID }}
--rm
-v ${{ github.workspace }}:/github_workspace:ro
-v /etc/passwd:/etc/passwd:ro
-v /etc/shadow:/etc/shadow:ro
-v /etc/bashrc:/etc/bashrc:ro
-v ${{ github.workspace }}:${{ github.workspace }}
--net=host
${{ inputs.docker_opts }}
-e LOGURU_LEVEL=${{ env.LOGURU_LEVEL }}
-e PYTHONPATH=/usr/app
-e PYTHONPATH=${{ github.workspace }}
-e HOME=${{ github.workspace }}
${{ inputs.device }}
-w ${{ github.workspace }}
run: |
cp -r /github_workspace/* /usr/app/
cd /usr/app/
if [ ${{ inputs.install_wheel }} ]; then
WHEEL_FILENAME=$(ls -1 *.whl)
pip3 install $WHEEL_FILENAME
fi
${{ inputs.run_args }}
7 changes: 1 addition & 6 deletions .github/workflows/fast-dispatch-build-and-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ jobs:
name: ${{ matrix.test-group.name }} ${{ inputs.arch }} ${{ inputs.runner-label }}
env:
LOGURU_LEVEL: INFO
# may not need this
LD_LIBRARY_PATH: ${{ github.workspace }}/build/lib
runs-on:
- ${{ inputs.runner-label }}
- cloud-virtual-machine
Expand All @@ -72,12 +70,9 @@ jobs:
timeout-minutes: ${{ inputs.timeout }}
uses: ./.github/actions/docker-run
with:
docker_username: ${{ github.actor }}
install_wheel: true
docker_password: ${{ secrets.GITHUB_TOKEN }}
docker_image_arch: ${{ inputs.arch }}
run_args: |
WHEEL_FILENAME=$(ls -1 *.whl)
pip3 install --user $WHEEL_FILENAME
${{ matrix.test-group.cmd }}
- uses: ./.github/actions/slack-report
if: ${{ failure() }}
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/models-post-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ jobs:
name: ${{ matrix.test-group.name }} ${{ inputs.arch }} ${{ inputs.runner-label }}
env:
LOGURU_LEVEL: INFO
# may not need this
LD_LIBRARY_PATH: ${{ github.workspace }}/build/lib
runs-on:
- ${{ inputs.runner-label }}
- in-service
Expand All @@ -64,12 +62,9 @@ jobs:
timeout-minutes: ${{ inputs.timeout }}
uses: ./.github/actions/docker-run
with:
docker_username: ${{ github.actor }}
install_wheel: true
docker_password: ${{ secrets.GITHUB_TOKEN }}
docker_image_arch: ${{ inputs.arch }}
run_args: |
WHEEL_FILENAME=$(ls -1 *.whl)
pip3 install --user $WHEEL_FILENAME
source tests/scripts/run_python_model_tests.sh && run_python_model_tests_${{ inputs.arch }}
- uses: ./.github/actions/slack-report
if: ${{ failure() }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ttnn-post-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ jobs:
name: ${{ matrix.test-group.name }} ${{ inputs.arch }} ${{ inputs.runner-label }}
env:
LOGURU_LEVEL: INFO
# may not need this
LD_LIBRARY_PATH: ${{ github.workspace }}/build/lib
runs-on:
- ${{ inputs.runner-label }}
- "in-service"
Expand Down

0 comments on commit cef5730

Please sign in to comment.