forked from toolshed/abra
Compare commits
54 Commits
0.4.1-alph
...
0.5.1-beta
Author | SHA1 | Date | |
---|---|---|---|
e41caa891d
|
|||
42a6818ff4
|
|||
8f709c05bf
|
|||
a4ebf7befc
|
|||
8458e61d17
|
|||
b42d5bf113
|
|||
f684c6d6e4
|
|||
6593baf9f4 | |||
50123f3810
|
|||
d132e87f14
|
|||
37a1c3fb85 | |||
c8183aa6d1 | |||
4711de29ae
|
|||
b719aaba41
|
|||
074c51b672 | |||
1aa6be704a | |||
e8e3cb8598
|
|||
85fec6b107
|
|||
12dbb061a9 | |||
351bd7d4ba | |||
cdc7037c25
|
|||
682237c98e | |||
08d97be43a
|
|||
786dfde27e
|
|||
6e012b910e | |||
c153c5da2e | |||
0540e42168
|
|||
4bc95a5b52
|
|||
febc6e2874
|
|||
b2c990bf12
|
|||
3b8893502a
|
|||
e0a0378f73 | |||
0837045d44 | |||
cd8137a7d8
|
|||
ece4537a2d
|
|||
16fe1b68c6
|
|||
e37f235fd4 | |||
0423ce7e84
|
|||
d46ac22bd7
|
|||
cef5cd8611
|
|||
8b38dac9ab | |||
89fc875088 | |||
026a9ba2d7
|
|||
99f2b9c6dc | |||
578e91eeec
|
|||
49f79dbd45
|
|||
574d556bb9
|
|||
801aad64df
|
|||
b0a0829712
|
|||
6aae06c3ec | |||
d0c6fa5b45 | |||
c947354ee3 | |||
9b7e5752fb
|
|||
9bc51629d4 |
@ -3,17 +3,17 @@ kind: pipeline
|
||||
name: coopcloud.tech/abra
|
||||
steps:
|
||||
- name: make check
|
||||
image: golang:1.18
|
||||
image: golang:1.19
|
||||
commands:
|
||||
- make check
|
||||
|
||||
- name: make build
|
||||
image: golang:1.18
|
||||
image: golang:1.19
|
||||
commands:
|
||||
- make build
|
||||
|
||||
- name: make test
|
||||
image: golang:1.18
|
||||
image: golang:1.19
|
||||
commands:
|
||||
- make test
|
||||
|
||||
@ -45,7 +45,7 @@ steps:
|
||||
event: tag
|
||||
|
||||
- name: release
|
||||
image: golang:1.18
|
||||
image: golang:1.19
|
||||
environment:
|
||||
GITEA_TOKEN:
|
||||
from_secret: goreleaser_gitea_token
|
||||
|
@ -39,8 +39,10 @@ changelog:
|
||||
sort: desc
|
||||
filters:
|
||||
exclude:
|
||||
- "^Merge"
|
||||
- "^Revert"
|
||||
- "^WIP:"
|
||||
- "^style:"
|
||||
- "^test:"
|
||||
- "^tests:"
|
||||
- "^Revert"
|
||||
- "^chore:"
|
||||
|
@ -1,10 +1,11 @@
|
||||
# authors
|
||||
|
||||
> If you're looking at this and you hack on Abra and you're not listed here,
|
||||
> please do add yourself! This is a community project, let's show
|
||||
> If you're looking at this and you hack on `abra` and you're not listed here,
|
||||
> please do add yourself! This is a community project, let's show some :heart:
|
||||
|
||||
- 3wordchant
|
||||
- decentral1se
|
||||
- frando
|
||||
- kawaiipunk
|
||||
- knoflook
|
||||
- roxxers
|
||||
|
@ -9,7 +9,7 @@ var AppCommand = cli.Command{
|
||||
Aliases: []string{"a"},
|
||||
Usage: "Manage apps",
|
||||
ArgsUsage: "<domain>",
|
||||
Description: "This command provides functionality for managing the life cycle of your apps",
|
||||
Description: "Functionality for managing the life cycle of your apps",
|
||||
Subcommands: []cli.Command{
|
||||
appNewCommand,
|
||||
appConfigCommand,
|
||||
|
@ -45,7 +45,7 @@ var appBackupCommand = cli.Command{
|
||||
Before: internal.SubCommandBefore,
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Description: `
|
||||
This command runs an app backup.
|
||||
Run an app backup.
|
||||
|
||||
A backup command and pre/post hook commands are defined in the recipe
|
||||
configuration. Abra reads this configuration and run the comands in the context
|
||||
|
@ -25,27 +25,12 @@ import (
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var localCmd bool
|
||||
var localCmdFlag = &cli.BoolFlag{
|
||||
Name: "local, l",
|
||||
Usage: "Run command locally",
|
||||
Destination: &localCmd,
|
||||
}
|
||||
|
||||
var remoteUser string
|
||||
var remoteUserFlag = &cli.StringFlag{
|
||||
Name: "user, u",
|
||||
Value: "",
|
||||
Usage: "User to run command within a service context",
|
||||
Destination: &remoteUser,
|
||||
}
|
||||
|
||||
var appCmdCommand = cli.Command{
|
||||
Name: "command",
|
||||
Aliases: []string{"cmd"},
|
||||
Usage: "Run app commands",
|
||||
Description: `
|
||||
This command runs app specific commands.
|
||||
Run an app specific command.
|
||||
|
||||
These commands are bash functions, defined in the abra.sh of the recipe itself.
|
||||
They can be run within the context of a service (e.g. app) or locally on your
|
||||
@ -56,21 +41,23 @@ Example:
|
||||
|
||||
abra app cmd example.com app create_user -- me@example.com
|
||||
`,
|
||||
ArgsUsage: "<domain> [<service>] <command>",
|
||||
ArgsUsage: "<domain> [<service>] <command> [-- <args>]",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
localCmdFlag,
|
||||
remoteUserFlag,
|
||||
internal.LocalCmdFlag,
|
||||
internal.RemoteUserFlag,
|
||||
},
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Before: internal.SubCommandBefore,
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
|
||||
if localCmd && remoteUser != "" {
|
||||
internal.ShowSubcommandHelpAndError(c, errors.New("cannot use --local & <user> together"))
|
||||
if internal.LocalCmd && internal.RemoteUser != "" {
|
||||
internal.ShowSubcommandHelpAndError(c, errors.New("cannot use --local & --user together"))
|
||||
}
|
||||
|
||||
hasCmdArgs, parsedCmdArgs := parseCmdArgs(c.Args(), internal.LocalCmd)
|
||||
|
||||
abraSh := path.Join(config.RECIPES_DIR, app.Recipe, "abra.sh")
|
||||
if _, err := os.Stat(abraSh); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
@ -79,21 +66,7 @@ Example:
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
var parsedCmdArgs string
|
||||
var cmdArgsIdx int
|
||||
var hasCmdArgs bool
|
||||
for idx, arg := range c.Args() {
|
||||
if arg == "--" {
|
||||
cmdArgsIdx = idx
|
||||
hasCmdArgs = true
|
||||
}
|
||||
|
||||
if hasCmdArgs && idx > cmdArgsIdx {
|
||||
parsedCmdArgs += fmt.Sprintf("%s ", c.Args().Get(idx))
|
||||
}
|
||||
}
|
||||
|
||||
if localCmd {
|
||||
if internal.LocalCmd {
|
||||
cmdName := c.Args().Get(1)
|
||||
if err := ensureCommand(abraSh, app.Recipe, cmdName); err != nil {
|
||||
logrus.Fatal(err)
|
||||
@ -104,10 +77,10 @@ Example:
|
||||
var sourceAndExec string
|
||||
if hasCmdArgs {
|
||||
logrus.Debugf("parsed following command arguments: %s", parsedCmdArgs)
|
||||
sourceAndExec = fmt.Sprintf("TARGET=local; APP_NAME=%s; . %s; %s %s", app.StackName(), abraSh, cmdName, parsedCmdArgs)
|
||||
sourceAndExec = fmt.Sprintf("TARGET=local; APP_NAME=%s; STACK_NAME=%s; . %s; %s %s", app.Name, app.StackName(), abraSh, cmdName, parsedCmdArgs)
|
||||
} else {
|
||||
logrus.Debug("did not detect any command arguments")
|
||||
sourceAndExec = fmt.Sprintf("TARGET=local; APP_NAME=%s; . %s; %s", app.StackName(), abraSh, cmdName)
|
||||
sourceAndExec = fmt.Sprintf("TARGET=local; APP_NAME=%s; STACK_NAME=%s; . %s; %s", app.Name, app.StackName(), abraSh, cmdName)
|
||||
}
|
||||
|
||||
cmd := exec.Command("/bin/sh", "-c", sourceAndExec)
|
||||
@ -156,6 +129,25 @@ Example:
|
||||
},
|
||||
}
|
||||
|
||||
func parseCmdArgs(args []string, isLocal bool) (bool, string) {
|
||||
var (
|
||||
parsedCmdArgs string
|
||||
hasCmdArgs bool
|
||||
)
|
||||
|
||||
if isLocal {
|
||||
if len(args) > 2 {
|
||||
return true, fmt.Sprintf("%s ", strings.Join(args[2:], " "))
|
||||
}
|
||||
} else {
|
||||
if len(args) > 3 {
|
||||
return true, fmt.Sprintf("%s ", strings.Join(args[3:], " "))
|
||||
}
|
||||
}
|
||||
|
||||
return hasCmdArgs, parsedCmdArgs
|
||||
}
|
||||
|
||||
func ensureCommand(abraSh, recipeName, execCmd string) error {
|
||||
bytes, err := ioutil.ReadFile(abraSh)
|
||||
if err != nil {
|
||||
@ -198,9 +190,9 @@ func runCmdRemote(app config.App, abraSh, serviceName, cmdName, cmdArgs string)
|
||||
|
||||
var cmd []string
|
||||
if cmdArgs != "" {
|
||||
cmd = []string{"/bin/sh", "-c", fmt.Sprintf("TARGET=%s; APP_NAME=%s; . /tmp/abra.sh; %s %s", serviceName, app.StackName(), cmdName, cmdArgs)}
|
||||
cmd = []string{"/bin/sh", "-c", fmt.Sprintf("TARGET=%s; APP_NAME=%s; STACK_NAME=%s; . /tmp/abra.sh; %s %s", serviceName, app.Name, app.StackName(), cmdName, cmdArgs)}
|
||||
} else {
|
||||
cmd = []string{"/bin/sh", "-c", fmt.Sprintf("TARGET=%s; APP_NAME=%s; . /tmp/abra.sh; %s", serviceName, app.StackName(), cmdName)}
|
||||
cmd = []string{"/bin/sh", "-c", fmt.Sprintf("TARGET=%s; APP_NAME=%s; STACK_NAME=%s; . /tmp/abra.sh; %s", serviceName, app.Name, app.StackName(), cmdName)}
|
||||
}
|
||||
|
||||
logrus.Debugf("running command: %s", strings.Join(cmd, " "))
|
||||
@ -214,9 +206,9 @@ func runCmdRemote(app config.App, abraSh, serviceName, cmdName, cmdArgs string)
|
||||
Tty: true,
|
||||
}
|
||||
|
||||
if remoteUser != "" {
|
||||
logrus.Debugf("running command with user %s", remoteUser)
|
||||
execCreateOpts.User = remoteUser
|
||||
if internal.RemoteUser != "" {
|
||||
logrus.Debugf("running command with user %s", internal.RemoteUser)
|
||||
execCreateOpts.User = internal.RemoteUser
|
||||
}
|
||||
|
||||
// FIXME: avoid instantiating a new CLI
|
||||
|
31
cli/app/cmd_test.go
Normal file
31
cli/app/cmd_test.go
Normal file
@ -0,0 +1,31 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseCmdArgs(t *testing.T) {
|
||||
tests := []struct {
|
||||
input []string
|
||||
shouldParse bool
|
||||
expectedOutput string
|
||||
}{
|
||||
// `--` is not parsed when passed in from the command-line e.g. -- foo bar baz
|
||||
// so we need to eumlate that as missing when testing if bash args are passed in
|
||||
// see https://git.coopcloud.tech/coop-cloud/organising/issues/336 for more
|
||||
{[]string{"foo.com", "app", "test"}, false, ""},
|
||||
{[]string{"foo.com", "app", "test", "foo"}, true, "foo "},
|
||||
{[]string{"foo.com", "app", "test", "foo", "bar", "baz"}, true, "foo bar baz "},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
ok, parsed := parseCmdArgs(test.input, false)
|
||||
if ok != test.shouldParse {
|
||||
t.Fatalf("[%s] should not parse", strings.Join(test.input, " "))
|
||||
}
|
||||
if parsed != test.expectedOutput {
|
||||
t.Fatalf("%s does not match %s", parsed, test.expectedOutput)
|
||||
}
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ var appCpCommand = cli.Command{
|
||||
Before: internal.SubCommandBefore,
|
||||
Usage: "Copy files to/from a running app service",
|
||||
Description: `
|
||||
This command supports copying files to and from any app service file system.
|
||||
Copy files to and from any app service file system.
|
||||
|
||||
If you want to copy a myfile.txt to the root of the app service:
|
||||
|
||||
|
@ -21,9 +21,8 @@ var appDeployCommand = cli.Command{
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
Description: `
|
||||
This command deploys an app. It does not support incrementing the version of a
|
||||
deployed app, for this you need to look at the "abra app upgrade <domain>"
|
||||
command.
|
||||
Deploy an app. It does not support incrementing the version of a deployed app,
|
||||
for this you need to look at the "abra app upgrade <domain>" command.
|
||||
|
||||
You may pass "--force" to re-deploy the same version again. This can be useful
|
||||
if the container runtime has gotten into a weird state.
|
||||
|
@ -25,7 +25,7 @@ var appErrorsCommand = cli.Command{
|
||||
Usage: "List errors for a deployed app",
|
||||
ArgsUsage: "<domain>",
|
||||
Description: `
|
||||
This command lists errors for a deployed app.
|
||||
List errors for a deployed app.
|
||||
|
||||
This is a best-effort implementation and an attempt to gather a number of tips
|
||||
& tricks for finding errors together into one convenient command. When an app
|
||||
|
@ -62,8 +62,8 @@ var appListCommand = cli.Command{
|
||||
Aliases: []string{"ls"},
|
||||
Usage: "List all managed apps",
|
||||
Description: `
|
||||
This command looks at your local file system listing of apps and servers (e.g.
|
||||
in ~/.abra/) to generate a report of all your apps.
|
||||
Read the local file system listing of apps and servers (e.g. ~/.abra/) to
|
||||
generate a report of all your apps.
|
||||
|
||||
By passing the "--status/-S" flag, you can query all your servers for the
|
||||
actual live deployment status. Depending on how many servers you manage, this
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
)
|
||||
|
||||
var appNewDescription = `
|
||||
This command takes a recipe and uses it to create a new app. This new app
|
||||
configuration is stored in your ~/.abra directory under the appropriate server.
|
||||
Take a recipe and uses it to create a new app. This new app configuration is
|
||||
stored in your ~/.abra directory under the appropriate server.
|
||||
|
||||
This command does not deploy your app for you. You will need to run "abra app
|
||||
deploy <domain>" to do so.
|
||||
|
@ -25,7 +25,7 @@ var appPsCommand = cli.Command{
|
||||
Aliases: []string{"p"},
|
||||
Usage: "Check app status",
|
||||
ArgsUsage: "<domain>",
|
||||
Description: "This command shows a more detailed status output of a specific deployed app.",
|
||||
Description: "Show a more detailed status output of a specific deployed app",
|
||||
Flags: []cli.Flag{
|
||||
internal.WatchFlag,
|
||||
internal.DebugFlag,
|
||||
|
@ -37,7 +37,7 @@ var appRestoreCommand = cli.Command{
|
||||
Before: internal.SubCommandBefore,
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Description: `
|
||||
This command runs an app restore.
|
||||
Run an app restore.
|
||||
|
||||
Pre/post hook commands are defined in the recipe configuration. Abra reads this
|
||||
configuration and run the comands in the context of the service before
|
||||
|
@ -32,8 +32,8 @@ var appUpgradeCommand = cli.Command{
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
Description: `
|
||||
This command supports upgrading an app. You can use it to choose and roll out a
|
||||
new upgrade to an existing app.
|
||||
Upgrade an app. You can use it to choose and roll out a new upgrade to an
|
||||
existing app.
|
||||
|
||||
This command specifically supports incrementing the version of running apps, as
|
||||
opposed to "abra app deploy <domain>" which will not change the version of a
|
||||
|
@ -41,9 +41,9 @@ var appVersionCommand = cli.Command{
|
||||
Before: internal.SubCommandBefore,
|
||||
Usage: "Show app versions",
|
||||
Description: `
|
||||
This command shows all information about versioning related to a deployed app.
|
||||
This includes the individual image names, tags and digests. But also the Co-op
|
||||
Cloud recipe version.
|
||||
Show all information about versioning related to a deployed app. This includes
|
||||
the individual image names, tags and digests. But also the Co-op Cloud recipe
|
||||
version.
|
||||
`,
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
|
@ -71,13 +71,14 @@ var catalogueGenerateCommand = cli.Command{
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
Description: `
|
||||
This command generates a new copy of the recipe catalogue which can be found on:
|
||||
Generate a new copy of the recipe catalogue which can be found on:
|
||||
|
||||
https://recipes.coopcloud.tech
|
||||
https://recipes.coopcloud.tech (website that humans read)
|
||||
https://recipes.coopcloud.tech/recipes.json (JSON that Abra reads)
|
||||
|
||||
It polls the entire git.coopcloud.tech/coop-cloud/... recipe repository
|
||||
listing, parses README.md and git tags of those repositories to produce recipe
|
||||
metadata and produces a recipes JSON file.
|
||||
listing, parses README.md and git tags to produce recipe metadata which is
|
||||
loaded into the catalogue JSON file.
|
||||
|
||||
It is possible to generate new metadata for a single recipe by passing
|
||||
<recipe>. The existing local catalogue will be updated, not overwritten.
|
||||
|
26
cli/cli.go
26
cli/cli.go
@ -27,19 +27,13 @@ var AutoCompleteCommand = cli.Command{
|
||||
Aliases: []string{"ac"},
|
||||
Usage: "Configure shell autocompletion (recommended)",
|
||||
Description: `
|
||||
This command helps set up autocompletion in your shell by downloading the
|
||||
relevant autocompletion files and laying out what additional information must
|
||||
be loaded.
|
||||
Set up auto-completion in your shell by downloading the relevant files and
|
||||
laying out what additional information must be loaded. Supported shells are as
|
||||
follows: bash, fizsh & zsh.
|
||||
|
||||
Example:
|
||||
|
||||
abra autocomplete bash
|
||||
|
||||
Supported shells are as follows:
|
||||
|
||||
fizsh
|
||||
zsh
|
||||
bash
|
||||
`,
|
||||
ArgsUsage: "<shell>",
|
||||
Flags: []cli.Flag{
|
||||
@ -86,7 +80,7 @@ Supported shells are as follows:
|
||||
switch shellType {
|
||||
case "bash":
|
||||
fmt.Println(fmt.Sprintf(`
|
||||
# Run the following commands to install autocompletion
|
||||
# Run the following commands to install auto-completion
|
||||
sudo mkdir /etc/bash_completion.d/
|
||||
sudo cp %s /etc/bash_completion.d/abra
|
||||
echo "source /etc/bash_completion.d/abra" >> ~/.bashrc
|
||||
@ -94,7 +88,7 @@ echo "source /etc/bash_completion.d/abra" >> ~/.bashrc
|
||||
`, autocompletionFile))
|
||||
case "zsh":
|
||||
fmt.Println(fmt.Sprintf(`
|
||||
# Run the following commands to install autocompletion
|
||||
# Run the following commands to install auto-completion
|
||||
sudo mkdir /etc/zsh/completion.d/
|
||||
sudo cp %s /etc/zsh/completion.d/abra
|
||||
echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra" >> ~/.zshrc
|
||||
@ -112,13 +106,11 @@ var UpgradeCommand = cli.Command{
|
||||
Aliases: []string{"u"},
|
||||
Usage: "Upgrade Abra itself",
|
||||
Description: `
|
||||
This command allows you to upgrade Abra in-place with the latest stable or
|
||||
release candidate.
|
||||
Upgrade Abra in-place with the latest stable or release candidate.
|
||||
|
||||
If you would like to install the latest release candidate, please pass the
|
||||
"-r/--rc" option. Please bear in mind that the latest release candidate may
|
||||
have some catastrophic bugs contained in it. In any case, thank you very much
|
||||
for the testing efforts!
|
||||
Pass "-r/--rc" to install the latest release candidate. Please bear in mind
|
||||
that it may contain catastrophic bugs. Thank you very much for the testing
|
||||
efforts!
|
||||
`,
|
||||
Flags: []cli.Flag{internal.RCFlag},
|
||||
Action: func(c *cli.Context) error {
|
||||
|
@ -353,6 +353,21 @@ var AllTagsFlag = &cli.BoolFlag{
|
||||
Destination: &AllTags,
|
||||
}
|
||||
|
||||
var LocalCmd bool
|
||||
var LocalCmdFlag = &cli.BoolFlag{
|
||||
Name: "local, l",
|
||||
Usage: "Run command locally",
|
||||
Destination: &LocalCmd,
|
||||
}
|
||||
|
||||
var RemoteUser string
|
||||
var RemoteUserFlag = &cli.StringFlag{
|
||||
Name: "user, u",
|
||||
Value: "",
|
||||
Usage: "User to run command within a service context",
|
||||
Destination: &RemoteUser,
|
||||
}
|
||||
|
||||
// SSHFailMsg is a hopefully helpful SSH failure message
|
||||
var SSHFailMsg = `
|
||||
Woops, Abra is unable to connect to connect to %s.
|
||||
|
@ -41,9 +41,9 @@ var recipeNewCommand = cli.Command{
|
||||
Usage: "Create a new recipe",
|
||||
ArgsUsage: "<recipe>",
|
||||
Description: `
|
||||
This command creates a new recipe.
|
||||
Create a new recipe.
|
||||
|
||||
Abra uses our built-in example repository which is available here:
|
||||
Abra uses the built-in example repository which is available here:
|
||||
|
||||
https://git.coopcloud.tech/coop-cloud/example
|
||||
|
||||
@ -111,7 +111,7 @@ In order to share your recipe, you can upload it the git repository to:
|
||||
|
||||
If you're not sure how to do that, come chat with us:
|
||||
|
||||
https://docs.coopcloud.tech/contact
|
||||
https://docs.coopcloud.tech/intro/contact
|
||||
|
||||
See "abra recipe -h" for additional recipe maintainer commands.
|
||||
|
||||
|
@ -13,7 +13,8 @@ var RecipeCommand = cli.Command{
|
||||
Description: `
|
||||
A recipe is a blueprint for an app. It is a bunch of config files which
|
||||
describe how to deploy and maintain an app. Recipes are maintained by the Co-op
|
||||
Cloud community and you can use Abra to read them and create apps for you.
|
||||
Cloud community and you can use Abra to read them, deploy them and create apps
|
||||
for you.
|
||||
|
||||
Anyone who uses a recipe can become a maintainer. Maintainers typically make
|
||||
sure the recipe is in good working order and the config upgraded in a timely
|
||||
|
@ -27,17 +27,16 @@ var recipeReleaseCommand = cli.Command{
|
||||
Usage: "Release a new recipe version",
|
||||
ArgsUsage: "<recipe> [<version>]",
|
||||
Description: `
|
||||
This command is used to specify a new version of a recipe. These versions are
|
||||
then published on the Co-op Cloud recipe catalogue. These versions take the
|
||||
following form:
|
||||
Create a new version of a recipe. These versions are then published on the
|
||||
Co-op Cloud recipe catalogue. These versions take the following form:
|
||||
|
||||
a.b.c+x.y.z
|
||||
|
||||
Where the "a.b.c" part is a semantic version determined by the maintainer. And
|
||||
the "x.y.z" part is the image tag of the recipe "app" service (the main
|
||||
container which contains the software to be used).
|
||||
Where the "a.b.c" part is a semantic version determined by the maintainer. The
|
||||
"x.y.z" part is the image tag of the recipe "app" service (the main container
|
||||
which contains the software to be used, by naming convention).
|
||||
|
||||
We maintain a semantic versioning scheme ("a.b.c") alongside the libre app
|
||||
We maintain a semantic versioning scheme ("a.b.c") alongside the recipe
|
||||
versioning scheme ("x.y.z") in order to maximise the chances that the nature of
|
||||
recipe updates are properly communicated. I.e. developers of an app might
|
||||
publish a minor version but that might lead to changes in the recipe which are
|
||||
|
@ -31,8 +31,8 @@ var recipeSyncCommand = cli.Command{
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
Description: `
|
||||
This command will generate labels for the main recipe service (i.e. by
|
||||
convention, the service named 'app') which corresponds to the following format:
|
||||
Generate labels for the main recipe service (i.e. by convention, the service
|
||||
named "app") which corresponds to the following format:
|
||||
|
||||
coop-cloud.${STACK_NAME}.version=<version>
|
||||
|
||||
|
@ -31,9 +31,9 @@ var recipeUpgradeCommand = cli.Command{
|
||||
Aliases: []string{"u"},
|
||||
Usage: "Upgrade recipe image tags",
|
||||
Description: `
|
||||
This command reads and attempts to parse all image tags within the given
|
||||
<recipe> configuration and prompt with more recent tags to upgrade to. It will
|
||||
update the relevant compose file tags on the local file system.
|
||||
Parse all image tags within the given <recipe> configuration and prompt with
|
||||
more recent tags to upgrade to. It will update the relevant compose file tags
|
||||
on the local file system.
|
||||
|
||||
Some image tags cannot be parsed because they do not follow some sort of
|
||||
semver-like convention. In this case, all possible tags will be listed and it
|
||||
|
@ -25,8 +25,8 @@ var RecordListCommand = cli.Command{
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
Description: `
|
||||
This command lists all domain name records managed by a 3rd party provider for
|
||||
a specific zone.
|
||||
List all domain name records managed by a 3rd party provider for a specific
|
||||
zone.
|
||||
|
||||
You must specify a zone (e.g. example.com) under which your domain name records
|
||||
are listed. This zone must already be created on your provider account.
|
||||
|
@ -33,7 +33,7 @@ var RecordNewCommand = cli.Command{
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
Description: `
|
||||
This command creates a new domain name record for a specific zone.
|
||||
Create a new domain name record for a specific zone.
|
||||
|
||||
You must specify a zone (e.g. example.com) under which your domain name records
|
||||
are listed. This zone must already be created on your provider account.
|
||||
|
@ -11,9 +11,9 @@ var RecordCommand = cli.Command{
|
||||
Aliases: []string{"rc"},
|
||||
ArgsUsage: "<record>",
|
||||
Description: `
|
||||
This command supports managing domain name records via 3rd party providers such
|
||||
as Gandi DNS. It supports listing, creating and removing all types of records
|
||||
that you might need for managing Co-op Cloud apps.
|
||||
Manage domain name records via 3rd party providers such as Gandi DNS. It
|
||||
supports listing, creating and removing all types of records that you might
|
||||
need for managing Co-op Cloud apps.
|
||||
|
||||
The following providers are supported:
|
||||
|
||||
|
@ -30,7 +30,7 @@ var RecordRemoveCommand = cli.Command{
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
Description: `
|
||||
This command removes a domain name record for a specific zone.
|
||||
Remove a domain name record for a specific zone.
|
||||
|
||||
It uses the type of record and name to match existing records and choose one
|
||||
for deletion. You must specify a zone (e.g. example.com) under which your
|
||||
|
@ -28,8 +28,8 @@ import (
|
||||
var (
|
||||
dockerInstallMsg = `
|
||||
A docker installation cannot be found on %s. This is a required system
|
||||
dependency for running Co-op Cloud on your server. If you would like, Abra can
|
||||
attempt to install Docker for you using the upstream non-interactive
|
||||
dependency for running Co-op Cloud apps on your server. If you would like, Abra
|
||||
can attempt to install Docker for you using the upstream non-interactive
|
||||
installation script.
|
||||
|
||||
See the following documentation for more:
|
||||
@ -246,7 +246,7 @@ Abra was unable to bootstrap Docker, see below for logs:
|
||||
|
||||
%s
|
||||
|
||||
If nothing works, you try running the Docker install script manually on your server:
|
||||
If nothing works, you can try running the Docker install script manually on your server:
|
||||
|
||||
wget -O- https://get.docker.com | bash
|
||||
|
||||
@ -276,7 +276,7 @@ Abra was unable to bootstrap Docker, see below for logs:
|
||||
|
||||
%s
|
||||
|
||||
This could be due to a number of things but one of the most common is that your
|
||||
This could be due to several reasons. One of the most common is that your
|
||||
server user account does not have sudo access, and if it does, you need to pass
|
||||
"--ask-sudo-pass" in order to supply Abra with your password.
|
||||
|
||||
@ -370,9 +370,9 @@ var serverAddCommand = cli.Command{
|
||||
Aliases: []string{"a"},
|
||||
Usage: "Add a server to your configuration",
|
||||
Description: `
|
||||
This command adds a new server to your configuration so that it can be managed
|
||||
by Abra. This command can also provision your server ("--provision/-p") with a
|
||||
Docker installation so that it is capable of hosting Co-op Cloud apps.
|
||||
Add a new server to your configuration so that it can be managed by Abra. This
|
||||
command can also provision your server ("--provision/-p") with a Docker
|
||||
installation so that it is capable of hosting Co-op Cloud apps.
|
||||
|
||||
Abra will default to expecting that you have a running ssh-agent and are using
|
||||
SSH keys to connect to your new server. Abra will also read your SSH config
|
||||
@ -385,9 +385,9 @@ password. "--ask-sudo-pass" may be passed if you run your provisioning commands
|
||||
via sudo privilege escalation.
|
||||
|
||||
The <domain> argument must be a publicy accessible domain name which points to
|
||||
your server. You should working SSH access to this server already, Abra will
|
||||
assume port 22 and will use your current system username to make an initial
|
||||
connection. You can use the <user> and <port> arguments to adjust this.
|
||||
your server. You should have working SSH access to this server already, Abra
|
||||
will assume port 22 and will use your current system username to make an
|
||||
initial connection. You can use the <user> and <port> arguments to adjust this.
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -99,9 +99,10 @@ You can access this new VPS via SSH using the following command:
|
||||
ssh root@%s
|
||||
|
||||
Please note, this server is not managed by Abra yet (i.e. "abra server ls" will
|
||||
not list this server)! You will need to assign a domain name record ("abra
|
||||
record new") and add the server to your Abra configuration ("abra server add")
|
||||
to have a working server that you can deploy Co-op Cloud apps to.
|
||||
not list this server)! You will need to assign a domain name record (manually
|
||||
or by using "abra record new") and add the server to your Abra configuration
|
||||
("abra server add") to have a working server that you can deploy Co-op Cloud
|
||||
apps to.
|
||||
|
||||
When setting up domain name records, you probably want to set up the following
|
||||
2 A records. This supports deploying apps to your root domain (e.g.
|
||||
@ -110,7 +111,6 @@ bar.example.com).
|
||||
|
||||
@ 1800 IN A %s
|
||||
* 1800 IN A %s
|
||||
|
||||
`,
|
||||
internal.HetznerCloudName, ip, rootPassword,
|
||||
ip, ip, ip,
|
||||
@ -181,9 +181,10 @@ address. You can learn all about how to get SSH access to your new Capsul on:
|
||||
%s/about-ssh
|
||||
|
||||
Please note, this server is not managed by Abra yet (i.e. "abra server ls" will
|
||||
not list this server)! You will need to assign a domain name record ("abra
|
||||
record new") and add the server to your Abra configuration ("abra server add")
|
||||
to have a working server that you can deploy Co-op Cloud apps to.
|
||||
not list this server)! You will need to assign a domain name record (manually
|
||||
or by using "abra record new") and add the server to your Abra configuration
|
||||
("abra server add") to have a working server that you can deploy Co-op Cloud
|
||||
apps to.
|
||||
|
||||
When setting up domain name records, you probably want to set up the following
|
||||
2 A records. This supports deploying apps to your root domain (e.g.
|
||||
@ -192,7 +193,6 @@ bar.example.com).
|
||||
|
||||
@ 1800 IN A <your-capsul-ip>
|
||||
* 1800 IN A <your-capsul-ip>
|
||||
|
||||
`, internal.CapsulName, resp.ID, internal.CapsulInstanceURL))
|
||||
|
||||
return nil
|
||||
@ -203,7 +203,7 @@ var serverNewCommand = cli.Command{
|
||||
Aliases: []string{"n"},
|
||||
Usage: "Create a new server using a 3rd party provider",
|
||||
Description: `
|
||||
This command creates a new server via a 3rd party provider.
|
||||
Create a new server via a 3rd party provider.
|
||||
|
||||
The following providers are supported:
|
||||
|
||||
@ -217,8 +217,6 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
||||
API tokens are read from the environment if specified, e.g.
|
||||
|
||||
export HCLOUD_TOKEN=...
|
||||
|
||||
Where "$provider_TOKEN" is the expected env var format.
|
||||
`,
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
|
@ -104,7 +104,7 @@ var serverRemoveCommand = cli.Command{
|
||||
ArgsUsage: "[<server>]",
|
||||
Usage: "Remove a managed server",
|
||||
Description: `
|
||||
This command removes a server from Abra management.
|
||||
Remova a server from Abra management.
|
||||
|
||||
Depending on whether you used a 3rd party provider to create this server ("abra
|
||||
server new"), you can also destroy the virtual server as well. Pass
|
||||
|
@ -10,13 +10,12 @@ var ServerCommand = cli.Command{
|
||||
Aliases: []string{"s"},
|
||||
Usage: "Manage servers",
|
||||
Description: `
|
||||
These commands support creating, managing and removing servers using 3rd party
|
||||
integrations.
|
||||
Create, manage and remove servers using 3rd party integrations.
|
||||
|
||||
Servers can be created from scratch using the "abra server new" command. If you
|
||||
already have a server, you can add it to your configuration using "abra server
|
||||
add". Abra can provision servers so that they are ready to deploy Co-op Cloud
|
||||
apps, see available flags on "server add" for more.
|
||||
recipes, see available flags on "abra server add" for more.
|
||||
`,
|
||||
Subcommands: []cli.Command{
|
||||
serverNewCommand,
|
||||
|
20
go.mod
20
go.mod
@ -4,23 +4,23 @@ go 1.16
|
||||
|
||||
require (
|
||||
coopcloud.tech/tagcmp v0.0.0-20211103052201-885b22f77d52
|
||||
github.com/AlecAivazis/survey/v2 v2.3.4
|
||||
github.com/AlecAivazis/survey/v2 v2.3.5
|
||||
github.com/Autonomic-Cooperative/godotenv v1.3.1-0.20210731094149-b031ea1211e7
|
||||
github.com/Gurpartap/logrus-stack v0.0.0-20170710170904-89c00d8a28f4
|
||||
github.com/docker/cli v20.10.14+incompatible
|
||||
github.com/docker/cli v20.10.17+incompatible
|
||||
github.com/docker/distribution v2.8.1+incompatible
|
||||
github.com/docker/docker v20.10.14+incompatible
|
||||
github.com/docker/docker v20.10.17+incompatible
|
||||
github.com/docker/go-units v0.4.0
|
||||
github.com/go-git/go-git/v5 v5.4.2
|
||||
github.com/hetznercloud/hcloud-go v1.33.1
|
||||
github.com/hetznercloud/hcloud-go v1.35.2
|
||||
github.com/moby/sys/signal v0.7.0
|
||||
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/schollz/progressbar/v3 v3.8.6
|
||||
github.com/schollz/progressbar/v3 v3.9.0
|
||||
github.com/schultz-is/passgen v1.0.1
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
gotest.tools/v3 v3.1.0
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
gotest.tools/v3 v3.3.0
|
||||
)
|
||||
|
||||
require (
|
||||
@ -33,7 +33,7 @@ require (
|
||||
github.com/docker/docker-credential-helpers v0.6.4 // indirect
|
||||
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
|
||||
github.com/fvbommel/sortorder v1.0.2 // indirect
|
||||
github.com/gliderlabs/ssh v0.3.3
|
||||
github.com/gliderlabs/ssh v0.3.4
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/gorilla/mux v1.8.0 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.1
|
||||
@ -46,9 +46,9 @@ require (
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/spf13/cobra v1.3.0 // indirect
|
||||
github.com/theupdateframework/notary v0.7.0 // indirect
|
||||
github.com/urfave/cli v1.22.5
|
||||
github.com/urfave/cli v1.22.9
|
||||
github.com/xanzy/ssh-agent v0.3.1 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190809123943-df4f5c81cb3b // indirect
|
||||
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838
|
||||
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8
|
||||
)
|
||||
|
41
go.sum
41
go.sum
@ -51,8 +51,8 @@ coopcloud.tech/libcapsul v0.0.0-20211022074848-c35e78fe3f3e/go.mod h1:HEQ9pSJRsD
|
||||
coopcloud.tech/tagcmp v0.0.0-20211103052201-885b22f77d52 h1:cyFFOl0tKe+dVHt8saejG8xoff33eQiHxFCVzRpPUjM=
|
||||
coopcloud.tech/tagcmp v0.0.0-20211103052201-885b22f77d52/go.mod h1:ESVm0wQKcbcFi06jItF3rI7enf4Jt2PvbkWpDDHk1DQ=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/AlecAivazis/survey/v2 v2.3.4 h1:pchTU9rsLUSvWEl2Aq9Pv3k0IE2fkqtGxazskAMd9Ng=
|
||||
github.com/AlecAivazis/survey/v2 v2.3.4/go.mod h1:hrV6Y/kQCLhIZXGcriDCUBtB3wnN7156gMXJ3+b23xM=
|
||||
github.com/AlecAivazis/survey/v2 v2.3.5 h1:A8cYupsAZkjaUmhtTYv3sSqc7LO5mp1XDfqe5E/9wRQ=
|
||||
github.com/AlecAivazis/survey/v2 v2.3.5/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI=
|
||||
github.com/Autonomic-Cooperative/godotenv v1.3.1-0.20210731094149-b031ea1211e7 h1:asQtdXYbxEYWcwAQqJTVYC/RltB4eqoWKvqWg/LFPOg=
|
||||
github.com/Autonomic-Cooperative/godotenv v1.3.1-0.20210731094149-b031ea1211e7/go.mod h1:oZRCMMRS318l07ei4DTqbZoOawfJlJ4yyo8juk2v4Rk=
|
||||
github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
||||
@ -332,16 +332,16 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
|
||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
|
||||
github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||
github.com/docker/cli v20.10.14+incompatible h1:dSBKJOVesDgHo7rbxlYjYsXe7gPzrTT+/cKQgpDAazg=
|
||||
github.com/docker/cli v20.10.14+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||
github.com/docker/cli v20.10.17+incompatible h1:eO2KS7ZFeov5UJeaDmIs1NFEDRf32PaqRpvoEkKBy5M=
|
||||
github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||
github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY=
|
||||
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
|
||||
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v20.10.14+incompatible h1:+T9/PRYWNDo5SZl5qS1r9Mo/0Q8AwxKKPtu9S1yxM0w=
|
||||
github.com/docker/docker v20.10.14+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v20.10.17+incompatible h1:JYCuMrWaVNophQTOrMMoSwudOVEfcegoZZrleKc1xwE=
|
||||
github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
|
||||
github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o=
|
||||
github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c=
|
||||
@ -403,8 +403,8 @@ github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2H
|
||||
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||
github.com/gliderlabs/ssh v0.3.3 h1:mBQ8NiOgDkINJrZtoizkC3nDNYgSaWtxyem6S2XHBtA=
|
||||
github.com/gliderlabs/ssh v0.3.3/go.mod h1:ZSS+CUoKHDrqVakTfTWUlKSr9MtMFkC4UvtQKD7O914=
|
||||
github.com/gliderlabs/ssh v0.3.4 h1:+AXBtim7MTKaLVPgvE+3mhewYRawNLTd+jEEz/wExZw=
|
||||
github.com/gliderlabs/ssh v0.3.4/go.mod h1:ZSS+CUoKHDrqVakTfTWUlKSr9MtMFkC4UvtQKD7O914=
|
||||
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
||||
github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
@ -602,8 +602,8 @@ github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn
|
||||
github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
|
||||
github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk=
|
||||
github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=
|
||||
github.com/hetznercloud/hcloud-go v1.33.1 h1:W1HdO2bRLTKU4WsyqAasDSpt54fYO4WNckWYfH5AuCQ=
|
||||
github.com/hetznercloud/hcloud-go v1.33.1/go.mod h1:XX/TQub3ge0yWR2yHWmnDVIrB+MQbda1pHxkUmDlUME=
|
||||
github.com/hetznercloud/hcloud-go v1.35.2 h1:eEDtmDiI2plZ2UQmj4YpiYse5XbtpXOUBpAdIOLxzgE=
|
||||
github.com/hetznercloud/hcloud-go v1.35.2/go.mod h1:mepQwR6va27S3UQthaEPGS86jtzSY9xWL1e9dyxXpgA=
|
||||
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
|
||||
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
@ -893,8 +893,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb
|
||||
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4=
|
||||
github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig=
|
||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/schollz/progressbar/v3 v3.8.6 h1:QruMUdzZ1TbEP++S1m73OqRJk20ON11m6Wqv4EoGg8c=
|
||||
github.com/schollz/progressbar/v3 v3.8.6/go.mod h1:W5IEwbJecncFGBvuEh4A7HT1nZZ6WNIL2i3qbnI0WKY=
|
||||
github.com/schollz/progressbar/v3 v3.9.0 h1:k9SRNQ8KZyibz1UZOaKxnkUE3iGtmGSDt1YY9KlCYQk=
|
||||
github.com/schollz/progressbar/v3 v3.9.0/go.mod h1:W5IEwbJecncFGBvuEh4A7HT1nZZ6WNIL2i3qbnI0WKY=
|
||||
github.com/schultz-is/passgen v1.0.1 h1:wUINzqW1Xmmy3yREHR6YTj+83VlFYjj2DIDMHzIi5TQ=
|
||||
github.com/schultz-is/passgen v1.0.1/go.mod h1:NnqzT2aSfvyheNQvBtlLUa0YlPFLDj60Jw2DZVwqiJk=
|
||||
github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U=
|
||||
@ -912,8 +912,9 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
@ -981,8 +982,8 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb
|
||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
|
||||
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli v1.22.9 h1:cv3/KhXGBGjEXLC4bH0sLuJ9BewaAbpk5oyMOveu4pw=
|
||||
github.com/urfave/cli v1.22.9/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/vbatts/tar-split v0.11.2/go.mod h1:vV3ZuO2yWSVsz+pfFzDG/upWH1JhjOiEaWq6kXyQ3VI=
|
||||
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
|
||||
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
||||
@ -1291,8 +1292,10 @@ golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo=
|
||||
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
|
||||
@ -1491,7 +1494,6 @@ google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ6
|
||||
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0=
|
||||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||
google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||
@ -1524,7 +1526,6 @@ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD
|
||||
google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||
google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A=
|
||||
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
@ -1586,8 +1587,8 @@ gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
|
||||
gotest.tools/v3 v3.1.0 h1:rVV8Tcg/8jHUkPUorwjaMTtemIMVXfIPKiOqnhEhakk=
|
||||
gotest.tools/v3 v3.1.0/go.mod h1:fHy7eyTmJFO5bQbUsEGQ1v4m2J3Jz9eWL54TP2/ZuYQ=
|
||||
gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo=
|
||||
gotest.tools/v3 v3.3.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
@ -65,6 +65,10 @@ func EnsureIPv4(domainName string) (string, error) {
|
||||
|
||||
// EnsureDomainsResolveSameIPv4 ensures that domains resolve to the same ipv4 address
|
||||
func EnsureDomainsResolveSameIPv4(domainName, server string) (string, error) {
|
||||
if server == "default" || server == "local" {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
var ipv4 string
|
||||
|
||||
domainIPv4, err := EnsureIPv4(domainName)
|
||||
|
@ -5,6 +5,25 @@ import (
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
)
|
||||
|
||||
// Check if a branch exists in a repo.
|
||||
// Use this and not repository.Branch(), because the latter does not
|
||||
// actually check for existing branches.
|
||||
// See https://github.com/go-git/go-git/issues/518
|
||||
func HasBranch(repository *git.Repository, name string) bool {
|
||||
var exist bool
|
||||
if iter, err := repository.Branches(); err == nil {
|
||||
iterFunc := func(reference *plumbing.Reference) error {
|
||||
if name == reference.Name().Short() {
|
||||
exist = true
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
_ = iter.ForEach(iterFunc)
|
||||
}
|
||||
return exist
|
||||
}
|
||||
|
||||
// GetCurrentBranch retrieves the current branch of a repository
|
||||
func GetCurrentBranch(repository *git.Repository) (string, error) {
|
||||
branchRefs, err := repository.Branches()
|
||||
|
@ -26,7 +26,7 @@ import (
|
||||
)
|
||||
|
||||
// RecipeCatalogueURL is the only current recipe catalogue available.
|
||||
const RecipeCatalogueURL = "https://recipes.coopcloud.tech"
|
||||
const RecipeCatalogueURL = "https://recipes.coopcloud.tech/recipes.json"
|
||||
|
||||
// ReposMetadataURL is the recipe repository metadata
|
||||
const ReposMetadataURL = "https://git.coopcloud.tech/api/v1/orgs/coop-cloud/repos"
|
||||
@ -625,8 +625,8 @@ func GetDefaultBranch(repo *git.Repository, recipeName string) (plumbing.Referen
|
||||
}
|
||||
|
||||
branch := "master"
|
||||
if _, err := repo.Branch("master"); err != nil {
|
||||
if _, err := repo.Branch("main"); err != nil {
|
||||
if !gitPkg.HasBranch(repo, "master") {
|
||||
if !gitPkg.HasBranch(repo, "main") {
|
||||
return "", fmt.Errorf("failed to select default branch in %s", recipeDir)
|
||||
}
|
||||
branch = "main"
|
||||
|
38
pkg/test/test.go
Normal file
38
pkg/test/test.go
Normal file
@ -0,0 +1,38 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// RmServerAppRecipe deletes the test server / app / recipe.
|
||||
func RmServerAppRecipe() {
|
||||
testAppLink := os.ExpandEnv("$HOME/.abra/servers/foo.com")
|
||||
if err := os.Remove(testAppLink); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
testRecipeLink := os.ExpandEnv("$HOME/.abra/recipes/test")
|
||||
if err := os.Remove(testRecipeLink); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// MkServerAppRecipe symlinks the test server / app / recipe.
|
||||
func MkServerAppRecipe() {
|
||||
RmServerAppRecipe()
|
||||
|
||||
testAppDir := os.ExpandEnv("$PWD/../../tests/resources/testapp")
|
||||
testAppLink := os.ExpandEnv("$HOME/.abra/servers/foo.com")
|
||||
if err := os.Symlink(testAppDir, testAppLink); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
testRecipeDir := os.ExpandEnv("$PWD/../../tests/resources/testrecipe")
|
||||
testRecipeLink := os.ExpandEnv("$HOME/.abra/recipes/test")
|
||||
if err := os.Symlink(testRecipeDir, testRecipeLink); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"ignoreDeps": [
|
||||
"github.com/urfave/cli"
|
||||
]
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ABRA_VERSION="0.4.1-alpha"
|
||||
ABRA_VERSION="0.5.1-beta"
|
||||
ABRA_RELEASE_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$ABRA_VERSION"
|
||||
RC_VERSION="0.4.1-alpha"
|
||||
RC_VERSION="0.5.1-beta"
|
||||
RC_VERSION_URL="https://git.coopcloud.tech/api/v1/repos/coop-cloud/abra/releases/tags/$RC_VERSION"
|
||||
|
||||
for arg in "$@"; do
|
||||
|
1
tests/integration/.gitignore
vendored
Normal file
1
tests/integration/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
logs
|
14
tests/integration/cmd.sh
Executable file
14
tests/integration/cmd.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./testfunctions.sh
|
||||
source ./common.sh
|
||||
|
||||
create_server_app_recipe
|
||||
|
||||
run_test '$ABRA app cmd foo.com test --local'
|
||||
|
||||
run_test '$ABRA app cmd foo.com test --local -- foo'
|
||||
|
||||
run_test '$ABRA app cmd foo.com test --local -- foo bar baz'
|
||||
|
||||
clean_server_app_recipe
|
@ -2,6 +2,16 @@
|
||||
|
||||
set -e
|
||||
|
||||
create_server_app_recipe() {
|
||||
ln -srf ../resources/testapp ~/.abra/servers/foo.com
|
||||
ln -srf ../resources/testrecipe ~/.abra/recipes
|
||||
}
|
||||
|
||||
clean_server_app_recipe() {
|
||||
unlink ~/.abra/servers/foo.com
|
||||
unlink ~/.abra/recipes/testrecipe
|
||||
}
|
||||
|
||||
function init() {
|
||||
ABRA="$(pwd)/../../abra"
|
||||
INSTALLER_URL="https://git.coopcloud.tech/coop-cloud/abra/raw/branch/main/scripts/installer/installer"
|
||||
|
@ -16,7 +16,7 @@ run_test () {
|
||||
echo $logfile
|
||||
}
|
||||
|
||||
testScripts=("app.sh" "autocomplete.sh" "catalogue.sh" "install.sh" "recipe.sh" "records.sh" "server.sh")
|
||||
testScripts=("app.sh" "autocomplete.sh" "catalogue.sh" "install.sh" "recipe.sh" "records.sh" "server.sh", "cmd.sh")
|
||||
|
||||
for i in "${testScripts[@]}"; do
|
||||
cmd="./$i $res_dir${i/sh/log}"
|
||||
|
1
tests/resources/testapp/foo.com.env
Normal file
1
tests/resources/testapp/foo.com.env
Normal file
@ -0,0 +1 @@
|
||||
TYPE=test
|
1
tests/resources/testapp/testapp
Symbolic link
1
tests/resources/testapp/testapp
Symbolic link
@ -0,0 +1 @@
|
||||
.
|
5
tests/resources/testrecipe/abra.sh
Normal file
5
tests/resources/testrecipe/abra.sh
Normal file
@ -0,0 +1,5 @@
|
||||
test(){
|
||||
echo "1: $1"
|
||||
echo "2: $2"
|
||||
echo "all: $@"
|
||||
}
|
5
tests/resources/testrecipe/compose.yml
Normal file
5
tests/resources/testrecipe/compose.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
app: []
|
Reference in New Issue
Block a user