Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Enterprise chart #55

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/chart-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Release Helm charts - main

on:
push:
branches:
- main
- enterprise-chart
paths:
- 'charts/testkube-cloud-api/templates/**'
- 'charts/testkube-cloud-api/Chart.yaml'
- 'charts/testkube-cloud-api/values.yaml'
- 'charts/testkube-cloud-api/README.md'
- 'charts/testkube-cloud-ui/templates/**'
- 'charts/testkube-cloud-ui/Chart.yaml'
- 'charts/testkube-cloud-ui/values.yaml'
- 'charts/testkube-cloud-ui/README.md'
- 'charts/testkube-enterprise/templates/**'
- 'charts/testkube-enterprise/Chart.yaml'
- 'charts/testkube-enterprise/values.yaml'
- 'charts/testkube-enterprise/README.md'
- '.github/workflows/chart-release.yaml'

jobs:
release-helm-charts:
name: Release Helm charts
runs-on: ubuntu-22.04
steps:

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config --global user.name "testkube-cloud-ci-bot"
git config --global user.email "testkube-cloud-ci-bot@users.noreply.github.com"

- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.10.0

- name: Update Helm chart with changes files
run: |
echo "Testkube Helm charts diff"
changed_files=$(git --no-pager diff HEAD~1 charts)

if [[ "$changed_files" == *"testkube-cloud-api/"* ]]; then
echo "Changes detected in files within the 'testkube-cloud-api' directory. Updating the chart minor version."
./scripts/update.sh -c testkube-cloud-api --strategy minor
else
echo "No changes detected in the specified directories."
fi

if [[ "$changed_files" == *"testkube-cloud-ui/"* ]]; then
echo "Changes detected in files within the 'testkube-cloud-ui' directory. Updating the chart minor version."
./scripts/update.sh -c testkube-cloud-ui --strategy minor
else
echo "No changes detected in the specified directories."
fi

tk_api_chart_version=$(./scripts/update.sh -c testkube-cloud-api --print-chart-version)
echo "New testkube-cloud-api chart version is $tk_api_chart_version" >> $GITHUB_STEP_SUMMARY
echo "API_CHART_VERSION=$tk_api_chart_version" >> $GITHUB_ENV

tk_ui_chart_version=$(./scripts/update.sh -c testkube-cloud-ui --print-chart-version)
echo "New testkube-cloud-ui chart version is $tk_ui_chart_version" >> $GITHUB_STEP_SUMMARY
echo "UI_CHART_VERSION=$tk_ui_chart_version" >> $GITHUB_ENV

- name: Sync & Update Testkube Enterprise Helm chart
run: |
bump_strategy="minor"
changed=$(git status --porcelain charts/testkube-enterprise | wc -l)
if [ $changed -gt 0 ]; then
bump_strategy="none"
fi

echo "Syncing subchart versions in testkube-enterprise Helm chart"
./scripts/sync.sh

echo "Updating testkube-enterprise Helm chart version with bump strategy: $bump_strategy"
./scripts/update.sh -c testkube-enterprise -s $bump_strategy --verbose

enterprise_chart_version=$(./scripts/update.sh -c testkube-enterprise --print-chart-version)
echo "ENTERPRISE_CHART_VERSION=$enterprise_chart_version" >> $GITHUB_ENV

echo -e "### Testkube Enterprise Helm chart diff" >> $GITHUB_STEP_SUMMARY
echo -e '```' >> $GITHUB_STEP_SUMMARY
git --no-pager diff charts/testkube-enterprise >> $GITHUB_STEP_SUMMARY
echo -e '```' >> $GITHUB_STEP_SUMMARY

- name: Commit & push changes
run: |
git status
git add **/*Chart.yaml **/*README.md charts/testkube-enterprise/Chart.lock
git commit -m "updating testkube-enterprise chart version to ${{ env.ENTERPRISE_CHART_VERSION }}"
git push --force

- name: Installing repositories
run: |
helm repo add dex https://charts.dexidp.io
helm repo add nats https://nats-io.github.io/k8s/helm/charts/
helm repo add bitnami https://charts.bitnami.com/bitnami

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
with:
charts_dir: charts
env:
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CR_SKIP_EXISTING: true
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
python-version: 3.9

- name: Setup Chart Linting
uses: helm/chart-testing-action@v2.4.0
uses: helm/chart-testing-action@v2.5.0
with:
# Note: Also update in scripts/lint.sh
version: v3.7.1
Expand Down
Loading