diff --git a/.drone.star b/.drone.star index bfc68c3..07aeada 100644 --- a/.drone.star +++ b/.drone.star @@ -3,11 +3,11 @@ KUBECTL_IMAGE = "docker.io/bitnami/kubectl:1.28" K3D_IMAGE = "ghcr.io/k3d-io/k3d:5-dind" def main(ctx): - pipeline_starlark = starlark(ctx) + pipeline_lint = lint(ctx) pipeline_release = release(ctx) pipeline_docs = documentation(ctx) - pipeline_docs[0]["depends_on"].append(pipeline_starlark[0]["name"]) + pipeline_docs[0]["depends_on"].append(pipeline_lint[0]["name"]) config = { "branches": [ @@ -29,31 +29,37 @@ def main(ctx): pipeline["depends_on"].append(pipeline_kubernetes[0]["name"]) pipeline_release[0]["depends_on"].append(pipeline["name"]) - return pipeline_starlark + pipeline_docs + pipeline_kubernetes + pipeline_deployments + pipeline_release + return pipeline_lint + pipeline_docs + pipeline_kubernetes + pipeline_deployments + pipeline_release -def starlark(ctx): - return [{ - "kind": "pipeline", - "type": "docker", - "name": "starlark", - "steps": [ - { - "name": "starlark-format", - "image": "docker.io/owncloudci/bazel-buildifier", - "commands": [ - "buildifier -d -diff_command='diff -u' .drone.star", +def lint(ctx): + return [ + { + "kind": "pipeline", + "type": "docker", + "name": "starlark", + "steps": [ + { + "name": "starlark-format", + "image": "docker.io/owncloudci/bazel-buildifier", + "commands": [ + "buildifier -d -diff_command='diff -u' .drone.star", + ], + }, + { + "name": "editorconfig-format", + "image": "docker.io/mstruebing/editorconfig-checker", + }, + ], + "depends_on": [], + "trigger": { + "ref": [ + "refs/heads/main", + "refs/tags/**", + "refs/pull/**", ], }, - ], - "depends_on": [], - "trigger": { - "ref": [ - "refs/heads/main", - "refs/tags/**", - "refs/pull/**", - ], }, - }] + ] def kubernetes(ctx, config): pipeline = { @@ -117,174 +123,184 @@ def kubernetes(ctx, config): return [pipeline] def deployments(ctx): - return [{ - "kind": "pipeline", - "type": "docker", - "name": "k3d", - "steps": wait(ctx) + install(ctx), - "services": [ - { - "name": "k3d", - "image": K3D_IMAGE, - "privileged": True, - "commands": [ - "nohup dockerd-entrypoint.sh &", - "until docker ps 2>&1 > /dev/null; do sleep 1s; done", - "k3d cluster create --config ci/k3d-drone.yaml --api-port k3d:6445", - "until kubectl get deployment coredns -n kube-system -o go-template='{{.status.availableReplicas}}' | grep -v -e ''; do sleep 1s; done", - "k3d kubeconfig get drone > kubeconfig-$${DRONE_BUILD_NUMBER}.yaml", - "chmod 0600 kubeconfig-$${DRONE_BUILD_NUMBER}.yaml", - "printf '@@@@@@@@@@@@@@@@@@@@@@@\n@@@@ k3d is ready @@@@\n@@@@@@@@@@@@@@@@@@@@@@@\n'", - "kubectl get events -Aw", + return [ + { + "kind": "pipeline", + "type": "docker", + "name": "k3d", + "steps": wait(ctx) + install(ctx), + "services": [ + { + "name": "k3d", + "image": K3D_IMAGE, + "privileged": True, + "commands": [ + "nohup dockerd-entrypoint.sh &", + "until docker ps 2>&1 > /dev/null; do sleep 1s; done", + "k3d cluster create --config ci/k3d-drone.yaml --api-port k3d:6445", + "until kubectl get deployment coredns -n kube-system -o go-template='{{.status.availableReplicas}}' | grep -v -e ''; do sleep 1s; done", + "k3d kubeconfig get drone > kubeconfig-$${DRONE_BUILD_NUMBER}.yaml", + "chmod 0600 kubeconfig-$${DRONE_BUILD_NUMBER}.yaml", + "printf '@@@@@@@@@@@@@@@@@@@@@@@\n@@@@ k3d is ready @@@@\n@@@@@@@@@@@@@@@@@@@@@@@\n'", + "kubectl get events -Aw", + ], + }, + ], + "depends_on": [], + "trigger": { + "ref": [ + "refs/heads/main", + "refs/tags/**", + "refs/pull/**", ], }, - ], - "depends_on": [], - "trigger": { - "ref": [ - "refs/heads/main", - "refs/tags/**", - "refs/pull/**", - ], }, - }] + ] def install(ctx): - return [{ - "name": "helm-install", - "image": "docker.io/owncloudci/alpine", - "commands": [ - "export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml", - "helm install --values ci/ci-values.yaml --atomic --timeout 5m0s owncloud charts/owncloud/", - ], - }] + return [ + { + "name": "helm-install", + "image": "docker.io/owncloudci/alpine", + "commands": [ + "export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml", + "helm install --values ci/ci-values.yaml --atomic --timeout 5m0s owncloud charts/owncloud/", + ], + }, + ] def documentation(ctx): - return [{ - "kind": "pipeline", - "type": "docker", - "name": "documentation", - "steps": [ - { - "name": "helm-docs-readme", - "image": HELM_DOCS_IMAGE, - "commands": [ - "/usr/bin/helm-docs --badge-style=flat --template-files=ci/README.md.gotmpl --output-file=README.md", - ], - }, - { - "name": "check-unchanged", - "image": "docker.io/owncloudci/alpine", - "commands": [ - "git diff --exit-code", + return [ + { + "kind": "pipeline", + "type": "docker", + "name": "documentation", + "steps": [ + { + "name": "helm-docs-readme", + "image": HELM_DOCS_IMAGE, + "commands": [ + "/usr/bin/helm-docs --badge-style=flat --template-files=ci/README.md.gotmpl --output-file=README.md", + ], + }, + { + "name": "check-unchanged", + "image": "docker.io/owncloudci/alpine", + "commands": [ + "git diff --exit-code", + ], + }, + ], + "depends_on": [], + "trigger": { + "ref": [ + "refs/heads/main", + "refs/tags/**", + "refs/pull/**", ], }, - ], - "depends_on": [], - "trigger": { - "ref": [ - "refs/heads/main", - "refs/tags/**", - "refs/pull/**", - ], }, - }] + ] def release(ctx): - return [{ - "kind": "pipeline", - "type": "docker", - "name": "release", - "steps": [ - { - "name": "changelog", - "image": "quay.io/thegeeklab/git-chglog", - "commands": [ - "git fetch -tq", - "git-chglog --no-color --no-emoji %s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "--next-tag unreleased unreleased"), - "git-chglog --no-color --no-emoji -o charts/owncloud/CHANGELOG.md %s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "--next-tag unreleased unreleased"), - ], - }, - { - "name": "helmpack-package", - "image": "quay.io/helmpack/chart-releaser", - "commands": [ - "sed -i 's/version: 0.0.0-devel/version: %s/g' charts/owncloud/Chart.yaml" % (ctx.build.ref.replace("refs/tags/", "").replace("v", "") if ctx.build.event == "tag" else "0.0.0-devel"), - "cr package charts/owncloud/", - ], - }, - { - "name": "helmpack-upload", - "image": "quay.io/helmpack/chart-releaser", - "environment": { - "CR_TOKEN": { - "from_secret": "github_token", - }, - }, - "commands": [ - "cr upload charts/owncloud/", - ], - "when": { - "ref": [ - "refs/tags/**", + return [ + { + "kind": "pipeline", + "type": "docker", + "name": "release", + "steps": [ + { + "name": "changelog", + "image": "quay.io/thegeeklab/git-chglog", + "commands": [ + "git fetch -tq", + "git-chglog --no-color --no-emoji %s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "--next-tag unreleased unreleased"), + "git-chglog --no-color --no-emoji -o charts/owncloud/CHANGELOG.md %s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "--next-tag unreleased unreleased"), ], }, - }, - { - "name": "helmpack-index", - "image": "quay.io/helmpack/chart-releaser", - "commands": [ - "mkdir -p dist/docs/", - "cp README.md dist/docs/README.md", - "cr index", - ], - "when": { - "ref": [ - "refs/tags/**", + { + "name": "helmpack-package", + "image": "quay.io/helmpack/chart-releaser", + "commands": [ + "sed -i 's/version: 0.0.0-devel/version: %s/g' charts/owncloud/Chart.yaml" % (ctx.build.ref.replace("refs/tags/", "").replace("v", "") if ctx.build.event == "tag" else "0.0.0-devel"), + "cr package charts/owncloud/", ], }, - }, - { - "name": "pages", - "image": "docker.io/plugins/gh-pages", - "settings": { - "pages_directory": "dist/docs", - "copy_contents": True, - "delete": True, - "password": { - "from_secret": "github_token", + { + "name": "helmpack-upload", + "image": "quay.io/helmpack/chart-releaser", + "environment": { + "CR_TOKEN": { + "from_secret": "github_token", + }, }, - "target_branch": "gh_pages", - "username": { - "from_secret": "github_username", + "commands": [ + "cr upload charts/owncloud/", + ], + "when": { + "ref": [ + "refs/tags/**", + ], }, }, - "when": { - "ref": [ - "refs/tags/**", + { + "name": "helmpack-index", + "image": "quay.io/helmpack/chart-releaser", + "commands": [ + "mkdir -p dist/docs/", + "cp README.md dist/docs/README.md", + "cr index", ], + "when": { + "ref": [ + "refs/tags/**", + ], + }, + }, + { + "name": "pages", + "image": "docker.io/plugins/gh-pages", + "settings": { + "pages_directory": "dist/docs", + "copy_contents": True, + "delete": True, + "password": { + "from_secret": "github_token", + }, + "target_branch": "gh_pages", + "username": { + "from_secret": "github_username", + }, + }, + "when": { + "ref": [ + "refs/tags/**", + ], + }, }, - }, - ], - "depends_on": [], - "trigger": { - "ref": [ - "refs/heads/main", - "refs/tags/**", - "refs/pull/**", ], + "depends_on": [], + "trigger": { + "ref": [ + "refs/heads/main", + "refs/tags/**", + "refs/pull/**", + ], + }, }, - }] + ] def wait(config): - return [{ - "name": "wait", - "image": KUBECTL_IMAGE, - "user": "root", - "commands": [ - "export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml", - "until test -f $${KUBECONFIG}; do sleep 1s; done", - "kubectl config view", - "kubectl get pods -A", - ], - }] + return [ + { + "name": "wait", + "image": KUBECTL_IMAGE, + "user": "root", + "commands": [ + "export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml", + "until test -f $${KUBECONFIG}; do sleep 1s; done", + "kubectl config view", + "kubectl get pods -A", + ], + }, + ] diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..57d5c52 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,22 @@ +# https://editorconfig.org/ + +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[Makefile] +indent_style = tab +indent_size = 4 + +[*.star] +indent_style = space +indent_size = 4 + +[LICENSE] +indent_size = unset diff --git a/charts/owncloud/templates/NOTES.txt b/charts/owncloud/templates/NOTES.txt index e91441f..09dbe6a 100644 --- a/charts/owncloud/templates/NOTES.txt +++ b/charts/owncloud/templates/NOTES.txt @@ -10,8 +10,8 @@ export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "owncloud.fullname" . }}' + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "owncloud.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "owncloud.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} diff --git a/charts/owncloud/values.yaml b/charts/owncloud/values.yaml index 902f47c..13003a5 100644 --- a/charts/owncloud/values.yaml +++ b/charts/owncloud/values.yaml @@ -412,7 +412,7 @@ persistence: # -- owncloud data Persistent Volume Storage Class. If defined, `storageClassName` of the PVC is set to the value defined here. If set to "-", `storageClassName`of the PVC is set to `""`, which disables dynamic provisioning. If undefined (the default) or set to null, no `storageClassName` spec is set, choosing the default provisioner. storageClassName: "" # -- Set annotations on the owncloud PVC. - annotations: + annotations: "helm.sh/resource-policy": keep # -- Number of replicas for each scalable service. Has no effect when `autoscaling.enabled` is set to `true`. @@ -442,7 +442,6 @@ service: # -- Service annotations. annotations: {} - ingress: # -- Enables the Ingress. enabled: false