|
| 1 | +# Copyright (C) 2024 Intel Corporation |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: Build and upgrade GMC system on call and manual |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + default: "latest" |
| 11 | + required: false |
| 12 | + type: string |
| 13 | + workflow_call: |
| 14 | + inputs: |
| 15 | + tag: |
| 16 | + default: "latest" |
| 17 | + required: false |
| 18 | + type: string |
| 19 | + pull_request: |
| 20 | + branches: [main] |
| 21 | + types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped |
| 22 | + paths: |
| 23 | + - .github/workflows/_gmc-workflow.yml |
| 24 | + |
| 25 | +jobs: |
| 26 | +#################################################################################################### |
| 27 | +# Image Build and Scan |
| 28 | +#################################################################################################### |
| 29 | + image-build: |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + platform: [docker-build-xeon] |
| 33 | + runs-on: ${{ matrix.platform }} |
| 34 | + steps: |
| 35 | + - name: Checkout GenAIInfra repository |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + repository: opea-project/GenAIInfra |
| 39 | + #ref: ${{ inputs.tag }} |
| 40 | + path: GenAIInfra |
| 41 | + |
| 42 | + - name: Set variables |
| 43 | + id: set_variables |
| 44 | + run: | |
| 45 | + echo "DOCKER_REGISTRY=${OPEA_IMAGE_REPO}opea" >> $GITHUB_ENV |
| 46 | + echo "IMAGE_REPO=${OPEA_IMAGE_REPO}" >> $GITHUB_OUTPUT |
| 47 | + # echo "VERSION=${{ inputs.tag }}" >> $GITHUB_ENV |
| 48 | + # echo "VERSION=${{ inputs.tag }}" >> $GITHUB_OUTPUT |
| 49 | + echo "VERSION=latest" >> $GITHUB_ENV |
| 50 | + echo "VERSION=latest" >> $GITHUB_OUTPUT |
| 51 | +
|
| 52 | + - name: Build image and push |
| 53 | + run: | |
| 54 | + cd ${{github.workspace}}/GenAIInfra/microservices-connector |
| 55 | + make docker.build |
| 56 | + make docker.push |
| 57 | +
|
| 58 | + - name: Scan gmcmanager |
| 59 | + uses: opea-project/validation/actions/trivy-scan@main |
| 60 | + with: |
| 61 | + image-ref: ${{ env.DOCKER_REGISTRY }}/gmcmanager:${{ env.VERSION }} |
| 62 | + output: gmcmanager-scan.txt |
| 63 | + |
| 64 | + - uses: actions/upload-artifact@v4.3.4 |
| 65 | + with: |
| 66 | + name: gmcmanager-scan |
| 67 | + path: gmcmanager-scan.txt |
| 68 | + overwrite: true |
| 69 | + |
| 70 | + - name: Scan gmcrouter |
| 71 | + uses: opea-project/validation/actions/trivy-scan@main |
| 72 | + with: |
| 73 | + image-ref: ${{ env.DOCKER_REGISTRY }}/gmcrouter:${{ env.VERSION }} |
| 74 | + output: gmcrouter-scan.txt |
| 75 | + |
| 76 | + - uses: actions/upload-artifact@v4.3.4 |
| 77 | + with: |
| 78 | + name: gmcrouter-scan |
| 79 | + path: gmcrouter-scan.txt |
| 80 | + overwrite: true |
| 81 | + |
| 82 | + - name: Clean up images |
| 83 | + if: always() |
| 84 | + run: | |
| 85 | + docker rmi ${{ env.DOCKER_REGISTRY }}/gmcrouter:${{ env.VERSION }} |
| 86 | + docker rmi ${{ env.DOCKER_REGISTRY }}/gmcmanager:${{ env.VERSION }} |
| 87 | +
|
| 88 | + - name: Clean up GenAIInfra source codes |
| 89 | + run: | |
| 90 | + rm -rf ${{github.workspace}}/GenAIInfra |
| 91 | +
|
| 92 | +#################################################################################################### |
| 93 | +# GMC Install |
| 94 | +#################################################################################################### |
| 95 | + gmc-install: |
| 96 | + strategy: |
| 97 | + matrix: |
| 98 | + platform: [k8s-xeon] |
| 99 | + needs: image-build |
| 100 | + runs-on: ${{ matrix.platform }} |
| 101 | + steps: |
| 102 | + - name: Checkout GenAIInfra repository |
| 103 | + uses: actions/checkout@v4 |
| 104 | + with: |
| 105 | + repository: opea-project/GenAIInfra |
| 106 | + #ref: ${{ inputs.tag }} |
| 107 | + path: GenAIInfra |
| 108 | + |
| 109 | + - name: Set variables |
| 110 | + run: | |
| 111 | + echo "SYSTEM_NAMESPACE=opea-system" >> $GITHUB_ENV |
| 112 | + #echo "VERSION=${{ inputs.tag }}" >> $GITHUB_ENV |
| 113 | + echo "VERSION=latest" >> $GITHUB_ENV |
| 114 | + echo "SET_VERSION=true" >> $GITHUB_ENV |
| 115 | +
|
| 116 | + - name: Cleanup existing GMC |
| 117 | + run: | |
| 118 | + cd GenAIInfra |
| 119 | + .github/workflows/scripts/e2e/gmc_install.sh cleanup_gmc |
| 120 | + cd .. |
| 121 | +
|
| 122 | + - name: Install GMC |
| 123 | + run: | |
| 124 | + cd GenAIInfra |
| 125 | + .github/workflows/scripts/e2e/gmc_install.sh install_gmc |
| 126 | + cd .. |
| 127 | +
|
| 128 | + - name: Clean up GenAIInfra source codes |
| 129 | + run: | |
| 130 | + rm -rf ${{github.workspace}}/GenAIInfra |
0 commit comments