Skip to content

Commit 97bc394

Browse files
committed
docs(copier): updates copier for final release
1 parent 5a981d1 commit 97bc394

8 files changed

Lines changed: 58 additions & 28 deletions

File tree

scripts/checkyamlcompliance.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424
api_ver = False
2525
if "kind" in yamldata.keys():
2626
match yamldata["kind"]:
27-
case "ClusterWorkflowTemplate":
28-
clst_tmpt = True
29-
case "Workflow":
30-
clst_tmpt = True
31-
case "WorkflowTemplate":
32-
clst_tmpt = True
3327
case "ClusterWorkflowTemplate":
3428
clst_tmpt = True
3529
case _:
@@ -38,7 +32,6 @@
3832
clst_tmpt = False
3933
if "metadata" in yamldata.keys():
4034
metadata = True
41-
gen_name = "generateName" in yamldata["metadata"].keys()
4235
normal_name = "name" in yamldata["metadata"].keys()
4336
if "annotations" in yamldata["metadata"].keys():
4437
annotations = True
@@ -64,19 +57,14 @@
6457
else:
6558
group = labels = False
6659
else:
67-
metadata = normal_name = gen_name = False
68-
if all([api_ver, clst_tmpt, title, repo, group, annotations, labels]):
69-
if gen_name != normal_name:
70-
exit(0)
71-
else:
72-
print(
73-
"generated_name and normal_name error, must have one of these not both"
74-
)
75-
exit(1)
60+
metadata = normal_name = False
61+
if all([api_ver, clst_tmpt, title, repo, group, annotations, labels, normal_name]):
62+
exit(0)
7663
else:
7764
print(f"""
7865
within file: {file}...
7966
metadata present?: {metadata}
67+
name present?: {normal_name}
8068
annotations present?: {annotations}
8169
labels present?: {labels}
8270
api_ver present?: {api_ver}

src/copier_template/README.md.jinja

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
Python alternative to creating and running argo workflows in the Data Analysis Platform
99

10+
Update pyproject.toml for the following use cases:
11+
- Pyright linting
12+
- Dependencies
13+
14+
1015
This is where you should write a short paragraph that describes what your module does,
1116
how it does it, and why people should use it.
1217

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{% raw %}}
2+
{
3+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
4+
"extends": [
5+
"config:recommended"
6+
],
7+
"lockFileMaintenance": {
8+
"description": "Keep uv.lock up to date, merging if tests pass",
9+
"enabled": true,
10+
"automerge": true
11+
},
12+
"packageRules": [
13+
{
14+
"description": "Disable python version as that is managed by {{repo_name}}",
15+
"matchManagers": [
16+
"pyenv"
17+
],
18+
"enabled": false
19+
},
20+
{
21+
"description": "Disable github actions that are managed by {{repo_name}}",
22+
"matchPackageNames": [
23+
"actions/checkout",
24+
"astral-sh/setup-uv",
25+
"actions/upload-artifact",
26+
"actions/download-artifact",
27+
"softprops/action-gh-release",
28+
"codecov/codecov-action",
29+
"docker/setup-buildx-action",
30+
"docker/login-action",
31+
"docker/build-push-action",
32+
"docker/metadata-action"
33+
],
34+
"matchManagers": [
35+
"github-actions"
36+
],
37+
"enabled": false
38+
}
39+
]
40+
}
41+
{{% endraw %}}

src/copier_template/scripts/checkyamlcompliance.py.jinja

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ for file in yamllist:
2626
match yamldata["kind"]:
2727
case "ClusterWorkflowTemplate":
2828
clst_tmpt = True
29-
case "Workflow":
30-
clst_tmpt = True
31-
case "WorkflowTemplate":
32-
clst_tmpt = True
3329
case _:
3430
clst_tmpt = False
3531
else:

src/copier_template/src/{{ project_name }}/templates/example_import_files.txt.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% raw %}
22
apiVersion: argoproj.io/v1alpha1
3-
kind: WorkflowTemplate
3+
kind: ClusterWorkflowTemplate
44
metadata:
55
name: hera-example-pandas
66
annotations:
@@ -28,7 +28,7 @@ spec:
2828
archive:
2929
none: {}
3030
script:
31-
image: ghcr.io/matt-carre/{% endraw %}{{repo_name}}{% raw %}-mounted-image:latest
31+
image: ghcr.io/diamondlightsource/{% endraw %}{{repo_name}}{% raw %}-mounted-image:latest
3232
source: |-
3333
import os
3434
import sys

src/copier_template/src/{{ project_name }}/workflow_definitions/create_notebook_in_image.py.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ from hera.workflows.archive import NoneArchiveStrategy
1818
# and was created with the included dockerfile.
1919
global_config.set_class_defaults( # pyright: ignore
2020
Script,
21-
image="ghcr.io/matt-carre/python-interface-to-workflows-mounted-image:latest",
21+
image="ghcr.io/diamondlightsource/python-interface-to-workflows-mounted-image:latest",
2222
)
2323

2424

@@ -89,7 +89,7 @@ with Workflow(
8989
# All of these are required aside from "workflows.argoproj.io/description".
9090
entrypoint="workflowentry",
9191
api_version="argoproj.io/v1alpha1",
92-
kind="WorkflowTemplate",
92+
kind="ClusterWorkflowTemplate",
9393
labels={"workflows.diamond.ac.uk/science-group-examples": "true"},
9494
annotations={
9595
"workflows.argoproj.io/title": "notebook.yaml remade via hera",

src/python_interface_to_workflows/templates/example_import_files.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: argoproj.io/v1alpha1
2-
kind: WorkflowTemplate
2+
kind: ClusterWorkflowTemplate
33
metadata:
44
name: hera-example-pandas
55
annotations:
@@ -27,7 +27,7 @@ spec:
2727
archive:
2828
none: {}
2929
script:
30-
image: ghcr.io/matt-carre/python-interface-to-workflows-mounted-image:latest
30+
image: ghcr.io/diamondlightsource/python-interface-to-workflows-mounted-image:latest
3131
source: |-
3232
import os
3333
import sys

src/python_interface_to_workflows/workflow_definitions/create_notebook_in_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# and was created with the included dockerfile.
1818
global_config.set_class_defaults( # pyright: ignore
1919
Script,
20-
image="ghcr.io/matt-carre/python-interface-to-workflows-mounted-image:latest",
20+
image="ghcr.io/diamondlightsource/python-interface-to-workflows-mounted-image:latest",
2121
)
2222

2323

@@ -88,7 +88,7 @@ def mount_files():
8888
# All of these are required aside from "workflows.argoproj.io/description".
8989
entrypoint="workflowentry",
9090
api_version="argoproj.io/v1alpha1",
91-
kind="WorkflowTemplate",
91+
kind="ClusterWorkflowTemplate",
9292
labels={"workflows.diamond.ac.uk/science-group-examples": "true"},
9393
annotations={
9494
"workflows.argoproj.io/title": "notebook.yaml remade via hera",

0 commit comments

Comments
 (0)