Skip to content

Commit

Permalink
Merge pull request #1533 from Altinity/fix_helm_release
Browse files Browse the repository at this point in the history
Add helm local testing github actions
  • Loading branch information
sunsingerus authored Oct 15, 2024
2 parents 6b2788b + ac2cd32 commit 3397933
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/check_helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: check_helm
on:
pull_request:
branches:
- '*'
push:
branches:
- '*'

jobs:
test_helm:
name: Test Helm Chart
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: medyagh/setup-minikube@master
with:
driver: docker
container-runtime: containerd
kubernetes-version: v1.31.0
cpus: max
memory: max

- name: Local Helm Test
run: |
set -xe
helm install -n test test-operator ./deploy/helm/clickhouse-operator/
sleep 10
workflow_count=$(kubectl get all --all-namespaces | grep -c "test-operator")
configmap_count=$(kubectl get cm --all-namespaces | grep -c "test-operator")
if [ "$workflow_count" -lt 4 ]; then
echo "Error: Workload count is less than 4. Current count: $workflow_count"
exit 1
fi
if [ "$configmap_count" -lt 9 ]; then
echo "Error: ConfigMap count is less than 9. Current count: $configmap_count"
exit 1
fi
20 changes: 20 additions & 0 deletions .github/workflows/release_chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,34 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install chart-releaser
run: |
wget https://github.com/helm/chart-releaser/releases/download/v1.4.1/chart-releaser_1.4.1_linux_amd64.tar.gz
tar -zxf chart-releaser_1.4.1_linux_amd64.tar.gz cr
sudo install cr /usr/local/bin/
rm -f cr chart-releaser_1.4.1_linux_amd64.tar.gz
- name: Package Chart
run: cr package deploy/helm/clickhouse-operator

- name: Get Release Assets
run: |
CHART_PATH=$(ls .cr-release-packages/altinity-clickhouse-operator-*.tgz)
ASSET_NAME=$(basename ${CHART_PATH})
ASSET_ID=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets" | \
jq -r ".[] | select(.name == \"$ASSET_NAME\") | .id")
echo "Asset ID is $ASSET_ID"
echo "::set-output name=asset_id::$ASSET_ID"
- name: Delete Existing Release Artifacts
if: steps.get_assets.outputs.asset_id != ''
run: |
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository
- name: Upload Release Artifacts
run: |
CHART_PATH=$(ls .cr-release-packages/altinity-clickhouse-operator-*.tgz)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
with:
driver: docker
container-runtime: containerd
kubernetes-version: v1.30.0
kubernetes-version: v1.31.0
cpus: max
memory: max

Expand Down

0 comments on commit 3397933

Please sign in to comment.