diff --git a/flux-check-buckets/README.md b/flux-check-buckets/README.md new file mode 100644 index 00000000..0ecc148a --- /dev/null +++ b/flux-check-buckets/README.md @@ -0,0 +1,7 @@ +## Introduction + +`flux-check-buckets` is a KCL validation module + +## Resource + +The Code source and documents are [here](https://github.com/kcl-lang/modules/tree/main/flux-check-buckets) diff --git a/flux-check-buckets/kcl.mod b/flux-check-buckets/kcl.mod new file mode 100644 index 00000000..50343a77 --- /dev/null +++ b/flux-check-buckets/kcl.mod @@ -0,0 +1,4 @@ +[package] +name = "flux-check-buckets" +version = "0.1.1" +description = "`flux-check-buckets` is a KCL validation module" diff --git a/flux-check-buckets/main.k b/flux-check-buckets/main.k new file mode 100644 index 00000000..ad6d920c --- /dev/null +++ b/flux-check-buckets/main.k @@ -0,0 +1,13 @@ +endpoints: [str] = option("params")?.endpoints or [] + +# Define the validation function +validate = lambda item, endpoints: [str] { + if item.kind == "Bucket" and endpoints: + endpoint: str = item?.spec?.endpoint + assert any e in endpoints { + endpoint.endswith(e) + }, ".spec.endpoint must reference an address within the organizations ${endpoints}." + item +} +# Validate All resource +items = [validate(i, endpoints) for i in option("items") or []] diff --git a/flux-check-github-repositories/README.md b/flux-check-github-repositories/README.md new file mode 100644 index 00000000..0e84fc1e --- /dev/null +++ b/flux-check-github-repositories/README.md @@ -0,0 +1,7 @@ +## Introduction + +`flux-check-github-repositories` is a KCL validation module + +## Resource + +The Code source and documents are [here](https://github.com/kcl-lang/modules/tree/main/flux-check-github-repositories) diff --git a/flux-check-github-repositories/kcl.mod b/flux-check-github-repositories/kcl.mod new file mode 100644 index 00000000..1b7dfb89 --- /dev/null +++ b/flux-check-github-repositories/kcl.mod @@ -0,0 +1,4 @@ +[package] +name = "flux-check-github-repositories" +version = "0.1.1" +description = "`flux-check-github-repositories` is a KCL validation module" diff --git a/flux-check-github-repositories/main.k b/flux-check-github-repositories/main.k new file mode 100644 index 00000000..7abdab4f --- /dev/null +++ b/flux-check-github-repositories/main.k @@ -0,0 +1,13 @@ +repos: [str] = option("params")?.repos or [] + +# Define the validation function +validate = lambda item, repos: [str] { + if item.kind == "GitRepository" and repos: + url: str = item?.spec?.url + assert any r in repos { + url.startswith("https://github.com/${r}/") or url.startswith("ssh://git@github.com:${r}/") + }, ".spec.url must be from a repository within the myorg organization." + item +} +# Validate All resource +items = [validate(i, repos) for i in option("items") or []] diff --git a/flux-check-helm-repositories/README.md b/flux-check-helm-repositories/README.md new file mode 100644 index 00000000..3782b8de --- /dev/null +++ b/flux-check-helm-repositories/README.md @@ -0,0 +1,7 @@ +## Introduction + +`flux-check-helm-repositories` is a KCL validation module + +## Resource + +The Code source and documents are [here](https://github.com/kcl-lang/modules/tree/main/flux-check-helm-repositories) diff --git a/flux-check-helm-repositories/kcl.mod b/flux-check-helm-repositories/kcl.mod new file mode 100644 index 00000000..b4efa049 --- /dev/null +++ b/flux-check-helm-repositories/kcl.mod @@ -0,0 +1,4 @@ +[package] +name = "flux-check-helm-repositories" +version = "0.1.1" +description = "`flux-check-helm-repositories` is a KCL validation module" diff --git a/flux-check-helm-repositories/main.k b/flux-check-helm-repositories/main.k new file mode 100644 index 00000000..3e1629f5 --- /dev/null +++ b/flux-check-helm-repositories/main.k @@ -0,0 +1,15 @@ +import regex + +repos: [str] = option("params")?.repos or [] + +# Define the validation function +validate = lambda item, repos: [str] { + if item.kind == "HelmRepository" and repos: + url: str = item?.spec?.url + assert any r in repos { + regex.match(url, "https://?*.${r}.com/*") + }, ".spec.url must be from a repository within the organizations ${repos}." + item +} +# Validate All resource +items = [validate(i, repos) for i in option("items") or []] diff --git a/flux-check-image-repositories/README.md b/flux-check-image-repositories/README.md new file mode 100644 index 00000000..a8fdaf06 --- /dev/null +++ b/flux-check-image-repositories/README.md @@ -0,0 +1,7 @@ +## Introduction + +`flux-check-image-repositories` is a KCL validation module + +## Resource + +The Code source and documents are [here](https://github.com/kcl-lang/modules/tree/main/flux-check-image-repositories) diff --git a/flux-check-image-repositories/kcl.mod b/flux-check-image-repositories/kcl.mod new file mode 100644 index 00000000..6b0e5aaf --- /dev/null +++ b/flux-check-image-repositories/kcl.mod @@ -0,0 +1,4 @@ +[package] +name = "flux-check-image-repositories" +version = "0.1.1" +description = "`flux-check-image-repositories` is a KCL validation module" diff --git a/flux-check-image-repositories/main.k b/flux-check-image-repositories/main.k new file mode 100644 index 00000000..a06650b0 --- /dev/null +++ b/flux-check-image-repositories/main.k @@ -0,0 +1,13 @@ +repos: [str] = option("params")?.repos or [] + +# Define the validation function +validate = lambda item, repos: [str] { + if item.kind == "ImageRepository" and repos: + image: str = item?.spec?.image + assert any r in repos { + image.startswith(r) + }, ".spec.image must be from an image repository within the organizations ${repos}." + item +} +# Validate All resource +items = [validate(i, repos) for i in option("items") or []] diff --git a/flux-check-url/README.md b/flux-check-url/README.md new file mode 100644 index 00000000..60137961 --- /dev/null +++ b/flux-check-url/README.md @@ -0,0 +1,7 @@ +## Introduction + +`flux-check-url` is a KCL validation module + +## Resource + +The Code source and documents are [here](https://github.com/kcl-lang/modules/tree/main/flux-check-url) diff --git a/flux-check-url/kcl.mod b/flux-check-url/kcl.mod new file mode 100644 index 00000000..860f20c1 --- /dev/null +++ b/flux-check-url/kcl.mod @@ -0,0 +1,4 @@ +[package] +name = "flux-check-url" +version = "0.1.1" +description = "`flux-check-url` is a KCL validation module" diff --git a/flux-check-url/main.k b/flux-check-url/main.k new file mode 100644 index 00000000..70c0a19f --- /dev/null +++ b/flux-check-url/main.k @@ -0,0 +1,16 @@ +repos: [str] = option("params")?.repos or [] +urls: [str] = option("params")?.urls or [] + +# Define the validation function +validate = lambda item, repos: [str] { + if item.kind == "GitRepository" and urls and repos: + url: str = item?.spec?.url + assert any r in repos { + any u in urls { + url.startswith("${u}/${r}/") + } + }, ".spec.url must be from a repository within the urls ${urls} and repos ${repos}" + item +} +# Validate All resource +items = [validate(i, repos) for i in option("items") or []]