-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from Peefy/add-more-tekton-modules
feat: add more tekton modules
- Loading branch information
Showing
9 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Introduction | ||
|
||
`tekton-require-bundle` is a KCL validation module. | ||
|
||
## Resource | ||
|
||
The Code source and document are [here](https://github.com/kcl-lang/modules/tree/main/nginx-ingress/tekton-require-bundle) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[package] | ||
name = "tekton-require-bundle" | ||
edition = "*" | ||
version = "0.1.0" | ||
description = "`tekton-require-bundle` is a KCL validation module" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
validate = lambda item { | ||
if item.kind in ["PipelineRun"]: | ||
assert item.spec?.pipelineRef?.bundle, "A bundle is required." | ||
elif item.kind in ["TaskeRun"]: | ||
assert item.spec?.taskRef?.bundle, "A bundle is required." | ||
item | ||
} | ||
# Validate All resource | ||
items = [validate(i) for i in option("items") or []] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Introduction | ||
|
||
`tekton-require-namespace-pipeline-run` is a KCL validation module. | ||
|
||
## Resource | ||
|
||
The Code source and document are [here](https://github.com/kcl-lang/modules/tree/main/nginx-ingress/tekton-require-namespace-pipeline-run) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[package] | ||
name = "tekton-require-namespace-pipeline-run" | ||
edition = "*" | ||
version = "0.1.0" | ||
description = "`tekton-require-namespace-pipeline-run` is a KCL validation module" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
validate = lambda item { | ||
if item.kind in ["PipelineRun"]: | ||
ns = item.metadata.namespace or "default" | ||
assert ns != "default", "A namespace is required and may not be set to default." | ||
item | ||
} | ||
# Validate All resource | ||
items = [validate(i) for i in option("items") or []] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Introduction | ||
|
||
`tekton-require-securitycontext` is a KCL validation module. | ||
|
||
## Resource | ||
|
||
The Code source and document are [here](https://github.com/kcl-lang/modules/tree/main/nginx-ingress/tekton-require-securitycontext) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[package] | ||
name = "tekton-require-securitycontext" | ||
edition = "*" | ||
version = "0.1.0" | ||
description = "`tekton-require-securitycontext` is a KCL validation module" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
validate = lambda item { | ||
if item.kind in ["TaskRun"]: | ||
steps = [s for s in (item.status?.taskSpec?.steps or [] + item.spec?.steps or []) if s.name != digest-to-results] | ||
assert all s in steps { | ||
s.privileged == False and s.allowPrivilegeEscalation == False | ||
}, "A securityContext is required with `privileged` and `allowPrivilegeEscalation` set to `false`." | ||
item | ||
} | ||
# Validate All resource | ||
items = [validate(i) for i in option("items") or []] |