Skip to content

Commit 1e434c0

Browse files
committed
Merge remote-tracking branch 'origin/master' into hostagent-ssh-banner-readiness
2 parents fcad5e4 + 3569ecb commit 1e434c0

113 files changed

Lines changed: 1679 additions & 789 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/codeql.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
persist-credentials: false
4444

4545
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
46+
uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
4747
with:
4848
languages: ${{ matrix.language }}
4949
build-mode: ${{ matrix.build-mode }}
@@ -59,6 +59,6 @@ jobs:
5959
exit 1
6060
6161
- name: Perform CodeQL Analysis
62-
uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
62+
uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
6363
with:
6464
category: "/language:${{matrix.language}}"

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ jobs:
6060
# Upload the results to GitHub's code scanning dashboard (optional).
6161
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
6262
- name: "Upload to code-scanning"
63-
uses: github/codeql-action/upload-sarif@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
63+
uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
6464
with:
6565
sarif_file: results.sarif

.github/workflows/test.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,21 @@ jobs:
4242
- name: Verify generated files
4343
run: make generate check-generated
4444
- name: Run nobin
45-
run: >-
46-
go tool -modfile=./hack/tools/go.mod nobin
47-
--allow-emoji
48-
--allow-escape
49-
--gitignore
50-
--skip-ext pb.desc
51-
--skip 'website/static/images/**/*.{gif,png}'
52-
--skip 'docs/reports/**/*.pdf'
45+
run: make nobin
5346
- name: Run editorconfig-checker
54-
run: go tool -modfile=./hack/tools/go.mod editorconfig-checker
47+
run: make editorconfig-checker
5548
- name: Run yamllint
56-
run: yamllint .
49+
run: make yamllint
5750
- name: Install shellcheck
5851
run: |
5952
sudo apt-get update
6053
sudo apt-get install -y shellcheck
6154
- name: Run file and directory name linter
6255
uses: ls-lint/action@02e380fe8733d499cbfc9e22276de5085508a5bd # v2.3.1
6356
- name: Run shellcheck
64-
run: find . -name '*.sh' | xargs shellcheck
57+
run: make shellcheck
6558
- name: Run shfmt
66-
run: find . -name '*.sh' | xargs go tool -modfile=./hack/tools/go.mod shfmt -s -d
59+
run: make shfmt
6760
- name: Check hyperlinks
6861
uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0
6962
with:
@@ -79,16 +72,13 @@ jobs:
7972
# TODO: move to `go tool` after upgrading to v2
8073
run: go install github.com/google/go-licenses@v1.6.0
8174
- name: Check licenses
82-
# the allow list corresponds to https://github.com/cncf/foundation/blob/e5db022a0009f4db52b89d9875640cf3137153fe/allowed-third-party-license-policy.md
83-
# hashicorp/hcl/v2 is MPL-2.0; covered by the CNCF license exception for hashicorp/hcl
84-
# see also https://github.com/cncf/foundation/issues/1242
85-
run: go-licenses check --include_tests --ignore github.com/hashicorp/hcl/v2 ./... --allowed_licenses=$(cat ./hack/allowed-licenses.txt)
75+
run: make go-licenses
8676
- name: Check license boilerplates
87-
run: go tool -modfile=./hack/tools/go.mod ltag -t ./hack/ltag --check -v
77+
run: make ltag
8878
- name: Check protobuf files
89-
run: go tool -modfile=./hack/tools/go.mod protolint .
79+
run: make protolint
9080
- name: Run zizmor
91-
uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3
81+
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
9282
with:
9383
# No need to hide the result in https://github.com/lima-vm/lima/security (private),
9484
# as anybody can already run zizmor locally to find vulnerabilities.
@@ -123,10 +113,11 @@ jobs:
123113
run: |
124114
echo "GOLANGCI_LINT_VERSION=$(go list -m -f '{{.Version}}' github.com/golangci/golangci-lint/v2)" >> $GITHUB_OUTPUT
125115
- name: Run golangci-lint
126-
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
116+
uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee # v9.2.1
127117
with:
128118
version: ${{ steps.golangci-lint-version.outputs.GOLANGCI_LINT_VERSION }}
129119
args: --verbose
120+
skip-cache: true
130121

