rig v2.0.0
Rig v2 is a ground-up redesign and refactoring of this package. As per go conventions it's now imported as github.com/k0sproject/rig/v2.
Existing github.com/k0sproject/rig (v0.x) consumers are unaffected. The old v0.x still resides on the release-0.x branch like it has since main became the base for v2 development. New features, fixes or dependency bumps for v0.x may be (reluctantly) backported to that branch and tagged.
See docs/MIGRATING-from-v0.x.md for a full migration guide.
Highlights
- Composable
Client- the monolithicrig.Connectionis replaced byrig.Client, built from pluggable, lazily-initialized service providers (filesystem, init system, package manager, OS detection) instead of one struct that did everything. Sudo()is a client, not an option -client.Sudo()returns a cloned client whose runner transparently wraps every command with the detected privilege-escalation mechanism (sudo/doas/runas), instead of threading aexec.Sudo(h)option through call sites.- Expanded
remotefs.OS- stdlibos-like functions available directly on the FS handle, such asLookPath,Rename,Chown/ChownTree,DownloadURL,FileContains,CreateTemp/TempDir,PatchFile(line-oriented patching) and atomic writes viaWriteFileAtomic. This replaces the hugeconfigurerinterface and tricky nested struct embedding for OS support modules in cosumers. - Built-in
sshconfigparser package - a complete OpenSSHssh_config(5)parser that supportsMatch/Includedirectives, token/env expansion and many of the availble options are wired into the native SSH transport. - Built-in
shandsh/shellescapepackages for building and escaping POSIX shell commands. - Improved
redactpackage for efficiently scrubbing secrets from strings, readers and writers. - New
rigtestpackage - mock runners and connections for unit-testing code that drives arig.Clientwithout a real host. client.Proc()gives anos/exec.Cmd-style handle for streaming stdin/stdout/stderr, this replaces the oldExecStreamsAPI.- Every
Exec/ExecOutputhas a new context-cancellable*Contexttwin. - Real-time log streaming for services and file following, capabilit discovery (
client.Capabilities()) and command dry-run/explain tracing.
Full Changelog: v0.21.11...v2.0.0
What's Changed
- V2 by @kke in #164
- Add ssh keepalive support by @kke in #178
- Detect windows SSH from server header by @kke in #177
- Replace go-shellwords with own shellescape.Split by @kke in #179
- Bump gopkg.in/yaml.v2 from 2.2.2 to 2.4.0 by @dependabot[bot] in #180
- Run stat in empty env with C locale by @twz123 in #183
- Implement an SSH config parser by @kke in #181
- Bump dependabot/fetch-metadata from 1 to 2 by @dependabot[bot] in #185
- Drop kevinburke/ssh_config dependency in favor of rig/v2/sshconfig by @kke in #186
- Bump golang.org/x/crypto from 0.21.0 to 0.22.0 by @dependabot[bot] in #187
- Bump golang.org/x/net from 0.21.0 to 0.23.0 by @dependabot[bot] in #190
- Bump github.com/Microsoft/go-winio from 0.6.1 to 0.6.2 by @dependabot[bot] in #191
- Bump golangci/golangci-lint-action from 4 to 5 by @dependabot[bot] in #192
- Use go1.22, lint updates by @kke in #198
- Add missing call to client setup in Clone() by @james-nesbitt in #199
- Bump golangci/golangci-lint-action from 5 to 6 by @dependabot[bot] in #200
- Bump golang.org/x/crypto from 0.22.0 to 0.23.0 by @dependabot[bot] in #201
- Just auto-approve dependabot PRs by @kke in #202
- Bump golang.org/x/crypto from 0.23.0 to 0.24.0 by @dependabot[bot] in #208
- Bump golang.org/x/term from 0.21.0 to 0.22.0 by @dependabot[bot] in #211
- Bump golang.org/x/crypto from 0.24.0 to 0.25.0 by @dependabot[bot] in #212
- Bump golang.org/x/crypto from 0.25.0 to 0.26.0 by @dependabot[bot] in #218
- Bump golang.org/x/term from 0.23.0 to 0.24.0 by @dependabot[bot] in #222
- Bump golang.org/x/crypto from 0.26.0 to 0.27.0 by @dependabot[bot] in #223
- Bump golang.org/x/crypto from 0.27.0 to 0.28.0 by @dependabot[bot] in #224
- Bump golang.org/x/crypto from 0.28.0 to 0.29.0 by @dependabot[bot] in #229
- Bump Go to v1.23.3 by @twz123 in #232
- Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 by @dependabot[bot] in #233
- Bump golang.org/x/crypto from 0.29.0 to 0.30.0 by @dependabot[bot] in #234
- Bump golang.org/x/crypto from 0.30.0 to 0.31.0 by @dependabot[bot] in #236
- Enable DCO by @jnummelin in #244
- Bump golang.org/x/crypto from 0.31.0 to 0.33.0 by @dependabot[bot] in #243
- Bump golang.org/x/net from 0.24.0 to 0.33.0 by @dependabot[bot] in #245
- Use full patch version for go directives in go.mod by @twz123 in #240
- Bump golang.org/x/crypto from 0.33.0 to 0.34.0 by @dependabot[bot] in #246
- Bump golang.org/x/crypto from 0.34.0 to 0.35.0 by @dependabot[bot] in #248
- Bump golang.org/x/crypto from 0.35.0 to 0.36.0 by @dependabot[bot] in #251
- Bump golang.org/x/crypto from 0.36.0 to 0.42.0 by @dependabot[bot] in #280
- Add license scan report and status by @fossabot in #271
- Bump actions/setup-go from 5 to 6 by @dependabot[bot] in #277
- Bump github.com/stretchr/testify from 1.10.0 to 1.11.1 by @dependabot[bot] in #276
- Fix integation tests by @juanluisvaladas in #263
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in #274
- Update workflows and go.sum in main by @kke in #300
- Try multiple authentication methods of the same type by @kke in #299
- Use .NET to calculate SHA256 hashes on Windows by @twz123 in #295
- Finetune v2 naming conventions by @kke in #301
- Minor v2 connection layer improvements to help with k0sctl migration by @kke in #302
- Validate yaml compatibility with v0.x by @kke in #303
- Remove eager Setup() call from ClientWithConfig.UnmarshalYAML by @kke in #304
- Add Arch() to os.Release by @kke in #305
- Preserve PATH when running commands in an empty env by @twz123 in #309
- Bump golang.org/x/crypto from 0.49.0 to 0.50.0 by @dependabot[bot] in #307
- Add MachineID and SystemTime to remotefs.OS interface by @kke in #306
- OS resolver missing os-release file fallback / guess by @kke in #313
- WithOSIDOverride client option by @kke in #314
- Add Service.SetEnvironment and Service.DaemonReload by @kke in #315
- Add WithPermissions option to remotefs.Upload by @kke in #316
- remotefs.OS Chown, Touch, DownloadURL, FileContains, IsContainer by @kke in #318
- Add Dir, Base, CommandExist to remotefs.OS interface by @kke in #319
- Add ChownInt, ChownTree, ChownTreeInt to remotefs.OS interface by @kke in #320
- Bump github.com/Azure/go-ntlmssp from 0.1.0 to 0.1.1 by @dependabot[bot] in #321
- Add CreateTemp(dir, prefix) to remotefs.OS interface by @kke in #323
- Add http.RoundTripper to remotefs FS via curl/PowerShell by @kke in #322
- Add cmd.Proc and rename Formatter.Command to Formatter.Format by @kke in #326
- Fix stat variant detection for uutils on newer Ubuntu by @kke in #330
- Improve PowerShell EncodedCommand usage by @kke in #325
- Fix golangci-lint failures from new linter version by @kke in #331
- WriteFileAtomic by @kke in #333
- Add PatchFile: line-oriented file patching on remote filesystems by @kke in #334
- Add two missing test files by @kke in #336
- Add kv.Encoder: write-side complement to kv.Decoder by @kke in #335
- Fix Service.Restart double-restart and waitState busy loop by @kke in #337
- Fix Windows sudo detection to use IsInRole for effective elevation check by @kke in #339
- Add real-time log streaming for services and file following by @kke in #340
- Use the "sh" package where applicable by @kke in #341
- Add connectivity probe to WinRM Connect by @kke in #342
- Bump golang.org/x/crypto from 0.50.0 to 0.51.0 by @dependabot[bot] in #344
- Bump golang.org/x/crypto from 0.51.0 to 0.52.0 by @dependabot[bot] in #348
- feat(reboot): add Client.Reboot with Windows schtasks and POSIX fallback by @kke in #345
- fix(windows): replace shell-sensitive commands with explicit PS equivalents by @kke in #349
- add sync.Pools for high-impact functions by @kke in #350
- fix: context propagation in service lifecycle, ExecInteractive and Windows detection by @kke in #351
- Add golden output tests for powershell, sh, sudo and cmd by @kke in #352
- Add fuzz tests to parsers and secret redaction by @kke in #353
- docs(examples): add package-level examples for core rig workflows by @kke in #358
- docs: specify PTY/TTY session semantics across all protocols by @kke in #359
- Run govulncheck on CI by @kke in #361
- fix: atomic temp-file cleanup in Upload and initTouch by @kke in #362
- feat: add Client.Capabilities() for remote capability discovery by @kke in #360
- Probe stat capabilities instead of parsing help text by @twz123 in #356
- test: add v0.x YAML fixture compatibility tests by @kke in #363
- feat(cmd): add command lifecycle tracing and dry-run explain by @kke in #364
- test: increase coverage for initsystem, homedir and sudo packages by @kke in #365
- feat(ssh): wire AddressFamily from sshconfig for IPv4/IPv6 selection by @kke in #367
- feat(ssh): suppress PasswordCallback in BatchMode by @kke in #368
- feat(ssh): skip pubkey auth if PubkeyAuthentication "no" in config by @kke in #369
- feat(ssh): use ServerAliveInterval from sshconfig as keepalive interval by @kke in #370
- feat(ssh): wire algorithm fields and connect timeout from sshconfig by @kke in #366
- feat(ssh): wire sshconfig RekeyLimit bytes to RekeyThreshold by @kke in #373
- feat(ssh): add SSHConfigOptions to set sshconfig options by @kke in #375
- feat(ssh): fallback to GlobalKnownHostsFile by @kke in #372
- feat(ssh): wire IdentityAgent from sshconfig for custom agent socket by @kke in #371
- feat(ssh): wire BindAddress and interface from sshconfig to net.Dialer by @kke in #376
- feat(ssh): wire CertificateFile for certificate-based authentication by @kke in #377
- feat(ssh): wire CheckHostIP from sshconfig for DNS-spoofing detection by @kke in #378
- feat(ssh): wire HostKeyAlias from sshconfig for known_hosts lookup by @kke in #379
- feat(ssh): wire ProxyJump as bastion and ProxyCommand as transport by @kke in #380
- feat(config): add config struct json schemas by @kke in #381
- build(deps): Bump golang.org/x/crypto from 0.52.0 to 0.53.0 by @dependabot[bot] in #382
- build(deps): Bump github.com/buger/jsonparser from 1.1.1 to 1.1.2 in /internal/jsonschema by @dependabot[bot] in #384
- fix(jsonschema): update schema validator go.mod+sum by @kke in #389
- feat: add Client.CheckSudo for eager privilege validation by @kke in #388
- feat(os): pass through unrecognised arch values; add riscv64 by @kke in #387
- feat(remotefs): add NativePath and ShellQuote to OS interface by @kke in #386
- fix(misc): k0sctl migration findings by @kke in #385
- build(deps): Bump actions/checkout from 5 to 7 by @dependabot[bot] in #393
- Add an integration test that uses || with sudo by @kke in #396
- Add v0.x migration guide and update README.md for rig v2 by @kke in #397
Full Changelog: v0.21.11...v2.0.0