@@ -6,6 +6,9 @@ permissions: read-all
6
6
on :
7
7
workflow_call :
8
8
inputs :
9
+ node :
10
+ required : true
11
+ type : string
9
12
example :
10
13
required : true
11
14
type : string
37
40
default : " latest"
38
41
required : false
39
42
type : string
43
+ GenAIComps_branch :
44
+ default : " main"
45
+ required : false
46
+ type : string
40
47
jobs :
41
48
# ###################################################################################################
42
49
# Image Build
43
50
# ###################################################################################################
44
51
build-images :
45
- if : ${{ fromJSON(inputs.build) }}
46
- strategy :
47
- matrix :
48
- node : ["docker-build-xeon", "docker-build-gaudi"]
49
- runs-on : ${{ matrix.node }}
52
+ runs-on : " docker-build-${{ inputs.node }}"
50
53
continue-on-error : true
51
54
steps :
52
55
- name : Clean Up Working Directory
53
- run : |
54
- sudo rm -rf ${{github.workspace}}/*
56
+ run : sudo rm -rf ${{github.workspace}}/*
55
57
56
58
- name : Checkout out Repo
57
59
uses : actions/checkout@v4
58
60
61
+ - name : Clone required Repo
62
+ run : |
63
+ cd ${{ github.workspace }}/${{ inputs.example }}/docker
64
+ build_compose_path=${{ github.workspace }}/${{ inputs.example }}/docker/docker_build_compose.yaml
65
+ if [[ $(grep -c "tei-gaudi:" ${docker_compose_path}) != 0 ]]; then
66
+ git clone https://github.com/huggingface/tei-gaudi.git
67
+ fi
68
+ if [[ $(grep -c "vllm:" ${docker_compose_path}) != 0 ]]; then
69
+ git clone https://github.com/huggingface/tei-gaudi.git
70
+ fi
71
+ git clone https://github.com/opea-project/GenAIComps.git
72
+ cd GenAIComps && checkout ${{ inputs.GenAIComps_branch }} && cd ../
73
+
59
74
- name : Build Image
75
+ if : ${{ fromJSON(inputs.build) }}
60
76
uses : opea-project/validation/actions/image-build@main
61
77
with :
62
- work_dir : ${{ github.workspace }}/${{ inputs.example }}
63
- docker_compose_path : ${{ github.workspace }}/.github/workflows/docker/compose/ ${{ inputs.example }}-compose .yaml
78
+ work_dir : ${{ github.workspace }}/${{ inputs.example }}/docker
79
+ docker_compose_path : ${{ github.workspace }}/${{ inputs.example }}/docker/docker_build_compose .yaml
64
80
registry : ${OPEA_IMAGE_REPO}opea
65
81
tag : ${{ inputs.tag }}
66
82
67
83
# ###################################################################################################
68
84
# Trivy Scan
69
85
# ###################################################################################################
70
86
image-list :
71
- needs : [ build-images ]
72
- if : ${{ fromJSON(inputs.scan) }}
87
+ needs : [build-images]
88
+ if : ${{ fromJSON(inputs.scan) && inputs.node == 'gaudi' }}
73
89
runs-on : ubuntu-latest
74
90
outputs :
75
91
matrix : ${{ steps.scan-matrix.outputs.matrix }}
76
92
steps :
77
- - name : Harden Runner
78
- uses : step-security/harden-runner@v2.8.1
79
- with :
80
- egress-policy : audit
81
-
82
93
- name : Checkout out Repo
83
94
uses : actions/checkout@v4
84
95
@@ -90,34 +101,32 @@ jobs:
90
101
echo "matrix=$(cat ${compose_path} | yq -r '.[]' | jq 'keys' | jq -c '.')" >> $GITHUB_OUTPUT
91
102
92
103
scan-images :
93
- needs : [image-list]
94
- if : ${{ fromJSON(inputs.scan) }}
95
- runs-on : " docker-build-gaudi "
104
+ needs : [image-list, build-images ]
105
+ if : ${{ fromJSON(inputs.scan) && inputs.node == 'gaudi' }}
106
+ runs-on : " docker-build-${{ inputs.node }} "
96
107
strategy :
97
108
matrix :
98
109
image : ${{ fromJSON(needs.image-list.outputs.matrix) }}
99
110
fail-fast : false
100
111
steps :
101
- - name : Harden Runner
102
- uses : step-security/harden-runner@v2.8.1
103
- with :
104
- egress-policy : audit
105
-
106
112
- name : Pull Image
107
- run : docker pull ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }}
113
+ run : |
114
+ docker pull ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }}
115
+ echo "OPEA_IMAGE_REPO=${OPEA_IMAGE_REPO}" >> $GITHUB_ENV
108
116
109
117
- name : Scan Container
110
118
uses : opea-project/validation/actions/trivy-scan@main
111
119
with :
112
- image-ref : ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }}
120
+ image-ref : ${{ env. OPEA_IMAGE_REPO } }opea/${{ matrix.image }}:${{ inputs.tag }}
113
121
output : ${{ inputs.example }}-${{ matrix.image }}-scan.txt
114
122
115
123
- name : Cleanup
116
124
if : always()
117
125
run : docker rmi -f ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }}
126
+
118
127
- uses : actions/upload-artifact@v4.3.4
119
128
with :
120
- name : ${{ inputs.example }}-scan
129
+ name : ${{ inputs.example }}-${{ matrix.image }}- scan
121
130
path : ${{ inputs.example }}-${{ matrix.image }}-scan.txt
122
131
overwrite : true
123
132
@@ -127,15 +136,11 @@ jobs:
127
136
test-example-compose :
128
137
needs : [build-images]
129
138
if : ${{ fromJSON(inputs.test_compose) }}
130
- strategy :
131
- matrix :
132
- hardware : ["xeon", "gaudi"]
133
- fail-fast : false
134
139
uses : ./.github/workflows/_run-docker-compose.yml
135
140
with :
136
141
tag : ${{ inputs.tag }}
137
142
example : ${{ inputs.example }}
138
- hardware : ${{ matrix.hardware }}
143
+ hardware : ${{ inputs.node }}
139
144
secrets : inherit
140
145
141
146
@@ -145,14 +150,10 @@ jobs:
145
150
test-k8s-manifest :
146
151
needs : [build-images]
147
152
if : ${{ fromJSON(inputs.test_k8s) }}
148
- strategy :
149
- matrix :
150
- hardware : ["xeon", "gaudi"]
151
- fail-fast : false
152
153
uses : ./.github/workflows/_manifest-e2e.yml
153
154
with :
154
155
example : ${{ inputs.example }}
155
- hardware : ${{ matrix.hardware }}
156
+ hardware : ${{ inputs.node }}
156
157
tag : ${{ inputs.tag }}
157
158
secrets : inherit
158
159
@@ -162,7 +163,7 @@ jobs:
162
163
# ###################################################################################################
163
164
publish :
164
165
needs : [image-list, build-images, scan-images, test-example-compose]
165
- if : ${{ fromJSON(inputs.publish) }}
166
+ if : ${{ fromJSON(inputs.publish) && inputs.node == 'gaudi' }}
166
167
strategy :
167
168
matrix :
168
169
image : ${{ fromJSON(needs.image-list.outputs.matrix) }}
0 commit comments