Skip to content

Commit

Permalink
Split official release workflow for binaries and docker (#2701)
Browse files Browse the repository at this point in the history
* Split official release workflow

* Split official release workflow

* Split official release workflow

* Split official release workflow

* Split official release workflow

* Split official release workflow

* Split official release workflow

* Split official release workflow

* Tested docker workflow

* review comments
  • Loading branch information
agunapal committed Oct 11, 2023
1 parent 447f3ef commit 9eb16cd
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 19 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/official_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,3 @@ jobs:
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: python binaries/upload.py --upload-pypi-packages
- name: Login to Docker
env:
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: docker login --username pytorchbot --password "$DOCKER_PASSWORD"
- name: Build & Upload pytorch/torchserve Docker images
run: |
cd docker
python build_upload_release.py
cd ..
- name: Build & Upload pytorch/torchserve-kfs Docker images
run: |
cd kubernetes/kserve
python build_upload_release.py
cd ..
46 changes: 46 additions & 0 deletions .github/workflows/official_release_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Make an official Release of Docker Images

on:
workflow_dispatch:
inputs:
upload_docker:
description: 'Upload TorchServe Docker Images?'
required: true
default: 'no'
upload_kfs:
description: 'Upload TorchServe-kfs Docker Images?'
required: true
default: 'no'

jobs:
official-release-docker:
runs-on: [self-hosted, ci-gpu]
steps:
- name: Clean up previous run
run: |
echo "Cleaning up previous run"
ls -la ./
sudo rm -rf ./* || true
sudo rm -rf ./.??* || true
ls -la ./
- name: Setup Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
architecture: x64
- name: Checkout TorchServe
uses: actions/checkout@v3
- name: Login to Docker
env:
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: docker login --username pytorchbot --password "$DOCKER_PASSWORD"
- name: Build & Upload pytorch/torchserve Docker images
if: github.event.inputs.upload_docker == 'yes'
run: |
cd docker
python build_upload_release.py --cleanup
- name: Build & Upload pytorch/torchserve-kfs Docker images
if: github.event.inputs.upload_kfs == 'yes'
run: |
cd kubernetes/kserve
python build_upload_release.py --cleanup
11 changes: 10 additions & 1 deletion docker/build_upload_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
action="store_true",
help="dry_run will print the commands that will be run without running them",
)
parser.add_argument(
"--cleanup",
action="store_true",
help="Delete all built docker images",
)
args = parser.parse_args()
dry_run = args.dry_run
organization = args.organization
Expand Down Expand Up @@ -51,4 +56,8 @@
f"{organization}/torchserve:{check_ts_version()}-cpu",
f"{organization}/torchserve:{check_ts_version()}-gpu",
]:
try_and_handle(f"docker push {image}")
os.system(f"docker push {image}")

# Cleanup built images
if args.cleanup:
try_and_handle(f"docker system prune --all --volumes -f", dry_run)
2 changes: 1 addition & 1 deletion docker/docker_nightly.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@

# Cleanup built images
if args.cleanup:
try_and_handle(f"docker system prune --all --volumes", dry_run)
try_and_handle(f"docker system prune --all --volumes -f", dry_run)
13 changes: 11 additions & 2 deletions kubernetes/kserve/build_upload_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from argparse import ArgumentParser

# To help discover local modules
REPO_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
REPO_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..")
sys.path.append(REPO_ROOT)

from ts_scripts.utils import check_ts_version, try_and_handle
Expand All @@ -21,6 +21,11 @@
action="store_true",
help="dry_run will print the commands that will be run without running them",
)
parser.add_argument(
"--cleanup",
action="store_true",
help="Delete all built docker images",
)
args = parser.parse_args()
dry_run = args.dry_run
organization = args.organization
Expand All @@ -38,4 +43,8 @@
f"{organization}/torchserve-kfs:{check_ts_version()}",
f"{organization}/torchserve-kfs:{check_ts_version()}-gpu",
]:
try_and_handle(f"docker push {image}", dry_run)
os.system(f"docker push {image}")

# Cleanup built images
if args.cleanup:
try_and_handle(f"docker system prune --all --volumes -f", dry_run)
2 changes: 1 addition & 1 deletion kubernetes/kserve/docker_nightly.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@

# Cleanup built images
if args.cleanup:
try_and_handle(f"docker system prune --all --volumes", dry_run)
try_and_handle(f"docker system prune --all --volumes -f", dry_run)

0 comments on commit 9eb16cd

Please sign in to comment.