From bb53f5e3f228ebcd101698704094ffbcf438f3ab Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Thu, 22 Feb 2024 15:41:25 +1100 Subject: [PATCH 01/13] Copy helm chart build and deploy job from ghcr_helm_deploy to ghcr_deploy. --- .github/workflows/ghcr_deploy.yml | 50 ++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index 50bd711a7..10428fb95 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -10,6 +10,7 @@ on: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + CHART_NAME: litellm # There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. jobs: @@ -111,7 +112,54 @@ jobs: file: Dockerfile.database push: true tags: ${{ steps.meta-database.outputs.tags }}-${{ github.event.inputs.tag || 'latest' }}, ${{ steps.meta-database.outputs.tags }}-latest - labels: ${{ steps.meta-database.outputs.labels }} + labels: ${{ steps.meta-database.outputs.labels }} + build-and-push-helm-chart: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: lowercase github.repository_owner + run: | + echo "REPO_OWNER=`echo ${{github.repository_owner}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV} + + - name: Get LiteLLM Latest Tag + id: current_app_tag + uses: WyriHaximus/github-action-get-previous-tag@v1.3.0 + + - name: Get last published chart version + id: current_version + shell: bash + run: helm show chart oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/litellm-helm | grep '^version:' | awk 'BEGIN{FS=":"}{print "current-version="$2}' | tr -d " " | tee -a $GITHUB_OUTPUT + env: + HELM_EXPERIMENTAL_OCI: '1' + + # Automatically update the helm chart version one "patch" level + - name: Bump release version + id: bump_version + uses: christian-draeger/increment-semantic-version@1.1.0 + with: + current-version: ${{ steps.current_version.outputs.current-version || '0.1.0' }} + version-fragment: 'bug' + + - uses: ./.github/actions/helm-oci-chart-releaser + with: + name: ${{ env.CHART_NAME }} + repository: ${{ env.REPO_OWNER }} + tag: ${{ github.event.inputs.chartVersion || steps.bump_version.outputs.next-version || '0.1.0' }} + app_version: ${{ steps.current_app_tag.outputs.tag || 'latest' }} + path: deploy/charts/${{ env.CHART_NAME }} + registry: ${{ env.REGISTRY }} + registry_username: ${{ github.actor }} + registry_password: ${{ secrets.GITHUB_TOKEN }} + update_dependencies: true release: name: "New LiteLLM Release" needs: [docker-hub-deploy, build-and-push-image, build-and-push-image-database] From 3be4837e7477ad2f8ddc6d0eeee573cf6c100bbf Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Thu, 22 Feb 2024 15:44:08 +1100 Subject: [PATCH 02/13] One more reference to the old chart name. --- .github/workflows/ghcr_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index 10428fb95..f59c8eb47 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -137,7 +137,7 @@ jobs: - name: Get last published chart version id: current_version shell: bash - run: helm show chart oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/litellm-helm | grep '^version:' | awk 'BEGIN{FS=":"}{print "current-version="$2}' | tr -d " " | tee -a $GITHUB_OUTPUT + run: helm show chart oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.CHART_NAME }} | grep '^version:' | awk 'BEGIN{FS=":"}{print "current-version="$2}' | tr -d " " | tee -a $GITHUB_OUTPUT env: HELM_EXPERIMENTAL_OCI: '1' From 8afa583dfe3b1e9932ffacb9635ed6540abe0697 Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Thu, 22 Feb 2024 16:12:04 +1100 Subject: [PATCH 03/13] Remove --run_gunicorn from proxy command line arguments --- deploy/charts/litellm/templates/deployment.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/deploy/charts/litellm/templates/deployment.yaml b/deploy/charts/litellm/templates/deployment.yaml index 6ed112dac..e1f722a92 100644 --- a/deploy/charts/litellm/templates/deployment.yaml +++ b/deploy/charts/litellm/templates/deployment.yaml @@ -150,7 +150,6 @@ spec: args: - --config - /etc/litellm/config.yaml - - --run_gunicorn ports: - name: http containerPort: {{ .Values.service.port }} From 157a675fade31c9931e68ecc6ad9f7cfbe7c04aa Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Fri, 23 Feb 2024 10:52:25 +1100 Subject: [PATCH 04/13] Test: Can we have an OCI image and Helm chart with the same name but different tags? --- .github/workflows/ghcr_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index f59c8eb47..3ecc82579 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -153,7 +153,7 @@ jobs: with: name: ${{ env.CHART_NAME }} repository: ${{ env.REPO_OWNER }} - tag: ${{ github.event.inputs.chartVersion || steps.bump_version.outputs.next-version || '0.1.0' }} + tag: helm-${{ github.event.inputs.chartVersion || steps.bump_version.outputs.next-version || '0.1.0' }} app_version: ${{ steps.current_app_tag.outputs.tag || 'latest' }} path: deploy/charts/${{ env.CHART_NAME }} registry: ${{ env.REGISTRY }} From e6ae14f003ce1620dcca64a8f8aa850cd522f2e5 Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Fri, 23 Feb 2024 10:56:28 +1100 Subject: [PATCH 05/13] Don't fail if there is no existing helm chart to get the version from --- .github/workflows/ghcr_deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index 3ecc82579..3b21d2380 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -15,6 +15,7 @@ env: # There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. jobs: docker-hub-deploy: + if: github.repository == 'BerriAI/litellm' runs-on: ubuntu-latest steps: - @@ -137,7 +138,7 @@ jobs: - name: Get last published chart version id: current_version shell: bash - run: helm show chart oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.CHART_NAME }} | grep '^version:' | awk 'BEGIN{FS=":"}{print "current-version="$2}' | tr -d " " | tee -a $GITHUB_OUTPUT + run: helm show chart oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.CHART_NAME }} || true | grep '^version:' | awk 'BEGIN{FS=":"}{print "current-version="$2}' | tr -d " " | tee -a $GITHUB_OUTPUT env: HELM_EXPERIMENTAL_OCI: '1' From e34f3203b62026dc7483b6c4298fcc24273d0bde Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Fri, 23 Feb 2024 11:01:28 +1100 Subject: [PATCH 06/13] No existing chart causes failure --- .github/workflows/ghcr_deploy.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index 3b21d2380..652e4529f 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -138,7 +138,11 @@ jobs: - name: Get last published chart version id: current_version shell: bash - run: helm show chart oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.CHART_NAME }} || true | grep '^version:' | awk 'BEGIN{FS=":"}{print "current-version="$2}' | tr -d " " | tee -a $GITHUB_OUTPUT + run: | + CHART_LIST=$(helm show chart oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.CHART_NAME }} 2>/dev/null || true) + if [ ! -z "${CHART_LIST}" ]; then + printf '%s' "${CHART_LIST}" | grep '^version:' | awk 'BEGIN{FS=":"}{print "current-version="$2}' | tr -d " " | tee -a $GITHUB_OUTPUT + fi env: HELM_EXPERIMENTAL_OCI: '1' From bc5f178e5ea8b5096f3d831dbcac19b4eb1136d2 Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Fri, 23 Feb 2024 12:37:22 +1100 Subject: [PATCH 07/13] Can't use tags, only semvers. --- .github/workflows/ghcr_deploy.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index 652e4529f..5f6cacce4 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -140,7 +140,9 @@ jobs: shell: bash run: | CHART_LIST=$(helm show chart oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/${{ env.CHART_NAME }} 2>/dev/null || true) - if [ ! -z "${CHART_LIST}" ]; then + if [ -z "${CHART_LIST}" ]; then + echo "current-version=0.1.0" | tee -a $GITHUB_OUTPUT + else printf '%s' "${CHART_LIST}" | grep '^version:' | awk 'BEGIN{FS=":"}{print "current-version="$2}' | tr -d " " | tee -a $GITHUB_OUTPUT fi env: @@ -158,7 +160,7 @@ jobs: with: name: ${{ env.CHART_NAME }} repository: ${{ env.REPO_OWNER }} - tag: helm-${{ github.event.inputs.chartVersion || steps.bump_version.outputs.next-version || '0.1.0' }} + tag: ${{ github.event.inputs.chartVersion || steps.bump_version.outputs.next-version || '0.1.0' }} app_version: ${{ steps.current_app_tag.outputs.tag || 'latest' }} path: deploy/charts/${{ env.CHART_NAME }} registry: ${{ env.REGISTRY }} From 5665234b86908b420c88f20b45c19c679aa4bcce Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 16 Mar 2024 10:40:49 -0700 Subject: [PATCH 08/13] (fix) rename chart --- deploy/charts/litellm/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/charts/litellm/Chart.yaml b/deploy/charts/litellm/Chart.yaml index cc08a9921..628b76a3c 100644 --- a/deploy/charts/litellm/Chart.yaml +++ b/deploy/charts/litellm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 # We can't call ourselves just "litellm" because then we couldn't publish to the # same OCI repository as the "litellm" OCI image -name: litellm +name: litellm-helm description: Call all LLM APIs using the OpenAI format # A chart can be either an 'application' or a 'library' chart. From 4436cdc621d1ba81c4fcfa3e4ad83235a9cbc380 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 16 Mar 2024 10:41:44 -0700 Subject: [PATCH 09/13] (fix) ghcr_deploy.yaml --- .github/workflows/ghcr_deploy.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index fe7f096bf..b863fc3fa 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -10,7 +10,7 @@ on: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} - CHART_NAME: litellm + CHART_NAME: litellm-helm # There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. jobs: @@ -105,6 +105,11 @@ jobs: uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-database + # Configure multi platform Docker builds + - name: Set up QEMU + uses: docker/setup-qemu-action@e0e4588fad221d38ee467c0bffd91115366dc0c5 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@edfb0fe6204400c56fbfd3feba3fe9ad1adfa345 - name: Build and push Database Docker image uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 @@ -113,7 +118,8 @@ jobs: file: Dockerfile.database push: true tags: ${{ steps.meta-database.outputs.tags }}-${{ github.event.inputs.tag || 'latest' }}, ${{ steps.meta-database.outputs.tags }}-latest - labels: ${{ steps.meta-database.outputs.labels }} + labels: ${{ steps.meta-database.outputs.labels }} + platforms: local,linux/amd64,linux/arm64,linux/arm64/v8 build-and-push-helm-chart: runs-on: ubuntu-latest steps: @@ -126,11 +132,10 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + - name: lowercase github.repository_owner run: | echo "REPO_OWNER=`echo ${{github.repository_owner}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV} - - name: Get LiteLLM Latest Tag id: current_app_tag uses: WyriHaximus/github-action-get-previous-tag@v1.3.0 @@ -167,6 +172,7 @@ jobs: registry_username: ${{ github.actor }} registry_password: ${{ secrets.GITHUB_TOKEN }} update_dependencies: true + release: name: "New LiteLLM Release" needs: [docker-hub-deploy, build-and-push-image, build-and-push-image-database] @@ -226,13 +232,13 @@ jobs: RELEASE_NOTES: ${{ steps.release-notes.outputs.result }} run: | curl -H "Content-Type: application/json" -X POST -d '{ - "content": "||@everyone||", + "content": "New LiteLLM release ${{ env.RELEASE_TAG }}", "username": "Release Changelog", "avatar_url": "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png", "embeds": [ { - "title": "Changelog for ${RELEASE_TAG}", - "description": "${RELEASE_NOTES}", + "title": "Changelog for LiteLLM ${{ env.RELEASE_TAG }}", + "description": "${{ env.RELEASE_NOTES }}", "color": 2105893 } ] From c838b2853c0950f0ee61fcbf04ec4057e81a68bf Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Thu, 22 Feb 2024 15:41:25 +1100 Subject: [PATCH 10/13] Copy helm chart build and deploy job from ghcr_helm_deploy to ghcr_deploy. --- .github/workflows/ghcr_deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index b5826f78f..4ae0488d5 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -171,7 +171,6 @@ jobs: registry_username: ${{ github.actor }} registry_password: ${{ secrets.GITHUB_TOKEN }} update_dependencies: true - release: name: "New LiteLLM Release" needs: [docker-hub-deploy, build-and-push-image, build-and-push-image-database] From f52f1f40e60876be6e609aa1537ce31881e3c419 Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Thu, 22 Feb 2024 16:12:04 +1100 Subject: [PATCH 11/13] Remove --run_gunicorn from proxy command line arguments --- deploy/charts/litellm-helm/templates/deployment.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/deploy/charts/litellm-helm/templates/deployment.yaml b/deploy/charts/litellm-helm/templates/deployment.yaml index 736f35680..07e617581 100644 --- a/deploy/charts/litellm-helm/templates/deployment.yaml +++ b/deploy/charts/litellm-helm/templates/deployment.yaml @@ -161,7 +161,6 @@ spec: args: - --config - /etc/litellm/config.yaml - - --run_gunicorn ports: - name: http containerPort: {{ .Values.service.port }} From 5e4b0d1f5a1e547ac237ebe93dc3577ac7c23ab1 Mon Sep 17 00:00:00 2001 From: Shaun Maher Date: Fri, 23 Feb 2024 10:56:28 +1100 Subject: [PATCH 12/13] Don't fail if there is no existing helm chart to get the version from --- .github/workflows/ghcr_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index 4ae0488d5..ac58a4c7a 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -15,6 +15,7 @@ env: # There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. jobs: docker-hub-deploy: + if: github.repository == 'BerriAI/litellm' runs-on: ubuntu-latest steps: - From 73a95e0d254ede5f3c0732f06c04a0d6ac8c5465 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 16 Mar 2024 10:41:44 -0700 Subject: [PATCH 13/13] (fix) ghcr_deploy.yaml --- .github/workflows/ghcr_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index ac58a4c7a..82b919b20 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -172,6 +172,7 @@ jobs: registry_username: ${{ github.actor }} registry_password: ${{ secrets.GITHUB_TOKEN }} update_dependencies: true + release: name: "New LiteLLM Release" needs: [docker-hub-deploy, build-and-push-image, build-and-push-image-database]