Skip to content

Commit

Permalink
Merge pull request #37 from chgl/lint-and-test-charts
Browse files Browse the repository at this point in the history
[FHIR] added workflow to lint and test charts
  • Loading branch information
lmsurpre authored Sep 24, 2021
2 parents d0c3b93 + c93e2c5 commit 6e70612
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 8 deletions.
20 changes: 20 additions & 0 deletions .ct/chart-schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: str()
home: str()
version: str()
apiVersion: str()
appVersion: any(str(), num(), required=False)
type: str()
dependencies: any(required=False)
description: str()
keywords: list(str(), required=False)
sources: list(str(), required=False)
maintainers: list(include('maintainer'), required=False)
icon: str(required=False)
deprecated: bool(required=False)
kubeVersion: str(required=False)
annotations: map(str(), str(), required=False)
---
maintainer:
name: str()
email: str(required=False)
url: str(required=False)
15 changes: 15 additions & 0 deletions .ct/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
remote: origin
target-branch: main
chart-yaml-schema: .ct/chart-schema.yaml
validate-maintainers: false
validate-chart-schema: true
validate-yaml: true
check-version-increment: true
chart-dirs:
- charts
helm-extra-args: --timeout 10m
upgrade: true
skip-missing-values: true
release-label: release
chart-repos:
- bitnami=https://charts.bitnami.com/bitnami
78 changes: 78 additions & 0 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Lint and Test Charts

on:
pull_request:
branches: [main]

jobs:
pre-commit-check:
runs-on: ubuntu-20.04
steps:
- name: Install helm-docs
working-directory: /tmp
env:
HELM_DOCS_URL: https://github.com/norwoodj/helm-docs/releases/download/v1.5.0/helm-docs_1.5.0_Linux_x86_64.tar.gz
run: |
curl -LSs $HELM_DOCS_URL | tar xz && \
mv ./helm-docs /usr/local/bin/helm-docs && \
chmod +x /usr/local/bin/helm-docs && \
helm-docs --version
- uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install pre-commit
run: pip install pre-commit

- uses: actions/checkout@v2

- name: run pre-commit
run: pre-commit run --all-files --show-diff-on-failure

lint:
runs-on: ubuntu-20.04
container: quay.io/helmpack/chart-testing:v3.4.0
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Run chart-testing (lint)
run: ct lint --config .ct/config.yaml

test:
runs-on: ubuntu-20.04
needs:
- lint
- pre-commit-check
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.7.0

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config .ct/config.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Create k8s Kind Cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: ct install --config .ct/config.yaml
if: steps.list-changed.outputs.changed == 'true'
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/norwoodj/helm-docs
rev: v1.2.0
rev: v1.5.0
hooks:
- id: helm-docs
args:
Expand Down
6 changes: 6 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: default
rules:
line-length: disable
document-start: disable
ignore: |
charts/**/templates
8 changes: 6 additions & 2 deletions charts/ibm-fhir-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
description: Helm chart for the IBM FHIR Server
name: ibm-fhir-server
version: 0.2.0
version: 0.2.1
appVersion: 4.9.1
dependencies:
- name: postgresql
Expand All @@ -11,6 +11,8 @@ dependencies:
sources:
- https://github.com/Alvearie/alvearie-helm
- https://github.com/IBM/FHIR
home: https://ibm.github.io/FHIR/
type: application
maintainers:
- name: Lee Surprenant
email: [email protected]
Expand All @@ -22,4 +24,6 @@ annotations:
# When using the list of objects option the valid supported kinds are
# added, changed, deprecated, removed, fixed, and security.
- kind: added
description: included a PostgreSQL sub-chart to simplify out-of-the box installation
description: added `home` and `type` fields to Chart.yaml
- kind: changed
description: set default `replicaCount` for the FHIR server pods to 1
5 changes: 2 additions & 3 deletions charts/ibm-fhir-server/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![AppVersion: 4.9.1](https://img.shields.io/badge/AppVersion-4.9.1-informational?style=flat-square)
![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.9.1](https://img.shields.io/badge/AppVersion-4.9.1-informational?style=flat-square)

# The IBM FHIR Server Helm Chart

Expand Down Expand Up @@ -233,7 +233,7 @@ If the `objectStorage.objectStorageSecret` value is set, this helm chart will on
| postgresql.image.tag | string | `"13.4.0-debian-10-r37"` | the tag for the postgresql image |
| postgresql.postgresqlDatabase | string | `"fhir"` | name of the database to create. see: <https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-on-first-run> |
| postgresql.postgresqlExtendedConf | object | `{"maxPreparedTransactions":24}` | Extended Runtime Config Parameters (appended to main or default configuration) |
| replicaCount | int | `2` | The number of replicas for the externally-facing FHIR server pods |
| replicaCount | int | `1` | The number of replicas for the externally-facing FHIR server pods |
| resources.limits.ephemeral-storage | string | `"1Gi"` | |
| resources.limits.memory | string | `"5Gi"` | |
| resources.requests.ephemeral-storage | string | `"1Gi"` | |
Expand All @@ -253,6 +253,5 @@ If the `objectStorage.objectStorageSecret` value is set, this helm chart will on
| security.smartScopes | list | openid, profile, fhirUser, launch/patient, offline_access, and a set of patient/<resource>.read scopes for a number of resource types. | OAuth 2.0 scopes to advertise from the server |
| serverRegistryResourceProviderEnabled | bool | `false` | Indicates whether the server registry resource provider should be used by the FHIR registry component to access definitional resources through the persistence layer |
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
2 changes: 1 addition & 1 deletion charts/ibm-fhir-server/templates/tests/test-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
- name: get-patient
image: docker.io/curlimages/curl:7.78.0
command: ["/bin/sh", "-exc"]
args: ["curl -vvv --insecure --fail -u ${FHIR_USER_NAME}:${FHIR_USER_PASSWORD} https://${FHIR_SERVER_HOST}:9443/fhir-server/api/v4/Patient"]
args: ["curl -vvv --retry-connrefuse --connect-timeout 30 --max-time 120 --retry 5 --retry-delay 15 --insecure --fail -u ${FHIR_USER_NAME}:${FHIR_USER_PASSWORD} https://${FHIR_SERVER_HOST}:9443/fhir-server/api/v4/Patient"]
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down
3 changes: 2 additions & 1 deletion charts/ibm-fhir-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fullnameOverride:
nameOverride:

# -- The number of replicas for the externally-facing FHIR server pods
replicaCount: 2
replicaCount: 1
image:
repository: ibmcom/ibm-fhir-server
tag: "4.9.1"
Expand All @@ -17,6 +17,7 @@ restrictEndpoints: false
# -- Control which interactions are supported for which resource type endpoints
# @default -- A single entry for resourceType "Resource" that applies to all resource types
endpoints:
# yamllint disable-line rule:comments
- # -- A valid FHIR resource type; use "Resource" for whole-system behavior
resourceType: Resource
# -- (list) Valid _include arguments while searching this resource type; nil means no restrictions
Expand Down

0 comments on commit 6e70612

Please sign in to comment.