completely automate helm chart incrementing and semver

This commit is contained in:
Martin McKeaveney 2021-12-08 16:27:33 +00:00
parent 208d1a82d4
commit cb9b7f75ce
10 changed files with 78 additions and 45 deletions

View File

@ -53,5 +53,6 @@ jobs:
uses: helm/chart-releaser-action@v1.1.0
with:
charts_dir: docs
branch: helm-repo
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

Binary file not shown.

View File

@ -2,8 +2,8 @@ apiVersion: v1
entries:
budibase:
- apiVersion: v2
appVersion: 1.0.6
created: "2021-12-06T18:32:46.48467+01:00"
appVersion: 2.0.0
created: "2021-12-08T16:26:47.061065Z"
dependencies:
- condition: services.couchdb.enabled
name: couchdb
@ -14,7 +14,7 @@ entries:
repository: https://github.com/kubernetes/ingress-nginx
version: 3.35.0
description: Budibase is an open source low-code platform, helping thousands of teams build apps for their workplace in minutes.
digest: 6c58f3fa361f9447721405d11616436679599c90c719a91cf892add5b1ad665a
digest: 9e3d5b600368a4fd65ba827986c943b65d7ffae6544b3fda0418e760866e8929
keywords:
- low-code
- database
@ -25,11 +25,11 @@ entries:
- https://budibase.com
type: application
urls:
- https://budibase.github.io/budibase/budibase-0.2.3.tgz
version: 0.2.3
- https://budibase.github.io/budibase/budibase-0.2.4.tgz
version: 0.2.4
- apiVersion: v2
appVersion: 0.9.169
created: "2021-12-06T18:32:46.480554+01:00"
created: "2021-12-08T16:26:47.055284Z"
dependencies:
- condition: services.couchdb.enabled
name: couchdb
@ -55,7 +55,7 @@ entries:
version: 0.2.2
- apiVersion: v2
appVersion: 0.9.163
created: "2021-12-06T18:32:46.475721+01:00"
created: "2021-12-08T16:26:47.051008Z"
dependencies:
- condition: services.couchdb.enabled
name: couchdb
@ -81,7 +81,7 @@ entries:
version: 0.2.1
- apiVersion: v2
appVersion: 0.9.163
created: "2021-12-06T18:32:46.47183+01:00"
created: "2021-12-08T16:26:47.046825Z"
dependencies:
- condition: services.couchdb.enabled
name: couchdb
@ -107,7 +107,7 @@ entries:
version: 0.2.0
- apiVersion: v2
appVersion: 0.9.56
created: "2021-12-06T18:32:46.468237+01:00"
created: "2021-12-08T16:26:47.042113Z"
dependencies:
- condition: services.couchdb.enabled
name: couchdb
@ -132,7 +132,7 @@ entries:
version: 0.1.1
- apiVersion: v2
appVersion: 0.9.56
created: "2021-12-06T18:32:46.463312+01:00"
created: "2021-12-08T16:26:47.036016Z"
dependencies:
- condition: services.couchdb.enabled
name: couchdb
@ -155,4 +155,4 @@ entries:
urls:
- https://budibase.github.io/budibase/budibase-0.1.0.tgz
version: 0.1.0
generated: "2021-12-06T18:32:46.459076+01:00"
generated: "2021-12-08T16:26:47.031998Z"

View File

@ -1,35 +1,18 @@
apiVersion: v2
name: budibase
description: Budibase is an open source low-code platform, helping thousands of teams build apps for their workplace in minutes.
description: >-
Budibase is an open source low-code platform, helping thousands of teams build
apps for their workplace in minutes.
keywords:
- low-code
- database
- cluster
- low-code
- database
- cluster
sources:
- https://github.com/Budibase/budibase
- https://budibase.com
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
- https://github.com/Budibase/budibase
- https://budibase.com
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.3
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.6"
version: 0.2.4
appVersion: 2.0.0
dependencies:
- name: couchdb
version: 3.3.4

View File

@ -106,7 +106,7 @@ spec:
value: {{ .Values.globals.accountPortalApiKey | quote }}
- name: COOKIE_DOMAIN
value: {{ .Values.globals.cookieDomain | quote }}
image: budibase/apps:{{ .Values.services.budibaseVersion }}
image: budibase/apps:{{ .Chart.appVersion }}
imagePullPolicy: Always
name: bbapps
ports:

View File

@ -111,7 +111,7 @@ spec:
value: {{ .Values.globals.smtp.from | quote }}
- name: APPS_URL
value: http://app-service:{{ .Values.services.apps.port }}
image: budibase/worker:{{ .Values.services.budibaseVersion }}
image: budibase/worker:{{ .Chart.appVersion }}
imagePullPolicy: Always
name: bbworker
ports:

View File

@ -8,6 +8,7 @@
"eslint-plugin-cypress": "^2.11.3",
"eslint-plugin-svelte3": "^3.2.0",
"husky": "^7.0.1",
"js-yaml": "^4.1.0",
"kill-port": "^1.6.1",
"lerna": "3.14.1",
"prettier": "^2.3.1",
@ -49,7 +50,7 @@
"build:docker:airgap": "node hosting/scripts/airgapped/airgappedDockerBuild",
"build:digitalocean": "cd hosting/digitalocean && ./build.sh && cd -",
"build:docs": "lerna run build:docs",
"release:helm": "./scripts/release_helm_chart.sh",
"release:helm": "node scripts/releaseHelmChart",
"env:multi:enable": "lerna run env:multi:enable",
"env:multi:disable": "lerna run env:multi:disable",
"env:selfhost:enable": "lerna run env:selfhost:enable",

39
scripts/releaseHelmChart.js Executable file
View File

@ -0,0 +1,39 @@
const yaml = require("js-yaml")
const { execSync } = require("child_process")
const fs = require("fs")
const path = require("path")
const UpgradeTypes = {
MAJOR: "major",
MINOR: "minor",
PATCH: "patch"
}
const CHART_PATH = path.join(__dirname, "../", "hosting", "kubernetes", "budibase", "Chart.yaml")
const UPGRADE_VERSION = process.env.BUDIBASE_RELEASE_VERSION
const UPGRADE_TYPE = process.env.HELM_CHART_UPGRADE_TYPE || UpgradeTypes.PATCH
if (!UPGRADE_VERSION) {
throw new Error("BUDIBASE_RELEASE_VERSION env var must be set.")
}
try {
const chartFile = fs.readFileSync(CHART_PATH, "utf-8")
const chart = yaml.load(chartFile)
// Upgrade app version in chart to match budibase release version
chart.appVersion = UPGRADE_VERSION
// semantically version the chart
const [major, minor, patch] = chart.version.split(".")
const newPatch = parseInt(patch) + 1
chart.version = [major, minor, newPatch].join(".")
const updatedChartYaml = yaml.dump(chart)
fs.writeFileSync(CHART_PATH, updatedChartYaml)
execSync(`helm package hosting/kubernetes/budibase --destination docs`)
execSync(`helm repo index docs --url https://budibase.github.io/budibase`)
} catch (err) {
console.error("Error releasing helm chart")
throw err
}

View File

@ -1,3 +0,0 @@
cd docs
helm package ../hosting/kubernetes/budibase
helm repo index . --url https://budibase.github.io/budibase

View File

@ -1082,6 +1082,11 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"
argparse@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
arr-diff@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
@ -3260,6 +3265,13 @@ js-yaml@^3.13.1:
argparse "^1.0.7"
esprima "^4.0.0"
js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"
jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"