Skip to content
Snippets Groups Projects
Commit 8cb5358c authored by Philipp S. Sommer's avatar Philipp S. Sommer
Browse files

Merge branch 'update-skeleton' into 'main'

update skeleton

See merge request !18
parents 1b211097 b0159291
No related branches found
No related tags found
1 merge request!18update skeleton
Pipeline #387093 passed
{
"template": "https://codebase.helmholtz.cloud/hcdc/software-templates/helm-chart-template.git",
"commit": "16d7b3cae4215f83af56f5361a4df40d51343709",
"commit": "21cf55055a0360ebbbfd588c2155ecf2a4712b18",
"checkout": null,
"context": {
"cookiecutter": {
......
"""Helper script to add licenses to files.
This script can be used to apply the licenses and default copyright holders
to files in the repository.
It uses the short cuts from the ``.reuse/shortcuts.yaml`` file and
adds them to the call of ``reuse annotate``. Any command line option however
overwrites the config in ``shortcuts.yaml``
Usage::
python .reuse/add_license.py <shortcut> <path> [OPTIONS]
"""
import os.path as osp
from argparse import ArgumentParser
from reuse import header
from reuse.project import create_project
from typing import Dict, TypedDict, Optional
from textwrap import dedent
import yaml
class LicenseShortCut(TypedDict):
"""Shortcut to add a copyright statement"""
#: The copyright statement
copyright: str
#: year of copyright statement
year: str
#: SPDX Identifier of the license
license: Optional[str]
def load_shortcuts() -> Dict[str, LicenseShortCut]:
"""Load the ``shortcuts.yaml`` file."""
with open(osp.join(osp.dirname(__file__), "shortcuts.yaml")) as f:
return yaml.safe_load(f)
def add_arguments(parser: ArgumentParser, shortcuts: Dict[str, LicenseShortCut]):
parser.add_argument(
"shortcut",
choices=[key for key in shortcuts if not key.startswith(".")],
help=(
"What license should be applied? Shortcuts are loaded from "
".reuse/shortcuts.yaml. Possible shortcuts are %(choices)s"
)
)
header.add_arguments(parser)
parser.set_defaults(func=header.run)
parser.set_defaults(parser=parser)
def main(argv=None):
shortcuts = load_shortcuts()
parser = ArgumentParser(
prog=".reuse/add_license.py",
description=dedent("""
Add copyright and licensing into the header of files with shortcuts
This script uses the ``reuse annotate`` command to add copyright
and licensing information into the header the specified files.
It accepts the same arguments as ``reuse annotate``, plus an
additional required `shortcuts` argument. The given `shortcut`
comes from the file at ``.reuse/shortcuts.yaml`` to fill in
copyright, year and license identifier.
For further information, please type ``reuse annotate --help``"""
)
)
add_arguments(parser, shortcuts)
args = parser.parse_args(argv)
shortcut = shortcuts[args.shortcut]
if args.year is None:
args.year = []
if args.copyright is None:
args.copyright = []
if args.license is None and shortcut.get("license"):
args.license = [shortcut["license"]]
elif args.license and shortcut.get("license"):
args.license.append(shortcut["license"])
args.year.append(shortcut["year"])
args.copyright.append(shortcut["copyright"])
project = create_project()
args.func(args, project)
if __name__ == "__main__":
main()
.defaults: &defaults
year: "2023"
copyright: "Helmholtz-Zentrum hereon GmbH"
# The following dictionaries items map to dictionaries with three possible
# keys:
#
# copyright: The copyright statement
# year: year of copyright statement
# license: SPDX Identifier
docs:
<<: *defaults
license: "CC-BY-4.0"
template:
<<: *defaults
license: "CC0-1.0"
supp:
<<: *defaults
license: "CC0-1.0"
......@@ -16,7 +16,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 "nginx.builtinBuildSecrets" . | fromYaml }}
{{- $allSecrets := mustMergeOverwrite (dict) $builtinSecrets .Values.buildSecrets }}
......
......@@ -17,16 +17,28 @@ spec:
source:{{- if ne $stage "prod" }}
git:
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 }}
sourceSecret:
name: k8sgitlab{{- if eq $stage "staging" }}
contextDir: "docker/nginx"
contextDir: {{ $.Values.contextDir | quote }}
{{- if $.Values.dockerfilePath }}
dockerfilePath: {{ $.Values.dockerfilePath | quote }}
{{- end }}
{{- else if eq $stage "test" }}
contextDir: "docker/nginx/tests"
contextDir: {{ $.Values.testContextDir | quote }}
{{- if $.Values.testDockerfilePath }}
dockerfilePath: {{ $.Values.testDockerfilePath | quote }}
{{- end }}
{{- end }}
{{- else }}
dockerfile: |
......
......@@ -36,7 +36,15 @@ spec:
{{- if $options.volumeName }}
volumeName: {{ $options.volumeName | quote }}
{{- end }}
storageClassName: {{ $options.storageClassName | default "ocs-storagecluster-cephfs" | quote }}
{{- if kindIs "invalid" $options.storageClassName -}}
{{- /*
We do allow empty storageClassNames here (i.e. ""). but if it is not defined,
we use "ocs-storagecluster-cephfs".
*/}}
storageClassName: "ocs-storagecluster-cephfs"
{{- else }}
storageClassName: {{ $options.storageClassName | quote }}
{{- end }}
...
{{- end }}
{{- end }}
......@@ -17,6 +17,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
# command is the command that the docker container shall run (has to be a list)
command: null
......@@ -62,6 +68,21 @@ buildTriggers: []
# - imageChange: {}
# type: ImageChange
# directory in the git repository where the Dockerfile is located
contextDir: "docker/nginx"
# path to the Dockerfile, relative to the given contextDir. If empty,
# Dockerfile is used
dockerfilePath: null
# directory in the git repository where the Dockerfile for the test setup is
# located
testContextDir: "docker/nginx/tests"
# path to the Dockerfile for the test stage, relative to the given
# testContextDir. If empty, Dockerfile is used
testDockerfilePath: null
# testStagePostCommit contains the command to run when the image from the
# test stage has been built, see
# https://docs.openshift.com/container-platform/4.10/rest_api/workloads_apis/buildconfig-build-openshift-io-v1.html#spec-postcommit
......
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