Skip to content

Commit

Permalink
Refactor paths (#1944)
Browse files Browse the repository at this point in the history
## Description
To prepare the repo for documentation migration and to improve the
discoverability of scripts for generating docs, I've renamed `hack/` to
`scripts/` and moved the `.templates/` folder with the JSFH configs into
`scripts/` path.

This will make doc conversion much cleaner and make it easier to find
things.
  • Loading branch information
bdfinst authored Aug 4, 2023
1 parent 95bd3ea commit 79d5021
Show file tree
Hide file tree
Showing 69 changed files with 68 additions and 68 deletions.
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ repos:
files: "src/types/types.go"
types: [go]
language: script
description: "Runs `zarf internal config-schema > zarf.schema.json` to ensure schema is up to date"
description:
"Runs `zarf internal config-schema > zarf.schema.json` to ensure
schema is up to date"
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.14.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ build-cli-linux: build-cli-linux-amd build-cli-linux-arm ## Build the Zarf CLI f
build-cli: build-cli-linux-amd build-cli-linux-arm build-cli-mac-intel build-cli-mac-apple build-cli-windows-amd build-cli-windows-arm ## Build the CLI

docs-and-schema: ensure-ui-build-dir ## Generate the Zarf Documentation and Schema
docs/gen-cli-docs.sh
hack/gen-cli-docs.sh
ZARF_CONFIG=hack/empty-config.toml hack/create-zarf-schema.sh

dev: ensure-ui-build-dir ## Start a Dev Server for the Zarf UI
Expand Down Expand Up @@ -213,7 +213,7 @@ test-cves: ensure-ui-build-dir
go run main.go tools sbom packages . -o json --exclude './docs-website' | grype --fail-on low

cve-report: ensure-ui-build-dir ## Create a CVE report for the current project (must `brew install grype` first)
go run main.go tools sbom packages . -o json --exclude './docs-website' | grype -o template -t hack/grype.tmpl > build/zarf-known-cves.csv
go run main.go tools sbom packages . -o json --exclude './docs-website' | 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/...
8 changes: 0 additions & 8 deletions docs/.templates/jsfh-config.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

DevSecOps for Airgap

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_completion.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf completion
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generate the autocompletion script for the specified shell

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf completion bash
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generate the autocompletion script for bash

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf completion fish
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generate the autocompletion script for fish

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf completion powershell
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generate the autocompletion script for powershell

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf completion zsh
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generate the autocompletion script for zsh

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_connect.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf connect
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Accesses services or pods deployed in the cluster

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_connect_list.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf connect list
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Lists all available connection shortcuts

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_destroy.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf destroy
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Tears down Zarf and removes its components from the environment

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_init.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf init
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Prepares a k8s cluster for the deployment of Zarf packages

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_package.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf package
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Zarf package commands for creating, deploying, and inspecting packages

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf package create
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Creates a Zarf package from a given directory or the current directory

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf package deploy
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Deploys a Zarf package from a local file or URL (runs offline)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf package inspect
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Displays the definition of a Zarf package (runs offline)

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_package_list.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf package list
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Lists out all of the packages that have been deployed to the cluster (runs offline)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf package publish
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Publishes a Zarf package to a remote registry

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_package_pull.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf package pull
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Pulls a Zarf package from a remote registry and save to the local file system

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf package remove
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Removes a Zarf package that has been deployed already (runs offline)

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_prepare.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf prepare
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Tools to help prepare assets for packaging

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf prepare find-images
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Evaluates components in a zarf file to identify images specified in their helm charts and manifests

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf prepare generate-config
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generates a config file for Zarf

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf prepare patch-git
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Converts all .git URLs to the specified Zarf HOST and with the Zarf URL pattern in a given FILE. NOTE:
This should only be used for manifests that are not mutated by the Zarf Agent Mutating Webhook.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf prepare sha256sum
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generates a SHA256SUM for the given file

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_tools.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Collection of additional tools to make airgap easier

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools archiver
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Compresses/Decompresses generic archives, including Zarf packages

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools archiver compress
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Compresses a collection of sources based off of the destination file extension.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools archiver decompress
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Decompresses an archive or Zarf package based off of the source file extension.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools clear-cache
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Clears the configured git and image cache directory

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools download-init
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Downloads the init package for the current Zarf version into the specified directory

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_tools_gen-key.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools gen-key
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generates a cosign public/private keypair that can be used to sign packages

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_tools_gen-pki.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools gen-pki
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generates a Certificate Authority and PKI chain of trust for the given host

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools get-creds
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Displays a Table of credentials for deployed components. Pass a component name to get a single credential

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_tools_kubectl.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools kubectl
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Kubectl command. See https://kubernetes.io/docs/reference/kubectl/overview/ for more information.

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_tools_monitor.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools monitor
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Launches a terminal UI to monitor the connected cluster using K9s.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools registry
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Tools for working with container registries using go-containertools

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools registry catalog
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

List the repos in a registry

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools registry copy
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Efficiently copy a remote image from src to dst while retaining the digest value

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools registry login
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Log in to a registry

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools registry ls
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

List the tags in a repo

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools registry pull
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Pull remote images by reference and store their contents locally

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools registry push
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Push local image contents to a remote registry

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_tools_sbom.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools sbom
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generates a Software Bill of Materials (SBOM) for the given package

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools sbom attest
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generate an SBOM as an attestation for the given [SOURCE] container image

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools sbom convert
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Convert between SBOM formats

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools sbom login
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Log in to a registry

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools sbom packages
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Generate a package SBOM

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools sbom version
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

show the version

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf tools wait-for
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Waits for a given Kubernetes resource to be ready

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_version.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zarf version
<!-- Auto-generated by docs/gen-cli-docs.sh -->
<!-- Auto-generated by hack/gen-cli-docs.sh -->

Shows the version of the running Zarf binary

Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions hack/.templates/jsfh-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"custom_template_path": "hack/.templates/jsonschemaforhumans/base.md",
"template_md_options": {
"badge_as_image": true,
"show_heading_numbers": false
},
"show_toc": false,
"show_breadcrumbs": false,
"footer_show_time": false,
"deprecated_from_description": true
}
File renamed without changes.
2 changes: 1 addition & 1 deletion hack/create-zarf-schema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ go run main.go internal config-schema > zarf.schema.json
go run main.go internal api-schema | npx quicktype -s schema -o src/ui/lib/api-types.ts

# Create docs from the zarf.yaml JSON schema
docker run -v $(pwd):/app -w /app --rm python:3.8-alpine /bin/sh -c "pip install json-schema-for-humans && generate-schema-doc --config-file docs/.templates/jsfh-config.json zarf.schema.json docs/3-create-a-zarf-package/4-zarf-schema.md"
docker run -v $(pwd):/app -w /app --rm python:3.8-alpine /bin/sh -c "pip install json-schema-for-humans && generate-schema-doc --config-file hack/.templates/jsfh-config.json zarf.schema.json docs/3-create-a-zarf-package/4-zarf-schema.md"
Loading

0 comments on commit 79d5021

Please sign in to comment.