Skip to content

GenAIInfra Helm CD workflow on manual event #4

GenAIInfra Helm CD workflow on manual event

GenAIInfra Helm CD workflow on manual event #4

# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: GenAIInfra Helm CD workflow on manual event
on:
workflow_dispatch:
inputs:
workloads:
default: ""
required: false
type: string
description: "workloads to test, empty for testing all helm charts"
tag:
default: "latest"
description: "Image tag to be tested"
required: true
type: string
opea_branch:
default: "main"
description: 'OPEA branch for image build'
required: false
type: string
env:
CHARTS_DIR: "helm-charts"
jobs:
get-build-matrix:
runs-on: ubuntu-latest
outputs:
run_matrix: ${{ steps.get-services.outputs.run_matrix }}
steps:
- name: Checkout out Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.opea_branch }}
- name: Get test Services
id: get-services
run: |
set -x
run_matrix="{\"include\":["
if [[ -z "${{ inputs.workloads }}" ]]; then
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
filename=$(basename "$file" .yaml)
if [[ "$filename" == *"gaudi"* ]]; then
run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"},"
else
run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\"},"
fi
fi
done
done
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
filename=$(basename "$file" .yaml)
if [[ "$filename" == *"gaudi"* ]]; then
run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\",\"directory\":\"common\"},"
else
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"/ci-*values.yaml; do
if [ -f "$file" ]; then
filename=$(basename "$file" .yaml)
if [[ "$filename" == *"gaudi"* ]]; then
run_matrix="${run_matrix}{\"example\":\"$service\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"},"
else
run_matrix="${run_matrix}{\"example\":\"$service\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\"},"
fi
fi
done
done
fi
run_matrix=$run_matrix"]}"
echo "run_matrix=${run_matrix}"
echo "run_matrix=${run_matrix}" >> $GITHUB_OUTPUT
helm-release:
needs: get-build-matrix
strategy:
matrix: ${{ fromJSON(needs.get-build-matrix.outputs.run_matrix) }}
uses: ./.github/workflows/_helm-e2e.yaml
with:
tag: ${{ inputs.tag }}
workload: ${{ matrix.example }}
hardware: ${{ matrix.hardware }}
valuefile: ${{ matrix.valuefile }}
secrets: inherit