Skip to content

Commit

Permalink
1686. Replace Zarf Logo (#1700)
Browse files Browse the repository at this point in the history
## Related Issue 
Fixes #1686 
<!-- or -->
Relates to #

## Type of change

- [x] UI Tweak

Co-authored-by: razzle <[email protected]>
Co-authored-by: Wayne Starr <[email protected]>
  • Loading branch information
3 people authored May 11, 2023
1 parent c9cdce4 commit 05f40cd
Show file tree
Hide file tree
Showing 17 changed files with 111 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Create a report to help us improve
title: ''
labels: possible-bug
assignees: ''

---

### Environment
Expand All @@ -25,3 +24,4 @@ Other:
### Severity/Priority

### Additional Context
Add any other context or screenshots about the technical debt here.
10 changes: 6 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
labels: 'enhancement'
assignees: ''

---

### Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

### Describe the solution you'd like
A clear and concise description of what you want to happen.

- **Given** a state
- **When** an action is taken
- **Then** something happens

### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
(optional) A clear and concise description of any alternative solutions or features you've considered.

### Additional context
Add any other context or screenshots about the feature request here.
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/tech_debt.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ about: Record something that should be investigated or refactored in the future.
title: ''
labels: 'tech-debt'
assignees: ''

---

### Describe what should be investigated or refactored
A clear and concise description of what should be changed/researched. Ex. This piece of the code is not DRY enough [...]

### Links to any relevant code
https://github.com/defenseunicorns/zarf/blob/main/README.md?plain=1#L1
(optional) i.e. - https://github.com/defenseunicorns/zarf/blob/main/README.md?plain=1#L1

### Additional context
Add any other context or screenshots about the technical debt here.
23 changes: 15 additions & 8 deletions .github/ISSUE_TEMPLATE/ux_test.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
## Driving Questions ##
*What are we hoping to validate?*
---
name: UX Test
about: Record something that should be investigated to test User Experience
title: ''
labels: 'ux'
assignees: ''
---

## Driving Questions
What are we hoping to validate?

## Testing Plan ##
User persona:
## Testing Plan
User Persona:
Sample Group:

- [ ] Use Checklist for Tasks

## Additional context ##
*Screenshot or link to what needs to be tested*
## Additional context
Add any other context or screenshots about the UX test here.

Related to issue
Related to issue: #

## Link to Test & Results ##
## Link to Test & Results
10 changes: 7 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,25 @@ jobs:
- name: Run Tests
run: |
sudo env "PATH=$PATH" CI=true APPLIANCE_MODE=true make test-e2e ARCH=amd64
sudo rm -rf zarf-sbom
sudo rm -rf build/zarf-package-*
sudo chown $USER /tmp/zarf-*.log
- name: Save logs
if: always()
uses: ./.github/actions/save-logs

- name: Cleanup files
run: |
sudo rm -rf zarf-sbom /tmp/zarf-*
sudo env "PATH=$PATH" CI=true make delete-packages
sudo build/zarf tools clear-cache
# Builds init packages since GoReleaser won't handle this for us
- name: Create release time CVE report
run: "make cve-report"

# Set up AWS credentials for GoReleaser to upload backups of artifacts to S3
- name: Set AWS Credentials
uses: aws-actions/configure-aws-credentials@023daa7fe5f7f817faa31fc0fc4a8d0fb6224ed0 # v1-node16
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2-node16
with:
aws-access-key-id: ${{ secrets.AWS_GOV_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_GOV_SECRET_ACCESS_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions docs/12-contribute-to-zarf/2-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ make test-e2e ARCH="[amd64|arm64]"
APPLIANCE_MODE=true make test-e2e ARCH="[amd64|arm64]"

# If you already have everything build, you can run this inside this folder. This lets you customize the test run.
go test ./src/test/... -v
go test ./src/test/... -v -failfast

# Let's say you only want to run one test. You would run:
go test ./src/test/... -v -run TestFooBarBaz
go test ./src/test/... -v -failfast -run TestFooBarBaz
```

:::note
Expand Down
2 changes: 1 addition & 1 deletion src/internal/cluster/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (c *Cluster) sanitizeZarfState(state types.ZarfState) types.ZarfState {
// SaveZarfState takes a given state and persists it to the Zarf/zarf-state secret.
func (c *Cluster) SaveZarfState(state types.ZarfState) error {
message.Debugf("k8s.SaveZarfState()")
message.Debug(message.JSONValue(state))
message.Debug(message.JSONValue(c.sanitizeZarfState(state)))

// Convert the data back to JSON.
data, err := json.Marshal(state)
Expand Down
1 change: 0 additions & 1 deletion src/internal/packager/helm/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ func (h *Helm) loadChartData() (*chart.Chart, map[string]any, error) {
if err != nil {
return loadedChart, nil, fmt.Errorf("unable to parse chart values: %w", err)
}
message.Debug(chartValues)
} else {
// Otherwise, use the overrides instead.
loadedChart = h.ChartOverride
Expand Down
2 changes: 1 addition & 1 deletion src/internal/packager/images/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
// PushToZarfRegistry pushes a provided image into the configured Zarf registry
// This function will optionally shorten the image name while appending a checksum of the original image name.
func (i *ImgConfig) PushToZarfRegistry() error {
message.Debugf("images.PushToZarfRegistry(%#v)", i)
message.Debug("images.PushToZarfRegistry()")

logs.Warn.SetOutput(&message.DebugWriter{})
logs.Progress.SetOutput(&message.DebugWriter{})
Expand Down
22 changes: 14 additions & 8 deletions src/pkg/message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var useLogFile bool
type DebugWriter struct{}

func (d *DebugWriter) Write(raw []byte) (int, error) {
Debug(raw)
Debug(string(raw))
return len(raw), nil
}

Expand Down Expand Up @@ -75,16 +75,22 @@ func UseLogFile() {
// Prepend the log filename with a timestamp.
ts := time.Now().Format("2006-01-02-15-04-05")

// Try to create a temp log file.
var err error
if logFile, err = os.CreateTemp("", fmt.Sprintf("zarf-%s-*.log", ts)); err != nil {
Error(err, "Error saving a log file")
} else {
useLogFile = true
if logFile != nil {
// Use the existing log file if logFile is set
logStream := io.MultiWriter(os.Stderr, logFile)
pterm.SetDefaultOutput(logStream)
message := fmt.Sprintf("Saving log file to %s", logFile.Name())
Note(message)
} else {
// Try to create a temp log file if one hasn't been made already
if logFile, err = os.CreateTemp("", fmt.Sprintf("zarf-%s-*.log", ts)); err != nil {
Error(err, "Error saving a log file")
} else {
useLogFile = true
logStream := io.MultiWriter(os.Stderr, logFile)
pterm.SetDefaultOutput(logStream)
message := fmt.Sprintf("Saving log file to %s", logFile.Name())
Note(message)
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/pkg/utils/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package utils

import (
"fmt"
"os"
"strings"

"github.com/defenseunicorns/zarf/src/config"
"github.com/defenseunicorns/zarf/src/pkg/message"
"github.com/defenseunicorns/zarf/src/types"
"github.com/pterm/pterm"
Expand All @@ -15,6 +17,9 @@ func PrintCredentialTable(state types.ZarfState, componentsToDeploy []types.Depl
componentsToDeploy = []types.DeployedComponent{{Name: "logging"}, {Name: "git-server"}}
}

// Set output to os.Stderr to avoid creds being printed in logs
pterm.SetDefaultOutput(os.Stderr)

pterm.Println()
loginTableHeader := pterm.TableData{
{" Application", "Username", "Password", "Connect"},
Expand Down Expand Up @@ -43,6 +48,11 @@ func PrintCredentialTable(state types.ZarfState, componentsToDeploy []types.Depl
loginTable = append(loginTableHeader, loginTable...)
_ = pterm.DefaultTable.WithHasHeader().WithData(loginTable).Render()
}

// Restore the log file if it was specified
if !config.SkipLogFile {
message.UseLogFile()
}
}

// PrintComponentCredential displays credentials for a single component
Expand Down
17 changes: 16 additions & 1 deletion src/test/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ package test
import (
"context"
"os"
"regexp"
"runtime"
"testing"

"github.com/defenseunicorns/zarf/src/pkg/utils"
"github.com/defenseunicorns/zarf/src/pkg/utils/exec"
"github.com/stretchr/testify/require"
)

// ZarfE2ETest Struct holding common fields most of the tests will utilize.
Expand All @@ -21,6 +24,8 @@ type ZarfE2ETest struct {
RunClusterTests bool
}

var logRegex = regexp.MustCompile(`Saving log file to (?P<logFile>.*?\.log)`)

// GetCLIName looks at the OS and CPU architecture to determine which Zarf binary needs to be run.
func GetCLIName() string {
var binaryName string
Expand Down Expand Up @@ -83,6 +88,16 @@ func (e2e *ZarfE2ETest) GetMismatchedArch() string {
case "arm64":
return "amd64"
default:
return"arm64"
return "arm64"
}
}

// GetLogFileContents gets the log file contents from a given run's std error.
func (e2e *ZarfE2ETest) GetLogFileContents(t *testing.T, stdErr string) string {
get, err := utils.MatchRegex(logRegex, stdErr)
require.NoError(t, err)
logFile := get("logFile")
logContents, err := os.ReadFile(logFile)
require.NoError(t, err)
return string(logContents)
}
31 changes: 28 additions & 3 deletions src/test/e2e/20_zarf_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
package test

import (
"encoding/base64"
"fmt"
"testing"

"encoding/json"

"github.com/defenseunicorns/zarf/src/types"
"github.com/stretchr/testify/require"
)

func TestZarfInit(t *testing.T) {
t.Log("E2E: Zarf init (limit to 10 minutes)")
t.Log("E2E: Zarf init")
e2e.SetupWithCluster(t)
defer e2e.Teardown(t)

Expand Down Expand Up @@ -42,9 +46,30 @@ func TestZarfInit(t *testing.T) {
require.Contains(t, stdErr, expectedErrorMessage)

// run `zarf init`
_, stdErr, err = e2e.ExecZarfCommand("init", "--components="+initComponents, "--confirm", "--nodeport", "31337")
require.Contains(t, stdErr, "artifacts with software bill-of-materials (SBOM) included")
_, initStdErr, err := e2e.ExecZarfCommand("init", "--components="+initComponents, "--confirm", "--nodeport", "31337", "-l", "trace")
require.NoError(t, err)
require.Contains(t, initStdErr, "artifacts with software bill-of-materials (SBOM) included")

logText := e2e.GetLogFileContents(t, initStdErr)

// Verify that any state secrets were not included in the log
base64State, _, err := e2e.ExecZarfCommand("tools", "kubectl", "get", "secret", "zarf-state", "-n", "zarf", "-o", "jsonpath={.data.state}")
require.NoError(t, err)
stateJSON, err := base64.StdEncoding.DecodeString(base64State)
require.NoError(t, err)
state := types.ZarfState{}
err = json.Unmarshal(stateJSON, &state)
require.NoError(t, err)
require.NotContains(t, logText, state.AgentTLS.CA)
require.NotContains(t, logText, state.AgentTLS.Cert)
require.NotContains(t, logText, state.AgentTLS.Key)
require.NotContains(t, logText, state.ArtifactServer.PushToken)
require.NotContains(t, logText, state.GitServer.PullPassword)
require.NotContains(t, logText, state.GitServer.PushPassword)
require.NotContains(t, logText, state.RegistryInfo.PullPassword)
require.NotContains(t, logText, state.RegistryInfo.PushPassword)
require.NotContains(t, logText, state.RegistryInfo.Secret)
require.NotContains(t, logText, state.LoggingSecret)

// Check that gitea is actually running and healthy
stdOut, _, err = e2e.ExecZarfCommand("tools", "kubectl", "get", "pods", "-l", "app in (gitea)", "-n", "zarf", "-o", "jsonpath={.items[*].status.phase}")
Expand Down
6 changes: 5 additions & 1 deletion src/test/e2e/24_variables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ func TestVariables(t *testing.T) {
// Deploy nginx
stdOut, stdErr, err := e2e.ExecZarfCommand("package", "deploy", path, "--confirm", "--set", "SITE_NAME=Lula Web", "--set", "AWS_REGION=unicorn-land", "-l", "trace")
require.NoError(t, err, stdOut, stdErr)
// Verify that unicorn-land was not included in the log
// Verify that the sensitive variable 'unicorn-land' was not printed to the screen
require.NotContains(t, stdErr, "unicorn-land")

logText := e2e.GetLogFileContents(t, stdErr)
// Verify that the sensitive variable 'unicorn-land' was not included in the log
require.NotContains(t, logText, "unicorn-land")

// Verify the terraform file was templated correctly
outputTF, err := os.ReadFile(tfPath)
require.NoError(t, err)
Expand Down
Binary file removed src/ui/images/png/global-navigation-zarf-logo.png
Binary file not shown.
Binary file modified src/ui/images/zarf-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/ui/lib/components/global-navigation-bar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-FileCopyrightText: 2021-Present The Zarf Authors
-->
<script lang="ts">
import ZarfLogoDark from '@images/png/global-navigation-zarf-logo.png';
import ZarfLogoDark from '@images/zarf-logo.png';
import { Paper, type SSX } from '@ui';
import ThemeToggle from './theme-toggle.svelte';
Expand Down Expand Up @@ -34,7 +34,9 @@
square
>
<div class="nav-right">
<a href="/"><img src={ZarfLogoDark} alt="Zarf logo link to home" /></a>
<a href="/">
<img src={ZarfLogoDark} height="48px" width="107px" alt="Zarf logo link to home" />
</a>
</div>
<div class="nav-left"><ThemeToggle /></div>
</Paper>

0 comments on commit 05f40cd

Please sign in to comment.