-
Notifications
You must be signed in to change notification settings - Fork 59
110 lines (105 loc) · 4.02 KB
/
manual-helm-cd-workflow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# 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"
dockerhub:
default: "false"
required: false
type: string
description: "Set to true if you want to use released docker images at dockerhub. By default using internal docker registry."
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 }}
dockerhub: ${{ inputs.dockerhub }}
workload: ${{ matrix.directory }}/${{ matrix.example }}
hardware: ${{ matrix.hardware }}
valuefile: ${{ matrix.valuefile }}
secrets: inherit