Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,24 @@ Always reference these instructions first and fallback to search or bash command
**Prerequisites:**
- Go >= 1.21 (currently uses Go 1.24.5)
- Helm v3 (tested with v3.17.4 and v3.18.6)
- Make sure `/home/runner/go/bin` is in your PATH for staticcheck: `export PATH=$PATH:/home/runner/go/bin`

**Bootstrap and Build Process:**
- ALWAYS run: `make bootstrap` first - downloads dependencies and installs staticcheck. Takes <1 second (if already done) or ~50 seconds (first time).
- Build the plugin: `make build` - includes linting and compiles the binary. Takes ~9 seconds after bootstrap.
- NEVER CANCEL builds. Set timeout to 3+ minutes for bootstrap, 2+ minutes for build operations.
**Build Process:**
- Build the plugin: `make build` - includes linting and compiles the binary.
- NEVER CANCEL builds. Set timeout to 2+ minutes for build operations.

**Testing:**
- Run unit tests: `make test` - includes coverage analysis. Takes ~12 seconds. NEVER CANCEL - set timeout to 3+ minutes.
- Tests include comprehensive coverage (38.7% overall) and use a fake helm binary for isolation.
- Test coverage is generated in `cover.out` with detailed function-level coverage reports.

**Linting and Code Quality:**
- Local linting: `make lint` - runs gofmt, go vet, and staticcheck verification. Takes ~2 seconds.
- Local linting: `make lint` - runs gofmt, go vet. Takes ~2 seconds.
- Code formatting: `make format` - applies gofmt formatting automatically. Takes <1 second.
- Full golangci-lint runs only in CI via GitHub Actions, not available locally.
- ALWAYS run `make format` and `make lint` before committing changes.

**Plugin Installation:**
- Install as Helm plugin: `make install` or `make install/helm3` - builds and installs to Helm plugins directory. Takes ~3 seconds.
- Install as Helm plugin: `make install` or `make install/helm` - builds and installs to Helm plugins directory. Takes ~3 seconds.
- The plugin installs via `install-binary.sh` script which handles cross-platform binary installation.

## Validation Scenarios
Expand Down Expand Up @@ -63,8 +61,7 @@ Always reference these instructions first and fallback to search or bash command

**CRITICAL: NEVER CANCEL long-running commands. Use these timeout values:**

