Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ac54efa
feat: add GitHub Actions workflow for linting and testing Helm charts
gomezbc Apr 8, 2025
c5d162d
fix: comment out frontend image build step in Helm workflow
gomezbc Apr 8, 2025
3511c4c
fix: correct template reference for external database secret creation
gomezbc Apr 8, 2025
813a640
fix: update Helm test workflow to use 'testing' tags and set target b…
gomezbc Apr 8, 2025
e88cf88
fix: database secret creation logic
gomezbc Apr 8, 2025
cd2185c
Merge branch 'main' of https://github.com/eclipse-tractusx/industry-c…
gomezbc Apr 9, 2025
fb84563
fix: update Helm test workflow to correctly build frontend image
gomezbc Apr 9, 2025
b413b0a
fix: improve Helm test workflow formatting and structure
gomezbc Apr 9, 2025
30eae69
chore: update package-lock.json
gomezbc Apr 9, 2025
948486b
fix: update frontend service to use port 8080 instead of priviliged p…
gomezbc Apr 9, 2025
8456abd
fix: update backend and frontend service ports to use new port config…
gomezbc Apr 9, 2025
0e150e8
fix: include Dockerfile in Helm test workflow triggers
gomezbc Apr 9, 2025
7af3ab7
fix: comment out unused upgrade_from parameter in Helm test workflow
gomezbc Apr 9, 2025
fd17247
fix: add license header to Helm test workflow file
gomezbc Apr 9, 2025
d404cfb
fix: set action versions to commit tags in Helm test workflow
gomezbc Apr 9, 2025
2f72b32
fix: update Helm chart version to 0.1.1 and fix workflow triggers (on…
gomezbc Apr 10, 2025
e8637f7
fix: ensure newline at end of files and removed trailling spaces in H…
gomezbc Apr 10, 2025
0df816d
fix: add Helm repos setup step in the test workflow
gomezbc Apr 10, 2025
dd2c604
Merge branch 'main' into main
gomezbc Apr 24, 2025
d20f566
chore: update DEPENDENCIES_ICHUB-FRONTEND file
gomezbc Apr 25, 2025
ee20baf
fix: update Docker build-push-action to specific version v6.16.0 in h…
gomezbc Apr 28, 2025
38e79b2
Merge branch 'main' into main
gomezbc Apr 29, 2025
f95a763
Update .github/workflows/helm-test.yaml
gomezbc Apr 29, 2025
facbc1a
Update .github/workflows/helm-test.yaml
gomezbc Apr 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions .github/workflows/helm-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#################################################################################
# Eclipse Tractus-X - Industry Core Hub Frontend
#
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the
# License for the specific language govern in permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#################################################################################

name: Lint and Test Charts

on:
push:
paths:
- "charts/industry-core-hub/**"
branches: main
pull_request:
paths:
- "charts/industry-core-hub/**"
branches: main
workflow_dispatch:
inputs:
node_image:
description: "kindest/node image for k8s kind cluster"
# k8s version from 3.1 release as default
default: "kindest/node:v1.27.3"
required: false
type: string
# upgrade_from:
# description: "chart version to upgrade from"
# # chart version from 3.1 release as default
# default: "x.x.x"
# required: false
# type: string
helm_version:
description: "helm version to test (default = latest)"
default: "latest"
required: false
type: string

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Kubernetes KinD Cluster
uses: container-tools/kind-action@0ad70e2299366b0e1552c7240f4e4567148f723e # v2.0.4
with:
# upgrade version, default (v0.17.0) uses node image v1.21.1 and doesn't work with more recent node image versions
version: v0.20.0
# default value for event_name != workflow_dispatch
node_image: ${{ github.event.inputs.node_image || 'kindest/node:v1.27.3' }}

- name: Build backend image
uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:ichub-backend"
push: true
tags: kind-registry:5000/ichub-backend:testing

- name: Build frontend image
uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:ichub-frontend"
push: true
tags: kind-registry:5000/ichub-frontend:testing

- name: Set up Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4
with:
version: ${{ github.event.inputs.helm_version || 'latest' }}

- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: "3.9"
check-latest: true
- name: Set up chart-testing
uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2.7.0

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi

- name: Run chart-testing (lint)
run: ct lint --validate-maintainers=false --target-branch ${{ github.event.repository.default_branch }}

- name: Setup Helm repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add runix https://helm.runix.net

- name: Run chart-testing (install)
run: ct install --charts charts/industry-core-hub --target-branch ${{ github.event.repository.default_branch }} --helm-extra-set-args "--set backend.image.repository=kind-registry:5000/ichub-backend --set backend.image.tag=testing --set frontend.image.repository=kind-registry:5000/ichub-frontend --set frontend.image.tag=testing"
if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true'

# Upgrade the released chart version with the locally available chart
# default value for event_name != workflow_dispatch
# industry-core-hub: we don't have yet a released chart
#- name: Run helm upgrade
# run: |
# helm repo add bitnami https://charts.bitnami.com/bitnami
# helm repo add tractusx-dev https://eclipse-tractusx.github.io/charts/dev
# helm install [NAME] tractusx-dev/[CHART] --version ${{ github.event.inputs.upgrade_from || 'x.x.x' }}
# helm dependency update charts/[CHART]
# helm upgrade [NAME] charts/[CHART]
# if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true'
4 changes: 2 additions & 2 deletions charts/industry-core-hub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apiVersion: v2
name: industry-core-hub
type: application
appVersion: "0.0.1"
version: 0.1.0
version: 0.1.1
description: A Helm chart for Eclipse Tractus-X - Industry Core Hub
home: https://github.com/eclipse-tractusx/industry-core-hub
sources:
Expand All @@ -35,4 +35,4 @@ dependencies:
- condition: pgadmin4.enabled
name: pgadmin4
repository: https://helm.runix.net
version: 1.25.x
version: 1.25.x
11 changes: 1 addition & 10 deletions charts/industry-core-hub/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,6 @@ Get the database secret key
{{- end -}}
{{- end -}}

{{/*
Return true if a secret object should be created for external database
*/}}
{{- define "industry-core-hub.externalDatabase.createSecret" -}}
{{- if and (not .Values.postgresql.enabled) (not .Values.externalDatabase.existingSecret) }}
{{- true -}}
{{- end -}}
{{- end -}}

{{/*
Return the postgresql URL
*/}}
Expand All @@ -227,4 +218,4 @@ Get the postgres configmap name
*/}}
{{- define "industry-core-hub.postgresql.configmap" -}}
{{- printf "%s-cm-postgres" .Release.Name -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ data:
02-init-db.sql: |
CREATE SCHEMA ichub;
ALTER SCHEMA ichub OWNER TO ichub;
{{- end -}}
{{- end -}}
10 changes: 5 additions & 5 deletions charts/industry-core-hub/templates/deployment-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/}}
{{ if .Values.backend.enabled }}
apiVersion: apps/v1
kind: Deployment

