Skip to content

Commit

Permalink
feat: add playground presets (#146)
Browse files Browse the repository at this point in the history
* chore: move main at the root of the repo

Signed-off-by: Charles-Edouard Brétéché <[email protected]>

* fix: add playground preset

Signed-off-by: Charles-Edouard Brétéché <[email protected]>

---------

Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly authored Oct 28, 2023
1 parent f582e30 commit dabd09c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions pkg/server/ui/dist/assets/data.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"examples": []
}
"examples": [
{
"name": "check-dockerfile",
"policy": "apiVersion: json.kyverno.io/v1alpha1\nkind: ValidationPolicy\nmetadata:\n name: check-dockerfile\nspec:\n rules:\n - name: deny-external-calls\n assert:\n all:\n - message: \"HTTP calls are not allowed\"\n check:\n ~.(Stages[].Commands[].Args[].Value):\n (contains(@, 'https://') || contains(@, 'http://')): false\n - message: \"HTTP calls are not allowed\"\n check:\n ~.(Stages[].Commands[].CmdLine[]):\n (contains(@, 'https://') || contains(@, 'http://')): false\n - message: \"curl is not allowed\"\n check:\n ~.(Stages[].Commands[].CmdLine[]):\n (contains(@, 'curl')): false\n - message: \"wget is not allowed\"\n check:\n ~.(Stages[].Commands[].CmdLine[]):\n (contains(@, 'wget')): false\n",
"payload": "MetaArgs:\n- Key: BUILD_PLATFORM\n DefaultValue: '\"linux/amd64\"'\n ProvidedValue:\n Value: '\"linux/amd64\"'\n- Key: BUILDER_IMAGE\n DefaultValue: '\"golang:1.20.6-alpine3.18\"'\n ProvidedValue:\n Value: '\"golang:1.20.6-alpine3.18\"'\nStages:\n- Name: builder\n BaseName: '\"golang:1.20.6-alpine3.18\"'\n Platform: \"$BUILD_PLATFORM\"\n Comment: ''\n SourceCode: FROM --platform=$BUILD_PLATFORM $BUILDER_IMAGE as builder\n Location:\n - Start:\n Line: 4\n Character: 0\n End:\n Line: 4\n Character: 0\n As: builder\n From:\n Image: '\"golang:1.20.6-alpine3.18\"'\n Commands:\n - Name: WORKDIR\n Path: \"/\"\n - Chmod: ''\n Chown: ''\n DestPath: \"./\"\n From: ''\n Link: false\n Name: COPY\n SourceContents:\n SourcePaths:\n - \".\"\n - Args:\n - Comment: ''\n Key: SIGNER_BINARY_LINK\n Value: '\"https://d2hvyiie56hcat.cloudfront.net/linux/amd64/plugin/latest/notation-aws-signer-plugin.zip\"'\n Name: ARG\n - Args:\n - Comment: ''\n Key: SIGNER_BINARY_FILE\n Value: '\"notation-aws-signer-plugin.zip\"'\n Name: ARG\n - CmdLine:\n - wget -O ${SIGNER_BINARY_FILE} ${SIGNER_BINARY_LINK}\n Files:\n FlagsUsed: []\n Name: RUN\n PrependShell: true\n - CmdLine:\n - apk update && apk add unzip && unzip -o ${SIGNER_BINARY_FILE}\n Files:\n FlagsUsed: []\n Name: RUN\n PrependShell: true\n - CmdLine:\n - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags=\"-w -s\" -o kyverno-notation-aws\n .\n Files:\n FlagsUsed: []\n Name: RUN\n PrependShell: true\n- Name: ''\n BaseName: gcr.io/distroless/static:nonroot\n Platform: ''\n Comment: ''\n SourceCode: FROM gcr.io/distroless/static:nonroot\n Location:\n - Start:\n Line: 20\n Character: 0\n End:\n Line: 20\n Character: 0\n From:\n Image: gcr.io/distroless/static:nonroot\n Commands:\n - Name: WORKDIR\n Path: \"/\"\n - Env:\n - Key: PLUGINS_DIR\n Value: \"/plugins\"\n Name: ENV\n - Chmod: ''\n Chown: ''\n DestPath: plugins/com.amazonaws.signer.notation.plugin/notation-com.amazonaws.signer.notation.plugin\n From: builder\n Link: false\n Name: COPY\n SourceContents:\n SourcePaths:\n - notation-com.amazonaws.signer.notation.plugin\n - Chmod: ''\n Chown: ''\n DestPath: kyverno-notation-aws\n From: builder\n Link: false\n Name: COPY\n SourceContents:\n SourcePaths:\n - kyverno-notation-aws\n - CmdLine:\n - \"/kyverno-notation-aws\"\n Files:\n Name: ENTRYPOINT\n PrependShell: false\n",
"category": "dockerfile"
}
]
}
11 changes: 9 additions & 2 deletions website/playground/assets/data.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"examples": []
}
"examples": [
{
"name": "check-dockerfile",
"policy": "apiVersion: json.kyverno.io/v1alpha1\nkind: ValidationPolicy\nmetadata:\n name: check-dockerfile\nspec:\n rules:\n - name: deny-external-calls\n assert:\n all:\n - message: \"HTTP calls are not allowed\"\n check:\n ~.(Stages[].Commands[].Args[].Value):\n (contains(@, 'https://') || contains(@, 'http://')): false\n - message: \"HTTP calls are not allowed\"\n check:\n ~.(Stages[].Commands[].CmdLine[]):\n (contains(@, 'https://') || contains(@, 'http://')): false\n - message: \"curl is not allowed\"\n check:\n ~.(Stages[].Commands[].CmdLine[]):\n (contains(@, 'curl')): false\n - message: \"wget is not allowed\"\n check:\n ~.(Stages[].Commands[].CmdLine[]):\n (contains(@, 'wget')): false\n",
"payload": "MetaArgs:\n- Key: BUILD_PLATFORM\n DefaultValue: '\"linux/amd64\"'\n ProvidedValue:\n Value: '\"linux/amd64\"'\n- Key: BUILDER_IMAGE\n DefaultValue: '\"golang:1.20.6-alpine3.18\"'\n ProvidedValue:\n Value: '\"golang:1.20.6-alpine3.18\"'\nStages:\n- Name: builder\n BaseName: '\"golang:1.20.6-alpine3.18\"'\n Platform: \"$BUILD_PLATFORM\"\n Comment: ''\n SourceCode: FROM --platform=$BUILD_PLATFORM $BUILDER_IMAGE as builder\n Location:\n - Start:\n Line: 4\n Character: 0\n End:\n Line: 4\n Character: 0\n As: builder\n From:\n Image: '\"golang:1.20.6-alpine3.18\"'\n Commands:\n - Name: WORKDIR\n Path: \"/\"\n - Chmod: ''\n Chown: ''\n DestPath: \"./\"\n From: ''\n Link: false\n Name: COPY\n SourceContents:\n SourcePaths:\n - \".\"\n - Args:\n - Comment: ''\n Key: SIGNER_BINARY_LINK\n Value: '\"https://d2hvyiie56hcat.cloudfront.net/linux/amd64/plugin/latest/notation-aws-signer-plugin.zip\"'\n Name: ARG\n - Args:\n - Comment: ''\n Key: SIGNER_BINARY_FILE\n Value: '\"notation-aws-signer-plugin.zip\"'\n Name: ARG\n - CmdLine:\n - wget -O ${SIGNER_BINARY_FILE} ${SIGNER_BINARY_LINK}\n Files:\n FlagsUsed: []\n Name: RUN\n PrependShell: true\n - CmdLine:\n - apk update && apk add unzip && unzip -o ${SIGNER_BINARY_FILE}\n Files:\n FlagsUsed: []\n Name: RUN\n PrependShell: true\n - CmdLine:\n - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags=\"-w -s\" -o kyverno-notation-aws\n .\n Files:\n FlagsUsed: []\n Name: RUN\n PrependShell: true\n- Name: ''\n BaseName: gcr.io/distroless/static:nonroot\n Platform: ''\n Comment: ''\n SourceCode: FROM gcr.io/distroless/static:nonroot\n Location:\n - Start:\n Line: 20\n Character: 0\n End:\n Line: 20\n Character: 0\n From:\n Image: gcr.io/distroless/static:nonroot\n Commands:\n - Name: WORKDIR\n Path: \"/\"\n - Env:\n - Key: PLUGINS_DIR\n Value: \"/plugins\"\n Name: ENV\n - Chmod: ''\n Chown: ''\n DestPath: plugins/com.amazonaws.signer.notation.plugin/notation-com.amazonaws.signer.notation.plugin\n From: builder\n Link: false\n Name: COPY\n SourceContents:\n SourcePaths:\n - notation-com.amazonaws.signer.notation.plugin\n - Chmod: ''\n Chown: ''\n DestPath: kyverno-notation-aws\n From: builder\n Link: false\n Name: COPY\n SourceContents:\n SourcePaths:\n - kyverno-notation-aws\n - CmdLine:\n - \"/kyverno-notation-aws\"\n Files:\n Name: ENTRYPOINT\n PrependShell: false\n",
"category": "dockerfile"
}
]
}

0 comments on commit dabd09c

Please sign in to comment.