Skip to content

Commit

Permalink
test gmc workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Yingchun Guo <[email protected]>
  • Loading branch information
daisy-ycguo committed Aug 16, 2024
1 parent 6296e9f commit 9755453
Showing 1 changed file with 126 additions and 0 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/_gmc-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# 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/[email protected]
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/[email protected]
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
run: |
rm -rf ${{github.workspace}}/GenAIInfra
####################################################################################################
# GMC Install
####################################################################################################
gmc-install:
strategy:
matrix:
platform: [k8s-xeon]
needs: image-build
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
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

0 comments on commit 9755453

Please sign in to comment.