Skip to content

Commit 69b756a

Browse files
authored
Merge branch 'main' into uv
2 parents 201a416 + 89e5f63 commit 69b756a

25 files changed

+782
-439
lines changed

.github/workflows/cicd.yml

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
name: CICD
22

33
on:
4-
push:
5-
branches: ["**"]
6-
tags: ["*.*.*"]
74
release:
8-
types: [created]
5+
types: [published, prereleased]
96

107
env:
118
REGISTRY: ghcr.io
@@ -28,7 +25,6 @@ jobs:
2825
- name: Checkout repository
2926
uses: actions/checkout@v4
3027

31-
# replaces slashes with dashes in platform name
3228
- name: Convert platform pairs
3329
run: |
3430
platform=${{ matrix.platform }}
@@ -38,7 +34,6 @@ jobs:
3834
uses: docker/setup-buildx-action@v3
3935

4036
- name: Log into registry ${{ env.REGISTRY }}
41-
if: github.event_name != 'pull_request'
4237
uses: docker/login-action@v3
4338
with:
4439
registry: ${{ env.REGISTRY }}
@@ -58,7 +53,7 @@ jobs:
5853
context: .
5954
platforms: ${{ matrix.platform }}
6055
labels: ${{ steps.meta.outputs.labels }}
61-
outputs: type=image,name=${{ env.REGISTRY }}/${{ github.repository }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
56+
outputs: type=image,name=${{ env.REGISTRY }}/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true
6257

6358
- name: Export digest
6459
run: |
@@ -76,7 +71,6 @@ jobs:
7671

7772
merge:
7873
runs-on: ubuntu-latest
79-
if: ${{ github.event_name != 'pull_request' }}
8074
needs:
8175
- build
8276
steps:
@@ -96,14 +90,10 @@ jobs:
9690
with:
9791
images: ${{ env.REGISTRY }}/${{ github.repository }}
9892
tags: |
99-
type=ref,event=branch
10093
type=ref,event=tag
101-
type=ref,event=pr
102-
type=sha
10394
type=semver,pattern={{version}}
10495
10596
- name: Log into registry ${{ env.REGISTRY }}
106-
if: github.event_name != 'pull_request'
10797
uses: docker/login-action@v3
10898
with:
10999
registry: ${{ env.REGISTRY }}

.github/workflows/release-event.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"act": true,
3-
"action": "created",
3+
"action": "published",
44
"ref": "refs/tags/v0.0.10",
55
"sha": "b7e12928f13caf61af40d3e8788649a1a8f24c22",
66
"release": {

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
venv/*
22
__pycache__
33
test/*
4-
launch.json
4+
launch.json
5+
lab-examples/*
6+
!lab-examples/*.yml
7+
!lab-examples/*.yaml
8+
lab-examples/*flow_panel.yaml

clab2drawio.py

+17-11
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@
1818

1919
logger = logging.getLogger(__name__)
2020

21+
2122
def main(
2223
input_file: str,
2324
output_file: str,
2425
grafana: bool,
2526
theme: str,
26-
include_unlinked_nodes: bool=False,
27-
no_links: bool=False,
28-
layout: str="vertical",
29-
verbose: bool=False,
30-
interactive: bool=False,
31-
grafana_config_path: str=None,
27+
include_unlinked_nodes: bool = False,
28+
no_links: bool = False,
29+
layout: str = "vertical",
30+
verbose: bool = False,
31+
interactive: bool = False,
32+
grafana_config_path: str = None,
3233
) -> None:
3334
"""
3435
Main function to generate a topology diagram from a containerlab YAML or draw.io XML file.
@@ -42,7 +43,7 @@ def main(
4243
:param layout: Layout direction ("vertical" or "horizontal").
4344
:param verbose: Enable verbose output.
4445
:param interactive: Run in interactive mode to define graph-levels and icons.
45-
"""
46+
"""
4647
logger.debug("Starting clab2drawio main function.")
4748
loader = TopologyLoader()
4849
try:
@@ -91,7 +92,7 @@ def main(
9192
# Use NodeLinkBuilder to build nodes and links
9293
logger.debug("Building nodes and links...")
9394
builder = NodeLinkBuilder(containerlab_data, styles, prefix, lab_name)
94-
nodes, links = builder.build_nodes_and_links()
95+
nodes, links = builder.build_nodes_and_links()
9596

9697
diagram.nodes = nodes
9798

@@ -194,11 +195,15 @@ def main(
194195
output_folder = os.path.dirname(grafana_output_file) or "."
195196
diagram.grafana_dashboard_file = grafana_output_file
196197
os.makedirs(output_folder, exist_ok=True)
197-
198-
grafana_dashboard = GrafanaDashboard(diagram, grafana_config_path=grafana_config_path)
198+
199+
grafana_dashboard = GrafanaDashboard(
200+
diagram, grafana_config_path=grafana_config_path
201+
)
199202
panel_config = grafana_dashboard.create_panel_yaml()
200203

201-
flow_panel_output_file = os.path.splitext(grafana_output_file)[0] + ".flow_panel.yaml"
204+
flow_panel_output_file = (
205+
os.path.splitext(grafana_output_file)[0] + ".flow_panel.yaml"
206+
)
202207
with open(flow_panel_output_file, "w") as f:
203208
f.write(panel_config)
204209
print("Saved flow panel YAML to:", flow_panel_output_file)
@@ -223,6 +228,7 @@ def main(
223228

224229
print("Saved file to:", output_file)
225230

231+
226232
if __name__ == "__main__":
227233
args = parse_arguments()
228234

cli/parser_clab2drawio.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22

3+
34
def parse_arguments():
45
"""
56
Parse command-line arguments for clab2drawio tool.
@@ -32,7 +33,7 @@ def parse_arguments():
3233
"--grafana-config",
3334
type=str,
3435
default=None,
35-
help="Path to a Grafana YAML config file. If omitted, defaults are used."
36+
help="Path to a Grafana YAML config file. If omitted, defaults are used.",
3637
)
3738
parser.add_argument(
3839
"--include-unlinked-nodes",

cli/parser_drawio2clab.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22

3+
34
def parse_arguments():
45
"""
56
Parse command-line arguments for drawio2clab tool.
@@ -9,9 +10,17 @@ def parse_arguments():
910
parser = argparse.ArgumentParser(
1011
description="Convert a .drawio file to a Containerlab YAML file."
1112
)
12-
parser.add_argument("-i", "--input", required=True, help="The input .drawio XML file.")
13+
parser.add_argument(
14+
"-i", "--input", required=True, help="The input .drawio XML file."
15+
)
1316
parser.add_argument("-o", "--output", required=False, help="The output YAML file.")
14-
parser.add_argument("--style", choices=["block", "flow"], default="flow", help="YAML style.")
15-
parser.add_argument("--diagram-name", required=False, help="Name of the diagram to parse.")
16-
parser.add_argument("--default-kind", default="nokia_srlinux", help="Default node kind.")
17+
parser.add_argument(
18+
"--style", choices=["block", "flow"], default="flow", help="YAML style."
19+
)
20+
parser.add_argument(
21+
"--diagram-name", required=False, help="Name of the diagram to parse."
22+
)
23+
parser.add_argument(
24+
"--default-kind", default="nokia_srlinux", help="Default node kind."
25+
)
1726
return parser.parse_args()

0 commit comments

Comments
 (0)