-
Notifications
You must be signed in to change notification settings - Fork 180
115 lines (101 loc) · 3.64 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
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Build and upgrade GMC system on call and manual
on:
workflow_dispatch:
inputs:
tag:
default: "latest"
required: false
type: string
workflow_call:
inputs:
tag:
default: "latest"
required: false
type: string
pull_request:
branches: [main]
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
paths:
- .github/workflows/_gmc-workflow.yml
jobs:
####################################################################################################
# Image Build and Scan
####################################################################################################
image-build:
strategy:
matrix:
platform: [docker-build-xeon]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout GenAIInfra repository
uses: actions/checkout@v4
with:
repository: opea-project/GenAIInfra
#ref: ${{ inputs.tag }}
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
echo "VERSION=latest" >> $GITHUB_ENV
echo "VERSION=latest" >> $GITHUB_OUTPUT
- name: Build image and push
run: |
cd ${{github.workspace}}/GenAIInfra/microservices-connector
make docker.build
make docker.push
- name: Scan gmcmanager
uses: opea-project/validation/actions/trivy-scan@main
with:
image-ref: ${{ env.DOCKER_REGISTRY }}/gmcmanager:${{ env.VERSION }}
output: gmcmanager-scan.txt
- uses: actions/upload-artifact@v4.3.4
with:
name: gmcmanager-scan
path: gmcmanager-scan.txt
overwrite: true
- name: Scan gmcrouter
uses: opea-project/validation/actions/trivy-scan@main
with:
image-ref: ${{ env.DOCKER_REGISTRY }}/gmcrouter:${{ env.VERSION }}
output: gmcrouter-scan.txt
- 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 }}
####################################################################################################
# GMC Install
####################################################################################################
gmc-install:
strategy:
matrix:
platform: [k8s-xeon]
needs: image-build
runs-on: ${{ matrix.platform }}
steps:
- name: Set variables
run: |
echo "SYSTEM_NAMESPACE=opea-system" >> $GITHUB_ENV
#echo "VERSION=${{ inputs.tag }}" >> $GITHUB_ENV
echo "VERSION=latest" >> $GITHUB_ENV
echo "SET_VERSION=true" >> $GITHUB_ENV
- name: Cleanup existing GMC
run: |
${{github.workspace}}/GenAIInfra/.github/workflows/scripts/e2e/gmc_install.sh cleanup_gmc
- name: Install GMC
run: |
${{github.workspace}}/GenAIInfra/.github/workflows/scripts/e2e/gmc_install.sh install_gmc
- name: Clean up GenAIInfra source codes
run: |
rm -rf ${{github.workspace}}/GenAIInfra