Check warning on line 23 in charts/industry-core-hub/templates/deployment-backend.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used
metadata:
name: {{ include "industry-core-hub.fullname.backend" . }}
labels:
Expand Down Expand Up @@ -59,7 +59,7 @@
imagePullPolicy: {{ .Values.backend.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.backend.service.port }}
containerPort: {{ .Values.backend.service.portContainer }}
protocol: TCP
env:
- name: DATABASE__HOST
Expand All @@ -73,13 +73,13 @@
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "industry-core-hub.postgresql.secretName" . }}

Check warning on line 76 in charts/industry-core-hub/templates/deployment-backend.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Readiness Probe Is Not Configured

Check if Readiness Probe is not configured.

Check warning on line 76 in charts/industry-core-hub/templates/deployment-backend.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[LOW] Image Pull Policy Of The Container Is Not Set To Always

Image Pull Policy of the container must be defined and set to Always

Check warning on line 76 in charts/industry-core-hub/templates/deployment-backend.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[LOW] Image Without Digest

Images should be specified together with their digests to ensure integrity
key: {{ include "industry-core-hub.postgresql.ichub.secretKey" . }}
{{- if .Values.backend.healthChecks.startup.enabled }}
startupProbe:
httpGet:
path: {{ .Values.backend.healthChecks.startup.path }}
port: {{ .Values.backend.service.port }}
port: {{ .Values.backend.service.portContainer }}
scheme: HTTP
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
Expand All @@ -91,7 +91,7 @@
livenessProbe:
httpGet:
path: {{ .Values.backend.healthChecks.liveness.path }}
port: {{ .Values.backend.service.port }}
port: {{ .Values.backend.service.portContainer }}
scheme: HTTP
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
Expand All @@ -103,7 +103,7 @@
readinessProbe:
httpGet:
path: {{ .Values.backend.healthChecks.readiness.path }}
port: {{ .Values.backend.service.port }}
port: {{ .Values.backend.service.portContainer }}
scheme: HTTP
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
Expand Down Expand Up @@ -153,4 +153,4 @@
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
10 changes: 5 additions & 5 deletions charts/industry-core-hub/templates/deployment-frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "industry-core-hub.fullname.frontend" . }}

