Skip to content

Commit

Permalink
feat: added helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
siredmar committed Jul 17, 2023
1 parent 3e116a7 commit 476a36c
Show file tree
Hide file tree
Showing 15 changed files with 756 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ on:
pull_request:
branches:
- "**"
push:
branches:
- main
- beta

jobs:
commitlint:
runs-on: ubuntu-latest
Expand Down
39 changes: 36 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,53 @@
name: Release

on:
push:
workflow_run:
workflows: ["Lint Commit Messages"]
branches:
- main
- beta
types:
- completed

env:
REGISTRY: ghcr.io

jobs:
release:
on-success:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"

- name: Setup helm
uses: azure/setup-helm@v3
with:
version: "v3.11.1"

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.PACKAGES_TOKEN }}

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
GITHUB_USER: ${{ github.actor }}
REGISTRY_USERNAME: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ secrets.PACKAGES_TOKEN }}
run: |-
#!/bin/bash
set -e
# add more plugins: https://semantic-release.gitbook.io/semantic-release/extending/plugins-list
npm install @semantic-release/exec @semantic-release/git semantic-release-helm3 -D
npx -c semantic-release
47 changes: 47 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"branches": [
{
"name": "main"
},
{
"name": "beta",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/exec",
{
"prepareCmd": "make install-helmify && make helm"
}
],
[
"semantic-release-helm3",
{
"chartPath": "./charts/edgefarm-applications",
"registry": "ghcr.io/edgefarm/edgefarm.applications"
}
],
[
"@semantic-release/git",
{
"assets": [
"charts/edgefarm-applications/Chart.yaml",
"charts/edgefarm-applications/templates/edgefarm-applications.yaml",
"charts/edgefarm-applications/templates/edgefarm-network-trait.yaml",
"charts/edgefarm-applications/templates/edgefarm-storage-trait.yaml",
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"successComment": false,
"failTitle": false
}
]
]
}
8 changes: 0 additions & 8 deletions .releaserc.yaml

This file was deleted.

35 changes: 28 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
all: render deploy ## renders and deploys all templates into the current k8s cluster
NAMESPACE=edgefarm-applications
all: render deploy helm ## renders and deploys all templates into the current k8s cluster
render: traits-render components-render ## renders all templates
apply: traits-apply components-apply ## applies all templates
deploy: traits-deploy components-deploy ## deploys all templates
Expand All @@ -17,23 +18,43 @@ traits-apply: ## applies all traits using vela cli
@vela def apply cue/traits/edgefarm-storage-trait.cue

traits-deploy: ## deploys all traits using kubectl
kubectl apply -n vela-system -f manifests/vela-caps/traits/edgefarm-network-trait.yaml
kubectl apply -n vela-system -f manifests/vela-caps/traits/edgefarm-storage-trait.yaml
kubectl apply -n $(NAMESPACE) -f manifests/vela-caps/traits/edgefarm-network-trait.yaml
kubectl apply -n $(NAMESPACE) -f manifests/vela-caps/traits/edgefarm-storage-trait.yaml

components-render: ## renders all components
@vela def vet cue/components/edgefarm-applications.cue
@vela def render cue/components/edgefarm-applications.cue -o manifests/vela-caps/components/edgefarm-applications.yaml
components-apply: ## applies all components using vela cli
@vela def apply cue/components/edgefarm-applications.cue
components-deploy: ## deploys all components using kubectl
kubectl apply -n vela-system -f manifests/vela-caps/components/edgefarm-applications.yaml

kubectl apply -n $(NAMESPACE) -f manifests/vela-caps/components/edgefarm-applications.yaml

helm: ## generate helm chart. Version is incremented using semantic-release and github actions
$(eval TEMPD := $(shell mktemp -d))
$(eval ROOTPWD := $(shell pwd))
@cd $(TEMPD)
@helmify -f $(ROOTPWD)/manifests/vela-caps/components/edgefarm-applications.yaml -f $(ROOTPWD)/manifests/vela-caps/traits/edgefarm-storage-trait.yaml -f $(ROOTPWD)/manifests/vela-caps/traits/edgefarm-network-trait.yaml $(TEMPD)/edgefarm-applications
@sed -i 's/name: {{ include "edgefarm-applications.fullname" . }}-applications/name: edgefarm-applications/g' $(TEMPD)/edgefarm-applications/templates/edgefarm-applications.yaml
@sed -i 's/name: {{ include "edgefarm-applications.fullname" . }}-network/name: edgefarm-network/g' $(TEMPD)/edgefarm-applications/templates/edgefarm-network-trait.yaml
@sed -i 's/name: {{ include "edgefarm-applications.fullname" . }}-storage/name: edgefarm-storage/g' $(TEMPD)/edgefarm-applications/templates/edgefarm-storage-trait.yaml
@cp -r $(TEMPD)/edgefarm-applications/templates/* $(ROOTPWD)/charts/edgefarm-applications/templates
@rm -r $(TEMPD)
@cd $(ROOTPWD)
@helm dependency update charts/edgefarm-applications

install-vela: ## install kubevela
@VELA_VERSION=v1.8.0
@curl -fsSl https://kubevela.io/script/install.sh | bash -s ${VELA_VERSION}
# Make sure to also modify the version of vela-core in charts/edgefarm-applications/Chart.yaml
@curl -fsSl https://kubevela.io/script/install.sh | bash -s v1.8.0
@vela install

install-helmify: ## install helmify
$(eval TEMPD := $(shell mktemp -d))
@curl -L https://github.com/arttor/helmify/releases/download/v0.4.5/helmify_Linux_x86_64.tar.gz -o $(TEMPD)/helmify.tar.gz && \
tar -xzf $(TEMPD)/helmify.tar.gz -C /$(TEMPD) && \
mv $(TEMPD)/helmify /usr/local/bin/helmify && \
chmod +x /usr/local/bin/helmify
@rm -r $(TEMPD)

help: ## show help message
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make [target]\033[36m\033[0m\n"} /^[$$()% 0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m\t %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

Expand Down
23 changes: 23 additions & 0 deletions charts/edgefarm-applications/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/edgefarm-applications/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: vela-core
repository: https://charts.kubevela.net/core
version: 1.8.0
digest: sha256:2e16553d56d88c8f3f484eddb29667b95aa5f34dbfd084da8fe418262cc0dfd7
generated: "2023-07-17T13:17:31.317729297+02:00"
23 changes: 23 additions & 0 deletions charts/edgefarm-applications/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v2
name: edgefarm-applications
description: A Helm chart for edgefarm.applications.

type: application
version: 0.1.0
appVersion: "0.1.0"

keywords:
- edgefarm.applications
- kubevela

sources:
- https://github.com/edgefarm/edgefarm.applications

maintainers:
- name: Armin Schlegel
email: armin.schlegel@gmx.de

dependencies:
- name: vela-core
version: 1.8.0
repository: https://charts.kubevela.net/core
Binary file not shown.
Loading

0 comments on commit 476a36c

Please sign in to comment.