From 6f4328ae958d98811235d760a37b972327fa080e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Sat, 28 Oct 2023 23:45:56 +0200 Subject: [PATCH 1/2] chore: move main at the root of the repo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- Makefile | 3 +-- cmd/cli/main.go => main.go | 0 2 files changed, 1 insertion(+), 2 deletions(-) rename cmd/cli/main.go => main.go (100%) diff --git a/Makefile b/Makefile index 28a121b9..de5b50df 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,6 @@ KO_REGISTRY := ko.local KO_PLATFORMS := all KO_TAGS := $(GIT_SHA) KO_CACHE ?= /tmp/ko-cache -CLI_DIR := cmd/cli CLI_BIN := kyverno-json ######### @@ -122,7 +121,7 @@ vet: ## Run go vet $(CLI_BIN): fmt vet build-wasm codegen-crds codegen-deepcopy codegen-register codegen-client codegen-playground @echo Build cli binary... >&2 - @CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) go build -o ./$(CLI_BIN) -ldflags=$(LD_FLAGS) ./$(CLI_DIR) + @CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) go build -o ./$(CLI_BIN) -ldflags=$(LD_FLAGS) . .PHONY: build build: $(CLI_BIN) ## Build diff --git a/cmd/cli/main.go b/main.go similarity index 100% rename from cmd/cli/main.go rename to main.go From a0de0d441d813a98a69a3b559909720acc5e3be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Sat, 28 Oct 2023 23:55:47 +0200 Subject: [PATCH 2/2] fix: add playground preset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- pkg/server/ui/dist/assets/data.json | 11 +++++++++-- website/playground/assets/data.json | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pkg/server/ui/dist/assets/data.json b/pkg/server/ui/dist/assets/data.json index 89b1c4ba..96141bf1 100644 --- a/pkg/server/ui/dist/assets/data.json +++ b/pkg/server/ui/dist/assets/data.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/website/playground/assets/data.json b/website/playground/assets/data.json index 89b1c4ba..96141bf1 100644 --- a/website/playground/assets/data.json +++ b/website/playground/assets/data.json @@ -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" + } + ] +} \ No newline at end of file