131122
security:
132123
name: "Vulncheck"
@@ -245,10 +236,7 @@ jobs:
245236
run: make
246237
- name: Install QEMU
247238
run: |
248-
# Pin to 10.2.0: QEMU 11.0.0 TCG breaks systemd boot on the Windows
249-
# runner with "Failed to fork off sandboxing environment: Protocol
250-
# error", blocking SSH.
251-
winget install --silent --accept-source-agreements --accept-package-agreements --disable-interactivity SoftwareFreedomConservancy.QEMU --version 10.2.0
239+
winget install --silent --accept-source-agreements --accept-package-agreements --disable-interactivity SoftwareFreedomConservancy.QEMU
252240
- name: Integration tests (QEMU, Windows host)
253241
run: |
254242
$env:PATH = "$pwd\_output\bin;" + 'C:\msys64\usr\bin;' + 'C:\Program Files\QEMU;' + $env:PATH

.golangci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ linters:
2929
- unconvert
3030
- unused
3131
- usetesting
32+
- usestdlibvars
3233
- whitespace
3334
settings:
3435
depguard:
@@ -133,6 +134,10 @@ linters:
133134
- -ST1000
134135
- -ST1001 # duplicates revive.dot-imports
135136
- -ST1022
137+
usestdlibvars:
138+
http-method: false
139+
time-date-month: true
140+
time-layout: true
136141
usetesting:
137142
os-temp-dir: true
138143
context-background: true

Makefile

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -607,21 +607,53 @@ check-generated:
607607
bats: native limactl-plugins
608608
PATH=$$PWD/_output/bin:$$PATH ./hack/bats/lib/bats-core/bin/bats --timing ./hack/bats/tests
609609

610-
.PHONY: lint
611-
lint: check-generated
612-
nobin --allow-emoji --allow-escape --gitignore --skip-ext pb.desc --skip 'website/static/images/**/*.{gif,png}' --skip 'docs/reports/**/*.pdf'
613-
editorconfig-checker
614-
golangci-lint run ./...
610+
# Linting targets - individual stages
611+
.PHONY: nobin
612+
nobin:
613+
$(GO) run -modfile=./hack/tools/go.mod github.com/jandubois/nobin --allow-emoji --allow-escape --gitignore --skip-ext pb.desc --skip 'website/static/images/**/*.{gif,png}' --skip 'docs/reports/**/*.pdf'
614+
615+
.PHONY: editorconfig-checker
616+
editorconfig-checker:
617+
$(GO) run -modfile=./hack/tools/go.mod github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker
618+
619+
.PHONY: golangci-lint
620+
golangci-lint:
621+
$(GO) run -modfile=./hack/tools/go.mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint run ./...
622+
623+
.PHONY: yamllint
624+
yamllint:
615625
yamllint .
626+
627+
.PHONY: ls-lint
628+
ls-lint:
616629
ls-lint
630+
631+
.PHONY: shellcheck
632+
shellcheck:
617633
find . -name '*.sh' ! -path "./.git/*" | xargs shellcheck
618-
find . -name '*.sh' ! -path "./.git/*" | xargs shfmt -s -d
634+
635+
.PHONY: shfmt
636+
shfmt:
637+
find . -name '*.sh' ! -path "./.git/*" | xargs $(GO) run -modfile=./hack/tools/go.mod mvdan.cc/sh/v3/cmd/shfmt -s -d
638+
639+
.PHONY: go-licenses
640+
go-licenses:
619641
# the allow list corresponds to https://github.com/cncf/foundation/blob/e5db022a0009f4db52b89d9875640cf3137153fe/allowed-third-party-license-policy.md
620642
# hashicorp/hcl/v2 is MPL-2.0; covered by the CNCF license exception for hashicorp/hcl
621643
# see also https://github.com/cncf/foundation/issues/1242
622644
go-licenses check --include_tests --ignore github.com/hashicorp/hcl/v2 ./... --allowed_licenses=$$(cat ./hack/allowed-licenses.txt)
623-
ltag -t ./hack/ltag --check -v
624-
protolint .
645+
646+
.PHONY: ltag
647+
ltag:
648+
$(GO) run -modfile=./hack/tools/go.mod github.com/containerd/ltag -t ./hack/ltag --check -v
649+
650+
.PHONY: protolint
651+
protolint:
652+
$(GO) run -modfile=./hack/tools/go.mod github.com/yoheimuta/protolint/cmd/protolint .
653+
654+
# Main lint target - runs all linting stages
655+
.PHONY: lint
656+
lint: check-generated nobin editorconfig-checker golangci-lint yamllint ls-lint shellcheck shfmt go-licenses ltag protolint
625657

