Compare commits
15 Commits
remoteReso
...
7c5f4a95da
Author | SHA1 | Date | |
---|---|---|---|
7c5f4a95da | |||
4981acbf9d | |||
932d5c380f | |||
f84d76badf | |||
6ee6e10621 | |||
127d38c076 | |||
0218dee76d | |||
67a1eab908 | |||
c618ca33f8 | |||
6e7d912fa2 | |||
b90d1958b2 | |||
c187fbb735 | |||
c3de4386ab | |||
e20141043c | |||
5d3c265ce9 |
@ -1,3 +0,0 @@
|
|||||||
kind: Added
|
|
||||||
body: '[feat]: package `packageOperation` option `checkVersion` implemented'
|
|
||||||
time: 2025-01-11T21:15:46.207199643-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Added
|
|
||||||
body: user management added - see docs
|
|
||||||
time: 2025-01-11T21:18:13.182822019-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Added
|
|
||||||
body: Support for remote config sources. Only config file and list can be used for now.
|
|
||||||
time: 2025-01-13T23:12:48.383700682-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Added
|
|
||||||
body: Cache functionality - still a WIP
|
|
||||||
time: 2025-01-28T15:35:24.512485671-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Added
|
|
||||||
body: Flag `--s3-endpoint` for config file fetching from S3
|
|
||||||
time: 2025-02-07T21:24:29.596055611-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Changed
|
|
||||||
body: Internal refactoring of config setup
|
|
||||||
time: 2025-01-13T23:10:07.215735108-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Changed
|
|
||||||
body: Formatting and sending for notifications
|
|
||||||
time: 2025-01-13T23:16:22.260458782-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Changed
|
|
||||||
body: "name of `configfetcher` to `remotefetcher`"
|
|
||||||
time: 2025-01-28T15:42:04.282668058-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Changed
|
|
||||||
body: Flags that took comma-separated lists now have to be passed multiple times for each argument.
|
|
||||||
time: 2025-02-08T15:15:08.457086102-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Fixed
|
|
||||||
body: Parsing of remote URLs when determining list config file path
|
|
||||||
time: 2025-01-28T15:38:06.957506929-06:00
|
|
@ -1,3 +0,0 @@
|
|||||||
kind: Fixed
|
|
||||||
body: Incorrect error notification template value
|
|
||||||
time: 2025-02-02T19:45:23.872797604-06:00
|
|
16
.changes/v0.7.0.md
Normal file
16
.changes/v0.7.0.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
## v0.7.0 - 2025-02-11
|
||||||
|
### Added
|
||||||
|
* [feat]: package `packageOperation` option `checkVersion` implemented
|
||||||
|
* user management added - see docs
|
||||||
|
* Support for remote config sources. Only config file and list can be used for now.
|
||||||
|
* Cache functionality - still a WIP
|
||||||
|
* Flag `--s3-endpoint` for config file fetching from S3
|
||||||
|
### Changed
|
||||||
|
* Internal refactoring of config setup
|
||||||
|
* Formatting and sending for notifications
|
||||||
|
* name of `configfetcher` to `remotefetcher`
|
||||||
|
* Flags that took comma-separated lists now have to be passed multiple times for each argument.
|
||||||
|
* Hosts passed to `exec host` now checked against default SSH config files
|
||||||
|
### Fixed
|
||||||
|
* Parsing of remote URLs when determining list config file path
|
||||||
|
* Incorrect error notification template value
|
3
.changes/v0.7.1.md
Normal file
3
.changes/v0.7.1.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## v0.7.1 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* Incorrect local config file loading logic caused files to not be detected
|
3
.changes/v0.7.2.md
Normal file
3
.changes/v0.7.2.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## v0.7.2 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* CI configs
|
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
@ -21,20 +21,19 @@ jobs:
|
|||||||
- run: git fetch --force --tags
|
- run: git fetch --force --tags
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '1.20'
|
go-version: '1.23'
|
||||||
cache: true
|
cache: true
|
||||||
# More assembly might be required: Docker logins, GPG, etc. It all depends
|
# More assembly might be required: Docker logins, GPG, etc. It all depends
|
||||||
# on your needs.
|
# on your needs.
|
||||||
- name: Get tag
|
- uses: olegtarasov/get-tag@v2.1.4
|
||||||
id: tag
|
id: tagName
|
||||||
uses: dawidd6/action-get-tag@v1
|
|
||||||
with:
|
with:
|
||||||
# Optionally strip `v` prefix
|
# tagRegex: "foobar-(.*)" # Optional. Returns specified group text as tag name. Full tag string is returned if regex is not defined.
|
||||||
strip_v: false
|
tagRegexGroup: 1 # Optional. Default is 1.
|
||||||
- uses: goreleaser/goreleaser-action@v4
|
- uses: goreleaser/goreleaser-action@v4
|
||||||
with:
|
with:
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: latest
|
version: latest
|
||||||
args: release --release-notes=".changes/${{steps.tag.outputs.tag}}.md" -f .goreleaser/github.yml --clean
|
args: release --release-notes=".changes/${GIT_TAG_NAME}.md" -f .goreleaser/github.yml --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
|
||||||
|
@ -16,7 +16,7 @@ builds:
|
|||||||
- arm64
|
- arm64
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- format: tar.gz
|
- formats: tar.gz
|
||||||
# this name template makes the OS and Arch compatible with the results of uname.
|
# this name template makes the OS and Arch compatible with the results of uname.
|
||||||
name_template: >-
|
name_template: >-
|
||||||
{{ .ProjectName }}_{{ .Version }}_
|
{{ .ProjectName }}_{{ .Version }}_
|
||||||
@ -28,7 +28,7 @@ archives:
|
|||||||
# use zip for windows archives
|
# use zip for windows archives
|
||||||
format_overrides:
|
format_overrides:
|
||||||
- goos: windows
|
- goos: windows
|
||||||
format: zip
|
formats: zip
|
||||||
checksum:
|
checksum:
|
||||||
name_template: 'checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
snapshot:
|
snapshot:
|
||||||
|
@ -17,7 +17,7 @@ builds:
|
|||||||
- arm64
|
- arm64
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- format: tar.gz
|
- formats: tar.gz
|
||||||
# this name template makes the OS and Arch compatible with the results of uname.
|
# this name template makes the OS and Arch compatible with the results of uname.
|
||||||
name_template: >-
|
name_template: >-
|
||||||
{{ .ProjectName }}_{{ .Version }}_
|
{{ .ProjectName }}_{{ .Version }}_
|
||||||
@ -29,7 +29,7 @@ archives:
|
|||||||
# use zip for windows archives
|
# use zip for windows archives
|
||||||
format_overrides:
|
format_overrides:
|
||||||
- goos: windows
|
- goos: windows
|
||||||
format: zip
|
formats: zip
|
||||||
checksum:
|
checksum:
|
||||||
name_template: 'checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
snapshot:
|
snapshot:
|
||||||
|
26
CHANGELOG.md
26
CHANGELOG.md
@ -6,10 +6,34 @@ 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.7.2 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* CI configs
|
||||||
|
|
||||||
|
## v0.7.1 - 2025-02-14
|
||||||
|
### Fixed
|
||||||
|
* Incorrect local config file loading logic caused files to not be detected
|
||||||
|
|
||||||
|
## v0.7.0 - 2025-02-11
|
||||||
|
### Added
|
||||||
|
* [feat]: package `packageOperation` option `checkVersion` implemented
|
||||||
|
* user management added - see docs
|
||||||
|
* Support for remote config sources. Only config file and list can be used for now.
|
||||||
|
* Cache functionality - still a WIP
|
||||||
|
* Flag `--s3-endpoint` for config file fetching from S3
|
||||||
|
### Changed
|
||||||
|
* Internal refactoring of config setup
|
||||||
|
* Formatting and sending for notifications
|
||||||
|
* name of `configfetcher` to `remotefetcher`
|
||||||
|
* Flags that took comma-separated lists now have to be passed multiple times for each argument.
|
||||||
|
* Hosts passed to `exec host` now checked against default SSH config files
|
||||||
|
### Fixed
|
||||||
|
* Parsing of remote URLs when determining list config file path
|
||||||
|
* Incorrect error notification template value
|
||||||
|
|
||||||
## v0.6.1 - 2025-01-04
|
## v0.6.1 - 2025-01-04
|
||||||
### Fixed
|
### Fixed
|
||||||
* When running a list, hooks now run explicitly after the command executes. Fixed panic due to improper logic.
|
* When running a list, hooks now run explicitly after the command executes. Fixed panic due to improper logic.
|
||||||
|
|
||||||
## v0.6.0 - 2025-01-04
|
## v0.6.0 - 2025-01-04
|
||||||
### Added
|
### Added
|
||||||
* Command Type Package - allows one to perform package operations [docs](https://backy.cybershell.xyz/config/packages/)
|
* Command Type Package - allows one to perform package operations [docs](https://backy.cybershell.xyz/config/packages/)
|
||||||
|
21
cmd/host.go
21
cmd/host.go
@ -15,14 +15,16 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// Holds command list to run
|
// Holds list of hosts to run commands on
|
||||||
var hostsList []string
|
var hostsList []string
|
||||||
|
|
||||||
|
// Holds command list to run
|
||||||
var cmdList []string
|
var cmdList []string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
||||||
hostExecCommand.Flags().StringArrayVarP(&hostsList, "hosts", "m", nil, "Accepts space-separated names of hosts.")
|
hostExecCommand.Flags().StringArrayVarP(&hostsList, "hosts", "m", nil, "Accepts space-separated names of hosts. Specify multiple times for multiple hosts.")
|
||||||
hostExecCommand.Flags().StringArrayVarP(&cmdList, "command", "c", nil, "Accepts space-separated names of commands.")
|
hostExecCommand.Flags().StringArrayVarP(&cmdList, "command", "c", nil, "Accepts space-separated names of commands. Specify multiple times for multiple commands.")
|
||||||
parseS3Config()
|
parseS3Config()
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -42,13 +44,18 @@ func Host(cmd *cobra.Command, args []string) {
|
|||||||
if hostsList == nil {
|
if hostsList == nil {
|
||||||
logging.ExitWithMSG("error: hosts must be specified", 1, &backyConfOpts.Logger)
|
logging.ExitWithMSG("error: hosts must be specified", 1, &backyConfOpts.Logger)
|
||||||
}
|
}
|
||||||
// host is only checked when we read the SSH File
|
|
||||||
// so a check may not be needed here
|
|
||||||
// but we can check if the host is in the config file
|
|
||||||
for _, h := range hostsList {
|
for _, h := range hostsList {
|
||||||
|
// check if h exists in the config file
|
||||||
_, hostFound := backyConfOpts.Hosts[h]
|
_, hostFound := backyConfOpts.Hosts[h]
|
||||||
if !hostFound {
|
if !hostFound {
|
||||||
logging.ExitWithMSG("host "+h+" not found", 1, &backyConfOpts.Logger)
|
// check if h exists in the SSH config file
|
||||||
|
hostFoundInConfig, s := backy.CheckIfHostHasHostName(h)
|
||||||
|
if !hostFoundInConfig {
|
||||||
|
logging.ExitWithMSG("host "+h+" not found", 1, &backyConfOpts.Logger)
|
||||||
|
}
|
||||||
|
// create host with hostname and host
|
||||||
|
backyConfOpts.Hosts[h] = &backy.Host{Host: h, HostName: s}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cmdList == nil {
|
if cmdList == nil {
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
const versionStr = "0.6.1"
|
const versionStr = "0.7.2"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
versionCmd = &cobra.Command{
|
versionCmd = &cobra.Command{
|
||||||
|
@ -14,7 +14,7 @@ Usage:
|
|||||||
backy [command]
|
backy [command]
|
||||||
|
|
||||||
Available Commands:
|
Available Commands:
|
||||||
backup Runs commands defined in config file.
|
backup Runs commands defined in config file. Use -l flag multiple times to run multiple lists.
|
||||||
completion Generate the autocompletion script for the specified shell
|
completion Generate the autocompletion script for the specified shell
|
||||||
cron Starts a scheduler that runs lists defined in config file.
|
cron Starts a scheduler that runs lists defined in config file.
|
||||||
exec Runs commands defined in config file in order given.
|
exec Runs commands defined in config file in order given.
|
||||||
@ -23,9 +23,11 @@ Available Commands:
|
|||||||
version Prints the version and exits
|
version Prints the version and exits
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
-h, --help help for backy
|
-h, --help help for backy
|
||||||
-v, --verbose Sets verbose level
|
--log-file string log file to write to
|
||||||
|
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
|
-v, --verbose Sets verbose level
|
||||||
|
|
||||||
Use "backy [command] --help" for more information about a command.
|
Use "backy [command] --help" for more information about a command.
|
||||||
```
|
```
|
||||||
@ -39,15 +41,17 @@ Backup executes commands defined in config file.
|
|||||||
Use the --lists or -l flag to execute the specified lists. If not flag is not given, all lists will be executed.
|
Use the --lists or -l flag to execute the specified lists. If not flag is not given, all lists will be executed.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
backy backup [--lists=list1,list2,... | -l list1, list2,...] [flags]
|
backy backup [--lists=list1 --lists list2 ... | -l list1 -l list2 ...] [flags]
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-h, --help help for backup
|
-h, --help help for backup
|
||||||
-l, --lists strings Accepts comma-separated names of command lists to execute.
|
-l, --lists stringArray Accepts comma-separated names of command lists to execute.
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
-v, --verbose Sets verbose level
|
--log-file string log file to write to
|
||||||
|
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
|
-v, --verbose Sets verbose level
|
||||||
```
|
```
|
||||||
|
|
||||||
## cron
|
## cron
|
||||||
@ -62,8 +66,10 @@ Flags:
|
|||||||
-h, --help help for cron
|
-h, --help help for cron
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
-v, --verbose Sets verbose level
|
--log-file string log file to write to
|
||||||
|
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
|
-v, --verbose Sets verbose level
|
||||||
```
|
```
|
||||||
|
|
||||||
## exec
|
## exec
|
||||||
@ -82,8 +88,10 @@ Flags:
|
|||||||
-h, --help help for exec
|
-h, --help help for exec
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
-v, --verbose Sets verbose level
|
--log-file string log file to write to
|
||||||
|
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
|
-v, --verbose Sets verbose level
|
||||||
|
|
||||||
Use "backy exec [command] --help" for more information about a command.
|
Use "backy exec [command] --help" for more information about a command.
|
||||||
```
|
```
|
||||||
@ -95,16 +103,18 @@ Host executes specified commands on the hosts defined in config file.
|
|||||||
Use the --commands or -c flag to choose the commands.
|
Use the --commands or -c flag to choose the commands.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
backy exec host [--commands=command1,command2, ... | -c command1,command2, ...] [--hosts=host1,hosts2, ... | -m host1,host2, ...] [flags]
|
backy exec host [--command=command1 --command=command2 ... | -c command1 -c command2 ...] [--hosts=host1 --hosts=hosts2 ... | -m host1 -m host2 ...] [flags]
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-c, --commands strings Accepts comma-separated names of commands.
|
-c, --command stringArray Accepts space-separated names of commands. Specify multiple times for multiple commands.
|
||||||
-h, --help help for host
|
-h, --help help for host
|
||||||
-m, --hosts strings Accepts comma-separated names of hosts.
|
-m, --hosts stringArray Accepts space-separated names of hosts. Specify multiple times for multiple hosts.
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
-v, --verbose Sets verbose level
|
--log-file string log file to write to
|
||||||
|
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
|
-v, --verbose Sets verbose level
|
||||||
```
|
```
|
||||||
|
|
||||||
## version
|
## version
|
||||||
@ -121,8 +131,10 @@ Flags:
|
|||||||
-V, --vpre Output the version with v prefixed.
|
-V, --vpre Output the version with v prefixed.
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
-v, --verbose Sets verbose level
|
--log-file string log file to write to
|
||||||
|
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
|
-v, --verbose Sets verbose level
|
||||||
```
|
```
|
||||||
|
|
||||||
## list
|
## list
|
||||||
@ -140,6 +152,8 @@ Flags:
|
|||||||
-l, --lists strings Accepts comma-separated names of command lists to list.
|
-l, --lists strings Accepts comma-separated names of command lists to list.
|
||||||
|
|
||||||
Global Flags:
|
Global Flags:
|
||||||
-f, --config string config file to read from
|
-f, --config string config file to read from
|
||||||
-v, --verbose Sets verbose level
|
--log-file string log file to write to
|
||||||
|
--s3-endpoint string Sets the S3 endpoint used for config file fetching. Overrides S3_ENDPOINT env variable.
|
||||||
|
-v, --verbose Sets verbose level
|
||||||
```
|
```
|
||||||
|
@ -34,15 +34,17 @@ var Sprintf = fmt.Sprintf
|
|||||||
func (command *Command) RunCmd(cmdCtxLogger zerolog.Logger, opts *ConfigOpts) ([]string, error) {
|
func (command *Command) RunCmd(cmdCtxLogger zerolog.Logger, opts *ConfigOpts) ([]string, error) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
outputArr []string
|
ArgsStr string // concatenating the arguments
|
||||||
ArgsStr string
|
|
||||||
cmdOutBuf bytes.Buffer
|
cmdOutBuf bytes.Buffer
|
||||||
cmdOutWriters io.Writer
|
cmdOutWriters io.Writer
|
||||||
|
errSSH error
|
||||||
|
|
||||||
envVars = environmentVars{
|
envVars = environmentVars{
|
||||||
file: command.Env,
|
file: command.Env,
|
||||||
env: command.Environment,
|
env: command.Environment,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outputArr []string // holds the output strings returned by processes
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get the command type
|
// Get the command type
|
||||||
@ -53,13 +55,13 @@ func (command *Command) RunCmd(cmdCtxLogger zerolog.Logger, opts *ConfigOpts) ([
|
|||||||
ArgsStr += fmt.Sprintf(" %s", v)
|
ArgsStr += fmt.Sprintf(" %s", v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print the user's password if it is updated
|
||||||
if command.Type == "user" {
|
if command.Type == "user" {
|
||||||
if command.UserOperation == "password" {
|
if command.UserOperation == "password" {
|
||||||
cmdCtxLogger.Info().Str("password", command.UserPassword).Msg("user password to be updated")
|
cmdCtxLogger.Info().Str("password", command.UserPassword).Msg("user password to be updated")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var errSSH error
|
|
||||||
// is host defined
|
// is host defined
|
||||||
if command.Host != nil {
|
if command.Host != nil {
|
||||||
outputArr, errSSH = command.RunCmdSSH(cmdCtxLogger, opts)
|
outputArr, errSSH = command.RunCmdSSH(cmdCtxLogger, opts)
|
||||||
|
@ -85,7 +85,6 @@ func (opts *ConfigOpts) InitConfig() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logging.ExitWithMSG(fmt.Sprintf("error initializing config fetcher: %v", err), 1, nil)
|
logging.ExitWithMSG(fmt.Sprintf("error initializing config fetcher: %v", err), 1, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.ConfigFilePath != "" {
|
if opts.ConfigFilePath != "" {
|
||||||
loadConfigFile(fetcher, opts.ConfigFilePath, backyKoanf, opts)
|
loadConfigFile(fetcher, opts.ConfigFilePath, backyKoanf, opts)
|
||||||
} else {
|
} else {
|
||||||
@ -109,22 +108,22 @@ func loadConfigFile(fetcher remotefetcher.RemoteFetcher, filePath string, k *koa
|
|||||||
func loadDefaultConfigFiles(fetcher remotefetcher.RemoteFetcher, configFiles []string, k *koanf.Koanf, opts *ConfigOpts) {
|
func loadDefaultConfigFiles(fetcher remotefetcher.RemoteFetcher, configFiles []string, k *koanf.Koanf, opts *ConfigOpts) {
|
||||||
cFileFailures := 0
|
cFileFailures := 0
|
||||||
for _, c := range configFiles {
|
for _, c := range configFiles {
|
||||||
|
opts.ConfigFilePath = c
|
||||||
data, err := fetcher.Fetch(c)
|
data, err := fetcher.Fetch(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cFileFailures++
|
cFileFailures++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := k.Load(rawbytes.Provider(data), yaml.Parser()); err != nil {
|
if data != nil {
|
||||||
cFileFailures++
|
if err := k.Load(rawbytes.Provider(data), yaml.Parser()); err == nil {
|
||||||
continue
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if cFileFailures == len(configFiles) {
|
if cFileFailures == len(configFiles) {
|
||||||
logging.ExitWithMSG("Could not find any valid config file", 1, nil)
|
logging.ExitWithMSG("Could not find any valid local config file", 1, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,3 +757,12 @@ func (h *Host) DetectOS(opts *ConfigOpts) (string, error) {
|
|||||||
osName := string(output)
|
osName := string(output)
|
||||||
return osName, nil
|
return osName, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CheckIfHostHasHostName(host string) (bool, string) {
|
||||||
|
HostName, err := ssh_config.DefaultUserSettings.GetStrict(host, "HostName")
|
||||||
|
if err != nil {
|
||||||
|
return false, ""
|
||||||
|
}
|
||||||
|
println(HostName)
|
||||||
|
return HostName != "", HostName
|
||||||
|
}
|
||||||
|
11
release
11
release
@ -1,6 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# export GORELEASER_CURRENT_TAG="$(go run backy.go version -V)"
|
set -eou pipefail
|
||||||
git tag "$(go run backy.go version -V)"
|
export CURRENT_TAG="$(go run backy.go version -V)"
|
||||||
|
goreleaser -f .goreleaser/github.yml check
|
||||||
|
goreleaser -f .goreleaser/gitea.yml check
|
||||||
|
changie batch $CURRENT_TAG
|
||||||
|
changie merge
|
||||||
|
git add .changes/
|
||||||
|
git commit -am "$CURRENT_TAG"
|
||||||
|
git tag "$CURRENT_TAG"
|
||||||
git push all
|
git push all
|
||||||
git push all --tags
|
git push all --tags
|
||||||
# goreleaser release -f .goreleaser/gitea.yml --clean --release-notes=".changes/$(go run backy.go version -V).md"
|
# goreleaser release -f .goreleaser/gitea.yml --clean --release-notes=".changes/$(go run backy.go version -V).md"
|
Reference in New Issue
Block a user