Skip to content

Commit

Permalink
ci: add flow for develop branch (#43)
Browse files Browse the repository at this point in the history
* add workflow for develop
  • Loading branch information
ypoplavs authored Oct 6, 2023
1 parent 47c47a9 commit 9fc3e8e
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 9 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/release-develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Update Helm charts - develop

on:
push:
branches:
- develop

paths:
- 'charts/testkube-cloud-api/templates/**'
- 'charts/testkube-cloud-api/values.yaml'
- 'charts/testkube-cloud-ui/templates/**'
- 'charts/testkube-cloud-ui/values.yaml'
- 'charts/testkube-enterprise/templates/**'
- 'charts/testkube-enterprise/values.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: Install Helm
uses: azure/setup-helm@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}


- 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
new_chart_version=$(./scripts/update.sh -c testkube-cloud-api --print-chart-version)
echo "New testkube-cloud-api chart version is $new_chart_version" >> $GITHUB_STEP_SUMMARY
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
new_chart_version=$(./scripts/update.sh -c testkube-cloud-ui --print-chart-version)
echo "New testkube-cloud-ui chart version is $new_chart_version" >> $GITHUB_STEP_SUMMARY
else
echo "No changes detected in the specified directories."
fi
- name: Update Testkube Enterprise Helm chart
run: |
echo "Syncing subchart versions in testkube-enterprise Helm chart"
./scripts/sync.sh
echo "Bumping testkube-enterprise Helm-chart version"
./scripts/update.sh -c testkube-enterprise --strategy minor
#get Enterprise version
enterprise_chart_version=$(./scripts/update.sh -c testkube-enterprise --print-chart-version)
echo "New testkube-enterprise chart version is $enterprise_chart_version" >> $GITHUB_STEP_SUMMARY
- name: Lint Helm charts for safety
run: |
helm lint charts/testkube-cloud-ui
helm lint charts/testkube-cloud-api
helm lint charts/testkube-enterprise
- name: Install Helm Docs
uses: envoy/install-helm-docs@v1.0.0
with:
version: 1.11.0

- name: Update Helm Docs
run: |
set -ex
helm-docs
- name: Commit & push changes
run: |
git config --global user.name "testkube-cloud-ci-bot"
git config --global user.email "testkube-cloud-ci-bot@users.noreply.github.com"
git status
git add **/*Chart.yaml **/*README.md
git commit -m "Updating helm-chart versions and README files"
git push
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# Chart dependencies
charts/testkube-cloud-api/charts/*.tgz
charts/testkube-cloud-ui/charts/*.tgz
charts/testkube-enterprise/charts/*.tgz

# OSX
.DS_Store
**/.DS_Store
**/.DS_Store
2 changes: 1 addition & 1 deletion charts/testkube-cloud-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ A Helm chart for Testkube Cloud UI
| ui.segment.writeKey | string | `""` | Segment.io write key (overriden by `secretRef` if set) |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
2 changes: 1 addition & 1 deletion charts/testkube-enterprise/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ A Helm chart for Testkube Enterprise
| testkube-cloud-ui.ingress.tlsSecretName | string | `"testkube-enterprise-ui-tls"` | Name of the TLS secret which contains the certificate files |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
Binary file removed charts/testkube-enterprise/charts/common-2.2.5.tgz
Binary file not shown.
Binary file removed charts/testkube-enterprise/charts/dex-0.14.1.tgz
Binary file not shown.
Binary file not shown.
Binary file removed charts/testkube-enterprise/charts/nats-0.14.2.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions charts/testkube-enterprise/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ testkube-cloud-api:
prometheus:
enabled: true
ingress:
enabled: true
testkube-cloud-ui:
fullnameOverride: testkube-enterprise-ui
image:
Expand Down
13 changes: 7 additions & 6 deletions scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# -v|--helm-version to specify the versions, and -c|--chart #
# to provide the name of the chart. #
# #
# Note: If -v|--helm-version is not provided, the latest Git tag is used #
# as the Helm version. If --strategy is specified, the Helm version is #
# bumped based on the specified strategy. #
# Note: If -v|--helm-version is not provided, we take the latest version #
# in Chart.yaml file and bump it. If --strategy is specified, the Helm version #
# is bumped based on the specified strategy. #
################################################################################

## VARIABLES
Expand Down Expand Up @@ -216,9 +216,12 @@ fi

show "Updating chart $chart_path"


chart_yaml_path="${chart_path}/Chart.yaml"

# use latest git tag if helm_version is not specified
if [[ -z "$helm_version" ]]; then
helm_version=$(git describe --abbrev=0 --tags)
helm_version=$(grep -E '^version:' "$chart_yaml_path" | awk '{print $2}')
if [[ -z "$helm_version" ]]; then
err "Helm version not specified or available. Use the -v|--helm-version flag or ensure there are Git tags."
usage
Expand All @@ -236,8 +239,6 @@ fi

show "Current Helm chart version: $helm_version"

chart_yaml_path="${chart_path}/Chart.yaml"

if [[ "$print_chart_version" == true ]]; then
print_chart_version
exit 0
Expand Down

0 comments on commit 9fc3e8e

Please sign in to comment.