-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update GMC image build and test workflow (#303)
Signed-off-by: Yingchun Guo <[email protected]>
- Loading branch information
1 parent
df5f6f3
commit 3d94844
Showing
5 changed files
with
238 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: GMC E2e Test For Call | ||
on: | ||
workflow_call: | ||
inputs: | ||
tag: | ||
default: "latest" | ||
description: "Tag to apply to images, default is latest" | ||
required: false | ||
type: string | ||
repo: | ||
description: "Repo to apply to images, default is empty string" | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
go-e2e: | ||
runs-on: kind-xeon | ||
steps: | ||
- name: Checkout out Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set variables | ||
env: | ||
imagerepo: ${{ inputs.repo }} | ||
imagetag: ${{ inputs.tag }} | ||
run: | | ||
if [[ -z "$imagerepo" ]]; then | ||
echo "DOCKER_REGISTRY=${OPEA_IMAGE_REPO}" >> $GITHUB_ENV | ||
else | ||
echo "DOCKER_REGISTRY=${imagerepo}" >> $GITHUB_ENV | ||
fi | ||
echo "DOCKER_REGISTRY=$DOCKER_REGISTRY" >> $GITHUB_ENV | ||
echo "VERSION=$imagetag" >> $GITHUB_ENV | ||
echo "SYSTEM_NAMESPACE=opea-system" >> $GITHUB_ENV | ||
echo "APP_NAMESPACE=opea-app" >> $GITHUB_ENV | ||
echo "should_cleanup=false" >> $GITHUB_ENV | ||
echo "skip_validate=false" >> $GITHUB_ENV | ||
echo "KIND_MOUNT_DIR=/mnt/huggingface/hub" >> $GITHUB_ENV | ||
- name: Install GMC | ||
run: | | ||
echo "should_cleanup=true" >> $GITHUB_ENV | ||
.github/workflows/scripts/e2e/gmc_install.sh install_gmc | ||
exit_status=$$?$$ | ||
if [ $$exit_status -ne 0 ]; then | ||
echo "Failed to install modules" | ||
echo "skip_validate=true" >> $GITHUB_ENV | ||
fi | ||
- name: Run e2e tests | ||
run: | | ||
if $skip_validate; then | ||
echo "Skip validate" | ||
else | ||
.github/workflows/scripts/e2e/gmc_xeon_test.sh validate_gmc | ||
fi | ||
- name: Cleanup modules | ||
if: always() | ||
run: | | ||
if $should_cleanup; then | ||
.github/workflows/scripts/e2e/gmc_xeon_test.sh cleanup_apps | ||
.github/workflows/scripts/e2e/gmc_install.sh cleanup_gmc | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: GenAIInfra GMC Jobs | ||
permissions: read-all | ||
on: | ||
workflow_call: | ||
inputs: | ||
tag: | ||
default: "latest" | ||
required: false | ||
type: string | ||
build: | ||
default: true | ||
required: false | ||
type: boolean | ||
scan: | ||
default: true | ||
required: false | ||
type: boolean | ||
test_gmc: | ||
default: true | ||
required: false | ||
type: boolean | ||
publish: | ||
default: false | ||
required: false | ||
type: boolean | ||
publish_tags: | ||
default: "latest" | ||
required: false | ||
type: string | ||
jobs: | ||
#################################################################################################### | ||
# Image Build | ||
#################################################################################################### | ||
image-build: | ||
if: ${{ fromJSON(inputs.build) }} | ||
uses: ./.github/workflows/_gmc-image-build.yaml | ||
with: | ||
image_tag: ${{ inputs.tag }} | ||
runner_label: 'docker-build-xeon' | ||
|
||
#################################################################################################### | ||
# Trivy Scan | ||
#################################################################################################### | ||
scan-images: | ||
needs: [image-build] | ||
if: ${{ fromJSON(inputs.scan) }} | ||
strategy: | ||
matrix: | ||
image: ["gmcmanager", "gmcrouter"] | ||
runs-on: 'docker-build-xeon' | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/[email protected] | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Pull Image | ||
run: docker pull ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }} | ||
|
||
- name: Scan Container | ||
uses: opea-project/validation/actions/trivy-scan@main | ||
with: | ||
image-ref: ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }} | ||
output: ${{ matrix.image }}-scan.txt | ||
|
||
- name: Cleanup | ||
if: always() | ||
run: docker rmi -f ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }} | ||
- uses: actions/[email protected] | ||
with: | ||
name: gmc-scan | ||
path: ${{ matrix.image }}-scan.txt | ||
overwrite: true | ||
|
||
#################################################################################################### | ||
# GMC Test | ||
#################################################################################################### | ||
test-gmc: | ||
needs: [image-build] | ||
if: ${{ fromJSON(inputs.test_gmc) }} | ||
uses: ./.github/workflows/_gmc-e2e.yaml | ||
with: | ||
repo: ${{ needs.image-build.outputs.image_repo }} | ||
tag: ${{ needs.image-build.outputs.image_tag }} | ||
secrets: inherit | ||
|
||
|
||
#################################################################################################### | ||
# Publish | ||
#################################################################################################### | ||
publish: | ||
needs: [image-build, scan-images, test-gmc] | ||
if: ${{ fromJSON(inputs.publish) }} | ||
strategy: | ||
matrix: | ||
image: ["gmcmanager", "gmcrouter"] | ||
runs-on: "docker-build-xeon" | ||
steps: | ||
- name: Image Publish | ||
uses: opea-project/validation/actions/image-publish@main | ||
with: | ||
local_image_ref: ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }} | ||
image_name: opea/${{ matrix.image }} | ||
publish_tags: ${{ inputs.publish_tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: GenAIInfra GMC CD workflow on manual event | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
default: "latest" | ||
description: "Tag to apply to images" | ||
required: true | ||
type: string | ||
build: | ||
default: true | ||
description: 'Build test required images for Examples' | ||
required: false | ||
type: boolean | ||
scan: | ||
default: true | ||
description: 'Scan all images with Trivy' | ||
required: false | ||
type: boolean | ||
test_gmc: | ||
default: true | ||
description: 'Test GMC on Xeon KIND' | ||
required: false | ||
type: boolean | ||
publish: | ||
default: false | ||
description: 'Publish images to docker hub' | ||
required: false | ||
type: boolean | ||
publish_tags: | ||
default: "latest,v0.9" | ||
description: 'Tag list apply to publish images' | ||
required: false | ||
type: string | ||
|
||
permissions: read-all | ||
jobs: | ||
gmc-release: | ||
uses: ./.github/workflows/_infra-workflow.yaml | ||
with: | ||
tag: ${{ inputs.tag }} | ||
build: ${{ fromJSON(inputs.build) }} | ||
scan: ${{ fromJSON(inputs.scan) }} | ||
test_gmc: ${{ fromJSON(inputs.test_gmc) }} | ||
publish: ${{ fromJSON(inputs.publish) }} | ||
publish_tags: ${{ fromJSON(inputs.publish_tags) }} | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters