Compare commits
6 Commits
1143d2850b
...
v0.9.1
Author | SHA1 | Date | |
---|---|---|---|
80a45cd595 | |||
551c8ad441 | |||
3823b1bf44 | |||
f777c78aad | |||
bb693dbb97 | |||
7beda281e0 |
@ -1,3 +0,0 @@
|
|||||||
kind: Added
|
|
||||||
body: '`list` command with subcommands `cmds` and `lists`'
|
|
||||||
time: 2025-02-20T14:45:49.562361581-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Added
|
|
||||||
body: Deprecation and unsupported warnings for old config keys
|
|
||||||
time: 2025-02-20T14:50:14.048452348-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Added
|
|
||||||
body: CLI flag `--cmdStdOut` to output command's stdout/stderr to stdout
|
|
||||||
time: 2025-02-20T14:52:45.030582408-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Added
|
|
||||||
body: Command type `remoteScript`. See docs for more info.
|
|
||||||
time: 2025-02-21T00:30:12.276616792-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Changed
|
|
||||||
body: change to enums for Command type
|
|
||||||
time: 2025-02-23T15:30:12.033359922-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Changed
|
|
||||||
body: Cache now stores resources by URL hash for ease-of-lookup
|
|
||||||
time: 2025-02-23T15:33:05.33444642-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Changed
|
|
||||||
body: Changed PackageOperation to enums
|
|
||||||
time: 2025-02-28T17:38:25.426136588-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Fixed
|
|
||||||
body: Local command's `dir` full path is now found with home directory
|
|
||||||
time: 2025-02-20T14:48:43.475300515-06:00
|
|
12
.changes/v0.9.0.md
Normal file
12
.changes/v0.9.0.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
## v0.9.0 - 2025-02-28
|
||||||
|
### Added
|
||||||
|
* `list` command with subcommands `cmds` and `lists`
|
||||||
|
* Deprecation and unsupported warnings for old config keys
|
||||||
|
* CLI flag `--cmdStdOut` to output command's stdout/stderr to stdout
|
||||||
|
* Command type `remoteScript`. See docs for more info.
|
||||||
|
### Changed
|
||||||
|
* change to enums for Command type
|
||||||
|
* Cache now stores resources by URL hash for ease-of-lookup
|
||||||
|
* Changed PackageOperation to enums
|
||||||
|
### Fixed
|
||||||
|
* Local command's `dir` full path is now found with home directory
|
3
.changes/v0.9.1.md
Normal file
3
.changes/v0.9.1.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## v0.9.1 - 2025-03-01
|
||||||
|
### Changed
|
||||||
|
* Use EnvVar AWS_PROFILE to get S3 profile
|
17
CHANGELOG.md
17
CHANGELOG.md
@ -6,6 +6,23 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
|||||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.9.1 - 2025-03-01
|
||||||
|
### Changed
|
||||||
|
* Use EnvVar AWS_PROFILE to get S3 profile
|
||||||
|
|
||||||
|
## v0.9.0 - 2025-02-28
|
||||||
|
### Added
|
||||||
|
* `list` command with subcommands `cmds` and `lists`
|
||||||
|
* Deprecation and unsupported warnings for old config keys
|
||||||
|
* CLI flag `--cmdStdOut` to output command's stdout/stderr to stdout
|
||||||
|
* Command type `remoteScript`. See docs for more info.
|
||||||
|
### Changed
|
||||||
|
* change to enums for Command type
|
||||||
|
* Cache now stores resources by URL hash for ease-of-lookup
|
||||||
|
* Changed PackageOperation to enums
|
||||||
|
### Fixed
|
||||||
|
* Local command's `dir` full path is now found with home directory
|
||||||
|
|
||||||
## v0.8.0 - 2025-02-15
|
## v0.8.0 - 2025-02-15
|
||||||
### Changed
|
### Changed
|
||||||
* Breaking: `cmd-lists` key changed to `cmdLists`
|
* Breaking: `cmd-lists` key changed to `cmdLists`
|
||||||
|
@ -8,8 +8,10 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"Autorestic",
|
"Autorestic",
|
||||||
|
"changie",
|
||||||
"Cmds",
|
"Cmds",
|
||||||
"CMDSTDOUT",
|
"CMDSTDOUT",
|
||||||
|
"goreleaser",
|
||||||
"knadh",
|
"knadh",
|
||||||
"koanf",
|
"koanf",
|
||||||
"mattn",
|
"mattn",
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
const versionStr = "0.8.0"
|
const versionStr = "0.9.1"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
versionCmd = &cobra.Command{
|
versionCmd = &cobra.Command{
|
||||||
|
@ -12,6 +12,10 @@ For the main config file to be fetched remotely, pass the URL using `-f [url]`.
|
|||||||
|
|
||||||
If using S3, you should use the s3 protocol URI: `s3://bucketName/key/path`. You will also need to set the env variable `S3_ENDPOINT` to the appropriate value. The flag `--s3-endpoint` can be used to override this value or to set this value, if not already set.
|
If using S3, you should use the s3 protocol URI: `s3://bucketName/key/path`. You will also need to set the env variable `S3_ENDPOINT` to the appropriate value. The flag `--s3-endpoint` can be used to override this value or to set this value, if not already set.
|
||||||
|
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
Currently, only the AWS authentication credentials file `~/.aws/credentials` is supported. For now, the environment variable `AWS_PROFILE` is used to lookup the profile.
|
||||||
|
|
||||||
## Scripts
|
## Scripts
|
||||||
|
|
||||||
Remote script support is currently limited to http/https endpoints.
|
Remote script support is currently limited to http/https endpoints.
|
@ -68,7 +68,7 @@ func (command *Command) RunCmd(cmdCtxLogger zerolog.Logger, opts *ConfigOpts) ([
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Handle package operations
|
// Handle package operations
|
||||||
if command.Type == PackageCT && command.PackageOperation == PackOppCheckVersion {
|
if command.Type == PackageCT && command.PackageOperation == PackOpCheckVersion {
|
||||||
cmdCtxLogger.Info().Str("package", command.PackageName).Msg("Checking package versions")
|
cmdCtxLogger.Info().Str("package", command.PackageName).Msg("Checking package versions")
|
||||||
|
|
||||||
// Execute the package version command
|
// Execute the package version command
|
||||||
|
@ -26,31 +26,31 @@ func (i PackageOperation) String() string {
|
|||||||
func _PackageOperationNoOp() {
|
func _PackageOperationNoOp() {
|
||||||
var x [1]struct{}
|
var x [1]struct{}
|
||||||
_ = x[DefaultPO-(0)]
|
_ = x[DefaultPO-(0)]
|
||||||
_ = x[PackOppInstall-(1)]
|
_ = x[PackOpInstall-(1)]
|
||||||
_ = x[PackOppUpgrade-(2)]
|
_ = x[PackOpUpgrade-(2)]
|
||||||
_ = x[PackOppPurge-(3)]
|
_ = x[PackOpPurge-(3)]
|
||||||
_ = x[PackOppRemove-(4)]
|
_ = x[PackOpRemove-(4)]
|
||||||
_ = x[PackOppCheckVersion-(5)]
|
_ = x[PackOpCheckVersion-(5)]
|
||||||
_ = x[PackOppIsInstalled-(6)]
|
_ = x[PackOpIsInstalled-(6)]
|
||||||
}
|
}
|
||||||
|
|
||||||
var _PackageOperationValues = []PackageOperation{DefaultPO, PackOppInstall, PackOppUpgrade, PackOppPurge, PackOppRemove, PackOppCheckVersion, PackOppIsInstalled}
|
var _PackageOperationValues = []PackageOperation{DefaultPO, PackOpInstall, PackOpUpgrade, PackOpPurge, PackOpRemove, PackOpCheckVersion, PackOpIsInstalled}
|
||||||
|
|
||||||
var _PackageOperationNameToValueMap = map[string]PackageOperation{
|
var _PackageOperationNameToValueMap = map[string]PackageOperation{
|
||||||
_PackageOperationName[0:0]: DefaultPO,
|
_PackageOperationName[0:0]: DefaultPO,
|
||||||
_PackageOperationLowerName[0:0]: DefaultPO,
|
_PackageOperationLowerName[0:0]: DefaultPO,
|
||||||
_PackageOperationName[0:7]: PackOppInstall,
|
_PackageOperationName[0:7]: PackOpInstall,
|
||||||
_PackageOperationLowerName[0:7]: PackOppInstall,
|
_PackageOperationLowerName[0:7]: PackOpInstall,
|
||||||
_PackageOperationName[7:14]: PackOppUpgrade,
|
_PackageOperationName[7:14]: PackOpUpgrade,
|
||||||
_PackageOperationLowerName[7:14]: PackOppUpgrade,
|
_PackageOperationLowerName[7:14]: PackOpUpgrade,
|
||||||
_PackageOperationName[14:19]: PackOppPurge,
|
_PackageOperationName[14:19]: PackOpPurge,
|
||||||
_PackageOperationLowerName[14:19]: PackOppPurge,
|
_PackageOperationLowerName[14:19]: PackOpPurge,
|
||||||
_PackageOperationName[19:25]: PackOppRemove,
|
_PackageOperationName[19:25]: PackOpRemove,
|
||||||
_PackageOperationLowerName[19:25]: PackOppRemove,
|
_PackageOperationLowerName[19:25]: PackOpRemove,
|
||||||
_PackageOperationName[25:37]: PackOppCheckVersion,
|
_PackageOperationName[25:37]: PackOpCheckVersion,
|
||||||
_PackageOperationLowerName[25:37]: PackOppCheckVersion,
|
_PackageOperationLowerName[25:37]: PackOpCheckVersion,
|
||||||
_PackageOperationName[37:48]: PackOppIsInstalled,
|
_PackageOperationName[37:48]: PackOpIsInstalled,
|
||||||
_PackageOperationLowerName[37:48]: PackOppIsInstalled,
|
_PackageOperationLowerName[37:48]: PackOpIsInstalled,
|
||||||
}
|
}
|
||||||
|
|
||||||
var _PackageOperationNames = []string{
|
var _PackageOperationNames = []string{
|
||||||
|
@ -538,7 +538,7 @@ func (command *Command) RunCmdSSH(cmdCtxLogger zerolog.Logger, opts *ConfigOpts)
|
|||||||
case ScriptFileCT:
|
case ScriptFileCT:
|
||||||
return command.runScriptFile(commandSession, cmdCtxLogger, &cmdOutBuf)
|
return command.runScriptFile(commandSession, cmdCtxLogger, &cmdOutBuf)
|
||||||
case PackageCT:
|
case PackageCT:
|
||||||
if command.PackageOperation == PackOppCheckVersion {
|
if command.PackageOperation == PackOpCheckVersion {
|
||||||
commandSession.Stderr = nil
|
commandSession.Stderr = nil
|
||||||
// Execute the package version command remotely
|
// Execute the package version command remotely
|
||||||
// Parse the output of package version command
|
// Parse the output of package version command
|
||||||
|
@ -312,10 +312,10 @@ const (
|
|||||||
//go:generate go run github.com/dmarkham/enumer -linecomment -yaml -text -json -type=PackageOperation
|
//go:generate go run github.com/dmarkham/enumer -linecomment -yaml -text -json -type=PackageOperation
|
||||||
const (
|
const (
|
||||||
DefaultPO PackageOperation = iota //
|
DefaultPO PackageOperation = iota //
|
||||||
PackOppInstall // install
|
PackOpInstall // install
|
||||||
PackOppUpgrade // upgrade
|
PackOpUpgrade // upgrade
|
||||||
PackOppPurge // purge
|
PackOpPurge // purge
|
||||||
PackOppRemove // remove
|
PackOpRemove // remove
|
||||||
PackOppCheckVersion // checkVersion
|
PackOpCheckVersion // checkVersion
|
||||||
PackOppIsInstalled // isInstalled
|
PackOpIsInstalled // isInstalled
|
||||||
)
|
)
|
||||||
|
@ -277,13 +277,13 @@ func getCommandTypeAndSetCommandInfo(command *Command) *Command {
|
|||||||
if command.Type == PackageCT && !command.packageCmdSet {
|
if command.Type == PackageCT && !command.packageCmdSet {
|
||||||
command.packageCmdSet = true
|
command.packageCmdSet = true
|
||||||
switch command.PackageOperation {
|
switch command.PackageOperation {
|
||||||
case PackOppInstall:
|
case PackOpInstall:
|
||||||
command.Cmd, command.Args = command.pkgMan.Install(command.PackageName, command.PackageVersion, command.Args)
|
command.Cmd, command.Args = command.pkgMan.Install(command.PackageName, command.PackageVersion, command.Args)
|
||||||
case PackOppRemove:
|
case PackOpRemove:
|
||||||
command.Cmd, command.Args = command.pkgMan.Remove(command.PackageName, command.Args)
|
command.Cmd, command.Args = command.pkgMan.Remove(command.PackageName, command.Args)
|
||||||
case PackOppUpgrade:
|
case PackOpUpgrade:
|
||||||
command.Cmd, command.Args = command.pkgMan.Upgrade(command.PackageName, command.PackageVersion)
|
command.Cmd, command.Args = command.pkgMan.Upgrade(command.PackageName, command.PackageVersion)
|
||||||
case PackOppCheckVersion:
|
case PackOpCheckVersion:
|
||||||
command.Cmd, command.Args = command.pkgMan.CheckVersion(command.PackageName, command.PackageVersion)
|
command.Cmd, command.Args = command.pkgMan.CheckVersion(command.PackageName, command.PackageVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,8 @@ func NewS3Fetcher(endpoint string, options ...FetcherOption) (*S3Fetcher, error)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
s3Endpoint := os.Getenv("S3_ENDPOINT")
|
s3Endpoint := os.Getenv("S3_ENDPOINT")
|
||||||
creds, err := getS3Credentials("default", s3Endpoint, cfg.HTTPClient)
|
creds, err := getS3Credentials(os.Getenv("AWS_PROFILE"), s3Endpoint, cfg.HTTPClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
println(err.Error())
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +132,7 @@ func getS3Credentials(profile, host string, httpClient *http.Client) (*credentia
|
|||||||
if hdirErr != nil {
|
if hdirErr != nil {
|
||||||
return nil, hdirErr
|
return nil, hdirErr
|
||||||
}
|
}
|
||||||
s3Creds := credentials.NewFileAWSCredentials(path.Join(homeDir, ".aws", "credentials"), "default")
|
s3Creds := credentials.NewFileAWSCredentials(path.Join(homeDir, ".aws", "credentials"), profile)
|
||||||
credVals, credErr := s3Creds.GetWithContext(&credentials.CredContext{Endpoint: host, Client: httpClient})
|
credVals, credErr := s3Creds.GetWithContext(&credentials.CredContext{Endpoint: host, Client: httpClient})
|
||||||
if credErr != nil {
|
if credErr != nil {
|
||||||
return nil, credErr
|
return nil, credErr
|
||||||
|
2
release
2
release
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
go generate ./...
|
go generate ./...
|
||||||
export CURRENT_TAG="$(go run backy.go version -V)"
|
CURRENT_TAG="$(go run backy.go version -V)"
|
||||||
goreleaser -f .goreleaser/github.yml check
|
goreleaser -f .goreleaser/github.yml check
|
||||||
goreleaser -f .goreleaser/gitea.yml check
|
goreleaser -f .goreleaser/gitea.yml check
|
||||||
changie batch $CURRENT_TAG
|
changie batch $CURRENT_TAG
|
||||||
|
Reference in New Issue
Block a user