Check warning on line 26 in charts/industry-core-hub/templates/deployment-frontend.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used
labels:
{{- include "industry-core-hub.labels" . | nindent 4 }}
spec:
Expand Down Expand Up @@ -57,10 +57,10 @@
securityContext:
{{- toYaml .Values.frontend.securityContext | nindent 12 }}
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}

Check warning on line 60 in charts/industry-core-hub/templates/deployment-frontend.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[LOW] Image Pull Policy Of The Container Is Not Set To Always

Image Pull Policy of the container must be defined and set to Always
ports:
- name: http
containerPort: {{ .Values.frontend.service.port }}
containerPort: {{ .Values.frontend.service.portContainer }}
protocol: TCP
env:
- name: ICHUB_BACKEND_URL
Expand All @@ -69,7 +69,7 @@
startupProbe:
httpGet:
path: {{ .Values.frontend.healthChecks.startup.path }}
port: {{ .Values.frontend.service.port }}
port: {{ .Values.frontend.service.portContainer }}
scheme: HTTP
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
Expand All @@ -81,7 +81,7 @@
livenessProbe:
httpGet:
path: {{ .Values.frontend.healthChecks.liveness.path }}
port: {{ .Values.frontend.service.port }}
port: {{ .Values.frontend.service.portContainer }}
scheme: HTTP
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
Expand All @@ -93,7 +93,7 @@
readinessProbe:
httpGet:
path: {{ .Values.frontend.healthChecks.readiness.path }}
port: {{ .Values.frontend.service.port }}
port: {{ .Values.frontend.service.portContainer }}
scheme: HTTP
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
Expand Down Expand Up @@ -129,4 +129,4 @@
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* SPDX-License-Identifier: Apache-2.0
*/}}

{{- if and .Values.backend.enabled (not .Values.postgresql.enabled) (include "industry-core-hub.industry-core-hub.externalDatabase.createSecret" .) -}}
{{- if not .Values.postgresql.enabled -}}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -41,4 +41,4 @@ stringData:
# if secret doesn't exist, use provided value from values file or generate a random one
ichub-password: {{ .Values.externalDatabase.password | default ( randAlphaNum 32 ) | quote }}
{{ end }}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* SPDX-License-Identifier: Apache-2.0
*/}}

{{- if and .Values.backend.enabled .Values.postgresql.enabled -}}
{{- if .Values.postgresql.enabled -}}
apiVersion: v1
kind: Secret
metadata:
Expand Down
6 changes: 3 additions & 3 deletions charts/industry-core-hub/templates/service-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
{{ if .Values.backend.enabled }}
apiVersion: v1
kind: Service
metadata:

Check warning on line 25 in charts/industry-core-hub/templates/service-backend.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used
name: {{ include "industry-core-hub.fullname.backend" . }}
labels: {{ include "industry-core-hub.labels" . | nindent 4 }}
spec:
type: {{ .Values.backend.service.type }}
ports:
- port: {{ .Values.backend.service.port }}
targetPort: {{ .Values.backend.service.targetPort }}
- port: {{ .Values.backend.service.portService }}
targetPort: {{ .Values.backend.service.portContainer }}
protocol: TCP
name: http
selector: {{ include "industry-core-hub.frontend.selectorLabels" . | nindent 4 }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/industry-core-hub/templates/service-frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
{{ if .Values.frontend.enabled }}
apiVersion: v1
kind: Service
metadata:

Check warning on line 25 in charts/industry-core-hub/templates/service-frontend.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used
name: {{ include "industry-core-hub.fullname.frontend" . }}
labels: {{ include "industry-core-hub.labels" . | nindent 4 }}
spec:
type: {{ .Values.frontend.service.type }}
ports:
- port: {{ .Values.frontend.service.port }}
targetPort: {{ .Values.frontend.service.targetPort }}
- port: {{ .Values.frontend.service.portService }}
targetPort: {{ .Values.frontend.service.portContainer }}
protocol: TCP
name: http
selector: {{ include "industry-core-hub.frontend.selectorLabels" . | nindent 4 }}
{{- end }}
{{- end }}
Loading
Loading