- `make bootstrap`: <1 second (if already done) or ~50 seconds (first time) (set timeout: 5+ minutes)
- `make build`: ~9 seconds after bootstrap (set timeout: 3+ minutes)
- `make build`: ~9 seconds (set timeout: 3+ minutes)
- `make test`: ~12 seconds (set timeout: 3+ minutes)
- `make lint`: ~2 seconds (set timeout: 1 minute)
- `make format`: <1 second (set timeout: 1 minute)
Expand All @@ -77,7 +74,7 @@ Always reference these instructions first and fallback to search or bash command
- `cmd/` - Command-line interface implementation (upgrade, release, revision, rollback, version)
- `diff/` - Core diffing logic and output formatting
- `manifest/` - Kubernetes manifest parsing and handling
- `scripts/` - Build and verification scripts (gofmt, govet, staticcheck)
- `scripts/` - Build and verification scripts (gofmt, govet)
- `testdata/`, `*/testdata/` - Test fixtures and mock data
- `plugin.yaml` - Helm plugin configuration
- `install-binary.sh` - Cross-platform installation script
Expand Down Expand Up @@ -114,7 +111,6 @@ HELM_NAMESPACE=default HELM_BIN=helm ./bin/diff upgrade --install --dry-run my-r
**Common Commands Reference:**
```bash
# Full development cycle
make bootstrap # Install dependencies (once)
make build # Build with linting
make test # Run all tests
make format # Format code
Expand Down
38 changes: 19 additions & 19 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ jobs:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'

- name: Install dependencies
run: make bootstrap
go-version-file: "go.mod"

- name: Run unit tests
run: make test
Expand All @@ -41,36 +38,36 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
shell: [ default ]
experimental: [ false ]
helm-version: [ v3.18.6, v3.19.0 ]
shell: [default]
experimental: [false]
helm-version: [v3.19.2, v4.0.0]
include:
- os: windows-latest
shell: wsl
experimental: false
helm-version: v3.18.6
helm-version: v3.19.2
- os: windows-latest
shell: cygwin
experimental: false
helm-version: v3.18.6
helm-version: v3.19.2
- os: ubuntu-latest
container: alpine
shell: sh
experimental: false
helm-version: v3.18.6
helm-version: v3.19.2
- os: windows-latest
shell: wsl
experimental: false
helm-version: v3.19.0
helm-version: v4.0.0
- os: windows-latest
shell: cygwin
experimental: false
helm-version: v3.19.0
helm-version: v4.0.0
- os: ubuntu-latest
container: alpine
shell: sh
experimental: false
helm-version: v3.19.0
helm-version: v4.0.0

steps:
- name: Disable autocrlf
Expand All @@ -84,7 +81,7 @@ jobs:
- name: Setup Helm
uses: azure/setup-helm@v4
with:
version: ${{ matrix.helm-version }}
version: "${{ matrix.helm-version }}"

- name: Setup WSL
if: "contains(matrix.shell, 'wsl')"
Expand All @@ -95,7 +92,7 @@ jobs:
uses: egor-tensin/setup-cygwin@v4

- name: helm plugin install
run: helm plugin install .
run: helm plugin install --debug .

integration-tests:
name: Integration Tests
Expand All @@ -109,12 +106,12 @@ jobs:
# That's why we cover only 2 Helm minor versions in this matrix.
# See https://github.com/helmfile/helmfile/pull/286#issuecomment-1250161182 for more context.
- helm-version: v3.18.6
- helm-version: v3.19.0
- helm-version: v3.19.2
- helm-version: v4.0.0
steps:
- uses: engineerd/[email protected]
with:
skipClusterLogsExport: true

skipClusterLogsExport: true

- uses: actions/checkout@v5

Expand All @@ -123,8 +120,11 @@ jobs:
with:
version: ${{ matrix.helm-version }}

- name: Helm Version
run: helm version

- name: helm plugin install
run: helm plugin install .
run: make install/helm

- name: helm create helm-diff
run: helm create helm-diff
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ linters:
- golang.org/x/term
- gopkg.in/yaml.v2
- github.com/stretchr/testify/require
- helm.sh/helm/v3
- helm.sh/helm/v4
- k8s.io/api/core/v1
- k8s.io/apiextensions-apiserver
- k8s.io/apimachinery
Expand Down
20 changes: 7 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
HELM_HOME ?= $(shell helm env HELM_DATA_HOME)
VERSION := $(shell sed -n -e 's/version:[ "]*\([^"]*\).*/\1/p' plugin.yaml)

HELM_3_PLUGINS := $(shell helm env HELM_PLUGINS)
HELM_PLUGINS := $(shell helm env HELM_PLUGINS)

PKG:= github.com/databus23/helm-diff/v3
LDFLAGS := -X $(PKG)/cmd.Version=$(VERSION)
Expand All @@ -19,18 +19,17 @@ install: build
cp bin/diff $(HELM_HOME)/plugins/helm-diff/bin
cp plugin.yaml $(HELM_HOME)/plugins/helm-diff/

.PHONY: install/helm3
install/helm3: build
mkdir -p $(HELM_3_PLUGINS)/helm-diff/bin
cp bin/diff $(HELM_3_PLUGINS)/helm-diff/bin
cp plugin.yaml $(HELM_3_PLUGINS)/helm-diff/
.PHONY: install/helm
install/helm: build
mkdir -p $(HELM_PLUGINS)/helm-diff/bin
cp bin/diff $(HELM_PLUGINS)/helm-diff/bin
cp plugin.yaml $(HELM_PLUGINS)/helm-diff/

.PHONY: lint
lint:
scripts/update-gofmt.sh
scripts/verify-gofmt.sh
scripts/verify-govet.sh
scripts/verify-staticcheck.sh

.PHONY: build
build: lint
Expand All @@ -42,11 +41,6 @@ test:
go test -v ./... -coverprofile cover.out -race
go tool cover -func cover.out

.PHONY: bootstrap
bootstrap:
go mod download
command -v staticcheck || go install honnef.co/go/tools/cmd/staticcheck@latest

.PHONY: docker-run-release
docker-run-release: export pkg=/go/src/github.com/databus23/helm-diff
docker-run-release:
Expand All @@ -63,7 +57,7 @@ docker-run-release:
-v ${SSH_AUTH_SOCK}:/tmp/ssh-agent.sock -e SSH_AUTH_SOCK=/tmp/ssh-agent.sock \
-v $(shell pwd):$(pkg) \
-v $(shell pwd)/docker-run-release-cache:/.cache \
-w $(pkg) helm-diff-release make bootstrap release
-w $(pkg) helm-diff-release make release

.PHONY: dist
dist: export COPYFILE_DISABLE=1 #teach OSX tar to not put ._* files in tar archive
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The first step is to download the repository and enter the directory. You can do
Next, install the plugin into helm.

```bash
make install/helm3
make install/helm
```


Expand Down
Loading
Loading