Skip to content

Commit

Permalink
Merge branch 'main' into OPSEXP-2043
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn authored Nov 6, 2023
2 parents a17a03b + bde5990 commit 8fb9b70
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
helm plugin install https://github.com/helm-unittest/helm-unittest --version $HELM_UNITTEST_VERSION
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0
uses: helm/chart-testing-action@v2.6.1
with:
version: v3.8.0

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
permissions:
contents: write
steps:
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-helm-docs@v3.1.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-helm-docs@v3.6.0
- name: Install kubeconform helm plugin
run: |
helm plugin install https://github.com/jtyr/kubeconform-helm --version v0.1.12
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v3.1.0
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v3.6.0
with:
auto-commit: "true"
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
helm repo add elastic https://helm.elastic.co
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.5.0
uses: helm/chart-releaser-action@v1.6.0
with:
charts_dir: charts
config: cr.yaml
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/updatecli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
token: ${{ secrets.BOT_GITHUB_TOKEN }}

- uses: >-
Alfresco/alfresco-build-tools/.github/actions/get-branch-name@v3.1.0
Alfresco/alfresco-build-tools/.github/actions/get-branch-name@v3.6.0
- name: Login to quay.io
uses: docker/login-action@v3
Expand All @@ -42,15 +42,15 @@ jobs:
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- uses: Alfresco/alfresco-build-tools/.github/actions/setup-helm-docs@v3.1.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-helm-docs@v3.6.0
- name: Regenerate helm docs if necessary
uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v3.1.0
uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v3.6.0
with:
pre-commit-args: helm-docs || true
skip_checkout: "true"

- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v4.16.0
uses: stefanzweifel/git-auto-commit-action@v5.0.0
with:
commit_message: |
🛠 Updatecli pipeline bump
Expand All @@ -70,7 +70,7 @@ jobs:
token: ${{ secrets.BOT_GITHUB_TOKEN }}

- uses: >-
Alfresco/alfresco-build-tools/.github/actions/get-branch-name@v3.1.0
Alfresco/alfresco-build-tools/.github/actions/get-branch-name@v3.6.0
- name: Login to quay.io
uses: docker/login-action@v3
Expand Down Expand Up @@ -102,15 +102,15 @@ jobs:
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
UPDATECLI_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}

- uses: Alfresco/alfresco-build-tools/.github/actions/setup-helm-docs@v3.1.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-helm-docs@v3.6.0
- name: Regenerate helm docs if necessary
uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v3.1.0
uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v3.6.0
with:
pre-commit-args: helm-docs || true
skip_checkout: "true"

- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v4.16.0
uses: stefanzweifel/git-auto-commit-action@v5.0.0
with:
commit_message: |
🛠 Updatecli pipeline acs bump
Expand Down
2 changes: 1 addition & 1 deletion charts/alfresco-common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: |
A helper subchart to avoid duplication in alfresco charts and set common
external dependencies
type: library
version: 3.0.0-alpha.3
version: 3.0.0-alpha.4
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
Expand Down
2 changes: 1 addition & 1 deletion charts/alfresco-common/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# alfresco-common

