From c17621e564e980951b2a44f4711a5b40968dadcb Mon Sep 17 00:00:00 2001 From: Spencer Bliven Date: Fri, 28 Jun 2024 17:17:14 +0200 Subject: [PATCH] Add jobConfig.json file This isn't read by the current version, but let's check if it gets written from the secret correctly. Also uncomment the be workflow --- .github/workflows/scicat-be.yml | 130 +++++++++++++------------- helm/configs/backend-next/values.yaml | 14 ++- 2 files changed, 75 insertions(+), 69 deletions(-) diff --git a/.github/workflows/scicat-be.yml b/.github/workflows/scicat-be.yml index fa12347a..2c1fb3fb 100644 --- a/.github/workflows/scicat-be.yml +++ b/.github/workflows/scicat-be.yml @@ -1,70 +1,70 @@ -# name: scicat-be +name: scicat-be -# on: -# workflow_dispatch: -# inputs: -# submodule_commit: -# description: 'Commit of the submodule to deploy' -# required: false -# commit: -# description: 'Commit of the CI repo to deploy' -# required: false -# pull_request: -# branches: [ main ] -# push: -# branches: [ main ] -# release: -# types: [published] +on: + workflow_dispatch: + inputs: + submodule_commit: + description: 'Commit of the submodule to deploy' + required: false + commit: + description: 'Commit of the CI repo to deploy' + required: false + pull_request: + branches: [ main ] + push: + branches: [ main ] + release: + types: [published] -# jobs: +jobs: -# set_env: -# uses: ./.github/workflows/reusable.environment.yml -# with: -# commit: ${{ github.event.inputs.commit }} -# submodule_commit: ${{ github.event.inputs.submodule_commit }} + set_env: + uses: ./.github/workflows/reusable.environment.yml + with: + commit: ${{ github.event.inputs.commit }} + submodule_commit: ${{ github.event.inputs.submodule_commit }} -# check_changed: -# needs: set_env -# uses: ./.github/workflows/reusable.changes.yml -# with: -# files: | -# .github/workflows/scicat-be.yml -# helm/configs/backend/values.yaml -# helm/configs/backend/login-callbacks.js -# helm/configs/backend/config.local.js -# helm/configs/backend/job-template.html -# helm/configs/backend/${{ needs.set_env.outputs.environment }}/** -# backend/** -# helm/configs/backend/authorizedJobs.js -# commit: ${{ needs.set_env.outputs.commit }} -# submodule_commit: ${{ github.event.inputs.submodule_commit }} -# submodule: backend + check_changed: + needs: set_env + uses: ./.github/workflows/reusable.changes.yml + with: + files: | + .github/workflows/scicat-be.yml + helm/configs/backend/values.yaml + helm/configs/backend/login-callbacks.js + helm/configs/backend/config.local.js + helm/configs/backend/job-template.html + helm/configs/backend/${{ needs.set_env.outputs.environment }}/** + backend/** + helm/configs/backend/authorizedJobs.js + commit: ${{ needs.set_env.outputs.commit }} + submodule_commit: ${{ github.event.inputs.submodule_commit }} + submodule: backend -# build_deploy_scicat_be: -# if: (needs.check_changed.outputs.changed == 'true' && !needs.set_env.outputs.component) || needs.set_env.outputs.component == 'be' -# needs: -# - check_changed -# - set_env -# uses: ./.github/workflows/reusable.build-deploy.yml -# with: -# context: backend/. -# image_name: ${{ github.repository }}/be -# release_name: backend -# tag: ${{ needs.set_env.outputs.tag }} -# environment: ${{ needs.set_env.outputs.environment }} -# commit: ${{ needs.set_env.outputs.commit }} -# submodule_commit: ${{ github.event.inputs.submodule_commit }} -# submodule: backend -# helm_set_files: >- -# CONFIG_LOCAL=helm/configs/backend/config.local.js -# LOGIN_CALLBACKS=helm/configs/backend/login-callbacks.js -# MIDDLEWARE=helm/configs/backend/${{ needs.set_env.outputs.environment }}/middleware.json -# EMAIL_TEMPLATE=helm/configs/backend/job-template.html -# HIDE_EMAIL=helm/configs/backend/hideEmail.js -# AUTHORIZED_JOBS=helm/configs/backend/authorizedJobs.js -# secrets: -# KUBECONFIG: ${{ secrets.KUBECONFIG }} -# JSON_SECRETS: ${{ toJSON(secrets) }} -# BASTION_USER: ${{ secrets.BASTION_USER }} -# BASTION_SSH_KEY: ${{ secrets.BASTION_SSH_KEY }} + build_deploy_scicat_be: + if: (needs.check_changed.outputs.changed == 'true' && !needs.set_env.outputs.component) || needs.set_env.outputs.component == 'be' + needs: + - check_changed + - set_env + uses: ./.github/workflows/reusable.build-deploy.yml + with: + context: backend/. + image_name: ${{ github.repository }}/be + release_name: backend + tag: ${{ needs.set_env.outputs.tag }} + environment: ${{ needs.set_env.outputs.environment }} + commit: ${{ needs.set_env.outputs.commit }} + submodule_commit: ${{ github.event.inputs.submodule_commit }} + submodule: backend + helm_set_files: >- + CONFIG_LOCAL=helm/configs/backend/config.local.js + LOGIN_CALLBACKS=helm/configs/backend/login-callbacks.js + MIDDLEWARE=helm/configs/backend/${{ needs.set_env.outputs.environment }}/middleware.json + EMAIL_TEMPLATE=helm/configs/backend/job-template.html + HIDE_EMAIL=helm/configs/backend/hideEmail.js + AUTHORIZED_JOBS=helm/configs/backend/authorizedJobs.js + secrets: + KUBECONFIG: ${{ secrets.KUBECONFIG }} + JSON_SECRETS: ${{ toJSON(secrets) }} + BASTION_USER: ${{ secrets.BASTION_USER }} + BASTION_SSH_KEY: ${{ secrets.BASTION_SSH_KEY }} diff --git a/helm/configs/backend-next/values.yaml b/helm/configs/backend-next/values.yaml index 26862866..e288f3d0 100644 --- a/helm/configs/backend-next/values.yaml +++ b/helm/configs/backend-next/values.yaml @@ -16,22 +16,23 @@ volumes: secret: secretName: "{{ .Release.Name }}-s" -secrets: +secrets: "{{ .Release.Name }}-s": type: Opaque - data: + data: .env: "{{ .Values.secretsJson.BENEXT_ENV }}" functionalAccounts.json: "{{ .Values.secretsJson.BENEXT_FUNCTIONAL_ACCOUNTS }}" + jobConfig.json: "{{ .Values.secretsJson.BENEXT_JOBCONFIG }}" ingress: enabled: true - annotations: + annotations: kubernetes.io/ingress.class: nginx cert-manager.io/cluster-issuer: letsencrypt-prod nginx.ingress.kubernetes.io/proxy-body-size: 50m hosts: - host: "{{ .Values.host }}" - paths: + paths: - path: "/" pathType: Prefix tls: @@ -46,6 +47,8 @@ env: value: "20.500.11935" - name: SITE value: "PSI" + - name: JOB_CONFIGURATION_FILE + value: /home/node/app/jobConfig.json volumeMounts: - name: secrets-volume @@ -54,3 +57,6 @@ volumeMounts: - name: secrets-volume mountPath: /home/node/app/functionalAccounts.json subPath: functionalAccounts.json + - name: secrets-volume + mountPath: /home/node/app/jobConfig.json + subPath: jobConfig.json \ No newline at end of file