626658
.PHONY: clean
627659
clean:

cmd/lima-guestagent/daemon_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func daemonAction(cmd *cobra.Command, _ []string) error {
142142
return err
143143
}
144144
l = socketL
145-
logrus.Infof("serving the guest agent on %q", socket)
145+
logrus.Infof("serving the guest agent on %#q", socket)
146146
}
147147
defer logrus.Debug("exiting lima-guestagent daemon")
148148
return server.StartServer(ctx, l, &server.GuestServer{Agent: agent, TunnelS: portfwdserver.NewTunnelServer()})

cmd/lima-guestagent/install_systemd_linux.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ func installSystemdAction(cmd *cobra.Command, _ []string) error {
5858
unitFileChanged := true
5959
if _, err := os.Stat(unitPath); !errors.Is(err, os.ErrNotExist) {
6060
if existingUnit, err := os.ReadFile(unitPath); err == nil && bytes.Equal(unit, existingUnit) {
61-
logrus.Infof("File %q is up-to-date", unitPath)
61+
logrus.Infof("File %#q is up-to-date", unitPath)
6262
unitFileChanged = false
6363
} else {
64-
logrus.Infof("File %q needs update", unitPath)
64+
logrus.Infof("File %#q needs update", unitPath)
6565
}
6666
} else {
6767
unitDir := filepath.Dir(unitPath)
@@ -73,7 +73,7 @@ func installSystemdAction(cmd *cobra.Command, _ []string) error {
7373
if err := os.WriteFile(unitPath, unit, 0o644); err != nil {
7474
return err
7575
}
76-
logrus.Infof("Written file %q", unitPath)
76+
logrus.Infof("Written file %#q", unitPath)
7777
} else if !guestAgentUpdated {
7878
logrus.Info("lima-guestagent.service already up-to-date")
7979
return nil

cmd/limactl/clone.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func cloneOrRenameAction(cmd *cobra.Command, args []string) error {
8989
if err != nil {
9090
return err
9191
}
92-
yBytes, err := yqutil.EvaluateExpression(yq, yContent)
92+
yBytes, err := yqutil.EvaluateExpression(ctx, yq, yContent)
9393
if err != nil {
9494
return err
9595
}

cmd/limactl/delete.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func deleteAction(cmd *cobra.Command, args []string) error {
4646
}
4747
return err
4848
}
49-
if err := instance.Delete(cmd.Context(), inst, force); err != nil {
49+
if err := instance.Delete(ctx, inst, force); err != nil {
5050
return fmt.Errorf("failed to delete instance %#q: %w", instName, err)
5151
}
5252
if registered, err := autostart.IsRegistered(ctx, inst); err != nil && !errors.Is(err, autostart.ErrNotSupported) {
@@ -60,7 +60,7 @@ func deleteAction(cmd *cobra.Command, args []string) error {
6060
}
6161
logrus.Infof("Deleted %#q (%#q)", instName, inst.Dir)
6262
}
63-
return reconcile.Reconcile(cmd.Context(), "")
63+
return reconcile.Reconcile(ctx, "")
6464
}
6565

6666
func deleteBashComplete(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {

cmd/limactl/edit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func editAction(cmd *cobra.Command, args []string) error {
100100
var yBytes []byte
101101
if len(yqExprs) > 0 {
102102
yq := yqutil.Join(yqExprs)
103-
yBytes, err = yqutil.EvaluateExpression(yq, yContent)
103+
yBytes, err = yqutil.EvaluateExpression(ctx, yq, yContent)
104104
if err != nil {
105105
return err
106106
}

0 commit comments

Comments
 (0)