Skip to content

Commit a4398b0

Browse files
authored
improve cd workflows and add release document (#347)
* 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]>
1 parent 9480afc commit a4398b0

File tree

6 files changed

+94
-98
lines changed

6 files changed

+94
-98
lines changed

.github/workflows/_gmc-image-build.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,24 @@ jobs:
3333
image_repo: ${{ steps.set_variables.outputs.IMAGE_REPO }}
3434
version: ${{ steps.set_variables.outputs.VERSION }}
3535
steps:
36+
- name: Clean Up Working Directory
37+
run: sudo rm -rf ${{github.workspace}}/*
38+
39+
- name: Get checkout ref
40+
id: get-checkout-ref
41+
run: |
42+
if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then
43+
CHECKOUT_REF=refs/pull/${{ github.event.number }}/merge
44+
else
45+
CHECKOUT_REF=${{ github.ref }}
46+
fi
47+
echo "CHECKOUT_REF=${CHECKOUT_REF}" >> $GITHUB_OUTPUT
48+
echo "checkout ref ${CHECKOUT_REF}"
49+
3650
- name: Checkout out Repo
3751
uses: actions/checkout@v4
3852
with:
53+
ref: ${{ steps.get-checkout-ref.outputs.CHECKOUT_REF }}
3954
fetch-depth: 0
4055

4156
- name: Set variables

.github/workflows/_helm-e2e.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ on:
1515
default: "latest"
1616
required: false
1717
type: string
18-
opea_branch:
19-
default: "main"
20-
required: false
21-
type: string
2218
hardware:
2319
default: "xeon"
2420
required: true
@@ -100,7 +96,6 @@ jobs:
10096
run: |
10197
set -xe
10298
echo "should_cleanup=true" >> $GITHUB_ENV
103-
helm-charts/update_dependency.sh && helm dependency update ${{ env.CHART_FOLDER }}
10499
value_file="values.yaml"
105100
if [ "${{ inputs.hardware }}" == "gaudi" ]; then
106101
value_file="gaudi-values.yaml"
@@ -111,6 +106,7 @@ jobs:
111106
echo "should_cleanup=false" >> $GITHUB_ENV
112107
exit 0
113108
fi
109+
helm-charts/update_dependency.sh && helm dependency update ${{ env.CHART_FOLDER }}
114110
if ! helm install --create-namespace --namespace $NAMESPACE --wait \
115111
--timeout "$ROLLOUT_TIMEOUT_SECONDS" \
116112
--set autodependency.enabled=true \

.github/workflows/_infra-workflow.yaml

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,11 @@ on:
1414
default: true
1515
required: false
1616
type: boolean
17-
scan:
18-
default: true
19-
required: false
20-
type: boolean
2117
test_gmc:
2218
default: true
2319
required: false
2420
type: boolean
25-
publish:
26-
default: false
27-
required: false
28-
type: boolean
29-
publish_tags:
30-
default: "latest"
31-
required: false
32-
type: string
21+
3322
jobs:
3423
####################################################################################################
3524
# Image Build
@@ -41,40 +30,6 @@ jobs:
4130
image_tag: ${{ inputs.tag }}
4231
runner_label: 'docker-build-xeon'
4332

44-
####################################################################################################
45-
# Trivy Scan
46-
####################################################################################################
47-
scan-images:
48-
needs: [image-build]
49-
if: ${{ fromJSON(inputs.scan) }}
50-
strategy:
51-
matrix:
52-
image: ["gmcmanager", "gmcrouter"]
53-
runs-on: 'docker-build-xeon'
54-
steps:
55-
- name: Harden Runner
56-
uses: step-security/[email protected]
57-
with:
58-
egress-policy: audit
59-
60-
- name: Pull Image
61-
run: docker pull ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }}
62-
63-
- name: Scan Container
64-
uses: opea-project/validation/actions/trivy-scan@main
65-
with:
66-
image-ref: ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }}
67-
output: ${{ matrix.image }}-scan.txt
68-
69-
- name: Cleanup
70-
if: always()
71-
run: docker rmi -f ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }}
72-
- uses: actions/[email protected]
73-
with:
74-
name: gmc-scan
75-
path: ${{ matrix.image }}-scan.txt
76-
overwrite: true
77-
7833
####################################################################################################
7934
# GMC Test
8035
####################################################################################################
@@ -86,22 +41,3 @@ jobs:
8641
repo: ${{ needs.image-build.outputs.image_repo }}
8742
tag: ${{ needs.image-build.outputs.image_tag }}
8843
secrets: inherit
89-
90-
91-
####################################################################################################
92-
# Publish
93-
####################################################################################################
94-
publish:
95-
needs: [image-build, scan-images, test-gmc]
96-
if: ${{ fromJSON(inputs.publish) }}
97-
strategy:
98-
matrix:
99-
image: ["gmcmanager", "gmcrouter"]
100-
runs-on: "docker-build-xeon"
101-
steps:
102-
- name: Image Publish
103-
uses: opea-project/validation/actions/image-publish@main
104-
with:
105-
local_image_ref: ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }}
106-
image_name: opea/${{ matrix.image }}
107-
publish_tags: ${{ inputs.publish_tags }}

.github/workflows/manual-gmc-cd-workflow.yaml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,14 @@ on:
1212
type: string
1313
build:
1414
default: true
15-
description: 'Build test required images for Examples'
16-
required: false
17-
type: boolean
18-
scan:
19-
default: true
20-
description: 'Scan all images with Trivy'
15+
description: 'Whether to build test required images for GMC'
2116
required: false
2217
type: boolean
2318
test_gmc:
2419
default: true
25-
description: 'Test GMC on Xeon KIND'
20+
description: 'Whether to test GMC in KIND on Xeon'
2621
required: false
2722
type: boolean
28-
publish:
29-
default: false
30-
description: 'Publish images to docker hub'
31-
required: false
32-
type: boolean
33-
publish_tags:
34-
default: "latest,v0.9"
35-
description: 'Tag list apply to publish images'
36-
required: false
37-
type: string
3823

3924
permissions: read-all
4025
jobs:
@@ -43,8 +28,5 @@ jobs:
4328
with:
4429
tag: ${{ inputs.tag }}
4530
build: ${{ fromJSON(inputs.build) }}
46-
scan: ${{ fromJSON(inputs.scan) }}
4731
test_gmc: ${{ fromJSON(inputs.test_gmc) }}
48-
publish: ${{ fromJSON(inputs.publish) }}
49-
publish_tags: ${{ fromJSON(inputs.publish_tags) }}
5032
secrets: inherit

.github/workflows/manual-helm-cd-workflow.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@ on:
1212
description: "workloads to test, empty for testing all helm charts"
1313
tag:
1414
default: "latest"
15-
description: "Tag to apply to images"
15+
description: "Image tag to be tested"
1616
required: true
1717
type: string
18-
infra_branch:
19-
default: latest
20-
description: 'Build test required images for Examples'
21-
required: false
22-
type: string
2318
nodes:
2419
default: "xeon,gaudi"
2520
required: true
2621
type: string
22+
description: 'Hardwares used to run tests'
2723

2824
env:
2925
CHARTS_DIR: "helm-charts"
@@ -58,7 +54,7 @@ jobs:
5854
nodes=$(printf '%s\n' "${node_list[@]}" | sort -u | jq -R '.' | jq -sc '.')
5955
echo "nodes=$nodes" >> $GITHUB_OUTPUT
6056
61-
gmc-release:
57+
helm-release:
6258
needs: get-build-matrix
6359
strategy:
6460
matrix:
@@ -69,5 +65,4 @@ jobs:
6965
tag: ${{ inputs.tag }}
7066
workload: ${{ matrix.workload }}
7167
hardware: ${{ matrix.node }}
72-
opea_branch: ${{ inputs.infra_branch }}
7368
secrets: inherit

RELEASE_BRANCHES.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Release Branches
2+
3+
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.
4+
5+
## 1. Create release candidate branch
6+
7+
On the feature freeze day, a release candidate branch will be created.
8+
9+
```
10+
git clone https://github.com/opea-project/GenAIInfra.git
11+
cd GenAIInfra
12+
git checkout -b v0.9rc
13+
git push origin v0.9rc
14+
```
15+
16+
## 2. Create images with release tag
17+
18+
This step is being executed under `GenAIExamples`.
19+
20+
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.)
21+
22+
There will be a window promoted for your input. The inputs to the workflow are:
23+
| Description | Value |
24+
|-----------------------------|------------|
25+
|Use workflow from|Branch: v0.9rc|
26+
|Hardware to run test|"gaudi,xeon"|
27+
|List of examples to test|"AudioQnA,ChatQnA,CodeGen,CodeTrans,DocSum,FaqGen,SearchQnA,Translation"|
28+
|Tag to apply to images|"v0.9rc"|
29+
|Whether to deploy gmc|false|
30+
|Build test required images for Examples|true|
31+
|Scan all images with Trivy|false|
32+
|Test examples with docker compose|false|
33+
|Test examples with k8s|false|
34+
|Test examples with gmc|false|
35+
|OPEA branch for image build|"v0.9rc"|
36+
37+
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.
38+
39+
## 3. Test helm charts
40+
41+
This step is being executed under `GenAIInfra`.
42+
43+
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.
44+
45+
The inputs to the workflow are:
46+
| Description | Value |
47+
|-----------------------------|------------|
48+
|Use workflow from|Branch: v0.9rc|
49+
|workloads to test, empty for testing all helm charts|""|
50+
|Image tag to be tested|"v0.9"|
51+
|Hardwares used to run tests|"xeon,gaudi"|
52+
53+
All the helm charts will be tested. Green ticks show helm charts pass the tests.
54+
55+
## 4. Test GMC
56+
57+
This step is being executed under `GenAIInfra`. The test will be executed in GMC CI K8s cluster, which is a KIND cluster for now.
58+
59+
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.
60+
61+
The inputs to the workflow are:
62+
| Description | Value |
63+
|-----------------------------|------------|
64+
|Use workflow from|Branch: v0.9rc|
65+
|Tag to apply to images|"v0.9"|
66+
|Whether to build test required images for GMC|true|
67+
68+
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.
69+
70+
## 5. Publish images
71+
72+
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 commit comments

Comments
 (0)