Skip to content

Commit

Permalink
Merge pull request #121 from gimlet-io/cloning-private-repos
Browse files Browse the repository at this point in the history
Cloning private repos
  • Loading branch information
laszlocph authored Feb 13, 2024
2 parents c56f637 + 7cacd6e commit 4d247e4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
26 changes: 18 additions & 8 deletions charts/static-site/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,37 @@ spec:
serviceAccountName: {{ .Values.serviceAccount }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes:
- name: static-files
emptyDir: {}
emptyDir: {}
initContainers:
- name: init-con
image: {{ .Values.buildImage }}
{{- if .Values.gitCloneUrlSecretName }}
envFrom:
- secretRef:
name: {{ .Values.gitCloneUrlSecretName }}
{{- end }}
{{- if .Values.buildScript }}
command:
- sh
- -c
- |
git clone {{ .Values.gitCloneUrl}} &&
cd {{ regexFind "([^\\/]+$)" .Values.gitCloneUrl | replace ".git" "" }} &&
{{ .Values.buildScript | nindent 12}}
mkdir -p /usr/share/nginx/html &&
cp -r ./{{ .Values.builtAssets }}. /usr/share/nginx/html
{{- if .Values.gitCloneUrlSecretName }}
git clone $gitCloneUrl &&
cd $(echo $gitCloneUrl | sed 's|.*/||' | cut -d "." -f1) &&
{{- else }}
git clone {{ .Values.gitCloneUrl }} &&
cd {{ regexFind "([^\\/]+$)" .Values.gitCloneUrl | replace ".git" "" }} &&
{{- end }}
{{ .Values.buildScript | nindent 10}}
mkdir -p /usr/share/nginx/html &&
cp -r ./{{ .Values.builtAssets }}. /usr/share/nginx/html
{{- end }}
volumeMounts:
- name: static-files
mountPath: /usr/share/nginx/html
mountPath: /usr/share/nginx/html
containers:
- name: {{ template "robustName" .Release.Name }}
securityContext:
Expand Down
2 changes: 2 additions & 0 deletions charts/static-site/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000

gitCloneUrlSecretName: git-creds

securityContext:
# capabilities:
# drop:
Expand Down

0 comments on commit 4d247e4

Please sign in to comment.