Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github workflows to release helm chart #570

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/manual-freeze-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@ on:
workflow_dispatch:
inputs:
oldversion:
default: "0.9.0"
default: "1.1-dev"
description: "Old helm version to be replaced"
required: true
type: string
newversion:
default: "1.0.0"
default: "1.1.0"
description: "New helm version to replace"
required: true
type: string
imageversion:
default: "v1.0"
default: "1.1"
description: "New image version to replace"
required: true
type: string
branches-ignore:
- main

jobs:
freeze-tag:
Expand All @@ -43,9 +45,9 @@ jobs:
env:
NEWTAG: ${{ inputs.imageversion }}
run: |
find helm-charts/ -name '*values.yaml' -type f -exec sed -i "s#tag: \"latest\"#tag: \"${imageversion}\"#g" {} \;
find helm-charts/ -name '*values.yaml' -type f -exec sed -i "s#tag: \"latest\"#tag: \"${{ inputs.imageversion }}\"#g" {} \;
find helm-charts/ -name 'Chart.yaml' -type f -exec sed -i "s#version: ${{ inputs.oldversion }}#version: ${{ inputs.newversion }}#g" {} \;
find microservices-connector/helm/ -name '*values.yaml' -type f -exec sed -i "s#tag: \"latest\"#tag: \"${imageversion}\"#g" {} \;
find microservices-connector/helm/ -name '*values.yaml' -type f -exec sed -i "s#tag: \"latest\"#tag: \"${{ inputs.imageversion }}\"#g" {} \;
find microservices-connector/helm/ -name 'Chart.yaml' -type f -exec sed -i "s#version: ${{ inputs.oldversion }}#version: ${{ inputs.newversion }}#g" {} \;
sed -i "s|opea/gmcrouter:latest|opea/gmcrouter:$NEWTAG|g" microservices-connector/config/gmcrouter/gmc-router.yaml
sed -i "s|opea/gmcmanager:latest|opea/gmcmanager:$NEWTAG|g" microservices-connector/config/manager/gmc-manager.yaml
Expand All @@ -54,5 +56,5 @@ jobs:
- name: Commit changes
run: |
git add .
git commit -s -m "Freeze Helm charts versions"
git commit -s -m "Freeze Helm charts versions for release ${{ inputs.imageversion }}"
git push
33 changes: 15 additions & 18 deletions .github/workflows/manual-helm-cd-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,44 +42,41 @@ jobs:
set -x
run_matrix="{\"include\":["
if [[ -z "${{ inputs.workloads }}" ]]; then
find "$CHARTS_DIR" -mindepth 1 -maxdepth 1 -type d ! -name "common" -exec basename {} \; | while read -r subfolder; do
for file in "$CHARTS_DIR/$subfolder"/*values.yaml; do
for chart in ${CHARTS_DIR}/*; do
if [[ "$chart" == *"common" ]] || [[ -f $chart ]]; then
continue
fi
for file in "$chart"/ci-*values.yaml; do
if [ -f "$file" ]; then
if [[ "$file" == *"nv-values.yaml" ]] || [[ "$file" == *"hpa-values.yaml" ]]; then
continue
fi
filename=$(basename "$file" .yaml)
if [[ "$filename" == *"gaudi"* ]]; then
run_matrix="${run_matrix}{\"example\":\"${subfolder}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"},"
run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"},"
else
run_matrix="${run_matrix}{\"example\":\"${subfolder}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\"},"
run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\"},"
fi
fi
done
done
find "$CHARTS_DIR/common" -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | while read -r subfolder; do
for file in "$CHARTS_DIR/common/$subfolder"/*values.yaml; do
for chart in ${CHARTS_DIR}/common/*; do
if [[ -f $chart ]]; then
continue
fi
for file in "$chart"/ci-*values.yaml; do
if [ -f "$file" ]; then
if [[ "$file" == *"nv-values.yaml" ]] || [[ "$file" == *"hpa-values.yaml" ]]; then
continue
fi
filename=$(basename "$file" .yaml)
if [[ "$filename" == *"gaudi"* ]]; then
run_matrix="${run_matrix}{\"example\":\"common/${subfolder}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"},"
run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\",\"directory\":\"common\"},"
else
run_matrix="${run_matrix}{\"example\":\"common/${subfolder}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\"},"
run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\",\"directory\":\"common\"},"
fi
fi
done
done
else
service_list=($(echo ${{ github.event.inputs.workloads }} | tr ',' ' '))
for service in $service_list; do
for file in "$CHARTS_DIR/$service"/*values.yaml; do
for file in "$CHARTS_DIR/$service"/ci-*values.yaml; do
if [ -f "$file" ]; then
if [ "$file" == *"nv-values.yaml" ] || [ "$file" == *"hpa-values.yaml" ]; then
continue
fi
filename=$(basename "$file" .yaml)
if [[ "$filename" == *"gaudi"* ]]; then
run_matrix="${run_matrix}{\"example\":\"$service\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"},"
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/manual-release-charts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

name: Manual event to release helm chart to public site on release branch

on:
workflow_dispatch:
inputs:
version:
default: "1.1.0"
description: "Release Version"
required: true
type: string
# artifacthub:
# default: false
# description: "Release to ArtifactHub repo"
# required: true
# type: bool
ghcr:
default: true
description: "Release to ghcr"
required: true
type: bool

jobs:
release-charts:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}

- name: Prepare helm packages
env:
SRC_DIR: helm-charts
DEST_DIR: charts
run: |
if grep -r '^version: ' `find helm-charts/ -name "Chart.yaml"` | grep -v "${{ inputs.version }}"; then
echo "Version check failed"
exit 1
fi
mkdir -p ${DEST_DIR}
# git clone --branch charts-release https://github.com/opea-project/GenAIInfra.git charts
# update components
yongfengdu marked this conversation as resolved.
Show resolved Hide resolved
for chart in ${SRC_DIR}/common/*
do
echo "Packaging chart $chart..."
helm dependency update ${chart}
helm package $chart --destination ${DEST_DIR}
done
# update E2E Applications
for chart in ${SRC_DIR}/*
do
if [ -f $chart ]; then continue; fi
if [[ $chart =~ "common" ]]; then continue; fi
echo "Packaging chart $chart..."
helm dependency update ${chart}
helm package $chart --destination ${DEST_DIR}
done

- name: Publish helm charts
run: |
set -x
cd charts
# if [ "${{ inputs.artifacthub }}" = "true" ]; then
# echo "Push ${{ inputs.version }} charts to charts-release branch"
# helm repo index .
# # Insert copyright to avoid warnings
# sed -i '1s/^/# Copyright (C) 2024 Intel Corporation\n# SPDX-License-Identifier: Apache-2.0\n\n/' index.yaml

# git config --global user.name "NeuralChatBot"
# git config --global user.email "[email protected]"
# git remote set-url origin https://NeuralChatBot:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIInfra.git

mkbhanda marked this conversation as resolved.
Show resolved Hide resolved
# git status
# git add .
# git commit -s -m "Add release ${{ inputs.version }} helm charts"
# git push
# fi
if [ "${{ inputs.ghcr }}" = "true" ]; then
echo "Publish charts version ${{ inputs.version }}to ghcr"
echo "${{ secrets.ACTION_TOKEN }}" | helm registry login ghcr.io -u test --password-stdin
for chart in *-${{ inputs.version }}.tgz; do
echo "Publishing ${chart}\n"
helm push ${chart} oci://ghcr.io/opea-project/charts
done
fi