Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zarf tools yq (or similar) for easily parsing yaml files #2384

Closed
Racer159 opened this issue Mar 15, 2024 · 2 comments · Fixed by #2406
Closed

Add zarf tools yq (or similar) for easily parsing yaml files #2384

Racer159 opened this issue Mar 15, 2024 · 2 comments · Fixed by #2406
Assignees
Labels
enhancement ✨ New feature or request

Comments

@Racer159
Copy link
Contributor

Is your feature request related to a problem? Please describe.

As Ezra I want to be able to use yq with Zarf so that I can quickly pull information out of YAML files / Kubernetes Manifests within actions.

Describe the solution you'd like

Describe alternatives you've considered

We could explore other libraries but the main yq cli is already written in go - it could also be put behind another layer rather than at the root of tools (to pave the way for potentially more tools like jq)

Additional context

This comes from us wanting to reduce dependencies within Software Factory and open up more options when using UDS Run.

@Racer159 Racer159 added the enhancement ✨ New feature or request label Mar 15, 2024
@zachariahmiller zachariahmiller self-assigned this Mar 19, 2024
@Noxsios
Copy link
Contributor

Noxsios commented Mar 25, 2024

Some notes:

// src/cmd/tools/yq.go

// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2021-Present The Zarf Authors

// Package tools contains the CLI commands for Zarf.
package tools

import (
	yq "github.com/mikefarah/yq/v4/cmd"
)

func init() {
	toolsCmd.AddCommand(yq.New())
}

Successfully embeds yq under zarf tools yq. zarf tools yq --version works properly.

Some things I wasn't able to grok about https://github.com/mikefarah/yq/blob/master/yq.go that may cause issues w/ usage. More research required.

@zachariahmiller
Copy link
Contributor

Thanks! I had already gotten that far locally and then sidetracked trying to track down why it made the package so much larger (tldr I wasn't building on Linux). Back to trying to put in doc generation and test things. Will need to try to account for making sure per your note that there aren't issues with certain commands running.

@zachariahmiller zachariahmiller linked a pull request Mar 27, 2024 that will close this issue
5 tasks
Noxsios pushed a commit that referenced this issue Mar 27, 2024
## Description

Adds `zarf tools yq`

## Related Issue

Fixes #2384

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
No open projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

3 participants