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`. 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/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/.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/.github/workflows/scan-lint.yml b/.github/workflows/scan-lint.yml index 123c7cfeeb..fb826ae737 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.5.7@sha256:087d4e61077087755711ab7e9fae3cc899b7bb07ff8f6a30c3dfb240b1620ae8 with: - config: revive.toml + config: hack/revive.toml # Exclude patterns, separated by semicolons (optional) exclude: "src/cmd/viper.go" # Path pattern (default: ./...) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7b3bcc66b4..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: @@ -34,6 +36,17 @@ repos: - -w language: system pass_filenames: true + - id: lint + name: revive go lint + entry: revive + args: + - "-config" + - "hack/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/CODEOWNERS b/CODEOWNERS index 4789538bef..991c8894cc 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,35 +1,5 @@ * @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 /CODEOWNERS @jeff-mccoy @austenbryan /cosign.pub @jeff-mccoy @austenbryan /LICENSE @jeff-mccoy @austenbryan diff --git a/Makefile b/Makefile index 08de34a14d..b781f88e21 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 @@ -219,11 +218,12 @@ 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/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/... + 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/README.md b/README.md index 4593158b2c..751bb141b1 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/zarf) zarf logo diff --git a/hack/check-spdx-go.sh b/hack/check-spdx-go.sh new file mode 100755 index 0000000000..7db63e2ff1 --- /dev/null +++ b/hack/check-spdx-go.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# 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/hack/check-zarf-docs-and-schema.sh b/hack/check-zarf-docs-and-schema.sh index 216d64b0ea..95fee01c1f 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 ./site/src/content/docs/commands/ ./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/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 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..85b734460a 100755 --- a/hack/lint-all-zarf-packages.sh +++ b/hack/lint-all-zarf-packages.sh @@ -1,4 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash + +set -euo pipefail ZARF_BIN=$1 LINT_SRC_TEST=$2 @@ -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/revive.toml b/hack/revive.toml similarity index 95% rename from revive.toml rename to hack/revive.toml index ebda8f5cb3..222a780640 100644 --- a/revive.toml +++ b/hack/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] diff --git a/renovate.json b/renovate.json index d8f6f4bb6b..91e8dd55b0 100644 --- a/renovate.json +++ b/renovate.json @@ -82,6 +82,16 @@ "https:\\/\\/github.com\\/(?[\\w\\/\\-\\.\\+\\%]+?)\\/releases\\/download\\/(?[\\w\\/\\-\\.\\+\\%]+?)\\/" ], "datasourceTemplate": "github-releases" + }, + { + "fileMatch": [ + "\\.*\\.ya?ml$" + ], + "matchStrings": [ + "# renovate: datasource=github-tags depName=anchore/grype versioning=semver\n\\s*VERSION: (?v[\\d.]+)" + ], + "datasourceTemplate": "github-tags", + "depNameTemplate": "anchore/grype" } ] } diff --git a/site/astro.config.ts b/site/astro.config.ts index fb53176741..6e54f621a0 100644 --- a/site/astro.config.ts +++ b/site/astro.config.ts @@ -7,7 +7,7 @@ import remarkGemoji from "remark-gemoji"; // https://astro.build/config export default defineConfig({ redirects: { - '/docs/zarf-overview': '/' + "/docs/zarf-overview": "/", }, markdown: { remarkPlugins: [remarkGemoji], @@ -37,7 +37,10 @@ export default defineConfig({ src: "./src/assets/zarf-logo-header.svg", replacesTitle: true, }, - customCss: ["./src/styles/custom.css"], + customCss: [ + "./src/styles/custom.css", + "@fontsource/source-code-pro/400.css", + ], lastUpdated: true, sidebar: [ { diff --git a/site/package-lock.json b/site/package-lock.json index a9ccc6756c..faa4544f51 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@astrojs/check": "^0.5.10", "@astrojs/starlight": "^0.21.2", + "@fontsource/source-code-pro": "^5.0.17", "astro": "^4.5.12", "mermaid": "^10.9.0", "rehype-autolink-headings": "^7.1.0", @@ -20,6 +21,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 +1355,11 @@ "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/@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..22dafe180d 100644 --- a/site/package.json +++ b/site/package.json @@ -17,6 +17,7 @@ "dependencies": { "@astrojs/check": "^0.5.10", "@astrojs/starlight": "^0.21.2", + "@fontsource/source-code-pro": "^5.0.17", "astro": "^4.5.12", "mermaid": "^10.9.0", "rehype-autolink-headings": "^7.1.0", 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 ``` diff --git a/site/src/styles/custom.css b/site/src/styles/custom.css index 9389191655..d16bc02119 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: #13282f; + --sl-color-accent: #00bbff; + --sl-color-accent-high: #70d9ff; + --sl-color-white: #ffffff; + --sl-color-gray-1: #e8edff; + /* --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; + --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: #007099; + --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-font-mono: "Source Code Pro", monospace; + --sl-content-width: 52rem; } /* 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; } 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/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/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/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/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/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 ( 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