From 15d19d0a5baa2af0db753fa985685ede5547487e Mon Sep 17 00:00:00 2001 From: razzle Date: Tue, 9 Apr 2024 22:53:26 -0500 Subject: [PATCH 01/34] cleanup refs to old docs dirs Signed-off-by: razzle --- .github/codeql.yaml | 2 +- CODEOWNERS | 31 +------------------------------ Makefile | 4 ++-- 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/.github/codeql.yaml b/.github/codeql.yaml index 3d376c23c1..a57c624727 100644 --- a/.github/codeql.yaml +++ b/.github/codeql.yaml @@ -2,7 +2,7 @@ paths-ignore: - src/pkg/packager/network.go - src/pkg/utils/network.go - src/pkg/utils/credentials.go - - docs-website/** + - site/** - build/** query-filters: diff --git a/CODEOWNERS b/CODEOWNERS index 4789538bef..acedf60269 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,35 +1,6 @@ * @defenseunicorns/zarf -# Docs & examples -/adr/ @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/docs/ @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/examples/ @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -*.md @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 - -# Core code -/src/ @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/go.* @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -main.go @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 - -# Init package -/packages/ @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/zarf.yaml @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 - -# Docs Website -/docs-website/ @Racer159 @Noxsios @jeff-mccoy @lucasrod16 @AustinAbro321 - -# Privileged pipeline files -/.github/ @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/hack/ @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/.gitignore @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/.golangci.yml @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/.goreleaser.yml @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/.grype.yaml @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/Dockerfile @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/renovate.json @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 -/Makefile @jeff-mccoy @Racer159 @Noxsios @lucasrod16 @AustinAbro321 - -# Additional privileged files +/.github/ @defenseunicorns/zarf-admin /CODEOWNERS @jeff-mccoy @austenbryan /cosign.pub @jeff-mccoy @austenbryan /LICENSE @jeff-mccoy @austenbryan diff --git a/Makefile b/Makefile index 08de34a14d..4bebb9feed 100644 --- a/Makefile +++ b/Makefile @@ -219,11 +219,11 @@ test-docs-and-schema: # INTERNAL: used to test for new CVEs that may have been introduced test-cves: - go run main.go tools sbom scan . -o json --exclude './docs-website' --exclude './examples' | grype --fail-on low + go run main.go tools sbom scan . -o json --exclude './site' --exclude './examples' | grype --fail-on low cve-report: ## Create a CVE report for the current project (must `brew install grype` first) @test -d ./build || mkdir ./build - go run main.go tools sbom scan . -o json --exclude './docs-website' --exclude './examples' | grype -o template -t hack/.templates/grype.tmpl > build/zarf-known-cves.csv + go run main.go tools sbom scan . -o json --exclude './site' --exclude './examples' | grype -o template -t hack/.templates/grype.tmpl > build/zarf-known-cves.csv lint-go: ## Run revive to lint the go code (must `brew install revive` first) revive -config revive.toml -exclude src/cmd/viper.go -formatter stylish ./src/... From 9e2b2380c7712275547bd1073515fc94b3d957a6 Mon Sep 17 00:00:00 2001 From: razzle Date: Tue, 9 Apr 2024 23:39:58 -0500 Subject: [PATCH 02/34] cleanup root Signed-off-by: razzle --- CONTRIBUTING.md => .github/CONTRIBUTING.md | 0 SECURITY.md => .github/SECURITY.md | 0 .github/pull_request_template.md | 2 +- Makefile | 6 +++--- hack/{.templates => }/grype.tmpl | 0 hack/lint-all-zarf-packages.sh | 2 +- revive.toml => hack/revive.toml | 0 site/src/content/docs/contribute/contributor-guide.mdx | 2 +- 8 files changed, 6 insertions(+), 6 deletions(-) rename CONTRIBUTING.md => .github/CONTRIBUTING.md (100%) rename SECURITY.md => .github/SECURITY.md (100%) rename hack/{.templates => }/grype.tmpl (100%) rename revive.toml => hack/revive.toml (100%) diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/SECURITY.md b/.github/SECURITY.md similarity index 100% rename from SECURITY.md rename to .github/SECURITY.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 370d4faa9a..cee28d19f1 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -11,4 +11,4 @@ Relates to # ## Checklist before merging - [ ] Test, docs, adr added or updated as needed -- [ ] [Contributor Guide Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow) followed +- [ ] [Contributor Guide Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow) followed diff --git a/Makefile b/Makefile index 4bebb9feed..cf7ea0077b 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,7 @@ destroy: ## Run `zarf destroy` on the current cluster rm -fr build delete-packages: ## Delete all Zarf package tarballs in the project recursively - find . -type f -name 'zarf-package-*' -delete + find . -type f \( -name 'zarf-package-*' -o -name 'zarf-init-*' \) -delete # Note: the path to the main.go file is not used due to https://github.com/golang/go/issues/51831#issuecomment-1074188363 .PHONY: build @@ -223,7 +223,7 @@ test-cves: cve-report: ## Create a CVE report for the current project (must `brew install grype` first) @test -d ./build || mkdir ./build - go run main.go tools sbom scan . -o json --exclude './site' --exclude './examples' | grype -o template -t hack/.templates/grype.tmpl > build/zarf-known-cves.csv + go run main.go tools sbom scan . -o json --exclude './site' --exclude './examples' | grype -o template -t hack/grype.tmpl > build/zarf-known-cves.csv lint-go: ## Run revive to lint the go code (must `brew install revive` first) - revive -config revive.toml -exclude src/cmd/viper.go -formatter stylish ./src/... + revive -config hack/revive.toml -exclude src/cmd/viper.go -formatter stylish ./src/... diff --git a/hack/.templates/grype.tmpl b/hack/grype.tmpl similarity index 100% rename from hack/.templates/grype.tmpl rename to hack/grype.tmpl diff --git a/hack/lint-all-zarf-packages.sh b/hack/lint-all-zarf-packages.sh index 5f41d3d887..31f8763812 100755 --- a/hack/lint-all-zarf-packages.sh +++ b/hack/lint-all-zarf-packages.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ZARF_BIN=$1 LINT_SRC_TEST=$2 diff --git a/revive.toml b/hack/revive.toml similarity index 100% rename from revive.toml rename to hack/revive.toml diff --git a/site/src/content/docs/contribute/contributor-guide.mdx b/site/src/content/docs/contribute/contributor-guide.mdx index f263929b06..29fe7e1db6 100644 --- a/site/src/content/docs/contribute/contributor-guide.mdx +++ b/site/src/content/docs/contribute/contributor-guide.mdx @@ -2,6 +2,6 @@ title: Contributing Guide --- -import Contributing from '../../../../../CONTRIBUTING.md'; +import Contributing from '../../../../../.github/CONTRIBUTING.md'; From e998095d1d2dd3adf6d53f0660a597ee0e124ed1 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 00:15:33 -0500 Subject: [PATCH 03/34] spdx go Signed-off-by: razzle --- Makefile | 1 + hack/check-spdx-go.sh | 61 +++++++++++++++++++++ src/config/lang/english.go | 12 ++-- src/extensions/bigbang/bigbang_test.go | 3 + src/extensions/bigbang/test/bigbang_test.go | 3 + src/internal/packager/helm/images.go | 3 + src/pkg/packager/common_test.go | 3 + src/pkg/transform/types.go | 3 + src/pkg/utils/cosign.go | 3 +- src/test/e2e/12_lint_test.go | 3 + src/test/e2e/13_find_images_test.go | 3 + 11 files changed, 91 insertions(+), 7 deletions(-) create mode 100755 hack/check-spdx-go.sh diff --git a/Makefile b/Makefile index cf7ea0077b..8c03f9d011 100644 --- a/Makefile +++ b/Makefile @@ -227,3 +227,4 @@ cve-report: ## Create a CVE report for the current project (must `brew install g lint-go: ## Run revive to lint the go code (must `brew install revive` first) revive -config hack/revive.toml -exclude src/cmd/viper.go -formatter stylish ./src/... + hack/check-spdx-go.sh src >/dev/null || (echo "SPDX check for go failed, please run 'hack/check-spdx-go.sh src' to see the errors" && exit 1) diff --git a/hack/check-spdx-go.sh b/hack/check-spdx-go.sh new file mode 100755 index 0000000000..6fb23e49de --- /dev/null +++ b/hack/check-spdx-go.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# Directory containing the Go files +DIRECTORY="$1" + +# Array of paths to exclude from the check +EXCLUDE_PATHS=( + "src/cmd/tools/helm/repo_update.go" + "src/cmd/tools/helm/repo_remove.go" + "src/cmd/tools/helm/load_plugins.go" + "src/cmd/tools/helm/repo_list.go" + "src/cmd/tools/helm/flags.go" + "src/cmd/tools/helm/repo_add.go" + "src/cmd/tools/helm/dependency.go" + "src/cmd/tools/helm/repo_index.go" + "src/cmd/tools/helm/repo.go" + "src/cmd/tools/helm/dependency_build.go" + "src/cmd/tools/helm/dependency_update.go" + "src/cmd/tools/helm/root.go" +) + +BLACK='\033[0;30m' +RED='\033[0;31m' +RESET='\033[0m' + +# Function to check if a path is in the EXCLUDE_PATHS array +is_excluded() { + local path="$1" + for exclude in "${EXCLUDE_PATHS[@]}"; do + if [[ "$path" == "$exclude"* ]]; then + return 0 # 0 means true/success in shell script + fi + done + return 1 # 1 means false/failure in shell script +} + +# Flag to track if any file meets the condition +found=0 + +# Use process substitution to avoid subshell issue with the 'found' variable +while IFS= read -r file; do + if is_excluded "$file"; then + echo -e "$BLACK$file$RESET" + continue + fi + + # Use `head` to grab the first two lines and compare them directly + firstLine=$(head -n 1 "$file") + secondLine=$(head -n 2 "$file" | tail -n 1) + + # Check if the lines do not match the specified strings + if [[ "$firstLine" != "// SPDX-License-Identifier: Apache-2.0" || "$secondLine" != "// SPDX-FileCopyrightText: 2021-Present The Zarf Authors" ]]; then + echo -e "$RED$file$RESET" + found=1 + fi +done < <(find "$DIRECTORY" -type f -name "*.go") + +# If any file met the condition, exit with status 1 +if [ "$found" -eq 1 ]; then + exit 1 +fi diff --git a/src/config/lang/english.go b/src/config/lang/english.go index 658ebab539..b5350deb7f 100644 --- a/src/config/lang/english.go +++ b/src/config/lang/english.go @@ -1,8 +1,8 @@ -//go:build !alt_language - // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2021-Present The Zarf Authors +//go:build !alt_language + // Package lang contains the language strings for english used by Zarf // Alternative languages can be created by duplicating this file and changing the build tag to "//go:build alt_language && ". package lang @@ -506,10 +506,10 @@ cat file2.yml | zarf tools yq ea '.a.b' file1.yml - file3.yml ` CmdToolsYqEvalExample = ` # Reads field under the given path for each file -zarf tools yq e '.a.b' f1.yml f2.yml +zarf tools yq e '.a.b' f1.yml f2.yml # Prints out the file -zarf tools yq e sample.yaml +zarf tools yq e sample.yaml # Pipe from STDIN ## use '-' as a filename to pipe from STDIN @@ -517,10 +517,10 @@ cat file2.yml | zarf tools yq e '.a.b' file1.yml - file3.yml # Creates a new yaml document ## Note that editing an empty file does not work. -zarf tools yq e -n '.a.b.c = "cat"' +zarf tools yq e -n '.a.b.c = "cat"' # Update a file inplace -zarf tools yq e '.a.b = "cool"' -i file.yaml +zarf tools yq e '.a.b = "cool"' -i file.yaml ` CmdToolsMonitorShort = "Launches a terminal UI to monitor the connected cluster using K9s." diff --git a/src/extensions/bigbang/bigbang_test.go b/src/extensions/bigbang/bigbang_test.go index b9807ff73b..21d09939f4 100644 --- a/src/extensions/bigbang/bigbang_test.go +++ b/src/extensions/bigbang/bigbang_test.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2021-Present The Zarf Authors + package bigbang import ( diff --git a/src/extensions/bigbang/test/bigbang_test.go b/src/extensions/bigbang/test/bigbang_test.go index 468a498b5b..aef7bd5df0 100644 --- a/src/extensions/bigbang/test/bigbang_test.go +++ b/src/extensions/bigbang/test/bigbang_test.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2021-Present The Zarf Authors + package main import ( diff --git a/src/internal/packager/helm/images.go b/src/internal/packager/helm/images.go index 14c3c65e07..dbe4d051ac 100644 --- a/src/internal/packager/helm/images.go +++ b/src/internal/packager/helm/images.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2021-Present The Zarf Authors + package helm import ( diff --git a/src/pkg/packager/common_test.go b/src/pkg/packager/common_test.go index 1f497415be..f2d085a1bd 100644 --- a/src/pkg/packager/common_test.go +++ b/src/pkg/packager/common_test.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2021-Present The Zarf Authors + package packager import ( diff --git a/src/pkg/transform/types.go b/src/pkg/transform/types.go index 7b19eaaee2..dbf4922a0f 100644 --- a/src/pkg/transform/types.go +++ b/src/pkg/transform/types.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2021-Present The Zarf Authors + package transform // Log is a function that logs a message. diff --git a/src/pkg/utils/cosign.go b/src/pkg/utils/cosign.go index 5883495fd0..d9f017afce 100644 --- a/src/pkg/utils/cosign.go +++ b/src/pkg/utils/cosign.go @@ -1,4 +1,3 @@ -// Forked from https://github.com/sigstore/cosign/blob/v1.7.1/pkg/sget/sget.go // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2021-Present The Zarf Authors @@ -37,6 +36,8 @@ import ( ) // Sget performs a cosign signature verification on a given image using the specified public key. +// +// Forked from https://github.com/sigstore/cosign/blob/v1.7.1/pkg/sget/sget.go func Sget(ctx context.Context, image, key string, out io.Writer) error { message.Warnf(lang.WarnSGetDeprecation) diff --git a/src/test/e2e/12_lint_test.go b/src/test/e2e/12_lint_test.go index 62b6964e88..cc6e513129 100644 --- a/src/test/e2e/12_lint_test.go +++ b/src/test/e2e/12_lint_test.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2021-Present The Zarf Authors + package test import ( diff --git a/src/test/e2e/13_find_images_test.go b/src/test/e2e/13_find_images_test.go index 3235d519f1..fbb0185320 100644 --- a/src/test/e2e/13_find_images_test.go +++ b/src/test/e2e/13_find_images_test.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2021-Present The Zarf Authors + package test import ( From f5185e08676fd2a3f394c8d234a73f5da185e899 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 00:55:55 -0500 Subject: [PATCH 04/34] normalize bash scripts and go fmt Signed-off-by: razzle --- .pre-commit-config.yaml | 26 ++++++++++---------------- hack/check-spdx-go.sh | 2 ++ hack/check-zarf-docs-and-schema.sh | 4 +++- hack/create-zarf-schema.sh | 4 +++- hack/lint-all-zarf-packages.sh | 6 ++++-- src/cmd/internal.go | 2 +- src/cmd/tools/yq.go | 5 ++--- src/pkg/layout/package_test.go | 4 ++-- src/pkg/zoci/push.go | 2 +- src/test/e2e/00_use_cli_test.go | 4 ++-- src/test/external/configure-gitea.sh | 1 + 11 files changed, 31 insertions(+), 29 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8c7700afb1..59976d2d2a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,25 +9,14 @@ repos: args: - "--allow-missing-credentials" - id: detect-private-key - exclude: | - (?x)^( - examples/big-bang/kustomization/values.yaml| - examples/istio-with-separate-cert/files/bigbangdev.key - )$ - id: end-of-file-fixer - exclude: "^examples/big-bang/template/bigbang/vendor/.*$" - id: fix-byte-order-marker - id: trailing-whitespace - exclude: "^examples/big-bang/template/bigbang/vendor/.*$" args: [--markdown-linebreak-ext=md] - - repo: https://github.com/sirosen/fix-smartquotes - rev: 0.2.0 + - repo: https://github.com/sirosen/texthooks + rev: 0.6.4 hooks: - id: fix-smartquotes - - repo: https://github.com/dnephin/pre-commit-golang - rev: v0.4.0 - hooks: - - id: go-fmt - repo: local hooks: - id: check-docs-and-schema @@ -36,9 +25,7 @@ repos: files: "src/types/types.go" types: [go] language: script - description: - "Checks if there have been changes - made to the docs and schema" + description: "Checks if there have been changes made to the docs and schema" - repo: https://github.com/python-jsonschema/check-jsonschema rev: 0.14.0 hooks: @@ -51,3 +38,10 @@ repos: (?x)^( src/test/packages/12-lint/.* )$ + - repo: local + hooks: + - id: go-fmt + name: go fmt + entry: go fmt ./... + language: system + pass_filenames: false diff --git a/hack/check-spdx-go.sh b/hack/check-spdx-go.sh index 6fb23e49de..7db63e2ff1 100755 --- a/hack/check-spdx-go.sh +++ b/hack/check-spdx-go.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -euo pipefail + # Directory containing the Go files DIRECTORY="$1" diff --git a/hack/check-zarf-docs-and-schema.sh b/hack/check-zarf-docs-and-schema.sh index 93f4e4be0e..a1e64ba56a 100755 --- a/hack/check-zarf-docs-and-schema.sh +++ b/hack/check-zarf-docs-and-schema.sh @@ -1,4 +1,6 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash + +set -euo pipefail if [ -z "$(git status -s docs/ zarf.schema.json)" ]; then echo "Success!" diff --git a/hack/create-zarf-schema.sh b/hack/create-zarf-schema.sh index aa9a8fc79c..46bd7451df 100755 --- a/hack/create-zarf-schema.sh +++ b/hack/create-zarf-schema.sh @@ -1,4 +1,6 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash + +set -euo pipefail # Create the json schema for the zarf.yaml go run main.go internal gen-config-schema > zarf.schema.json diff --git a/hack/lint-all-zarf-packages.sh b/hack/lint-all-zarf-packages.sh index 31f8763812..85b734460a 100755 --- a/hack/lint-all-zarf-packages.sh +++ b/hack/lint-all-zarf-packages.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -euo pipefail + ZARF_BIN=$1 LINT_SRC_TEST=$2 SCRIPT=$(realpath "$0") @@ -11,7 +13,7 @@ find "." -type f -name 'zarf.yaml' | while read -r yaml_file; do if [[ "$dir" == *src/test/* ]] && [ "$LINT_SRC_TEST" != true ]; then continue fi - echo "Running 'zarf prepare lint' in directory: $dir" - $ZARF_BIN prepare lint "$dir" + echo "Running 'zarf dev lint' in directory: $dir" + $ZARF_BIN dev lint "$dir" echo "---" done diff --git a/src/cmd/internal.go b/src/cmd/internal.go index deda9ae16d..8ea6113113 100644 --- a/src/cmd/internal.go +++ b/src/cmd/internal.go @@ -102,7 +102,7 @@ var genCLIDocs = &cobra.Command{ if toolCmd.Use == "monitor" { resetStringFlags(toolCmd) } - + if toolCmd.Use == "yq" { for _, subCmd := range toolCmd.Commands() { if subCmd.Name() == "shell-completion" { diff --git a/src/cmd/tools/yq.go b/src/cmd/tools/yq.go index e1cebd2b74..4dbf43ddff 100644 --- a/src/cmd/tools/yq.go +++ b/src/cmd/tools/yq.go @@ -7,7 +7,6 @@ package tools import ( "github.com/defenseunicorns/zarf/src/config/lang" yq "github.com/mikefarah/yq/v4/cmd" - ) func init() { @@ -16,10 +15,10 @@ func init() { yqCmd.Example = lang.CmdToolsYqExample yqCmd.Use = "yq" for _, subCmd := range yqCmd.Commands() { - if subCmd.Name() == "eval" { + if subCmd.Name() == "eval" { subCmd.Example = lang.CmdToolsYqEvalExample } - if subCmd.Name() == "eval-all" { + if subCmd.Name() == "eval-all" { subCmd.Example = lang.CmdToolsYqEvalAllExample } } diff --git a/src/pkg/layout/package_test.go b/src/pkg/layout/package_test.go index 8e7036f066..3c73c1b9b9 100644 --- a/src/pkg/layout/package_test.go +++ b/src/pkg/layout/package_test.go @@ -90,13 +90,13 @@ func TestPackageFiles(t *testing.T) { "checksums.txt": normalizePath("test/checksums.txt"), } require.Equal(t, expected, files) - + pp.SBOMs.Path = normalizePath("test/sboms.tar") files = pp.Files() expected = map[string]string{ "zarf.yaml": normalizePath("test/zarf.yaml"), "checksums.txt": normalizePath("test/checksums.txt"), - "sboms.tar": normalizePath("test/sboms.tar"), + "sboms.tar": normalizePath("test/sboms.tar"), } require.Equal(t, expected, files) }) diff --git a/src/pkg/zoci/push.go b/src/pkg/zoci/push.go index 3f1bc2b265..380750574e 100644 --- a/src/pkg/zoci/push.go +++ b/src/pkg/zoci/push.go @@ -33,7 +33,7 @@ func (r *Remote) PublishPackage(ctx context.Context, pkg *types.ZarfPackage, pat // Get all of the layers in the package var descs []ocispec.Descriptor for name, path := range paths.Files() { - spinner.Updatef("Preparing layer %s", helpers.First30last30(name)) + spinner.Updatef("Preparing layer %s", helpers.First30Last30(name)) mediaType := ZarfLayerMediaTypeBlob diff --git a/src/test/e2e/00_use_cli_test.go b/src/test/e2e/00_use_cli_test.go index eec380619e..efdd0f3f82 100644 --- a/src/test/e2e/00_use_cli_test.go +++ b/src/test/e2e/00_use_cli_test.go @@ -223,14 +223,14 @@ func TestUseCLI(t *testing.T) { _, stdErr, err := e2e.Zarf("tools", "yq", "eval", "-i", `.items[1].name = "renamed-item"`, file) require.NoError(t, err, stdErr) stdOut, stdErr, err := e2e.Zarf("tools", "yq", ".items[1].name", file) + require.NoError(t, err, stdErr) require.Contains(t, stdOut, "renamed-item") // Test that yq ea can be used properly _, stdErr, err = e2e.Zarf("tools", "yq", "eval-all", "-i", `. as $doc ireduce ({}; .items += $doc.items)`, file, otherFile) require.NoError(t, err, stdErr) stdOut, stdErr, err = e2e.Zarf("tools", "yq", "e", ".items | length", file) + require.NoError(t, err, stdErr) require.Equal(t, "4\n", stdOut) - }) } - diff --git a/src/test/external/configure-gitea.sh b/src/test/external/configure-gitea.sh index 4a2f1759d8..adbb8da780 100755 --- a/src/test/external/configure-gitea.sh +++ b/src/test/external/configure-gitea.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash + set -euo pipefail # Retry gitea migrate until the db is ready From 85551c05b432484bc8ac4687cac3ac984cd2411a Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 01:09:33 -0500 Subject: [PATCH 05/34] goimports Signed-off-by: razzle --- .pre-commit-config.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 59976d2d2a..7b3bcc66b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,15 @@ repos: files: "src/types/types.go" types: [go] language: script - description: "Checks if there have been changes made to the docs and schema" + - id: goimports + name: goimports + entry: goimports + files: .go$ + args: + - -l + - -w + language: system + pass_filenames: true - repo: https://github.com/python-jsonschema/check-jsonschema rev: 0.14.0 hooks: @@ -38,10 +46,3 @@ repos: (?x)^( src/test/packages/12-lint/.* )$ - - repo: local - hooks: - - id: go-fmt - name: go fmt - entry: go fmt ./... - language: system - pass_filenames: false From 95da7af4baf5a548d52a6025623b149004d6af3c Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 01:18:20 -0500 Subject: [PATCH 06/34] cleanup makefile Signed-off-by: razzle --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 8c03f9d011..4847a7f417 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ # Provide a default value for the operating system architecture used in tests, e.g. " APPLIANCE_MODE=true|false make test-e2e ARCH=arm64" ARCH ?= amd64 -KEY ?= "" ###################################################################################### # Figure out which Zarf binary we should use based on the operating system we are on From 4b868c203926e3fb380019a247b041f793c8eb23 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 01:43:32 -0500 Subject: [PATCH 07/34] update contributing Signed-off-by: razzle --- .github/CONTRIBUTING.md | 35 +++++++++++--------- examples/big-bang/config/neuvector.yaml | 2 +- examples/kiwix/zarf.yaml | 2 +- packages/logging-pgl/connect.yaml | 2 +- site/src/content/docs/contribute/testing.mdx | 10 +++--- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 464d570d20..9137fa6b9b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -15,6 +15,20 @@ Specifically: - We perform automated testing on all changes before they get merged to `main` - We create immutable release artifacts +### Pre-Commit Hooks and Linting + +We use [pre-commit](https://pre-commit.com/) to manage our pre-commit hooks. This ensures that all code is linted and formatted before it is committed. After `pre-commit` is [installed](https://pre-commit.com/#installation): + +```bash +# install hooks +pre-commit install + +# install goimports +go install golang.org/x/tools/cmd/goimports@latest +``` + +Now every time you commit, the hooks will run and format your code, linting can be called via `make lint-go`. + ### Developer Workflow :key: == Required by automation @@ -34,30 +48,19 @@ Specifically: ## Testing -This section dives deeper into how we test Zarf - -### (Optional) Pre-Commit Hooks and Linting - -In this repo you can optionally use [pre-commit](https://pre-commit.com/) hooks for automated validation and linting, but if not CI will run these checks for you. +> A more comprehensive guide to testing can be found [here](https://docs.zarf.dev/contribute/testing). -### Code Testing +Our E2E tests can be found in the `src/test` folder and follow the journey of someone as they would use the Zarf CLI. In CI these tests run against our currently supported cluster distros and are the primary way that Zarf code is tested. -Our E2E tests can be found in the `/test` folder and follow the journey of someone as they would use the Zarf CLI. In CI these tests run against our currently supported cluster distros and are the primary way that Zarf code is tested. - -Our Unit tests can be found as `*_test.go` files inside the package that they are designed to test. These are also run in CI and are designed to test small functions with clear interfaces that would be difficult to test otherwise. As a general rule, we are limiting unit tests to the `src/pkg/*` folder. - -All of our tests should be able to be run locally or in CI. -You can learn more about the testing of Zarf [here](https://docs.zarf.dev/contribute/testing). +Our unit tests can be found as `*_test.go` files inside the package that they are designed to test. These are also run in CI and are designed to test small functions with clear interfaces that would be difficult to test otherwise. ## Documentation -### Updating Our Documentation - -Our documentation is auto-generated from the `src/types` and `src/cmd` go packages. This includes the [Zarf package jsonschema](https://github.com/defenseunicorns/zarf/blob/main/zarf.schema.json), the [Zarf schema docs](https://docs.zarf.dev/docs/create-a-zarf-package/zarf-schema), and the [Zarf CLI docs](https://docs.zarf.dev/docs/the-zarf-cli/). When an update to types or the CLI commands is made you will need to run `make docs-and-schema` locally to regenerate the schema and documentation. CI checks if this was ran, and will fail if it wasn't. +The CLI docs (located at `site/src/content/docs/commands`), and [`zarf.schema.json`](https://github.com/defenseunicorns/zarf/blob/main/zarf.schema.json) are autogenerated from `make docs-and-schema`. Run this make target locally to regenerate the schema and documentation each time you make a change to the CLI commands or the schema, otherwise CI will fail. We do this so that there is a git commit signature from a person on the commit for better traceability, rather than a non-person entity (e.g. GitHub CI token). -### Architecture Decision Records (ADR) +## Architecture Decision Records (ADR) We've chosen to use ADRs to document architecturally significant decisions. We primarily use the guidance found in [this article by Michael Nygard](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions) with a couple of tweaks: diff --git a/examples/big-bang/config/neuvector.yaml b/examples/big-bang/config/neuvector.yaml index e7ea4f7707..d804274901 100644 --- a/examples/big-bang/config/neuvector.yaml +++ b/examples/big-bang/config/neuvector.yaml @@ -1,4 +1,4 @@ -# If running in k3s, this is needed for Neuvector to start properly +# If running in k3s, this is needed for Neuvector to start properly neuvector: values: k3s: diff --git a/examples/kiwix/zarf.yaml b/examples/kiwix/zarf.yaml index b353812d88..0ddf467086 100644 --- a/examples/kiwix/zarf.yaml +++ b/examples/kiwix/zarf.yaml @@ -50,5 +50,5 @@ x-mdx: | Data injections depend on the `tar` (and for `compress`, `gzip`) executables and their implementation across operating systems. Between macOS and Linux there is general agreement on how these utilities should function, however on Windows you may see issues enabling compression. To resolve this you can either disable compression or use the GNU core-utils version of `tar` and `gzip`. - + ::: diff --git a/packages/logging-pgl/connect.yaml b/packages/logging-pgl/connect.yaml index a72eaa2883..41be9204d6 100644 --- a/packages/logging-pgl/connect.yaml +++ b/packages/logging-pgl/connect.yaml @@ -4,7 +4,7 @@ metadata: name: zarf-connect-logging labels: # Enables "zarf connect logging" - zarf.dev/connect-name: logging + zarf.dev/connect-name: logging annotations: zarf.dev/connect-description: "Zarf Cluster Logging Service (Grafana)" spec: diff --git a/site/src/content/docs/contribute/testing.mdx b/site/src/content/docs/contribute/testing.mdx index 776869a058..d97081e04b 100644 --- a/site/src/content/docs/contribute/testing.mdx +++ b/site/src/content/docs/contribute/testing.mdx @@ -2,17 +2,17 @@ title: Running Tests --- -Currently, we primarily test Zarf through a series of end-to-end tests located in the [e2e directory](https://github.com/defenseunicorns/zarf/tree/main/src/test/e2e) of the project. This directory houses all of the e2e tests that we use to verify Zarf's functionality in an environment that replicates a live setting. The tests in this directory undergo automatic execution against several K8s distros whenever a pull request is created or updated. Through this testing, we ensure that Zarf performs consistently across a range of K8s environments, ensuring its reliability for users. +Currently, we primarily test Zarf through a series of [end-to-end tests](https://github.com/defenseunicorns/zarf/tree/main/src/test/e2e). These tests are called in the `test-*.yml` workflows and undergo automatic execution against several K8s distros whenever a pull request is created or updated. -In addition, Zarf undergoes a series of unit tests for specific functions where edge cases prove difficult to cover through end-to-end testing alone. You can locate these tests in the [src/pkg directory](https://github.com/defenseunicorns/zarf/tree/main/src/pkg), where they are identified by `*_test.go` files. +In addition, Zarf implements unit tests for specific functions where edge cases prove difficult to cover through end-to-end testing alone. Unit tests follow standard Go convention and are `*_test.go` files. ## Dependencies To run the end-to-end tests locally, you must meet the same prerequisites as those required for building and running Zarf, which include: -1. GoLang >= 1.21.x. -2. Make. -3. Any clean K8s cluster (local or remote) or Linux with sudo if you want to use the Zarf-installed K3s cluster. +1. GoLang >= 1.21.x +2. Make +3. Any clean K8s cluster (local or remote) or Linux with sudo if you want to use the Zarf-installed K3s cluster ### CLI End-to-End Tests From 1362d7e277fdaf00636193f3f210de2c47082f96 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 01:47:44 -0500 Subject: [PATCH 08/34] update lint workflow Signed-off-by: razzle --- .github/workflows/scan-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scan-lint.yml b/.github/workflows/scan-lint.yml index 5bda787160..bbdfbfea81 100644 --- a/.github/workflows/scan-lint.yml +++ b/.github/workflows/scan-lint.yml @@ -14,7 +14,7 @@ jobs: - name: Run Revive Action by pulling pre-built image uses: docker://morphy/revive-action:v2 with: - config: revive.toml + config: hack/revive.toml # Exclude patterns, separated by semicolons (optional) exclude: "src/cmd/viper.go" # Path pattern (default: ./...) From e53319902a7067e9f803d010daae5e3d56fbab56 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 02:07:12 -0500 Subject: [PATCH 09/34] update contributing Signed-off-by: razzle --- site/src/components/StripH1.astro | 9 +++++++++ site/src/content/docs/contribute/contributor-guide.mdx | 5 +++++ 2 files changed, 14 insertions(+) create mode 100644 site/src/components/StripH1.astro diff --git a/site/src/components/StripH1.astro b/site/src/components/StripH1.astro new file mode 100644 index 0000000000..d39e8968e4 --- /dev/null +++ b/site/src/components/StripH1.astro @@ -0,0 +1,9 @@ +--- +let html = await Astro.slots.render("default"); + +// remove any h1 from the html +const h1 = /]*>.*?<\/h1>/g; +html = html.replace(h1, ""); +--- + + diff --git a/site/src/content/docs/contribute/contributor-guide.mdx b/site/src/content/docs/contribute/contributor-guide.mdx index 29fe7e1db6..038d5a4586 100644 --- a/site/src/content/docs/contribute/contributor-guide.mdx +++ b/site/src/content/docs/contribute/contributor-guide.mdx @@ -1,7 +1,12 @@ --- title: Contributing Guide +# MDX is unable to render TOC from imported markdown file +tableOfContents: false --- +import StripH1 from "@components/StripH1.astro"; import Contributing from '../../../../../.github/CONTRIBUTING.md'; + + From 33ba67dbb524a0c6b04844e76fd12123f549747f Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 03:29:53 -0500 Subject: [PATCH 10/34] lets try these fonts Signed-off-by: razzle --- site/astro.config.ts | 6 +++- site/package-lock.json | 15 ++++++++ site/package.json | 2 ++ site/src/styles/custom.css | 73 ++++++++++++++++++++------------------ 4 files changed, 60 insertions(+), 36 deletions(-) diff --git a/site/astro.config.ts b/site/astro.config.ts index a65fec3d84..a73793ca6a 100644 --- a/site/astro.config.ts +++ b/site/astro.config.ts @@ -34,7 +34,11 @@ export default defineConfig({ src: "./src/assets/zarf-logo-header.svg", replacesTitle: true, }, - customCss: ["./src/styles/custom.css"], + customCss: [ + "./src/styles/custom.css", + "@fontsource/space-grotesk/400.css", + "@fontsource/source-code-pro/400.css", + ], lastUpdated: true, sidebar: [ { diff --git a/site/package-lock.json b/site/package-lock.json index a9ccc6756c..be2b5dce5a 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -10,6 +10,8 @@ "dependencies": { "@astrojs/check": "^0.5.10", "@astrojs/starlight": "^0.21.2", + "@fontsource/source-code-pro": "^5.0.17", + "@fontsource/space-grotesk": "^5.0.17", "astro": "^4.5.12", "mermaid": "^10.9.0", "rehype-autolink-headings": "^7.1.0", @@ -20,6 +22,9 @@ "markdownlint-cli2": "^0.12.1", "remark-gemoji": "^8.0.0", "yaml": "^2.4.1" + }, + "engines": { + "node": ">=20.11.1" } }, "node_modules/@ampproject/remapping": { @@ -1351,6 +1356,16 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/@fontsource/source-code-pro": { + "version": "5.0.17", + "resolved": "https://registry.npmjs.org/@fontsource/source-code-pro/-/source-code-pro-5.0.17.tgz", + "integrity": "sha512-Q5GfthInOTW+Ek5k97/LH6FWLmD+IwHwBEEXF+KStvsyPwSZz+0ssdWJfz/ZRaTZxOk7FwlRgysXAWo41fq6bQ==" + }, + "node_modules/@fontsource/space-grotesk": { + "version": "5.0.17", + "resolved": "https://registry.npmjs.org/@fontsource/space-grotesk/-/space-grotesk-5.0.17.tgz", + "integrity": "sha512-N2LC4atRec1b87oKDiXI/TYCOA8NanT4+cnmGYHbzzIJpQB4eQJtfLgJp8rm0+8xsvTID6eNi2fZGbvrzpL2CQ==" + }, "node_modules/@img/sharp-darwin-arm64": { "version": "0.33.3", "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.3.tgz", diff --git a/site/package.json b/site/package.json index 82f61d39c9..fef14e2120 100644 --- a/site/package.json +++ b/site/package.json @@ -17,6 +17,8 @@ "dependencies": { "@astrojs/check": "^0.5.10", "@astrojs/starlight": "^0.21.2", + "@fontsource/source-code-pro": "^5.0.17", + "@fontsource/space-grotesk": "^5.0.17", "astro": "^4.5.12", "mermaid": "^10.9.0", "rehype-autolink-headings": "^7.1.0", diff --git a/site/src/styles/custom.css b/site/src/styles/custom.css index 9389191655..69a7cddf03 100644 --- a/site/src/styles/custom.css +++ b/site/src/styles/custom.css @@ -1,58 +1,61 @@ -/* +/* Generated from https://starlight.astro.build/guides/css-and-tailwind/#theming -Accent- H: 220.909 C: 0.0.87 +Accent- H: 220.909 C: 0.0.87 Gray- H: 273.019 C: 0.064 */ /* Dark mode colors. */ :root { - --sl-color-accent-low: #13272e; - --sl-color-accent: #1d758d; - --sl-color-accent-high: #b5cdd6; - --sl-color-white: #ffffff; - --sl-color-gray-1: #e8edff; - --sl-color-gray-2: #bbc1d7; - --sl-color-gray-3: #7e89b3; - --sl-color-gray-4: #4c567c; - --sl-color-gray-5: #2d3559; - --sl-color-gray-6: #1d2446; - --sl-color-black: #131727; + --sl-color-accent-low: #13272e; + --sl-color-accent: #1d758d; + --sl-color-accent-high: #b5cdd6; + --sl-color-white: #ffffff; + --sl-color-gray-1: #e8edff; + --sl-color-gray-2: #bbc1d7; + --sl-color-gray-3: #7e89b3; + --sl-color-gray-4: #4c567c; + --sl-color-gray-5: #2d3559; + --sl-color-gray-6: #1d2446; + --sl-color-black: #131727; } /* Light mode colors. */ -:root[data-theme='light'] { - --sl-color-accent-low: #c8dbe1; - --sl-color-accent: #20778f; - --sl-color-accent-high: #153742; - --sl-color-white: #131727; - --sl-color-gray-1: #1d2446; - --sl-color-gray-2: #2d3559; - --sl-color-gray-3: #4c567c; - --sl-color-gray-4: #7e89b3; - --sl-color-gray-5: #bbc1d7; - --sl-color-gray-6: #e8edff; - --sl-color-gray-7: #f3f6ff; - --sl-color-black: #ffffff; +:root[data-theme="light"] { + --sl-color-accent-low: #c8dbe1; + --sl-color-accent: #20778f; + --sl-color-accent-high: #153742; + --sl-color-white: #131727; + --sl-color-gray-1: #1d2446; + --sl-color-gray-2: #2d3559; + --sl-color-gray-3: #4c567c; + --sl-color-gray-4: #7e89b3; + --sl-color-gray-5: #bbc1d7; + --sl-color-gray-6: #e8edff; + --sl-color-gray-7: #f3f6ff; + --sl-color-black: #ffffff; } :root { - --transition-speed: 0.2s; + --transition-speed: 0.2s; + --sl-content-width: 82ch; + --sl-font: "Space Grotesk", sans-serif; + --sl-font-mono: "Source Code Pro", monospace; } /* Heading link styling */ .heading-link::after { - content: '#'; - padding-inline-start: 0.25em; - opacity: 0; - transition: var(--transition-speed); + content: "#"; + padding-inline-start: 0.25em; + opacity: 0; + transition: var(--transition-speed); } .heading-link:hover::after { - color: var(--sl-color-text-accent); - opacity: 1; + color: var(--sl-color-text-accent); + opacity: 1; } .heading-link { - text-decoration: none; - color: var(--sl-color-white) !important; + text-decoration: none; + color: var(--sl-color-white) !important; } From 2b9bc74c99ad1f602a58737b9a8076679dbe6088 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 03:53:51 -0500 Subject: [PATCH 11/34] remove width change Signed-off-by: razzle --- site/src/styles/custom.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/site/src/styles/custom.css b/site/src/styles/custom.css index 69a7cddf03..148e3f7dfc 100644 --- a/site/src/styles/custom.css +++ b/site/src/styles/custom.css @@ -35,9 +35,13 @@ Gray- H: 273.019 C: 0.064 --sl-color-black: #ffffff; } +html { + /* fluid sizing: https://frontaid.io/blog/fluid-typography-2d-css-locks-clamp/ */ + font-size: clamp(1em, 0.909em + 0.45vmin, 1.25em); +} + :root { --transition-speed: 0.2s; - --sl-content-width: 82ch; --sl-font: "Space Grotesk", sans-serif; --sl-font-mono: "Source Code Pro", monospace; } From 8c052506d4dffe294534c21e0d2819fad23a3e15 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 14:36:17 -0500 Subject: [PATCH 12/34] add desc to root Signed-off-by: razzle --- site/src/content/docs/index.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/site/src/content/docs/index.mdx b/site/src/content/docs/index.mdx index a0b2e13aa6..ebceb10ace 100644 --- a/site/src/content/docs/index.mdx +++ b/site/src/content/docs/index.mdx @@ -1,5 +1,6 @@ --- title: What is Zarf? +description: Zarf is a free and open-source tool that enables declarative creation & distribution of software into air-gapped/constrained/standalone environments. tableOfContents: false --- From 5dd340f81bdd3e5df5a4c42338a97e9fc10652eb Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 22:27:16 -0500 Subject: [PATCH 13/34] tweak theme colors and provide some redirects Signed-off-by: razzle --- site/astro.config.ts | 8 ++++++-- site/package-lock.json | 6 ------ site/package.json | 1 - site/src/styles/custom.css | 9 ++++----- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/site/astro.config.ts b/site/astro.config.ts index 37fa628f4f..689e1de1cd 100644 --- a/site/astro.config.ts +++ b/site/astro.config.ts @@ -7,7 +7,12 @@ import remarkGemoji from "remark-gemoji"; // https://astro.build/config export default defineConfig({ redirects: { - '/docs/zarf-overview': '/' + "/docs/[...slug]": "/[...slug]/", + "/examples": "/ref/examples/", + "/docs/create-a-zarf-package/[...slug]": "/ref/", + "/docs/deploy-a-zarf-package/[...slug]": "/ref/", + "/docs/the-zarf-cli/cli-commands/[...slug]": "/commands/[...slug]/", + "/docs/zarf-overview": "/", }, markdown: { remarkPlugins: [remarkGemoji], @@ -39,7 +44,6 @@ export default defineConfig({ }, customCss: [ "./src/styles/custom.css", - "@fontsource/space-grotesk/400.css", "@fontsource/source-code-pro/400.css", ], lastUpdated: true, diff --git a/site/package-lock.json b/site/package-lock.json index be2b5dce5a..faa4544f51 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -11,7 +11,6 @@ "@astrojs/check": "^0.5.10", "@astrojs/starlight": "^0.21.2", "@fontsource/source-code-pro": "^5.0.17", - "@fontsource/space-grotesk": "^5.0.17", "astro": "^4.5.12", "mermaid": "^10.9.0", "rehype-autolink-headings": "^7.1.0", @@ -1361,11 +1360,6 @@ "resolved": "https://registry.npmjs.org/@fontsource/source-code-pro/-/source-code-pro-5.0.17.tgz", "integrity": "sha512-Q5GfthInOTW+Ek5k97/LH6FWLmD+IwHwBEEXF+KStvsyPwSZz+0ssdWJfz/ZRaTZxOk7FwlRgysXAWo41fq6bQ==" }, - "node_modules/@fontsource/space-grotesk": { - "version": "5.0.17", - "resolved": "https://registry.npmjs.org/@fontsource/space-grotesk/-/space-grotesk-5.0.17.tgz", - "integrity": "sha512-N2LC4atRec1b87oKDiXI/TYCOA8NanT4+cnmGYHbzzIJpQB4eQJtfLgJp8rm0+8xsvTID6eNi2fZGbvrzpL2CQ==" - }, "node_modules/@img/sharp-darwin-arm64": { "version": "0.33.3", "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.3.tgz", diff --git a/site/package.json b/site/package.json index fef14e2120..22dafe180d 100644 --- a/site/package.json +++ b/site/package.json @@ -18,7 +18,6 @@ "@astrojs/check": "^0.5.10", "@astrojs/starlight": "^0.21.2", "@fontsource/source-code-pro": "^5.0.17", - "@fontsource/space-grotesk": "^5.0.17", "astro": "^4.5.12", "mermaid": "^10.9.0", "rehype-autolink-headings": "^7.1.0", diff --git a/site/src/styles/custom.css b/site/src/styles/custom.css index 148e3f7dfc..a3bfc11347 100644 --- a/site/src/styles/custom.css +++ b/site/src/styles/custom.css @@ -7,9 +7,9 @@ Gray- H: 273.019 C: 0.064 /* Dark mode colors. */ :root { - --sl-color-accent-low: #13272e; - --sl-color-accent: #1d758d; - --sl-color-accent-high: #b5cdd6; + --sl-color-accent-low: #13282f; + --sl-color-accent: #1d748c; + --sl-color-accent-high: #4cb2d6; --sl-color-white: #ffffff; --sl-color-gray-1: #e8edff; --sl-color-gray-2: #bbc1d7; @@ -22,7 +22,7 @@ Gray- H: 273.019 C: 0.064 /* Light mode colors. */ :root[data-theme="light"] { --sl-color-accent-low: #c8dbe1; - --sl-color-accent: #20778f; + --sl-color-accent: #2684a6; --sl-color-accent-high: #153742; --sl-color-white: #131727; --sl-color-gray-1: #1d2446; @@ -42,7 +42,6 @@ html { :root { --transition-speed: 0.2s; - --sl-font: "Space Grotesk", sans-serif; --sl-font-mono: "Source Code Pro", monospace; } From 86f03ba3ca3db8f0577d6d04f3cfb99810806c6d Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 22:48:58 -0500 Subject: [PATCH 14/34] tweak colors Signed-off-by: razzle --- site/src/styles/custom.css | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/site/src/styles/custom.css b/site/src/styles/custom.css index a3bfc11347..3171be6f70 100644 --- a/site/src/styles/custom.css +++ b/site/src/styles/custom.css @@ -8,11 +8,12 @@ Gray- H: 273.019 C: 0.064 /* Dark mode colors. */ :root { --sl-color-accent-low: #13282f; - --sl-color-accent: #1d748c; - --sl-color-accent-high: #4cb2d6; + --sl-color-accent: hsl(196, 100%, 50%); + --sl-color-accent-high: #70d9ff; --sl-color-white: #ffffff; --sl-color-gray-1: #e8edff; - --sl-color-gray-2: #bbc1d7; + /* --sl-color-gray-2: #bbc1d7; */ + --sl-color-gray-2: var(--sl-color-gray-1); --sl-color-gray-3: #7e89b3; --sl-color-gray-4: #4c567c; --sl-color-gray-5: #2d3559; @@ -22,7 +23,7 @@ Gray- H: 273.019 C: 0.064 /* Light mode colors. */ :root[data-theme="light"] { --sl-color-accent-low: #c8dbe1; - --sl-color-accent: #2684a6; + --sl-color-accent: #2684a6; --sl-color-accent-high: #153742; --sl-color-white: #131727; --sl-color-gray-1: #1d2446; From 67e9dee1613bd7cd245345f9f802d7e021c1d087 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 22:49:53 -0500 Subject: [PATCH 15/34] tweak colors Signed-off-by: razzle --- site/src/styles/custom.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/src/styles/custom.css b/site/src/styles/custom.css index 3171be6f70..d502664b1d 100644 --- a/site/src/styles/custom.css +++ b/site/src/styles/custom.css @@ -8,7 +8,7 @@ Gray- H: 273.019 C: 0.064 /* Dark mode colors. */ :root { --sl-color-accent-low: #13282f; - --sl-color-accent: hsl(196, 100%, 50%); + --sl-color-accent: #00bbff; --sl-color-accent-high: #70d9ff; --sl-color-white: #ffffff; --sl-color-gray-1: #e8edff; @@ -23,7 +23,7 @@ Gray- H: 273.019 C: 0.064 /* Light mode colors. */ :root[data-theme="light"] { --sl-color-accent-low: #c8dbe1; - --sl-color-accent: #2684a6; + --sl-color-accent: #007099; --sl-color-accent-high: #153742; --sl-color-white: #131727; --sl-color-gray-1: #1d2446; From c7a3c7eb4322eb3d55adacd8a3622d1701c64f80 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 23:02:48 -0500 Subject: [PATCH 16/34] redirects Signed-off-by: razzle --- site/astro.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/astro.config.ts b/site/astro.config.ts index 689e1de1cd..cb887b34e5 100644 --- a/site/astro.config.ts +++ b/site/astro.config.ts @@ -8,7 +8,7 @@ import remarkGemoji from "remark-gemoji"; export default defineConfig({ redirects: { "/docs/[...slug]": "/[...slug]/", - "/examples": "/ref/examples/", + "/examples/[...slug]": "/ref/examples/", "/docs/create-a-zarf-package/[...slug]": "/ref/", "/docs/deploy-a-zarf-package/[...slug]": "/ref/", "/docs/the-zarf-cli/cli-commands/[...slug]": "/commands/[...slug]/", From 6641d2c372283ea298dab4e3aee9a4f2a17889d5 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 23:21:27 -0500 Subject: [PATCH 17/34] static astro cannot do dynamic redirects, using netlify redirects instead Signed-off-by: razzle --- netlify.toml | 20 ++++++++++++++++++++ site/astro.config.ts | 5 ----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/netlify.toml b/netlify.toml index 3521d1663b..6ab6263f2a 100644 --- a/netlify.toml +++ b/netlify.toml @@ -6,3 +6,23 @@ [build.environment] NODE_VERSION = "20.11.1" + +[[redirects]] +from = "/docs/the-zarf-cli/cli-commands/*" +to = "/commands/:splat" + +[[redirects]] +from = "/docs/create-a-zarf-package/*" +to = "/ref/" + +[[redirects]] +from = "/docs/deploy-a-zarf-package/*" +to = "/ref/" + +[[redirects]] +from = "/examples/*" +to = "/ref/examples/:splat" + +[[redirects]] +from = "/docs/*" +to = "/:splat" diff --git a/site/astro.config.ts b/site/astro.config.ts index cb887b34e5..6e54f621a0 100644 --- a/site/astro.config.ts +++ b/site/astro.config.ts @@ -7,11 +7,6 @@ import remarkGemoji from "remark-gemoji"; // https://astro.build/config export default defineConfig({ redirects: { - "/docs/[...slug]": "/[...slug]/", - "/examples/[...slug]": "/ref/examples/", - "/docs/create-a-zarf-package/[...slug]": "/ref/", - "/docs/deploy-a-zarf-package/[...slug]": "/ref/", - "/docs/the-zarf-cli/cli-commands/[...slug]": "/commands/[...slug]/", "/docs/zarf-overview": "/", }, markdown: { From 0144f38c45e1f50ca7da5f30d6d7fdb3157e9775 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 23:23:06 -0500 Subject: [PATCH 18/34] tweak netlify config Signed-off-by: razzle --- netlify.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netlify.toml b/netlify.toml index 6ab6263f2a..eeba453604 100644 --- a/netlify.toml +++ b/netlify.toml @@ -24,5 +24,5 @@ from = "/examples/*" to = "/ref/examples/:splat" [[redirects]] -from = "/docs/*" -to = "/:splat" +from = "/docs/:page" +to = "/:page" From 7db5c9154af214f20bede1e6ee886b2e33be5e07 Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 23:27:30 -0500 Subject: [PATCH 19/34] trigger Signed-off-by: razzle --- netlify.toml | 2 +- site/src/content/docs/contribute/contributor-guide.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/netlify.toml b/netlify.toml index eeba453604..3c974ecbf2 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,7 +2,7 @@ base = "site/" command = "npm run build" publish = "dist/" - ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . src/content/docs ../examples/" + ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . src/content/ ../examples/" [build.environment] NODE_VERSION = "20.11.1" diff --git a/site/src/content/docs/contribute/contributor-guide.mdx b/site/src/content/docs/contribute/contributor-guide.mdx index 038d5a4586..02277d13d4 100644 --- a/site/src/content/docs/contribute/contributor-guide.mdx +++ b/site/src/content/docs/contribute/contributor-guide.mdx @@ -5,7 +5,7 @@ tableOfContents: false --- import StripH1 from "@components/StripH1.astro"; -import Contributing from '../../../../../.github/CONTRIBUTING.md'; +import Contributing from "../../../../../.github/CONTRIBUTING.md"; From 75096834d8d436cf26b062c0e74e7a83fcf8646e Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 23:37:26 -0500 Subject: [PATCH 20/34] remove code from headers Signed-off-by: razzle --- site/src/content/docs/faq.mdx | 4 ++-- site/src/content/docs/ref/index.mdx | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/site/src/content/docs/faq.mdx b/site/src/content/docs/faq.mdx index 008a2ab650..024399c23e 100644 --- a/site/src/content/docs/faq.mdx +++ b/site/src/content/docs/faq.mdx @@ -38,9 +38,9 @@ The Agent does not need to create any secrets in the cluster. Instead, during `z Resources can be excluded at the namespace or resources level by adding the `zarf.dev/agent: ignore` label. -## What happens to resources that exist in the cluster before [`zarf init`](/commands/zarf_init/)? +## What happens to resources that exist in the cluster before `zarf init`? -During the `zarf init` operation, the Zarf Agent will patch any existing namespaces with the `zarf.dev/agent: ignore` label to prevent the Agent from modifying any resources in that namespace. This is done because there is no way to guarantee the images used by pods in existing namespaces are available in the Zarf Registry. +During the [`zarf init`](/commands/zarf_init) operation, the Zarf Agent will patch any existing namespaces with the `zarf.dev/agent: ignore` label to prevent the Agent from modifying any resources in that namespace. This is done because there is no way to guarantee the images used by pods in existing namespaces are available in the Zarf Registry. If you would like to adopt pre-existing resources into a Zarf deployment you can use the `--adopt-existing-resources` flag on [`zarf package deploy`](/commands/zarf_package_deploy/) to adopt those resources into the Helm Releases that Zarf manages (including namespaces). This will add the requisite annotations and labels to those resources and drop the `zarf.dev/agent: ignore` label from any namespaces specified by those resources. diff --git a/site/src/content/docs/ref/index.mdx b/site/src/content/docs/ref/index.mdx index 23ada376e5..b1320f9c9d 100644 --- a/site/src/content/docs/ref/index.mdx +++ b/site/src/content/docs/ref/index.mdx @@ -18,11 +18,15 @@ Zarf provides a suite of commands that streamline the creation, deployment, and As previously mentioned, Zarf was specifically designed to facilitate the deployment of applications in disconnected environments with ease. As a result, the most commonly utilized commands are `zarf init`, `zarf package create`, and `zarf package deploy`. Detailed information on all commands can be found in the [CLI Commands](/commands/zarf) section. However, brief descriptions of the most frequently used commands are provided below. It's worth noting that these three commands are closely linked to what we refer to as a "Zarf Package". Additional information on Zarf Packages can be found on the [Zarf Packages](/ref/packages/) page. -### [`zarf init`](/commands/zarf_init) +### Init + +> [`zarf init`](/commands/zarf_init/) Used to configure a K8s cluster in preparation for the deployment of future Zarf Packages. The init command uses a specialized 'init' package to operate which may be located in your current working directory, the directory where the Zarf CLI binary is located, or downloaded from the GitHub Container Registry during command execution. For further details regarding the init-package, please refer to the [init-package](/ref/init-package/) page. -### [`zarf package create`](/commands/zarf_package_create) +### Create + +> [`zarf package create`](/commands/zarf_package_create/) Used to create a Zarf package from a `zarf.yaml` package definition. This command will pull all of the defined resources into a single package you can take with you to a disconnected environment. You can learn more about creating Zarf packages on the [Create a Zarf Package](/ref/create/) page. @@ -32,7 +36,9 @@ When developing packages you may find the sub-commands under `zarf dev` useful t ::: -### [`zarf package deploy`](/commands/zarf_package_deploy) +### Deploy + +> [`zarf package deploy`](/commands/zarf_package_deploy/) Used to deploy an already created Zarf package onto a machine, typically to a K8s cluster. Generally, it is presumed that the `zarf init` command has already been executed on the target machine, however, there are a few exceptional cases where this assumption does not apply. You can learn more about deploying Zarf packages on the [Deploy a Zarf Package](/ref/deploy/) page. From 0d44b76e5bed7f7d258cb11f197f925151c394de Mon Sep 17 00:00:00 2001 From: razzle Date: Wed, 10 Apr 2024 23:45:15 -0500 Subject: [PATCH 21/34] width instead of font Signed-off-by: razzle --- site/src/styles/custom.css | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/site/src/styles/custom.css b/site/src/styles/custom.css index d502664b1d..d16bc02119 100644 --- a/site/src/styles/custom.css +++ b/site/src/styles/custom.css @@ -36,14 +36,10 @@ Gray- H: 273.019 C: 0.064 --sl-color-black: #ffffff; } -html { - /* fluid sizing: https://frontaid.io/blog/fluid-typography-2d-css-locks-clamp/ */ - font-size: clamp(1em, 0.909em + 0.45vmin, 1.25em); -} - :root { --transition-speed: 0.2s; --sl-font-mono: "Source Code Pro", monospace; + --sl-content-width: 52rem; } /* Heading link styling */ From d3edd2021befd0370a1ce5bb98b14e095341537b Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Wed, 17 Apr 2024 15:58:17 +0000 Subject: [PATCH 22/34] better openssf scorecard link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f49de8ee0..89c78e44cb 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Go version](https://img.shields.io/github/go-mod/go-version/defenseunicorns/zarf?filename=go.mod)](https://go.dev/) [![Build Status](https://img.shields.io/github/actions/workflow/status/defenseunicorns/zarf/release.yml)](https://github.com/defenseunicorns/zarf/actions/workflows/release.yml) [![Zarf Documentation Status](https://api.netlify.com/api/v1/badges/fe846ae4-25fb-4274-9968-90782640ee9f/deploy-status)](https://app.netlify.com/sites/zarf-docs/deploys) -[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/defenseunicorns/zarf/badge)](https://api.securityscorecards.dev/projects/github.com/defenseunicorns/zarf) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/defenseunicorns/zarf/badge)](https://securityscorecards.dev/viewer/?uri=github.com/defenseunicorns/pkg) zarf logo From bbd4cffd32981d4b566940f1ff32c1cc0f124e41 Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Wed, 17 Apr 2024 16:03:54 +0000 Subject: [PATCH 23/34] rennovate hook for grype install --- .github/actions/install-tools/action.yaml | 6 +++++- renovate.json | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/actions/install-tools/action.yaml b/.github/actions/install-tools/action.yaml index e34f24c746..e8e052b640 100644 --- a/.github/actions/install-tools/action.yaml +++ b/.github/actions/install-tools/action.yaml @@ -8,7 +8,11 @@ runs: - uses: anchore/sbom-action/download-syft@b6a39da80722a2cb0ef5d197531764a89b5d48c3 # v0.15.8 - - run: "curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin --tag v0.64.2" + - name: install grype + env: + # renovate: datasource=github-tags depName=anchore/grype versioning=semver + VERSION: v0.74.6 + run: "curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin $VERSION" shell: bash - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 diff --git a/renovate.json b/renovate.json index d8f6f4bb6b..8385b71c7a 100644 --- a/renovate.json +++ b/renovate.json @@ -82,6 +82,16 @@ "https:\\/\\/github.com\\/(?[\\w\\/\\-\\.\\+\\%]+?)\\/releases\\/download\\/(?[\\w\\/\\-\\.\\+\\%]+?)\\/" ], "datasourceTemplate": "github-releases" + }, + { + "fileMatch": [ + ".github/actions/install-tools/action.yaml" + ], + "matchStrings": [ + "# renovate: datasource=github-tags depName=anchore/grype versioning=semver\n\\s*VERSION: (?v[\\d.]+)" + ], + "datasourceTemplate": "github-tags", + "depNameTemplate": "anchore/grype" } ] } From dfa7e24b06b82020f1c2d0978f633e1011f71af6 Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Wed, 17 Apr 2024 16:23:54 +0000 Subject: [PATCH 24/34] pre-commit lint --- .pre-commit-config.yaml | 11 +++++++++++ revive.toml | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7b3bcc66b4..ce34760795 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,6 +34,17 @@ repos: - -w language: system pass_filenames: true + - id: lint + name: revive go lint + entry: revive + args: + - "-config" + - "revive.toml" + - "-exclude" + - "src/cmd/viper.go" + files: .go$ + language: system + pass_filenames: true - repo: https://github.com/python-jsonschema/check-jsonschema rev: 0.14.0 hooks: diff --git a/revive.toml b/revive.toml index ebda8f5cb3..222a780640 100644 --- a/revive.toml +++ b/revive.toml @@ -1,8 +1,8 @@ ignoreGeneratedHeader = false severity = "warning" confidence = 0.8 -errorCode = 0 -warningCode = 0 +errorCode = 1 +warningCode = 1 formatter = "stylish" [rule.blank-imports] From 8e12469fef2b1d13cc432a23e8179f893eb0ccc4 Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Wed, 17 Apr 2024 16:24:36 +0000 Subject: [PATCH 25/34] update docs-website references --- .github/codeql.yaml | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/codeql.yaml b/.github/codeql.yaml index 3d376c23c1..a57c624727 100644 --- a/.github/codeql.yaml +++ b/.github/codeql.yaml @@ -2,7 +2,7 @@ paths-ignore: - src/pkg/packager/network.go - src/pkg/utils/network.go - src/pkg/utils/credentials.go - - docs-website/** + - site/** - build/** query-filters: diff --git a/Makefile b/Makefile index 08de34a14d..4bebb9feed 100644 --- a/Makefile +++ b/Makefile @@ -219,11 +219,11 @@ test-docs-and-schema: # INTERNAL: used to test for new CVEs that may have been introduced test-cves: - go run main.go tools sbom scan . -o json --exclude './docs-website' --exclude './examples' | grype --fail-on low + go run main.go tools sbom scan . -o json --exclude './site' --exclude './examples' | grype --fail-on low cve-report: ## Create a CVE report for the current project (must `brew install grype` first) @test -d ./build || mkdir ./build - go run main.go tools sbom scan . -o json --exclude './docs-website' --exclude './examples' | grype -o template -t hack/.templates/grype.tmpl > build/zarf-known-cves.csv + go run main.go tools sbom scan . -o json --exclude './site' --exclude './examples' | grype -o template -t hack/.templates/grype.tmpl > build/zarf-known-cves.csv lint-go: ## Run revive to lint the go code (must `brew install revive` first) revive -config revive.toml -exclude src/cmd/viper.go -formatter stylish ./src/... From d97715bb048d7251606d14e9d8bfda9ac54b8442 Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Wed, 17 Apr 2024 16:26:29 +0000 Subject: [PATCH 26/34] correct links --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89c78e44cb..10dcace28c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Go version](https://img.shields.io/github/go-mod/go-version/defenseunicorns/zarf?filename=go.mod)](https://go.dev/) [![Build Status](https://img.shields.io/github/actions/workflow/status/defenseunicorns/zarf/release.yml)](https://github.com/defenseunicorns/zarf/actions/workflows/release.yml) [![Zarf Documentation Status](https://api.netlify.com/api/v1/badges/fe846ae4-25fb-4274-9968-90782640ee9f/deploy-status)](https://app.netlify.com/sites/zarf-docs/deploys) -[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/defenseunicorns/zarf/badge)](https://securityscorecards.dev/viewer/?uri=github.com/defenseunicorns/pkg) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/defenseunicorns/zarf/badge)](https://securityscorecards.dev/viewer/?uri=github.com/defenseunicorns/zarf) zarf logo From 0929a67e26be9a56c04a461ac1a7f6f9b978ffae Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Wed, 17 Apr 2024 17:06:01 +0000 Subject: [PATCH 27/34] broader file match --- renovate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renovate.json b/renovate.json index 8385b71c7a..0033d59cf9 100644 --- a/renovate.json +++ b/renovate.json @@ -85,7 +85,7 @@ }, { "fileMatch": [ - ".github/actions/install-tools/action.yaml" + ".github/**" ], "matchStrings": [ "# renovate: datasource=github-tags depName=anchore/grype versioning=semver\n\\s*VERSION: (?v[\\d.]+)" From 779831d327de33ccc92d7c508b3d9b34686e3e08 Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Thu, 18 Apr 2024 11:54:01 +0000 Subject: [PATCH 28/34] fix pre-commit, comments --- .pre-commit-config.yaml | 2 +- hack/empty-config.toml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ce34760795..c44084b716 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: entry: revive args: - "-config" - - "revive.toml" + - "hack/revive.toml" - "-exclude" - "src/cmd/viper.go" files: .go$ diff --git a/hack/empty-config.toml b/hack/empty-config.toml index e69de29bb2..65c006efc8 100644 --- a/hack/empty-config.toml +++ b/hack/empty-config.toml @@ -0,0 +1,3 @@ +# This is here so it can be used during certain Zarf commands +# such as `internal gen-cli-docs` where we prefer an empty config +# as opposed to the init package config at the base of the repo From f0795b1dfe1bce0acb11cd733c00d7c261965fbc Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Thu, 18 Apr 2024 18:43:09 +0000 Subject: [PATCH 29/34] fix file match --- renovate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renovate.json b/renovate.json index 0033d59cf9..91e8dd55b0 100644 --- a/renovate.json +++ b/renovate.json @@ -85,7 +85,7 @@ }, { "fileMatch": [ - ".github/**" + "\\.*\\.ya?ml$" ], "matchStrings": [ "# renovate: datasource=github-tags depName=anchore/grype versioning=semver\n\\s*VERSION: (?v[\\d.]+)" From f50ba20d940a46be08f15f4f96d6e1ecf2b51359 Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Thu, 18 Apr 2024 18:47:09 +0000 Subject: [PATCH 30/34] install revive --- .github/CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 9137fa6b9b..a931273d47 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -25,6 +25,9 @@ pre-commit install # install goimports go install golang.org/x/tools/cmd/goimports@latest + +# install revive +go install github.com/mgechev/revive@latest ``` Now every time you commit, the hooks will run and format your code, linting can be called via `make lint-go`. From 51e6c589ca5a4b0433c271f90959cfab89f6210e Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Thu, 18 Apr 2024 19:56:05 +0000 Subject: [PATCH 31/34] save init package --- .github/workflows/test-bigbang.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-bigbang.yml b/.github/workflows/test-bigbang.yml index e7fbd80bda..89b7fd8d92 100644 --- a/.github/workflows/test-bigbang.yml +++ b/.github/workflows/test-bigbang.yml @@ -72,6 +72,13 @@ jobs: name: build-artifacts path: build/ + - name: copy init package + run: | + sudo mkdir /mnt/zarf-tmp + sudo chown -R runner:runner /mnt/zarf-tmp + mv build/zarf-init* /mnt/zarf-tmp + + - name: Setup golang uses: ./.github/actions/golang @@ -101,8 +108,6 @@ jobs: env: IRON_BANK_ROBOT_USERNAME: ${{ secrets.IRON_BANK_ROBOT_USERNAME }} run: | - sudo mkdir /mnt/zarf-tmp - sudo chown -R runner:runner /mnt/zarf-tmp CI=true go test ./src/extensions/bigbang/test -failfast -v -timeout 30m - name: Save logs From bf1af11dcde1a6694eea1e050f77b1fbc272e241 Mon Sep 17 00:00:00 2001 From: razzle Date: Thu, 18 Apr 2024 16:01:01 -0500 Subject: [PATCH 32/34] update CODEOWNERS Signed-off-by: razzle --- CODEOWNERS | 1 - 1 file changed, 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index acedf60269..991c8894cc 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,6 +1,5 @@ * @defenseunicorns/zarf -/.github/ @defenseunicorns/zarf-admin /CODEOWNERS @jeff-mccoy @austenbryan /cosign.pub @jeff-mccoy @austenbryan /LICENSE @jeff-mccoy @austenbryan From 19db6f9f62c0cd07fc4a35a0f4ad784d1baf9245 Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Thu, 18 Apr 2024 21:43:55 +0000 Subject: [PATCH 33/34] revert delete packages change --- .github/workflows/test-bigbang.yml | 9 ++------- Makefile | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-bigbang.yml b/.github/workflows/test-bigbang.yml index 89b7fd8d92..e7fbd80bda 100644 --- a/.github/workflows/test-bigbang.yml +++ b/.github/workflows/test-bigbang.yml @@ -72,13 +72,6 @@ jobs: name: build-artifacts path: build/ - - name: copy init package - run: | - sudo mkdir /mnt/zarf-tmp - sudo chown -R runner:runner /mnt/zarf-tmp - mv build/zarf-init* /mnt/zarf-tmp - - - name: Setup golang uses: ./.github/actions/golang @@ -108,6 +101,8 @@ jobs: env: IRON_BANK_ROBOT_USERNAME: ${{ secrets.IRON_BANK_ROBOT_USERNAME }} run: | + sudo mkdir /mnt/zarf-tmp + sudo chown -R runner:runner /mnt/zarf-tmp CI=true go test ./src/extensions/bigbang/test -failfast -v -timeout 30m - name: Save logs diff --git a/Makefile b/Makefile index 4847a7f417..b781f88e21 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ destroy: ## Run `zarf destroy` on the current cluster rm -fr build delete-packages: ## Delete all Zarf package tarballs in the project recursively - find . -type f \( -name 'zarf-package-*' -o -name 'zarf-init-*' \) -delete + find . -type f -name 'zarf-package-*' -delete # Note: the path to the main.go file is not used due to https://github.com/golang/go/issues/51831#issuecomment-1074188363 .PHONY: build From 8ac69ff023f0836d8bf41013f33cbac2d2096f50 Mon Sep 17 00:00:00 2001 From: Austin Abro Date: Tue, 23 Apr 2024 17:15:36 +0000 Subject: [PATCH 34/34] skip checks for whitespace on autogen --- .pre-commit-config.yaml | 2 ++ site/src/content/docs/commands/zarf_tools_yq_eval.md | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c44084b716..5e96cba653 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,9 +10,11 @@ repos: - "--allow-missing-credentials" - id: detect-private-key - id: end-of-file-fixer + exclude: site/src/content/docs/commands/.* - id: fix-byte-order-marker - id: trailing-whitespace args: [--markdown-linebreak-ext=md] + exclude: site/src/content/docs/commands/.* - repo: https://github.com/sirosen/texthooks rev: 0.6.4 hooks: diff --git a/site/src/content/docs/commands/zarf_tools_yq_eval.md b/site/src/content/docs/commands/zarf_tools_yq_eval.md index 6a6f57b8e1..58921184ab 100644 --- a/site/src/content/docs/commands/zarf_tools_yq_eval.md +++ b/site/src/content/docs/commands/zarf_tools_yq_eval.md @@ -28,10 +28,10 @@ zarf tools yq eval [expression] [yaml_file1]... [flags] ``` # Reads field under the given path for each file -zarf tools yq e '.a.b' f1.yml f2.yml +zarf tools yq e '.a.b' f1.yml f2.yml # Prints out the file -zarf tools yq e sample.yaml +zarf tools yq e sample.yaml # Pipe from STDIN ## use '-' as a filename to pipe from STDIN @@ -39,10 +39,10 @@ cat file2.yml | zarf tools yq e '.a.b' file1.yml - file3.yml # Creates a new yaml document ## Note that editing an empty file does not work. -zarf tools yq e -n '.a.b.c = "cat"' +zarf tools yq e -n '.a.b.c = "cat"' # Update a file inplace -zarf tools yq e '.a.b = "cool"' -i file.yaml +zarf tools yq e '.a.b = "cool"' -i file.yaml ```