forked from opea-project/GenAIExamples
-
Notifications
You must be signed in to change notification settings - Fork 2
146 lines (130 loc) · 4.45 KB
/
_gmc-workflow.yml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Build and deploy GMC system on call and manual
on:
workflow_dispatch:
inputs:
tag:
default: "latest"
required: true
type: string
description: "Tag to apply to images"
node:
default: "xeon"
required: true
type: string
description: "Hardware to run test"
opea_branch:
default: "main"
required: false
type: string
description: 'OPEA branch for image build'
workflow_call:
inputs:
tag:
default: "latest"
required: true
type: string
description: "Tag to apply to images"
node:
default: "xeon"
required: true
type: string
description: "Hardware to run test"
opea_branch:
default: "main"
required: false
type: string
description: 'OPEA branch for image build'
jobs:
####################################################################################################
# Image Build and Scan
####################################################################################################
image-build:
runs-on: "docker-build-${{ inputs.node }}"
steps:
- name: Checkout GenAIInfra repository
uses: actions/checkout@v4
with:
repository: opea-project/GenAIInfra
ref: ${{ inputs.opea_branch }}
path: GenAIInfra
- name: Set variables
id: set_variables
run: |
echo "DOCKER_REGISTRY=${OPEA_IMAGE_REPO}opea" >> $GITHUB_ENV
echo "IMAGE_REPO=${OPEA_IMAGE_REPO}" >> $GITHUB_OUTPUT
echo "VERSION=${{ inputs.tag }}" >> $GITHUB_ENV
echo "VERSION=${{ inputs.tag }}" >> $GITHUB_OUTPUT
- name: Build image and push
run: |
cd ${{github.workspace}}/GenAIInfra/microservices-connector
make docker.build
make docker.push
- name: Scan gmcmanager
if: ${{ inputs.node == 'gaudi' }}
uses: opea-project/validation/actions/trivy-scan@main
with:
image-ref: ${{ env.DOCKER_REGISTRY }}/gmcmanager:${{ env.VERSION }}
output: gmcmanager-scan.txt
- name: Upload gmcmanager scan result
if: ${{ inputs.node == 'gaudi' }}
uses: actions/upload-artifact@v4.3.4
with:
name: gmcmanager-scan
path: gmcmanager-scan.txt
overwrite: true
- name: Scan gmcrouter
if: ${{ inputs.node == 'gaudi' }}
uses: opea-project/validation/actions/trivy-scan@main
with:
image-ref: ${{ env.DOCKER_REGISTRY }}/gmcrouter:${{ env.VERSION }}
output: gmcrouter-scan.txt
- name: Upload gmcrouter scan result
if: ${{ inputs.node == 'gaudi' }}
uses: actions/upload-artifact@v4.3.4
with:
name: gmcrouter-scan
path: gmcrouter-scan.txt
overwrite: true
- name: Clean up images
if: always()
run: |
docker rmi ${{ env.DOCKER_REGISTRY }}/gmcrouter:${{ env.VERSION }}
docker rmi ${{ env.DOCKER_REGISTRY }}/gmcmanager:${{ env.VERSION }}
- name: Clean up GenAIInfra source codes
if: always()
run: |
rm -rf ${{github.workspace}}/GenAIInfra
####################################################################################################
# GMC Install
####################################################################################################
gmc-install:
needs: image-build
runs-on: "k8s-${{ inputs.node }}"
steps:
- name: Checkout GenAIInfra repository
uses: actions/checkout@v4
with:
repository: opea-project/GenAIInfra
ref: ${{ inputs.opea_branch }}
path: GenAIInfra
- name: Set variables
run: |
echo "SYSTEM_NAMESPACE=opea-system" >> $GITHUB_ENV
echo "VERSION=${{ inputs.tag }}" >> $GITHUB_ENV
echo "SET_VERSION=true" >> $GITHUB_ENV # to change the tag of microservice images
- name: Cleanup existing GMC
run: |
cd GenAIInfra
.github/workflows/scripts/e2e/gmc_install.sh cleanup_gmc
cd ..
- name: Install GMC
run: |
cd GenAIInfra
.github/workflows/scripts/e2e/gmc_install.sh install_gmc
cd ..
- name: Clean up GenAIInfra source codes
if: always()
run: |
rm -rf ${{github.workspace}}/GenAIInfra