Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor scm env vars #141

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion charts/nx-cloud/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: nx-cloud
description: Nx Cloud Helm Chart
type: application
version: 0.15.12
version: 0.15.13
maintainers:
- name: nx
url: "https://nx.app/"
Expand Down
8 changes: 4 additions & 4 deletions charts/nx-cloud/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Thank you for installing {{ .Chart.Name }}

The version you installed is {{ .Chart.Version }}

Please note that as of version 0.12.0, the compatibility with nx-cloud images has changed and
only image tag 2312.11.7 and later are supported.
BREAKING CHANGE: As of Helm chart version 0.15.13 we have stopped using helm based VCS Integration configs. If you have defined
any of the "github.pr" or "gitlab.mr" values in your config.yaml, please remove them and setup your VCS integration via your
workspace "Settings" page.

At the time of install, you used version {{ .Values.global.imageTag }}, if you experience
any issues, please ensure you are using a compatible version.
See https://nx.dev/ci/reference/release-notes for an expanded version of this note.
102 changes: 25 additions & 77 deletions charts/nx-cloud/templates/_scm-helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,75 +1,4 @@
{{- define "nxCloud.frontend.scm.github" }}
{{- if .Values.github.pr.enabled }}
{{- if eq .Values.github.pr.mode "webhook" }}
- name: NX_CLOUD_VCS_INTEGRATION_TYPE
value: 'GITHUB_WEBHOOK'
{{- if .Values.github.pr.apiUrl }}
- name: GITHUB_API_URL
value: {{ .Values.github.pr.apiUrl }}
{{- end }}
{{- if .Values.github.pr.remoteRepositoryName }}
- name: NX_CLOUD_REMOTE_REPOSITORY_NAME
value: {{ .Values.github.pr.remoteRepositoryName }}
{{- end }}
{{- if .Values.secret.name }}
- name: GITHUB_WEBHOOK_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
key: {{ .Values.secret.githubWebhookSecret }}
- name: GITHUB_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
key: {{ .Values.secret.githubAuthToken }}
{{- end }}
{{- if .Values.github.pr.defaultWorkspaceId }}
- name: NX_CLOUD_INTEGRATION_DEFAULT_WORKSPACE_ID
value: {{ .Values.github.pr.defaultWorkspaceId }}
{{- end }}
{{- end }}
{{- if eq .Values.github.pr.mode "eventless" }}
- name: NX_CLOUD_VCS_INTEGRATION_TYPE
value: 'GITHUB_EVENTLESS'
{{- if .Values.github.pr.apiUrl }}
- name: NX_CLOUD_GITHUB_API_URL
value: {{ .Values.github.pr.apiUrl }}
{{- end }}
{{- if .Values.github.pr.remoteRepositoryName }}
- name: NX_CLOUD_REMOTE_REPOSITORY_NAME
value: {{ .Values.github.pr.remoteRepositoryName }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

{{- define "nxCloud.frontend.scm.gitlab" }}
{{- if .Values.gitlab.mr.enabled }}
- name: NX_CLOUD_VCS_INTEGRATION_TYPE
value: "GITLAB_EVENTLESS"
{{- if .Values.gitlab.projectId }}
- name: NX_CLOUD_GITLAB_PROJECT_ID
value: {{ .Values.gitlab.projectId }}
{{- end }}
{{- if .Values.gitlab.apiUrl }}
- name: NX_CLOUD_GITLAB_BASE_URL
value: {{ .Values.gitlab.apiUrl }}
{{- end }}
{{- if .Values.secret.name }}
{{- if .Values.secret.gitlabAccessToken }}
- name: NX_CLOUD_GITLAB_ACCESS_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
key: {{ .Values.secret.gitlabAccessToken }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

{{- define "nxCloud.frontend.scm.all" }}
{{- include "nxCloud.frontend.scm.github" . }}
{{- include "nxCloud.frontend.scm.gitlab" . }}
{{- if .Values.vcsHttpsProxy }}
- name: VERSION_CONTROL_HTTPS_PROXY
value: {{ .Values.vcsHttpsProxy }}
Expand All @@ -78,15 +7,13 @@

{{- define "nxCloud.frontend.scm.githubAppEnv" }}
{{- if .Values.secret.name }}
{{- if .Values.secret.githubAuthToken }}
- name: NX_CLOUD_GITHUB_AUTH_TOKEN
{{- if .Values.secret.githubAppId }}
- name: NX_CLOUD_GITHUB_APP_ID
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
key: {{ .Values.secret.githubAuthToken }}
{{- end }}
{{- if .Values.secret.githubAppId }}
- name: NX_CLOUD_GITHUB_APP_ID
key: {{ .Values.secret.githubAppId }}
- name: NX_CLOUD_GITHUB_APP_APP_ID
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
Expand All @@ -99,5 +26,26 @@
name: {{ .Values.secret.name }}
key: {{ .Values.secret.githubPrivateKey }}
{{- end }}
{{- if .Values.secret.githubWebhookSecret }}
- name: NX_CLOUD_GITHUB_WEBHOOK_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
key: {{ .Values.secret.githubWebhookSecret }}
{{- end }}
{{- if .Values.secret.githubAppClientId }}
- name: NX_CLOUD_GITHUB_APP_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
key: {{ .Values.secret.githubAppClientId }}
{{- end }}
{{- if .Values.secret.githubAppClientSecret }}
- name: NX_CLOUD_GITHUB_APP_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.secret.name }}
key: {{ .Values.secret.githubAppClientSecret }}
{{- end }}
{{- end }}
Copy link
Collaborator Author

