Skip to content
107 changes: 57 additions & 50 deletions .github/workflows/release-chart.yaml
Original file line number Diff line number Diff line change
@@ -1,64 +1,50 @@
# must enable github page in your project
# all charts under "charts/*", this workflow will create the tgz chart and merge to "/docs" of "chart" branch
# please make the "chart" branch as the github page
# please create the "chart" branch beforhand, or else the workflow will fail
# put all charts under /docs/charts/*.tgz, and /docs/index.yaml
# must set branch 'github-pages' as github page
# this workflow will create the tgz from "/charts/*" of branch main,
# and deploy to "/charts" of branch "github_pages"
# and on branch "github_pages", update '/index.yaml' for '/charts/*.tgz'

name: Release Charts

env:
HELM_VERSION: v3.8.1
PR_LABEL: pr/release/robot_chart
PR_REVIWER: weizhoublue
MERGE_BRANCH: webserver
MERGE_BRANCH: github_pages

on:
workflow_dispatch:
inputs:
base:
description: 'Base: tag or sha'
description: 'tag, sha, branch'
required: true
default: v1.0.0

jobs:
generate_chart:
# packages tgz from /charts of original branch, deploy to /charts of target branch
package_chart:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- chart_dir: charts/cilium

steps:
- name: Get Version
id: get_version
continue-on-error: false
- name: Get Original Ref
id: get_original_ref
run: |
if ${{ github.event_name == 'workflow_dispatch' }} ; then
ver=${{ github.event.inputs.base }}
echo ::set-output name=version::${ver}
echo ::set-output name=ref::${ver}
else
echo ::set-output name=version::main
echo ::set-output name=ref::main
fi

- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ steps.get_version.outputs.version }}

- name: Get Base URL
id: get_base_url
run: |
name=${{ github.repository }}
proj=${name#*/}
url=https://${{ github.repository_owner }}.github.io/${proj}
echo "::set-output name=url::${url}"
ref: ${{ steps.get_original_ref.outputs.ref }}

- name: Install Helm
uses: azure/setup-helm@v2.0
with:
version: ${{ env.HELM_VERSION }}

- name: Prepare Chart
- name: Package Chart
continue-on-error: false
run: |
cd charts
Expand All @@ -69,46 +55,67 @@ jobs:
exit 1
fi
cd ..
mkdir -p docs/charts
mv charts/*.tgz docs/charts
git checkout -- charts
mkdir -p tmp
mv charts/*.tgz tmp

- name: Prepare Index
continue-on-error: false
run: |
#rebuild index for docs/charts
cd docs
helm repo index ./charts --url ${{ steps.get_base_url.outputs.url }}/charts
mv ./charts/index.yaml ./


- name: Upload Chart Package
- name: Upload Artifact
uses: actions/upload-artifact@v3.0.0
with:
name: chart-package
path: ./docs/charts/*
path: tmp/*
retention-days: 1
if-no-files-found: error

- name: Upload Chart Yaml
uses: actions/upload-artifact@v3.0.0
# update /index.yaml in the target branch
update_githubpage:
runs-on: ubuntu-latest
needs: package_chart
steps:
- name: Get Base URL
id: get_base_url
run: |
name=${{ github.repository }}
proj=${name#*/}
url=https://${{ github.repository_owner }}.github.io/${proj}
echo "::set-output name=url::${url}"

- name: Get Original Ref
id: get_original_ref
run: |
if ${{ github.event_name == 'workflow_dispatch' }} ; then
ver=${{ github.event.inputs.base }}
echo ::set-output name=ref::${ver}
else
echo ::set-output name=ref::main
fi

- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ env.MERGE_BRANCH }}

- name: Download Artifact
uses: actions/download-artifact@v3.0.0
with:
name: chart-package
path: ./docs/index.yaml
retention-days: 1
if-no-files-found: error
path: charts/

- name: Update Chart Yaml
run: |
helm repo index ./charts --url ${{ steps.get_base_url.outputs.url }}/charts
mv ./charts/index.yaml ./index.yaml

- name: Create Pull Request
id: create_pr
uses: peter-evans/create-pull-request@v4
with:
title: "robot Update chart from ${{ steps.get_version.outputs.version }} to branch ${{ env.MERGE_BRANCH }} "
title: "robot Update chart from ${{ steps.get_original_ref.outputs.ref }} to branch ${{ env.MERGE_BRANCH }} "
# from branch
commit-message: "robot Update chart from ${{ steps.get_version.outputs.version }} to branch ${{ env.MERGE_BRANCH }} "
commit-message: "robot Update chart from ${{ steps.get_original_ref.outputs.ref }} to branch ${{ env.MERGE_BRANCH }} "
# branch name: ${branch}-${branch-suffix}
# an branch suffix could make sure the branch is unique
branch-suffix: timestamp
branch: update_chart
branch: robot/update_chart
# Delete the branch when closing pull requests, and when undeleted after merging
delete-branch: true
# merge to
Expand Down
6 changes: 3 additions & 3 deletions docs/contributing/development/chart.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Chart Management

the '/docs' of branch 'webserver' is used by github page
the '/' of branch 'github_pages' is used as github page

each version of chart package will be automatically created by CI,
they will pushed to '/docs/chart' of branch 'webserver'.
they will be pushed to '/chart' of branch 'github_pages'.

the index.yaml of chart registry will also be updated by CI, and published to '/docs' of branch 'webserver'.
the '/index.yaml' of branch 'github_pages' will also be updated by CI.

so, you could use following command to get the chart

Expand Down
8 changes: 5 additions & 3 deletions docs/contributing/development/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ if a tag vXX.XX.XX is puhed , the following will auto trigger:

### 2 generate the changelog by historical PR with "pr/release/*"

and submit a PR commit to branch 'main', with PR label "pr/release/robot_changelog".
submit a PR commit to branch 'main', with PR label "pr/release/robot_changelog".

### 3 build the chart package with the pushed tag, and submit a PR with new chart and index.yaml to branch 'webserver'
### 3 build the chart package with the pushed tag, and submit a PR to branch 'github_pages'

By the PR, it commits the new chart package to '/charts' and update /index.yaml on the branch 'github_pages'

### 4 create a Github Realse attached with the chart and changelog

### finnally, by hand, need approve the chart PR with label "pr/release/robot_changelog" , and changelog PR with label "pr/release/robot_changelog"
### finnally, by hand, need approve the chart PR with label "pr/release/robot_chart" , and changelog PR with label "pr/release/robot_changelog"
3 changes: 1 addition & 2 deletions pkg/lock/lock.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium

// Copyright Authors of helloword
package lock

// RWMutex is equivalent to sync.RWMutex but applies deadlock detection if the
Expand Down
2 changes: 2 additions & 0 deletions pkg/print/print_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ import (

func TestPrint(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecs(t, "Print Suite")

}
1 change: 1 addition & 0 deletions pkg/print/print_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var _ = Describe("Print", Label("unitest"), func() {
It("test output", func() {
print.MyPrint()
print.MyPrint()

Expect(1).To(Equal(1))
})
})