Skip to content

Commit

Permalink
Merge pull request #8239 from OpenMined/rasswanth/switch-cd-to-self-h…
Browse files Browse the repository at this point in the history
…osted

[WIP] Switch CD to Self hosted runners.
  • Loading branch information
rasswanth-s authored Nov 10, 2023
2 parents 48810d5 + d241a3e commit f660bb2
Show file tree
Hide file tree
Showing 17 changed files with 201 additions and 142 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.8.2-beta.52
current_version = 0.8.2-beta.53
tag = False
tag_name = {new_version}
commit = True
Expand Down
247 changes: 145 additions & 102 deletions .github/workflows/cd-syft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,153 @@ jobs:
uses: OpenMined/PySyft/.github/workflows/pr-tests-stack.yml@dev
secrets: inherit

deploy-syft:
build-and-push-docker-images:
needs: [call-pr-tests-linting, call-pr-tests-syft, call-pr-tests-stack]
if: always() && (needs.call-pr-tests-linting.result == 'success' && needs.call-pr-tests-syft.result == 'success' && needs.call-pr-tests-stack.result == 'success' || github.event.inputs.skip_tests == 'true')

strategy:
matrix:
runner: [sh-arc-linux-x64, sh-arc-linux-arm64]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3

# actions/setup-python doesn't yet support ARM
- name: Setup Python on x64
if: ${{ !endsWith(matrix.runner, '-arm64') }}
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install Metadata packages for arm64
if: ${{ endsWith(matrix.runner, '-arm64') }}
run: |
sudo apt update -y
sudo apt install software-properties-common -y
- name: Setup Python on arm64
if: ${{ endsWith(matrix.runner, '-arm64') }}
uses: deadsnakes/[email protected]
with:
python-version: "3.11"

- name: Check python version
run: |
python --version
python3 --version
which python
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade bump2version
- name: Bump the Version
id: bump-version
run: |
ls **/VERSION | xargs -I {} python {}
cat packages/grid/devspace.yaml | grep '0\.'
bump2version prenum --allow-dirty --no-commit
ls **/VERSION | xargs -I {} python {}
cat packages/grid/devspace.yaml | grep '0\.'
- name: Generate Release Metadata
id: release_metadata
run: |
if [[ $(python packages/grid/VERSION) == *"beta"* ]]; then
echo "release_tag=beta" >> $GITHUB_OUTPUT
else
echo "release_tag=latest" >> $GITHUB_OUTPUT
fi
if [[ ${{matrix.runner}} == *"x64"* ]]; then
echo "release_platform=linux/amd64" >> $GITHUB_OUTPUT
else
echo "release_platform=linux/arm64" >> $GITHUB_OUTPUT
fi
echo "GRID_VERSION=$(python packages/grid/VERSION)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta for Grid-Backend
id: meta_grid_backend
uses: docker/metadata-action@v5
with:
images: openmined/grid-backend
tags: |
type=raw,value=${{ steps.release_metadata.outputs.GRID_VERSION }}
type=raw,value=${{ steps.release_metadata.outputs.release_tag }}
- name: Build and push `grid-backend` image to DockerHub
uses: docker/build-push-action@v5
with:
context: ./packages
file: ./packages/grid/backend/backend.dockerfile
push: true
platforms: ${{ steps.release_metadata.outputs.release_platform }}
tags: ${{ steps.meta_grid_backend.outputs.tags }}
target: backend
cache-from: type=registry,ref=${{ steps.meta_grid_backend.outputs.tags }}
cache-to: type=inline

- name: Docker meta for Grid-Frontend
id: meta_grid_frontend
uses: docker/metadata-action@v5
with:
images: openmined/grid-frontend
tags: |
type=raw,value=${{ steps.release_metadata.outputs.GRID_VERSION }}
type=raw,value=${{ steps.release_metadata.outputs.release_tag }}
- name: Build and push `grid-frontend` image to DockerHub
uses: docker/build-push-action@v5
with:
context: ./packages/grid/frontend
file: ./packages/grid/frontend/frontend.dockerfile
push: true
platforms: ${{ steps.release_metadata.outputs.release_platform }}
tags: ${{ steps.meta_grid_frontend.outputs.tags }}
target: grid-ui-development
cache-from: type=registry,ref= ${{ steps.meta_grid_frontend.outputs.tags }}
cache-to: type=inline

- name: Docker meta for Grid-Enclave
id: meta_grid_enclave
uses: docker/metadata-action@v5
with:
images: openmined/grid-enclave
tags: |
type=raw,value=${{ steps.release_metadata.outputs.GRID_VERSION }}
type=raw,value=${{ steps.release_metadata.outputs.release_tag }}
- name: Build and push `grid-enclave` image to DockerHub
uses: docker/build-push-action@v5
with:
context: ./packages
file: ./packages/grid/worker/worker.dockerfile
push: true
platforms: ${{ steps.release_metadata.outputs.release_platform }}
tags: ${{ steps.meta_grid_enclave.outputs.tags }}
target: worker
cache-from: type=registry,ref=${{ steps.meta_grid_enclave.outputs.tags }}
cache-to: type=inline

