ci(gitlab): Check also for optional lint issues

This commit is contained in:
Dominik Kaminski
2024-10-03 20:02:38 +02:00
parent b7faa24d76
commit 3a9468f04d
4 changed files with 33 additions and 10 deletions

View File

@@ -4,7 +4,7 @@
--- ---
include: include:
- project: "${PROJECT_PATH_GITLAB_CONFIG_TOOLING}" - project: "${PROJECT_PATH_GITLAB_CONFIG_TOOLING}"
ref: "v2.3.4" ref: "v2.4.2"
file: file:
- "ci/common/automr.yml" - "ci/common/automr.yml"
- "ci/common/lint.yml" - "ci/common/lint.yml"

View File

@@ -27,7 +27,19 @@ lint-kyverno:
- > - >
node /app/opendesk-ci-cli/src/index.js generate-kyverno-env node /app/opendesk-ci-cli/src/index.js generate-kyverno-env
-d ${CI_PROJECT_DIR}/helmfile/environments -d ${CI_PROJECT_DIR}/helmfile/environments
- "helmfile template -e test --include-needs > ${CI_PROJECT_DIR}/.kyverno/opendesk.yaml" - "helmfile template -e test --include-needs --skip-tests > ${CI_PROJECT_DIR}/.kyverno/opendesk.yaml"
- "cd ${CI_PROJECT_DIR}/.kyverno"
# Test optional
- >
node /app/opendesk-ci-cli/src/index.js generate-kyverno-tests
-d ${CI_PROJECT_DIR}/.kyverno
-t optional
-s manifest
-f opendesk.yaml
--skip-tests true
${APP}
- "kyverno test . || true"
# Test required
- > - >
node /app/opendesk-ci-cli/src/index.js generate-kyverno-tests node /app/opendesk-ci-cli/src/index.js generate-kyverno-tests
-d ${CI_PROJECT_DIR}/.kyverno -d ${CI_PROJECT_DIR}/.kyverno
@@ -36,8 +48,5 @@ lint-kyverno:
-f opendesk.yaml -f opendesk.yaml
--skip-tests true --skip-tests true
${APP} ${APP}
- "node /app/opendesk-ci-cli/src/index.js filter-for-kinds -f ${CI_PROJECT_DIR}/.kyverno/opendesk.yaml"
- "cd ${CI_PROJECT_DIR}/.kyverno"
- "kyverno test ." - "kyverno test ."
... ...

View File

@@ -13,7 +13,7 @@ pod:
- "DaemonSet" - "DaemonSet"
- name: "disallow-default-serviceaccount" - name: "disallow-default-serviceaccount"
rule: "disallow-default-serviceAccountName" rule: "disallow-default-serviceAccountName"
type: "required" type: "optional"
kinds: kinds:
- "StatefulSet" - "StatefulSet"
- "Deployment" - "Deployment"
@@ -58,7 +58,7 @@ pod:
- "DaemonSet" - "DaemonSet"
- name: "require-health-and-liveness-check" - name: "require-health-and-liveness-check"
rule: "require-health-and-liveness-check" rule: "require-health-and-liveness-check"
type: "required" type: "optional"
kinds: kinds:
- "StatefulSet" - "StatefulSet"
- "Deployment" - "Deployment"
@@ -158,7 +158,7 @@ pod:
- "DaemonSet" - "DaemonSet"
- name: "require-containersecuritycontext" - name: "require-containersecuritycontext"
rule: "require-seccomp-profile" rule: "require-seccomp-profile"
type: "required" type: "optional"
kinds: kinds:
- "StatefulSet" - "StatefulSet"
- "Deployment" - "Deployment"
@@ -176,7 +176,7 @@ pod:
- "DaemonSet" - "DaemonSet"
- name: "require-containersecuritycontext" - name: "require-containersecuritycontext"
rule: "require-empty-seLinuxOptions" rule: "require-empty-seLinuxOptions"
type: "required" type: "optional"
kinds: kinds:
- "StatefulSet" - "StatefulSet"
- "Deployment" - "Deployment"
@@ -285,7 +285,7 @@ pod:
- "Ingress" - "Ingress"
- name: "template-replicas" - name: "template-replicas"
rule: "template-replicas" rule: "template-replicas"
type: "required" type: "optional"
kinds: kinds:
- "StatefulSet" - "StatefulSet"
- "Deployment" - "Deployment"

View File

@@ -27,6 +27,20 @@ spec:
message: "CPU and memory resource requests and limits are required." message: "CPU and memory resource requests and limits are required."
pattern: pattern:
spec: spec:
=(ephemeralContainers):
- resources:
limits:
memory: "?*"
requests:
cpu: "?*"
memory: "?*"
=(initContainers):
- resources:
limits:
memory: "?*"
requests:
cpu: "?*"
memory: "?*"
containers: containers:
- resources: - resources:
limits: limits: