diff --git a/.github/workflows/release-selfhost.yml b/.github/workflows/release-selfhost.yml index ad0941709c..444071fa7b 100644 --- a/.github/workflows/release-selfhost.yml +++ b/.github/workflows/release-selfhost.yml @@ -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 }}" diff --git a/docs/budibase-0.2.3.tgz b/docs/budibase-0.2.3.tgz deleted file mode 100644 index b7207376a1..0000000000 Binary files a/docs/budibase-0.2.3.tgz and /dev/null differ diff --git a/docs/index.yaml b/docs/index.yaml index 1230b3cbc2..21586652f6 100644 --- a/docs/index.yaml +++ b/docs/index.yaml @@ -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" diff --git a/hosting/kubernetes/budibase/Chart.yaml b/hosting/kubernetes/budibase/Chart.yaml index cc4bbaa5f5..790c7845d8 100644 --- a/hosting/kubernetes/budibase/Chart.yaml +++ b/hosting/kubernetes/budibase/Chart.yaml @@ -1,41 +1,24 @@ 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 repository: https://apache.github.io/couchdb-helm condition: services.couchdb.enabled - name: ingress-nginx - version: 3.35.0 + version: 3.35.0 repository: https://github.com/kubernetes/ingress-nginx condition: ingress.nginx diff --git a/hosting/kubernetes/budibase/templates/app-service-deployment.yaml b/hosting/kubernetes/budibase/templates/app-service-deployment.yaml index 5e45474c8a..e75f84e779 100644 --- a/hosting/kubernetes/budibase/templates/app-service-deployment.yaml +++ b/hosting/kubernetes/budibase/templates/app-service-deployment.yaml @@ -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: diff --git a/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml b/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml index 70249123d0..d71fc80578 100644 --- a/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml +++ b/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml @@ -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: diff --git a/package.json b/package.json index 4be3fe1401..63de8251d4 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/releaseHelmChart.js b/scripts/releaseHelmChart.js new file mode 100755 index 0000000000..4c022c9a0c --- /dev/null +++ b/scripts/releaseHelmChart.js @@ -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 +} diff --git a/scripts/release_helm_chart.sh b/scripts/release_helm_chart.sh deleted file mode 100755 index b1594cca91..0000000000 --- a/scripts/release_helm_chart.sh +++ /dev/null @@ -1,3 +0,0 @@ -cd docs -helm package ../hosting/kubernetes/budibase -helm repo index . --url https://budibase.github.io/budibase \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index aa02ce87f5..628e48bd0c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"