From c69066f318214d2cce8c05dfa76bde1b46c530e0 Mon Sep 17 00:00:00 2001 From: Liviu Anita Date: Tue, 21 May 2024 11:57:39 +0100 Subject: [PATCH] action test to see if worth doing --- .github/workflows/api_ops_tests.yaml | 48 +++++++++++++++++++ api/local/api/Chart.yaml | 18 +++---- api/local/api/templates/service.yaml | 1 - .../api/templates/tests/test-connection.yaml | 2 +- api/local/api/values.yaml | 4 +- 5 files changed, 57 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/api_ops_tests.yaml diff --git a/.github/workflows/api_ops_tests.yaml b/.github/workflows/api_ops_tests.yaml new file mode 100644 index 00000000..909f6a3d --- /dev/null +++ b/.github/workflows/api_ops_tests.yaml @@ -0,0 +1,48 @@ +# See https://github.com/helm/chart-testing-action +name: Lint and Test Charts + +on: + push: + branches: + #- main + - local_api_infra + pull_request: + workflow_dispatch: + +jobs: + ops-lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install Helm + uses: azure/setup-helm@v3 + # as of 2022/12 the set-output still not fixed in this action + # https://github.com/Azure/setup-helm/issues/103 + with: + version: v3.12.1 + + - name: Install chart-testing + uses: helm/chart-testing-action@v2.6.0 + + - name: Run chart-testing (lint) + run: ct lint --charts ./api/local/api --debug + + - name: Start minikube - if this breaks on local do a 'minikube delete' + id: minikube + uses: medyagh/setup-minikube@master + with: + cpus: 2 + memory: 2G # 1.9G recommended minimum + start-args: '--force' + + - name: Run chart-testing (install) + run: ct install --charts ./api/local/api + + - name: Cleanup + run: | + minikube delete + if: ${{ always() }} \ No newline at end of file diff --git a/api/local/api/Chart.yaml b/api/local/api/Chart.yaml index cc238c07..c949671e 100644 --- a/api/local/api/Chart.yaml +++ b/api/local/api/Chart.yaml @@ -1,24 +1,18 @@ apiVersion: v2 name: api description: A Helm chart for Kubernetes +maintainers: + # See https://github.com/helm/chart-testing/issues/192 + # for why the maintainer doesn't validate if the name field is the name of an actual human that exists (afaict) + - name: LA # Liviu Anita + email: liviu@ebi.ac.uk -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. type: application -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) version: 0.1.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "1.16.0" +appVersion: "0.1.0" diff --git a/api/local/api/templates/service.yaml b/api/local/api/templates/service.yaml index 1bdc3d49..72a8f3b3 100644 --- a/api/local/api/templates/service.yaml +++ b/api/local/api/templates/service.yaml @@ -7,6 +7,5 @@ spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.port }} - nodePort: {{ .Values.service.port }} selector: {{- include "api.selectorLabels" . | nindent 4 }} diff --git a/api/local/api/templates/tests/test-connection.yaml b/api/local/api/templates/tests/test-connection.yaml index 06a77246..995c137f 100644 --- a/api/local/api/templates/tests/test-connection.yaml +++ b/api/local/api/templates/tests/test-connection.yaml @@ -11,5 +11,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "api.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "api.fullname" . }}:{{ .Values.service.port }}/v1/openapi.json'] restartPolicy: Never diff --git a/api/local/api/values.yaml b/api/local/api/values.yaml index 968f2cbc..16ad8171 100644 --- a/api/local/api/values.yaml +++ b/api/local/api/values.yaml @@ -22,7 +22,7 @@ ingress: - path: / pathType: ImplementationSpecific -resources: +resources: limits: memory: "1G" cpu: "1" @@ -33,4 +33,4 @@ api_env: mongoHost: "" dbName: "bia-integrator" jwtSecretKey: "" - userCreateSecretToken: "" \ No newline at end of file + userCreateSecretToken: ""