@rarmatei rarmatei Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm checking with Mark about these vars: NX_CLOUD_GITHUB_WEBHOOK_SECRET and NX_CLOUD_GITHUB_WEBHOOK_SECRET

  1. we either need to add them to the docs: https://nx.dev/ci/recipes/enterprise/on-premise/custom-github-app#using-helm
  2. or we don't need them in here

{{- end }}
26 changes: 1 addition & 25 deletions charts/nx-cloud/templates/nx-cloud-frontend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,38 +64,14 @@ spec:
{{- include "nxCloud.frontend.auth" . | indent 12 }}
{{- include "nxCloud.workflows.serviceTarget" . | indent 12 }}
{{- include "nxCloud.frontend.nxApiTarget" . | indent 12 }}
{{- include "nxCloud.frontend.scm.githubAppEnv" . | indent 12 }}
{{- if .Values.frontend.deployment.env }}
{{- toYaml .Values.frontend.deployment.env | nindent 12 }}
{{- end }}
{{- if .Values.selfSignedCertConfigMap }}
- name: NODE_EXTRA_CA_CERTS
value: /self-signed-certs/self-signed-cert.crt
{{- end}}
{{- with .Values.secret }}
{{- if .name }}
{{- if .githubPrivateKey }}
- name: NX_CLOUD_GITHUB_PRIVATE_KEY
valueFrom:
secretKeyRef:
name: {{ .name }}
key: {{ .githubPrivateKey }}
{{- end }}
{{- if .githubAppId }}
- name: NX_CLOUD_GITHUB_APP_ID
valueFrom:
secretKeyRef:
name: {{ .name }}
key: {{ .githubAppId }}
{{- end }}
{{- if .hubspotApiKey }}
- name: HUBSPOT_API_KEY
valueFrom:
secretKeyRef:
name: {{ .name }}
key: {{ .hubspotApiKey }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.selfSignedCertConfigMap }}
volumes:
- configMap:
Expand Down
3 changes: 3 additions & 0 deletions charts/nx-cloud/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ saml:
# If you plan to deploy using your own self-signed certs, add them to a config map and provide the name here
# We will mount the configmap to the pods and import the certs contained within at `self-signed-cert.crt`
selfSignedCertConfigMap: ''
vcsHttpsProxy: ''

secret:
name: ''
Expand All @@ -235,6 +236,8 @@ secret:
githubAuthToken: ''
githubAppId: ''
githubPrivateKey: ''
githubAppClientId: ''
githubAppClientSecret: ''
gitlabAccessToken: ''

extraManifests: {}
Loading