-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ci worklofw to check clusterpedia crd whether been update
Signed-off-by: calvin <[email protected]>
- Loading branch information
calvin
committed
Dec 15, 2022
1 parent
3bb71cb
commit 561e338
Showing
1 changed file
with
45 additions
and
0 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,45 @@ | ||
# validate any chart changes under charts directory | ||
name: Clusterpedia crd sync | ||
|
||
env: | ||
CLUSTERPEDIA_REPO: https://github.com/clusterpedia-io/clusterpedia.git | ||
TMP_DIR: /tmp/clusterpedia | ||
CLUSTERPEDIA_CRD_DIR: deploy/crds | ||
CLSUTERPEDIA_HELM_CRD_DIR: charts/clusterpedia/_crds | ||
CHART_YAML_PATH: charts/clusterpedia/Chart.yaml | ||
IGNORE_MATCHING_LINES: "helm.sh/resource-policy: keep" | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
crd-sync-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Lookup clusterpedia version | ||
run: | | ||
APP_VERSION=$(yq '.appVersion' < ${{ env.CHART_YAML_PATH }}) | ||
echo "APP_VERSION=${APP_VERSION,,}" >> ${GITHUB_ENV} | ||
- name: Pull clusterpedia code | ||
run: | | ||
echo "chart appVersion: ${{ env.APP_VERSION }}" | ||
echo "pull clusterpedia from https://github.com/clusterpedia-io/clusterpedia.git" | ||
git clone --single-branch --depth 1 --branch ${{ env.APP_VERSION }} ${{ env.CLUSTERPEDIA_REPO }} ${{ env.TMP_DIR }} | ||
- name: check whether crd is sync | ||
run: | | ||
ret=0 | ||
diff -Naupr -I '${{ env.IGNORE_MATCHING_LINES }}' ${{ env.CLSUTERPEDIA_HELM_CRD_DIR }} ${{ env.TMP_DIR }}/${{ env.CLUSTERPEDIA_CRD_DIR }} || ret=$? | ||
if [[ $ret -eq 1 ]] | ||
then | ||
echo "clusterpedia crd has been change, please update synchronouly this repo crd resource." | ||
exit 1 | ||
fi | ||
- name: cleanup | ||
run: | | ||
echo "remove clusterpedia code" | ||
rm ${{ env.TMP_DIR }} -rf |