diff --git a/.github/workflows/appversion.yaml b/.github/workflows/appversion.yaml new file mode 100644 index 0000000..bce669e --- /dev/null +++ b/.github/workflows/appversion.yaml @@ -0,0 +1,51 @@ +name: Update App version + +on: + push: + branches: + - dev + +jobs: + release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: dev + + - name: Get latest release of Kexa + uses: rez0n/actions-github-release@794c12f5e8d629e6ca329cf2e2daeb0f0ce6a3ce + id: get_latest_release + with: + token: ${{ secrets.GIT_TOKEN }} + repository: "kexa-io/Kexa" + type: "stable" + + - name: print new latest kexa version + run: echo ${{ steps.get_latest_release.outputs.release }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Run Javascript to update local files + run: | + npm install + node update-app-version.js "${{ steps.get_latest_release.outputs.release }}" + env: + GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} + + - name: Commit and push changes to dev + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add charts/kexa-chart/Chart.yaml + git commit -m "chore(release): update Chart.yaml appversion" + git push origin dev + env: + GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 0f8c7e6..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Release Charts - -on: - workflow_dispatch: - -jobs: - release: - permissions: - contents: write - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Helm - run: | - helm repo add bitnami https://charts.bitnami.com/bitnami - helm repo add grafana https://grafana.github.io/helm-charts - helm repo update - - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.6.0 - env: - CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - with: - config: "cr.yaml" diff --git a/.github/workflows/versioning.yaml b/.github/workflows/versioning.yaml deleted file mode 100644 index d0c0077..0000000 --- a/.github/workflows/versioning.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: Release - -on: - workflow_dispatch: - -jobs: - release: - permissions: - contents: write - issues: write - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: prep plugins - run: | - npm install -D @semantic-release/changelog @semantic-release/git @semantic-release/exec - - name: run semantic release - id: ver - run: npx semantic-release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index c66c9a4..1acb10a 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,20 @@ If you do not want to use the cronjob, and just need a one time run: ## Create your secrets +Kexa need configuration file (that define which rule to use and which addon to use) to run, +as well as the credentials for the addons you will use. + Most of addon's credentials are passed in .env file, only Kubernetes addon require a specific credential type, described below. -Refer to the official Kexa documentation to learn more about addons authentication. +Refer to the official Kexa documentation to learn more about addons authentication +and Kexa configuration. + + +*Upload your Kexa configuration (default.json)* +```bash +kubectl create secret generic kexa-configuration-secret --from-file=default.json=default.json +``` *For most addons credentials* ```bash diff --git a/charts/kexa-chart/Chart.yaml b/charts/kexa-chart/Chart.yaml index fbac3ee..9f837df 100644 --- a/charts/kexa-chart/Chart.yaml +++ b/charts/kexa-chart/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: kexa description: A Helm chart that installs PostgreSQL and Grafana version: 1.4.2 -appVersion: '1.0' +appVersion: 1.16.4 icon: https://kexa.io/kexa-no-background-color.png dependencies: - name: postgresql diff --git a/charts/kexa-chart/files/config/default.json b/charts/kexa-chart/files/config/default.json deleted file mode 100644 index 377e4f5..0000000 --- a/charts/kexa-chart/files/config/default.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "kubernetes":[ - { - "description": "organization 4urcloud", - "prefix": "KUBE1_", - "rules": [ - "kubernetesConsumptions", - ] - } - ], - "save": [ - { - "type": "postgres", - "name": "Clever Cloud Postgresql", - "urlName": "POSTGRES_STRING", - "description": "Database to save the data (clever-cloud)" - } - ] -} \ No newline at end of file diff --git a/charts/kexa-chart/templates/kexa-job.yaml b/charts/kexa-chart/templates/kexa-job.yaml index 4276544..69aa8f1 100644 --- a/charts/kexa-chart/templates/kexa-job.yaml +++ b/charts/kexa-chart/templates/kexa-job.yaml @@ -48,8 +48,8 @@ spec: restartPolicy: Never volumes: - name: kexa-config-volume - configMap: - name: kexa-configuration-files + secret: + secretName: kexa-configuration-secret - name: kexa-env-volume secret: secretName: kexa-environment-secret diff --git a/update-app-version.js b/update-app-version.js new file mode 100644 index 0000000..f5ba943 --- /dev/null +++ b/update-app-version.js @@ -0,0 +1,43 @@ +// YAML TO JSON +// CHANGE APP VERSION +// THEN JSON TO YAML AND WRITE TO FILE + +const fs = require('fs'); +const path = require('path'); +const yaml = require('js-yaml'); + +const newVersion = process.argv[2]; + +if (!newVersion) { + console.error('Error: No version specified.'); + process.exit(1); +} + +const chartFilePath = 'charts/kexa-chart/Chart.yaml'; + +if (!fs.existsSync(chartFilePath)) { + console.error(`Error: ${chartFilePath} not found.`); + process.exit(1); +} + +let fileContent = fs.readFileSync(chartFilePath, 'utf8'); +let chartData; + +try { + chartData = yaml.load(fileContent); +} catch (e) { + console.error('Error parsing YAML:', e); + process.exit(1); +} + +if (chartData.version) { + chartData.appVersion = newVersion; + console.log(`Updating version to ${newVersion}`); +} else { + console.error('Version field not found in Chart.yaml.'); + process.exit(1); +} + +const updatedYaml = yaml.dump(chartData); +fs.writeFileSync(chartFilePath, updatedYaml, 'utf8'); +console.log(`Updated ${chartFilePath} to version ${newVersion}`); \ No newline at end of file diff --git a/update-chart-version.js b/update-chart-version.js index e6443d1..5d46d40 100644 --- a/update-chart-version.js +++ b/update-chart-version.js @@ -1,5 +1,5 @@ // YAML TO JSON -// CHANGE VERSION +// CHANGE CHART VERSION // THEN JSON TO YAML AND WRITE TO FILE const fs = require('fs');