![Version: 3.0.0-alpha.3](https://img.shields.io/badge/Version-3.0.0--alpha.3-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)
![Version: 3.0.0-alpha.4](https://img.shields.io/badge/Version-3.0.0--alpha.4-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)

A helper subchart to avoid duplication in alfresco charts and set common
external dependencies
Expand Down
6 changes: 3 additions & 3 deletions charts/alfresco-common/templates/_helpers-jdbc.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ Usage: include "alfresco-common.db.hostname" "URL"
{{/*
Provide database port from JDBC URL
Usage: include "alfresco-common.db.port" (dict "url" "someurl")
Usage: include "alfresco-common.db.port" "URL"
*/}}
{{- define "alfresco-common.db.port" -}}
{{- $socket := (index (include "alfresco-common.jdbc.parser" .url | fromJson) "jdbc" "host") }}
{{- $socket := (index (include "alfresco-common.jdbc.parser" . | fromJson) "jdbc" "host") }}
{{- if gt ($socket | splitList ":" | len) 1 }}
{{- $socket | splitList ":" | last }}
{{- else }}
{{- template "alfresco-common.db.default.port" (index (include "alfresco-common.jdbc.parser" .url | fromJson) "jdbc" "scheme") }}
{{- template "alfresco-common.db.default.port" (index (include "alfresco-common.jdbc.parser" . | fromJson) "jdbc" "scheme") }}
{{- end }}
{{- end -}}
Expand Down
6 changes: 3 additions & 3 deletions charts/alfresco-repository/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dependencies:
- name: alfresco-common
repository: https://alfresco.github.io/alfresco-helm-charts/
version: 3.0.0-alpha.3
version: 3.0.0-alpha.4
- name: postgresql
repository: oci://registry-1.docker.io/bitnamicharts
version: 12.5.6
digest: sha256:fc5f240540fd10560dca1e88b13601b18128e2fbf0ed0b52ab9294ad58dff037
generated: "2023-10-18T14:43:10.28712+02:00"
digest: sha256:569e88f1d311e341437a62bae88d6bca83b986d8f40cb9bbafd4f33aa4e9ed8f
generated: "2023-10-27T17:28:14.899057+02:00"
4 changes: 2 additions & 2 deletions charts/alfresco-repository/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apiVersion: v2
name: alfresco-repository
description: Alfresco content repository Helm chart
type: application
version: 0.1.0-alpha.19
version: 0.1.0-alpha.21
appVersion: 23.1.0-A21
dependencies:
- name: alfresco-common
version: 3.0.0-alpha.3
version: 3.0.0-alpha.4
repository: https://alfresco.github.io/alfresco-helm-charts/
- name: postgresql
version: 12.5.6
Expand Down
6 changes: 2 additions & 4 deletions charts/alfresco-repository/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# alfresco-repository

![Version: 0.1.0-alpha.19](https://img.shields.io/badge/Version-0.1.0--alpha.19-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 23.1.0-A21](https://img.shields.io/badge/AppVersion-23.1.0--A21-informational?style=flat-square)
![Version: 0.1.0-alpha.21](https://img.shields.io/badge/Version-0.1.0--alpha.21-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 23.1.0-A21](https://img.shields.io/badge/AppVersion-23.1.0--A21-informational?style=flat-square)

Alfresco content repository Helm chart

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0-alpha.3 |
| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0-alpha.4 |
| oci://registry-1.docker.io/bitnamicharts | postgresql | 12.5.6 |

## Values
Expand All @@ -20,8 +20,6 @@ Alfresco content repository Helm chart
| command | list | `[]` | |
| configuration.db.driver | string | `nil` | JDBC driver class of the driver if none is provided the it is guessed from the URL provided |
| configuration.db.existingConfigMap.keys.driver | string | `"DATABASE_DRIVER"` | configmap key where to find the JDBC driver class to use. The configmap may leverage the alfresco-repository.db.cm named template to auto-generate it from the sole url parameter. |
| configuration.db.existingConfigMap.keys.host | string | `"DATABASE_HOST"` | configmap key where to find the hostname part of the database URL. The configmap may leverage the alfresco-repository.db.cm named template to auto-generate it from the sole url parameter. |
| configuration.db.existingConfigMap.keys.port | string | `"DATABASE_PORT"` | configmap key where to find the port part of the database URL. The configmap may leverage the alfresco-repository.db.cm named template to auto-generate it from the sole url parameter. |
| configuration.db.existingConfigMap.keys.url | string | `"DATABASE_URL"` | configmap key where to find the URL of the database |
| configuration.db.existingConfigMap.name | string | `nil` | |
| configuration.db.existingSecret | object | `{"keys":{"password":"DATABASE_PASSWORD","username":"DATABASE_USERNAME"},"name":null}` | Existing secret and their keys where to find the database username & password. |
Expand Down
12 changes: 0 additions & 12 deletions charts/alfresco-repository/templates/_helpers-database.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ Usage: include "alfresco-repository.db.env" $
configMapKeyRef:
name: {{ $dbcm }}
key: {{ .existingConfigMap.keys.url }}
- name: DATABASE_HOST
valueFrom:
configMapKeyRef:
name: {{ $dbcm }}
key: {{ .existingConfigMap.keys.host }}
- name: DATABASE_PORT
valueFrom:
configMapKeyRef:
name: {{ $dbcm }}
key: {{ .existingConfigMap.keys.port }}
- name: DATABASE_DRIVER
valueFrom:
configMapKeyRef:
Expand All @@ -39,7 +29,5 @@ Usage: include "alfresco-repository.db.cm" (dict "url" "" "driver" "")
*/}}
{{- define "alfresco-repository.db.cm" -}}
DATABASE_URL: {{ hasPrefix "jdbc:" .url | ternary .url (print "jdbc:" .url) }}
DATABASE_HOST: {{ template "alfresco-common.db.hostname" .url }}
DATABASE_PORT: {{ include "alfresco-common.db.port" . | quote }}
DATABASE_DRIVER: {{ template "alfresco-common.db.driver" . }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
-Ddb.url="$DATABASE_URL"
-Ddb.username=${DATABASE_USERNAME}
-Ddb.password=${DATABASE_PASSWORD}
-Ddb.driver="$DATABASE_DRIVER"
-Ddb.driver="${DATABASE_DRIVER}"
-Dmessaging.broker.url="$BROKER_URL"
-Dmessaging.broker.username="$BROKER_USERNAME"
-Dmessaging.broker.password="$BROKER_PASSWORD"
Expand Down
24 changes: 15 additions & 9 deletions charts/alfresco-repository/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ spec:
{{- include "alfresco-repository.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "alfresco-repository.serviceAccountName" . }}
{{- include "component-pod-security-context" .Values | indent 4 }}
{{- include "alfresco-common.component-pod-security-context" .Values | indent 4 }}
nodeSelector:
{{- toYaml .Values.nodeSelector | nindent 8 }}
{{- include "alfresco-content-services.imagePullSecrets" . | indent 6 }}
{{- include "alfresco-common.imagePullSecrets" . | indent 6 }}
initContainers:
- name: wait-db-ready
image: busybox:1.35
imagePullPolicy: IfNotPresent
{{- include "component-security-context" dict | indent 8 }}
{{- include "alfresco-common.component-security-context" dict | indent 8 }}
resources:
limits:
cpu: "0.25"
Expand All @@ -40,13 +40,19 @@ spec:
- sh
- -c
- |
until nc -w1 $(DATABASE_HOST):$(DATABASE_PORT)
do echo "waiting for database on $(DATABASE_HOST):$(DATABASE_PORT)"
sleep 2
done
NCTARGET=$(echo DATABASE_URL | awk -F ';|/' '{print $3}')
if [[ "$NCTARGET" == *":"* ]]; then
until nc -vw1 $NCTARGET; do
sleep 2
done
else echo "No port in jdbc URL $DATABASE_URL. Can't guess it so skipping db status check"
fi
{{- range .Values.extraInitContainers }}
{{- list . | toYaml | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- include "component-security-context" .Values | indent 8 }}
{{- include "alfresco-common.component-security-context" .Values | indent 8 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- $dbsecretCtx := dict }}
Expand Down Expand Up @@ -189,7 +195,7 @@ spec:
{{ tpl (toYaml (list .)) $ | nindent 8 }}
{{- end }}
volumes:
{{- include "data_volume" .Values | nindent 8 }}
{{- include "alfresco-common.data_volume" .Values | nindent 8 }}
{{- if .Values.configuration.repository.existingConfigMap }}
- name: global-properties
configMap:
Expand Down
2 changes: 1 addition & 1 deletion charts/alfresco-repository/templates/secret-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
labels:
{{- include "alfresco-repository.labels" . | nindent 4 }}
type: Opaque
{{- $reqmsg := "Either provide database credentiasl as values, or provide a secret that contains them." }}
{{- $reqmsg := "Either provide database credentials as values, or provide a secret that contains them." }}
data:
DATABASE_USERNAME: {{ required $reqmsg .Values.configuration.db.username | b64enc | quote }}
DATABASE_PASSWORD: {{ required $reqmsg .Values.configuration.db.password | b64enc | quote }}
Expand Down
24 changes: 0 additions & 24 deletions charts/alfresco-repository/tests/configmap_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ tests:
- equal:
path: data.DATABASE_URL
value: jdbc:mysql://sandy:secret@myhost1:1111
- equal:
path: data.DATABASE_HOST
value: myhost1
- equal:
path: data.DATABASE_PORT
value: "1111"
- equal:
path: data.DATABASE_DRIVER
value: com.mysql.jdbc.Driver
Expand All @@ -79,12 +73,6 @@ tests:
- equal:
path: data.DATABASE_URL
value: jdbc:postgresql://pghost/alfdb
- equal:
path: data.DATABASE_HOST
value: pghost
- equal:
path: data.DATABASE_PORT
value: "5432"
- equal:
path: data.DATABASE_DRIVER
value: org.postgresql.Driver
Expand All @@ -99,12 +87,6 @@ tests:
- equal:
path: data.DATABASE_URL
value: jdbc:sqlserver://sqlserverhost;databaseName=alfdb;lockTimeout=1000;
- equal:
path: data.DATABASE_HOST
value: sqlserverhost
- equal:
path: data.DATABASE_PORT
value: "1434"
- equal:
path: data.DATABASE_DRIVER
value: com.microsoft.sqlserver.jdbc.SQLServerDriver
Expand All @@ -119,12 +101,6 @@ tests:
- equal:
path: data.DATABASE_URL
value: jdbc:oracle:thin:@tcp://mydbhost:1521/mydbservice
- equal:
path: data.DATABASE_HOST
value: mydbhost
- equal:
path: data.DATABASE_PORT
value: "1521"
- equal:
path: data.DATABASE_DRIVER
value: oracle.jdbc.OracleDriver
Expand Down
45 changes: 29 additions & 16 deletions charts/alfresco-repository/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,6 @@ tests:
memory: "8Gi"
template: deployment.yaml

- it: should have wait-db-ready initcontainer
asserts:
- equal:
path: spec.template.spec.initContainers[0].name
value: wait-db-ready
template: deployment.yaml
- contains:
path: spec.template.spec.initContainers[0].command
content: |
until nc -w1 $(DATABASE_HOST):$(DATABASE_PORT)
do echo "waiting for database on $(DATABASE_HOST):$(DATABASE_PORT)"
sleep 2
done
template: deployment.yaml

- it: should have custom extra volumes when defined
set:
extraVolumes:
Expand Down Expand Up @@ -137,6 +122,7 @@ tests:
mountPath: /usr/local/tomcat/shared/classes/alfresco/extension/subsystems/Authentication/ldap-ad/myAzureAD
readOnly: true
template: deployment.yaml

- it: should not have any license volume but vars instead
set:
configuration:
Expand Down Expand Up @@ -175,7 +161,7 @@ tests:
name: RELEASE-NAME-alfresco-database
key: DATABASE_URL

- it: should render configured DATABASE URL
- it: should render deployment using provided database cm
set:
configuration:
db:
Expand All @@ -193,3 +179,30 @@ tests:
configMapKeyRef:
name: mycm
key: DBURL
- contains:
path: spec.template.spec.containers[0].env
content:
name: DATABASE_DRIVER
valueFrom:
configMapKeyRef:
name: mycm
key: DBDRIVER

- it: should deploy with extra containers
values: *test_values
set:
extraInitContainers:
- name: init1
image: init:latest
extraSideContainers:
- name: sidecar1
image: sidecar:latest
asserts:
- lengthEqual:
path: spec.template.spec.initContainers
count: 2
template: deployment.yaml
- lengthEqual:
path: spec.template.spec.containers
count: 2
template: deployment.yaml
Loading

0 comments on commit 8fb9b70

Please sign in to comment.