deploy-syft:
needs:
[
call-pr-tests-linting,
call-pr-tests-syft,
call-pr-tests-stack,
build-and-push-docker-images,
]
if: always() && (needs.call-pr-tests-linting.result == 'success' && needs.call-pr-tests-syft.result == 'success' && needs.call-pr-tests-stack.result == 'success' || github.event.inputs.skip_tests == 'true') && needs.build-and-push-docker-images.result == 'success'
# runs-on: [self-hosted, Linux]
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -115,11 +259,9 @@ jobs:
run: |
if [[ $(python packages/grid/VERSION) == *"beta"* ]]; then
echo "is_pre_release=true" >> $GITHUB_OUTPUT
echo "release_tag=beta" >> $GITHUB_OUTPUT
echo "github_release_version=$(python packages/grid/VERSION | sed 's/-beta./b/')" >> $GITHUB_OUTPUT
else
echo "is_pre_release=false" >> $GITHUB_OUTPUT
echo "release_tag=latest" >> $GITHUB_OUTPUT
echo "github_release_version=$(python packages/grid/VERSION)" >> $GITHUB_OUTPUT
fi
Expand Down Expand Up @@ -215,105 +357,6 @@ jobs:
./packages/hagrid/hagrid/manifest_template.yml
tag_name: v${{ steps.release_checks.outputs.github_release_version }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta for Grid-Backend
id: meta_grid_backend
uses: docker/metadata-action@v5
with:
images: openmined/grid-backend
tags: |
type=raw,value=${{ steps.grid-version.outputs.GRID_VERSION }}
type=raw,value=${{ steps.release_checks.outputs.release_tag }}
- name: Build and push `grid-backend` image to DockerHub
uses: docker/build-push-action@v5
with:
context: ./packages
file: ./packages/grid/backend/backend.dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta_grid_backend.outputs.tags }}
target: backend
cache-from: type=registry,ref=${{ steps.meta_grid_backend.outputs.tags }}
cache-to: type=inline

- name: Docker meta for Grid-Frontend
id: meta_grid_frontend
uses: docker/metadata-action@v5
with:
images: openmined/grid-frontend
tags: |
type=raw,value=${{ steps.grid-version.outputs.GRID_VERSION }}
type=raw,value=${{ steps.release_checks.outputs.release_tag }}
- name: Build and push `grid-frontend` image to DockerHub
uses: docker/build-push-action@v5
with:
context: ./packages/grid/frontend
file: ./packages/grid/frontend/frontend.dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta_grid_frontend.outputs.tags }}
target: grid-ui-development
cache-from: type=registry,ref= ${{ steps.meta_grid_frontend.outputs.tags }}
cache-to: type=inline

# free 10GB of space
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker image prune --all --force
docker builder prune --all --force
docker system prune --all --force
- name: Docker meta for Grid-Enclave
id: meta_grid_enclave
uses: docker/metadata-action@v5
with:
images: openmined/grid-enclave
tags: |
type=raw,value=${{ steps.grid-version.outputs.GRID_VERSION }}
type=raw,value=${{ steps.release_checks.outputs.release_tag }}
- name: Build and push `grid-enclave` image to DockerHub
uses: docker/build-push-action@v5
with:
context: ./packages
file: ./packages/grid/worker/worker.dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta_grid_enclave.outputs.tags }}
target: worker
cache-from: type=registry,ref=${{ steps.meta_grid_enclave.outputs.tags }}
cache-to: type=inline

# free 10GB of space
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker image prune --all --force
docker builder prune --all --force
docker system prune --all --force
- name: Login to Docker-Helm
run: |
helm registry login registry-1.docker.io -u ${{ secrets.DOCKER_LOGIN }} --password ${{secrets.DOCKER_PASSWORD}}
cd packages/grid/helm/repo && helm push syft-${{ steps.grid-version.outputs.GRID_VERSION }}.tgz oci://registry-1.docker.io/openmined
# Checkout to gh-pages and update helm repo
- name: Checkout to gh-pages
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Mono Repo Global Version
__version__ = "0.8.2-beta.52"
__version__ = "0.8.2-beta.53"
# elsewhere we can call this file: `python VERSION` and simply take the stdout

# stdlib
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/VERSION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Mono Repo Global Version
__version__ = "0.8.2-beta.52"
__version__ = "0.8.2-beta.53"
# elsewhere we can call this file: `python VERSION` and simply take the stdout

# stdlib
Expand Down
4 changes: 2 additions & 2 deletions packages/grid/devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ pipelines:
run: |-
run_dependencies --all
ensure_pull_secrets --all
build_images --all -t $(git rev-parse --short=6 HEAD) -t 0.8.2-beta.52 -t dev-latest
build_images --all -t $(git rev-parse --short=6 HEAD) -t 0.8.2-beta.53 -t dev-latest
create_deployments --all
vars:
DEVSPACE_ENV_FILE: "default.env"
CONTAINER_REGISTRY: "docker.io"
VERSION: "0.8.2-beta.52"
VERSION: "0.8.2-beta.53"

# This is a list of `images` that DevSpace can build for this project
# We recommend to skip image building during development (devspace dev) as much as possible
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pygrid-ui",
"version": "0.8.2-beta.52",
"version": "0.8.2-beta.53",
"private": true,
"scripts": {
"dev": "pnpm i && vite dev --host --port 80",
Expand Down
Loading

0 comments on commit f660bb2

Please sign in to comment.