Skip to content

Commit

Permalink
Fix linting and UI version check (#1624)
Browse files Browse the repository at this point in the history
## Description

This cleans up the UI diff check script for local dev and a few linting
issues.

## Related Issue

Fixes #1614 
 
## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [X] 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
  • Loading branch information
Racer159 authored Apr 19, 2023
1 parent 33cb502 commit 0daaf50
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
push-resources:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
packages: write
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ builds:
- darwin
- windows
ldflags:
- -s -w -X github.com/defenseunicorns/zarf/src/config.CLIVersion={{.Tag}}
- -s -w -X github.com/defenseunicorns/zarf/src/config.CLIVersion={{.Tag}} -X k8s.io/component-base/version.gitVersion=v0.0.0+zarf{{.Tag}} -X k8s.io/component-base/version.gitCommit={{.FullCommit}} -X k8s.io/component-base/version.buildDate={{.Date}}
goarch:
- amd64
- arm64
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
[![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)

<img align="right" alt="zarf logo" src=".images/zarf-logo.png" height="256" />

[![Zarf Website](https://img.shields.io/badge/web-zarf.dev-6d87c3)](https://zarf.dev/)
[![Zarf Documentation](https://img.shields.io/badge/docs-docs.zarf.dev-775ba1)](https://docs.zarf.dev/)
[![Zarf Slack Channel](https://img.shields.io/badge/k8s%20slack-zarf-40a3dd)](https://kubernetes.slack.com/archives/C03B6BJAUJ3)

<img align="right" alt="zarf logo" src=".images/zarf-logo.png" height="256" />

Zarf eliminates the [complexity of air gap software delivery](https://www.itopstimes.com/contain/air-gap-kubernetes-considerations-for-running-cloud-native-applications-without-the-cloud/) for Kubernetes clusters and cloud-native workloads using a declarative packaging strategy to support DevSecOps in offline and semi-connected environments.

## 📦 Out of the Box Features
Expand Down
3 changes: 0 additions & 3 deletions hack/print-ui-diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

# Get the diff for UI related files
git diff HEAD src/ui
git diff HEAD package.json
git diff HEAD package-lock.json
git diff HEAD .npmrc
git diff HEAD .eslint*
git diff HEAD ts*
git diff HEAD prettier*
Expand Down
3 changes: 2 additions & 1 deletion src/internal/packager/images/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package images
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -63,7 +64,7 @@ func (i *ImgConfig) PullAll() error {

// Create the ImagePath directory
err := os.Mkdir(i.ImagesPath, 0755)
if err != nil {
if err != nil && !errors.Is(err, os.ErrExist) {
return fmt.Errorf("failed to create image path %s: %w", i.ImagesPath, err)
}

Expand Down
6 changes: 2 additions & 4 deletions src/pkg/message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ const (
// NoProgress tracks whether spinner/progress bars show updates.
var NoProgress bool

// Separator is a string of 100 spaces to provide visual separation between elements.
var Separator = strings.Repeat(" ", 100)

var logLevel = InfoLevel

// Write logs to stderr and a buffer for logFile generation.
var logFile *os.File

var useLogFile bool

// DebugWriter represents a writer interface that writes to message.Debug
type DebugWriter struct{}

func (d *DebugWriter) Write(raw []byte) (int, error) {
Expand Down Expand Up @@ -220,7 +218,7 @@ func HorizontalRule() {
pterm.Println(strings.Repeat("━", 100))
}

// HorizontalRule prints a yellow horizontal rule to separate the terminal
// HorizontalNoteRule prints a yellow horizontal rule to separate the terminal
func HorizontalNoteRule() {
pterm.Println()
pterm.FgYellow.Println(strings.Repeat("━", 100))
Expand Down
1 change: 1 addition & 0 deletions src/pkg/packager/deprecated/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/pterm/pterm"
)

// BreakingChange represents a breaking change that happened on a specified Zarf version
type BreakingChange struct {
version *semver.Version
title string
Expand Down
4 changes: 2 additions & 2 deletions src/pkg/transform/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ func ImageTransformHost(targetHost, srcReference string) (string, error) {
// If this image is specified by digest then don't add a checksum it as it will already be a specific SHA
if image.Digest != "" {
return fmt.Sprintf("%s/%s@%s", targetHost, image.Path, image.Digest), nil
} else {
return fmt.Sprintf("%s/%s:%s-zarf-%d", targetHost, image.Path, image.Tag, checksum), nil
}

return fmt.Sprintf("%s/%s:%s-zarf-%d", targetHost, image.Path, image.Tag, checksum), nil
}

// ImageTransformHostWithoutChecksum replaces the base url for an image but avoids adding a checksum of the original url (note image refs are not full URLs).
Expand Down

0 comments on commit 0daaf50

Please sign in to comment.