Skip to content
Snippets Groups Projects
Verified Commit 1a424d38 authored by Philipp S. Sommer's avatar Philipp S. Sommer
Browse files

implement local overriding of buildSource

parent b849f0da
No related branches found
No related tags found
1 merge request!44implement local overriding of buildSource
Pipeline #387086 passed
......@@ -25,4 +25,10 @@ setup() {
@test "include build test stage" {
create_template '{"include_build_config": "yes", "include_build_test_stage": "yes"}'
assert [ -e "${TEMPLATE_FOLDER}/buildconfig.yaml" ]
}
@test "override buildSource" {
create_template '{"include_build_config": "yes"}'
assert [ -e "${TEMPLATE_FOLDER}/buildconfig.yaml" ]
lint_chart "buildSource: {gitlabProject: somerepo}"
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ Then update the k8sgitlab secret via
And add the contents of the id_rsa.pub file to the Deploy Keys section in
https://{{ .Values.global.buildSource.gitlabHost }}/{{ .Values.global.buildSource.gitlabProject }}/-/settings/repository#js-deploy-keys-settings
https://{{ .Values.buildSource.gitlabProject | default .Values.global.buildSource.gitlabHost }}/{{ .Values.buildSource.gitlabProject | default .Values.global.buildSource.gitlabProject }}/-/settings/repository#js-deploy-keys-settings
{{- $builtinSecrets := include "{% endraw %}{{ cookiecutter.template_base_name }}{% raw %}.builtinBuildSecrets" . | fromYaml }}
{{- $allSecrets := mustMergeOverwrite (dict) $builtinSecrets .Values.buildSecrets }}
......
......@@ -18,10 +18,16 @@ spec:
{%- if stages %}{% raw %}{{- if ne $stage "prod" }}{% endraw %}{% endif %}
git:
{% raw %}
uri: "git@{{ required "A gitlab host (global.buildSource.gitlabHost) is required!" $.Values.global.buildSource.gitlabHost }}:{{ required "A project on gitlab (global.buildSource.gitlabProject) is required!" $.Values.global.buildSource.gitlabProject }}.git"
uri: "git@{{ required "A gitlab host (global.buildSource.gitlabHost) is required!" ($.Values.buildSource.gitlabHost | default $.Values.global.buildSource.gitlabHost) }}:{{ required "A project on gitlab (global.buildSource.gitlabProject) is required!" ($.Values.buildSource.gitlabProject | default $.Values.global.buildSource.gitlabProject) }}.git"
{{- if $.Values.buildSource.gitlabProject }}
{{- if $.Values.buildSource.gitlabRef }}
ref: {{ $.Values.buildSource.gitlabRef | quote }}
{{- end }}
{{- else }}
{{- if $.Values.global.buildSource.gitlabRef }}
ref: {{ $.Values.global.buildSource.gitlabRef | quote }}
{{- end }}
{{- end }}
{% endraw %}
sourceSecret:
name: k8sgitlab
......
......@@ -16,6 +16,12 @@ global:
# the origin of the docker image to build
fromImage: null
# buildSource is a mapping with overrides of global.buildSource
buildSource:
gitlabHost: null
gitlabProject: null
gitlabRef: null
{%- endif %}
{%- if cookiecutter.__include_deployment == "yes" or cookiecutter.__include_workers == "yes" %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment