Skip to content

Commit

Permalink
improve cd workflows and add release document (#347)
Browse files Browse the repository at this point in the history
* add release document

Signed-off-by: Yingchun Guo <[email protected]>

* improve cd workflows, add cd document

Signed-off-by: Yingchun Guo <[email protected]>

---------

Signed-off-by: Yingchun Guo <[email protected]>
  • Loading branch information
daisy-ycguo authored Aug 23, 2024
1 parent 9480afc commit a4398b0
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 98 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/_gmc-image-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,24 @@ jobs:
image_repo: ${{ steps.set_variables.outputs.IMAGE_REPO }}
version: ${{ steps.set_variables.outputs.VERSION }}
steps:
- name: Clean Up Working Directory
run: sudo rm -rf ${{github.workspace}}/*

- name: Get checkout ref
id: get-checkout-ref
run: |
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
CHECKOUT_REF=refs/pull/${{ github.event.number }}/merge
else
CHECKOUT_REF=${{ github.ref }}
fi
echo "CHECKOUT_REF=${CHECKOUT_REF}" >> $GITHUB_OUTPUT
echo "checkout ref ${CHECKOUT_REF}"
- name: Checkout out Repo
uses: actions/checkout@v4
with:
ref: ${{ steps.get-checkout-ref.outputs.CHECKOUT_REF }}
fetch-depth: 0

- name: Set variables
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/_helm-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ on:
default: "latest"
required: false
type: string
opea_branch:
default: "main"
required: false
type: string
hardware:
default: "xeon"
required: true
Expand Down Expand Up @@ -100,7 +96,6 @@ jobs:
run: |
set -xe
echo "should_cleanup=true" >> $GITHUB_ENV
helm-charts/update_dependency.sh && helm dependency update ${{ env.CHART_FOLDER }}
value_file="values.yaml"
if [ "${{ inputs.hardware }}" == "gaudi" ]; then
value_file="gaudi-values.yaml"
Expand All @@ -111,6 +106,7 @@ jobs:
echo "should_cleanup=false" >> $GITHUB_ENV
exit 0
fi
helm-charts/update_dependency.sh && helm dependency update ${{ env.CHART_FOLDER }}
if ! helm install --create-namespace --namespace $NAMESPACE --wait \
--timeout "$ROLLOUT_TIMEOUT_SECONDS" \
--set autodependency.enabled=true \
Expand Down
66 changes: 1 addition & 65 deletions .github/workflows/_infra-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,11 @@ on:
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
Expand All @@ -41,40 +30,6 @@ jobs:
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
####################################################################################################
Expand All @@ -86,22 +41,3 @@ jobs:
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 }}
22 changes: 2 additions & 20 deletions .github/workflows/manual-gmc-cd-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,14 @@ on:
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'
description: 'Whether to build test required images for GMC'
required: false
type: boolean
test_gmc:
default: true
description: 'Test GMC on Xeon KIND'
description: 'Whether to test GMC in KIND on Xeon'
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:
Expand All @@ -43,8 +28,5 @@ jobs:
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
11 changes: 3 additions & 8 deletions .github/workflows/manual-helm-cd-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@ on:
description: "workloads to test, empty for testing all helm charts"
tag:
default: "latest"
description: "Tag to apply to images"
description: "Image tag to be tested"
required: true
type: string
infra_branch:
default: latest
description: 'Build test required images for Examples'
required: false
type: string
nodes:
default: "xeon,gaudi"
required: true
type: string
description: 'Hardwares used to run tests'

env:
CHARTS_DIR: "helm-charts"
Expand Down Expand Up @@ -58,7 +54,7 @@ jobs:
nodes=$(printf '%s\n' "${node_list[@]}" | sort -u | jq -R '.' | jq -sc '.')
echo "nodes=$nodes" >> $GITHUB_OUTPUT
gmc-release:
helm-release:
needs: get-build-matrix
strategy:
matrix:
Expand All @@ -69,5 +65,4 @@ jobs:
tag: ${{ inputs.tag }}
workload: ${{ matrix.workload }}
hardware: ${{ matrix.node }}
opea_branch: ${{ inputs.infra_branch }}
secrets: inherit
72 changes: 72 additions & 0 deletions RELEASE_BRANCHES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Release Branches

Release branches have a name of `v#.#` like `v0.9`. The branch with `v#.#rc` is the release candidate branch. This document describe how a release branch is created and how a release is made. All these steps have to be executed by release manager who has write permission.

## 1. Create release candidate branch

On the feature freeze day, a release candidate branch will be created.

```
git clone https://github.com/opea-project/GenAIInfra.git
cd GenAIInfra
git checkout -b v0.9rc
git push origin v0.9rc
```

## 2. Create images with release tag

This step is being executed under `GenAIExamples`.

In the [Actions](https://github.com/opea-project/GenAIExamples/actions), select the workflow "Examples CD workflow on manual event", and manually trigger this workflow. (Refer to [github website](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow) to get how to manually run a workflow.)

There will be a window promoted for your input. The inputs to the workflow are:
| Description | Value |
|-----------------------------|------------|
|Use workflow from|Branch: v0.9rc|
|Hardware to run test|"gaudi,xeon"|
|List of examples to test|"AudioQnA,ChatQnA,CodeGen,CodeTrans,DocSum,FaqGen,SearchQnA,Translation"|
|Tag to apply to images|"v0.9rc"|
|Whether to deploy gmc|false|
|Build test required images for Examples|true|
|Scan all images with Trivy|false|
|Test examples with docker compose|false|
|Test examples with k8s|false|
|Test examples with gmc|false|
|OPEA branch for image build|"v0.9rc"|

After this workflow executed, the images for GenAIExamples and GenAIComps with `v0.9` tag will be created and pushed to CI local image registries both in Gaudi and Xeon environment.

## 3. Test helm charts

This step is being executed under `GenAIInfra`.

In the [Actions](https://github.com/opea-project/GenAIInfra/actions), select the workflow "GenAIInfra Helm CD workflow on manual event", and manually trigger this workflow. There will be a window promoted for your input.

The inputs to the workflow are:
| Description | Value |
|-----------------------------|------------|
|Use workflow from|Branch: v0.9rc|
|workloads to test, empty for testing all helm charts|""|
|Image tag to be tested|"v0.9"|
|Hardwares used to run tests|"xeon,gaudi"|

All the helm charts will be tested. Green ticks show helm charts pass the tests.

## 4. Test GMC

This step is being executed under `GenAIInfra`. The test will be executed in GMC CI K8s cluster, which is a KIND cluster for now.

In the [Actions](https://github.com/opea-project/GenAIInfra/actions), select the workflow "GenAIInfra GMC CD workflow on manual event", and manually trigger this workflow. There will be a window promoted for your input.

The inputs to the workflow are:
| Description | Value |
|-----------------------------|------------|
|Use workflow from|Branch: v0.9rc|
|Tag to apply to images|"v0.9"|
|Whether to build test required images for GMC|true|

GMC images will be built with v0.9rc branch. GMC test cases will be tested in KIND cluster on Xeon. Green ticks show helm charts pass the tests.

## 5. Publish images

The image pass action will be executed under `GenAIExamples` repo. After all previous tests pass and GenAIExamples release tests also pass, the images will be pushed through GenAIExample workflow [Examples publish docker image on manual event](https://github.com/opea-project/GenAIExamples/actions/workflows/manual-docker-publish.yml).

0 comments on commit a4398b0

Please sign in to comment.