From 2cb0252670be03f925054a68560ba2f673b5cafc Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Thu, 10 Oct 2024 03:33:48 +0100 Subject: [PATCH 01/10] pull latest changes Signed-off-by: Eti Ijeoma --- internal/errors/error.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/internal/errors/error.go b/internal/errors/error.go index 7338417035..001a987f7c 100644 --- a/internal/errors/error.go +++ b/internal/errors/error.go @@ -7,12 +7,13 @@ import ( ) var ( - ErrInvalidChartURICode = "kanvas-snapshot-900" - ErrCreatingMesheryDesignCode = "kanvas-snapshot-901" - ErrGeneratingSnapshotCode = "kanvas-snapshot-902" - ErrHTTPPostRequestCode = "kanvas-snapshot-903" - ErrDecodingAPICode = "kanvas-snapshot-905" - ErrUnexpectedResponseCodeCode = "kanvas-snapshot-906" + ErrInvalidChartURICode = "kanvas-snapshot-900" + ErrCreatingMesheryDesignCode = "kanvas-snapshot-901" + ErrGeneratingSnapshotCode = "kanvas-snapshot-902" + ErrHTTPPostRequestCode = "kanvas-snapshot-903" + ErrDecodingAPICode = "kanvas-snapshot-905" + ErrUnexpectedResponseCodeCode = "kanvas-snapshot-906" + ErrRequiredFieldNotProvidedCode = "kanvas-snapshot-907" ) func ErrInvalidChartURI(err error) error { @@ -68,3 +69,12 @@ func ErrUnexpectedResponseCode(statusCode int, body string) error { []string{"Check the request details and ensure the Meshery API is functioning correctly."}, ) } + +func ErrRequiredFieldNotProvided(err error, field string) error { + return errors.New(ErrRequiredFieldNotProvidedCode, errors.Alert, + []string{"All required flags are not passed."}, + []string{err.Error()}, + []string{"Required flag \"%s\" is not passed."}, + []string{"Ensure value for flag \"%s\" is correctly provided."}, + ) +} From 8d188880bcdde5fef82af7d4372c0b64f39320e1 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Thu, 10 Oct 2024 03:34:18 +0100 Subject: [PATCH 02/10] pull latest changes Signed-off-by: Eti Ijeoma --- cmd/kanvas-snapshot/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/kanvas-snapshot/main.go b/cmd/kanvas-snapshot/main.go index fcfea0b04b..0271ec402f 100644 --- a/cmd/kanvas-snapshot/main.go +++ b/cmd/kanvas-snapshot/main.go @@ -49,7 +49,11 @@ var generateKanvasSnapshotCmd = &cobra.Command{ -h Help for Helm Kanvas Snapshot plugin`, RunE: func(cmd *cobra.Command, args []string) error { +<<<<<<< HEAD Log = log.SetupMeshkitLogger("helm-kanvas-snapshot", false, os.Stdout) +======= + +>>>>>>> d6f467c2 (pull latest changes) // Use the extracted name from URI if not provided if designName == "" { designName = ExtractNameFromURI(chartURI) @@ -271,3 +275,9 @@ func main() { } } + +func init() { + cobra.OnInitialize(func() { + Log = log.SetupMeshkitLogger("helm-kanvas-snapshot", false, os.Stdout) + }) +} From 84b6d4b95252a66673f8f74544f7a3bde10d8983 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Fri, 4 Oct 2024 20:45:03 +0530 Subject: [PATCH 03/10] update command description Signed-off-by: MUzairS15 --- cmd/kanvas-snapshot/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/kanvas-snapshot/main.go b/cmd/kanvas-snapshot/main.go index 0271ec402f..a3eac0e513 100644 --- a/cmd/kanvas-snapshot/main.go +++ b/cmd/kanvas-snapshot/main.go @@ -45,7 +45,7 @@ var generateKanvasSnapshotCmd = &cobra.Command{ Flags: -f, --file string URI to Helm chart (required) -n, --name string (optional name for the Meshery design - -e, --email string (optional) email address to notify when snapshot is ready + -e, --email string email address to notify when snapshot is ready (required) -h Help for Helm Kanvas Snapshot plugin`, RunE: func(cmd *cobra.Command, args []string) error { From f5800f7896a1179cf72eb4836e4f5ddd5235e875 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Thu, 10 Oct 2024 03:35:38 +0100 Subject: [PATCH 04/10] pull latest changes Signed-off-by: Eti Ijeoma --- cmd/kanvas-snapshot/main.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cmd/kanvas-snapshot/main.go b/cmd/kanvas-snapshot/main.go index a3eac0e513..ed87547d81 100644 --- a/cmd/kanvas-snapshot/main.go +++ b/cmd/kanvas-snapshot/main.go @@ -49,11 +49,6 @@ var generateKanvasSnapshotCmd = &cobra.Command{ -h Help for Helm Kanvas Snapshot plugin`, RunE: func(cmd *cobra.Command, args []string) error { -<<<<<<< HEAD - Log = log.SetupMeshkitLogger("helm-kanvas-snapshot", false, os.Stdout) -======= - ->>>>>>> d6f467c2 (pull latest changes) // Use the extracted name from URI if not provided if designName == "" { designName = ExtractNameFromURI(chartURI) From 49377fc7d1b3df35fdf251d4cfc08e06b0b00c45 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Thu, 10 Oct 2024 04:08:55 +0100 Subject: [PATCH 05/10] fix error code workflow Signed-off-by: Eti Ijeoma --- .github/workflows/error-codes-updater.yaml | 2 +- plugin.yaml => cmd/kanvas-snapshot/plugin.yaml | 0 {build => helpers}/Makefile.core.mk | 0 {build => helpers}/component_info.json | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename plugin.yaml => cmd/kanvas-snapshot/plugin.yaml (100%) rename {build => helpers}/Makefile.core.mk (100%) rename {build => helpers}/component_info.json (100%) diff --git a/.github/workflows/error-codes-updater.yaml b/.github/workflows/error-codes-updater.yaml index 132ba0ffc5..2184c52340 100644 --- a/.github/workflows/error-codes-updater.yaml +++ b/.github/workflows/error-codes-updater.yaml @@ -45,7 +45,7 @@ jobs: if [ "$output" -ne 0 ]; then exit 1 fi - echo '{ "errors_export": "" }' | jq --slurpfile export ../server/helpers/errorutil_errors_export.json '.errors_export = $export[0]' > ../docs/_data/errorref/mesheryctl_errors_export.json + echo '{ "errors_export": "" }' | jq --slurpfile export ./helpers/errorutil_errors_export.json '.errors_export = $export[0]' > ./helpers/errorutil_errors_export.json - name: Pull changes from remote run: git pull origin master diff --git a/plugin.yaml b/cmd/kanvas-snapshot/plugin.yaml similarity index 100% rename from plugin.yaml rename to cmd/kanvas-snapshot/plugin.yaml diff --git a/build/Makefile.core.mk b/helpers/Makefile.core.mk similarity index 100% rename from build/Makefile.core.mk rename to helpers/Makefile.core.mk diff --git a/build/component_info.json b/helpers/component_info.json similarity index 100% rename from build/component_info.json rename to helpers/component_info.json From 9cc67f9651feb77f0652545a14195adb9313cf16 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Thu, 10 Oct 2024 04:10:28 +0100 Subject: [PATCH 06/10] fix error code workflow Signed-off-by: Eti Ijeoma --- .github/workflows/error-codes-updater.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/error-codes-updater.yaml b/.github/workflows/error-codes-updater.yaml index 2184c52340..e20696258c 100644 --- a/.github/workflows/error-codes-updater.yaml +++ b/.github/workflows/error-codes-updater.yaml @@ -39,7 +39,6 @@ jobs: - name: Run Utility For Plugin run: | - cd ./cmd ~/errorutil update -d . -i ./helpers -o ./helpers output=$(~/errorutil -d . analyze -i ./helpers -o ./helpers | wc -c) if [ "$output" -ne 0 ]; then From 1c0b84d5919ac69055a9ef142b0e8e830509e9f4 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Thu, 10 Oct 2024 04:22:22 +0100 Subject: [PATCH 07/10] debug error code workflow Signed-off-by: Eti Ijeoma --- .github/workflows/error-codes-updater.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/error-codes-updater.yaml b/.github/workflows/error-codes-updater.yaml index e20696258c..8549119235 100644 --- a/.github/workflows/error-codes-updater.yaml +++ b/.github/workflows/error-codes-updater.yaml @@ -39,6 +39,8 @@ jobs: - name: Run Utility For Plugin run: | + echo $(pwd) + echo $(ls) ~/errorutil update -d . -i ./helpers -o ./helpers output=$(~/errorutil -d . analyze -i ./helpers -o ./helpers | wc -c) if [ "$output" -ne 0 ]; then From 9ebff3e0a8eeef0a30a5d60be2d8b069e424e2a9 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Thu, 10 Oct 2024 04:26:05 +0100 Subject: [PATCH 08/10] debug error code workflow Signed-off-by: Eti Ijeoma --- .github/workflows/error-codes-updater.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/error-codes-updater.yaml b/.github/workflows/error-codes-updater.yaml index 8549119235..c7163c5c10 100644 --- a/.github/workflows/error-codes-updater.yaml +++ b/.github/workflows/error-codes-updater.yaml @@ -55,7 +55,7 @@ jobs: if: ${{ github.event_name != 'pull_request' }} # Skip for pull requests uses: stefanzweifel/git-auto-commit-action@v5 with: - file_pattern: mesheryctl/helpers server/helpers/ **.go docs/ + file_pattern: helpers commit_user_name: l5io commit_user_email: ci@layer5.io commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> From efeb8e09bdaf27524b6434be225dccd7758abb05 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Thu, 10 Oct 2024 23:22:08 +0100 Subject: [PATCH 09/10] remove unused code Signed-off-by: Eti Ijeoma --- .github/workflows/error-codes-updater.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/error-codes-updater.yaml b/.github/workflows/error-codes-updater.yaml index c7163c5c10..f283a0284c 100644 --- a/.github/workflows/error-codes-updater.yaml +++ b/.github/workflows/error-codes-updater.yaml @@ -39,8 +39,6 @@ jobs: - name: Run Utility For Plugin run: | - echo $(pwd) - echo $(ls) ~/errorutil update -d . -i ./helpers -o ./helpers output=$(~/errorutil -d . analyze -i ./helpers -o ./helpers | wc -c) if [ "$output" -ne 0 ]; then From 571eafd1aa78d2bd8e9684dd3158947ef56d13e6 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Fri, 11 Oct 2024 16:13:18 +0100 Subject: [PATCH 10/10] move plugin to the root dir Signed-off-by: Eti Ijeoma --- cmd/kanvas-snapshot/plugin.yaml => plugin.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cmd/kanvas-snapshot/plugin.yaml => plugin.yaml (100%) diff --git a/cmd/kanvas-snapshot/plugin.yaml b/plugin.yaml similarity index 100% rename from cmd/kanvas-snapshot/plugin.yaml rename to plugin.yaml