refactor: rename command to :set-property
This will allow us to set other property values for the buildpacks plugin.
This commit is contained in:
@@ -78,7 +78,7 @@ The following config variables have special meanings and can be set in a variety
|
||||
| Name | Default | How to modify | Description |
|
||||
| ------------------------------ | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
|
||||
| `DOKKU_ROOT` | `~dokku` | `/etc/environment` | The root directory where dokku will store application repositories, as well as certain configuration files. |
|
||||
| `DOKKU_IMAGE` | `gliderlabs/herokuish` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | The default image to use when building herokuish containers. Deprecated in favor of using `buildpacks:stack-set` |
|
||||
| `DOKKU_IMAGE` | `gliderlabs/herokuish` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | The default image to use when building herokuish containers. Deprecated in favor of using `buildpacks:set-property` |
|
||||
| `DOKKU_LIB_ROOT` | `/var/lib/dokku` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | The directory where plugins, certain data, and general configuration is stored. |
|
||||
| `PLUGIN_PATH` | `$DOKKU_LIB_ROOT/plugins"` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | The top-level directory where plugins are stored. |
|
||||
| `PLUGIN_AVAILABLE_PATH` | `$PLUGIN_PATH/available"` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | The directory that holds all available plugins, including core. |
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
> New as of 0.22.0
|
||||
|
||||
```
|
||||
buildpacks:stack-set <app> <stack> # Sets the stack of an app
|
||||
buildpacks:set-property [--global|<app>] <key> <value> # Set or clear a buildpacks property for an app
|
||||
```
|
||||
Cloud Native Buildpacks are an evolution over the Buildpacks technology provided by the Herokuish builder. See the [herokuish buildpacks documentation](/docs/deployment/methods/herokuish.md) for more information on how to clear buildpack build cache for an application.
|
||||
|
||||
@@ -39,16 +39,16 @@ As this functionality is highly experimental, there are a number of caveats. Ple
|
||||
|
||||
> New as of 0.23.0
|
||||
|
||||
The default stack builder in use by CNB buildpacks in Dokku is based on `heroku/buildpacks`. Users may desire to switch the stack builder to a custom version, either to update the operating system or to customize packages included with the stack builder. This can be performed via the `buildpacks:stack-set` command.
|
||||
The default stack builder in use by CNB buildpacks in Dokku is based on `heroku/buildpacks`. Users may desire to switch the stack builder to a custom version, either to update the operating system or to customize packages included with the stack builder. This can be performed via the `buildpacks:set-property` command.
|
||||
|
||||
```shell
|
||||
dokku buildpacks:stack-set node-js-app paketobuildpacks/build:base-cnb
|
||||
dokku buildpacks:set-property node-js-app paketobuildpacks/build:base-cnb
|
||||
```
|
||||
|
||||
The specified stack builder can also be unset by omitting the name of the stack builder when calling `buildpacks:stack-set`.
|
||||
The specified stack builder can also be unset by omitting the name of the stack builder when calling `buildpacks:set-property`.
|
||||
|
||||
```shell
|
||||
dokku buildpacks:stack-set node-js-app
|
||||
dokku buildpacks:set-property node-js-app
|
||||
```
|
||||
|
||||
A change in the stack builder value will execute the `post-stack-set` trigger.
|
||||
@@ -57,8 +57,8 @@ Finally, stack builders can be set or unset globally as a fallback. This will ta
|
||||
|
||||
```shell
|
||||
# set globally
|
||||
dokku buildpacks:stack-set --global paketobuildpacks/build:base-cnb
|
||||
dokku buildpacks:set-property --global paketobuildpacks/build:base-cnb
|
||||
|
||||
# unset globally
|
||||
dokku buildpacks:stack-set --global
|
||||
dokku buildpacks:set-property --global
|
||||
```
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
> Subcommands new as of 0.15.0
|
||||
|
||||
```
|
||||
buildpacks:add [--index 1] <app> <buildpack> # Add new app buildpack while inserting into list of buildpacks if necessary
|
||||
buildpacks:clear <app> # Clear all buildpacks set on the app
|
||||
buildpacks:list <app> # List all buildpacks for an app
|
||||
buildpacks:remove <app> <buildpack> # Remove a buildpack set on the app
|
||||
buildpacks:report [<app>] [<flag>] # Displays a buildpack report for one or more apps
|
||||
buildpacks:set [--index 1] <app> <buildpack> # Set new app buildpack at a given position defaulting to the first buildpack if no index is specified
|
||||
buildpacks:stack-set <app> <stack> # Sets the stack of an app
|
||||
buildpacks:add [--index 1] <app> <buildpack> # Add new app buildpack while inserting into list of buildpacks if necessary
|
||||
buildpacks:clear <app> # Clear all buildpacks set on the app
|
||||
buildpacks:list <app> # List all buildpacks for an app
|
||||
buildpacks:remove <app> <buildpack> # Remove a buildpack set on the app
|
||||
buildpacks:report [<app>] [<flag>] # Displays a buildpack report for one or more apps
|
||||
buildpacks:set [--index 1] <app> <buildpack> # Set new app buildpack at a given position defaulting to the first buildpack if no index is specified
|
||||
buildpacks:set-property [--global|<app>] <key> <value> # Set or clear a buildpacks property for an app
|
||||
```
|
||||
|
||||
> Warning: If using the `buildpacks` plugin, be sure to unset any `BUILDPACK_URL` and remove any such entries from a committed `.env` file. A specified `BUILDPACK_URL` will always override a `.buildpacks` file or the buildpacks plugin.
|
||||
@@ -128,16 +128,16 @@ dokku buildpacks:clear node-js-app
|
||||
|
||||
> New as of 0.23.0
|
||||
|
||||
The default stack builder in use by Herokuish buildpacks in Dokku is based on `gliderlabs/herokuish:latest`. Typically, this is installed via an OS package which pulls the requisite Docker image. Users may desire to switch the stack builder to a custom version, either to update the operating system or to customize packages included with the stack builder. This can be performed via the `buildpacks:stack-set` command.
|
||||
The default stack builder in use by Herokuish buildpacks in Dokku is based on `gliderlabs/herokuish:latest`. Typically, this is installed via an OS package which pulls the requisite Docker image. Users may desire to switch the stack builder to a custom version, either to update the operating system or to customize packages included with the stack builder. This can be performed via the `buildpacks:set-property` command.
|
||||
|
||||
```shell
|
||||
dokku buildpacks:stack-set node-js-app gliderlabs/herokuish:latest
|
||||
dokku buildpacks:set-property node-js-app gliderlabs/herokuish:latest
|
||||
```
|
||||
|
||||
The specified stack builder can also be unset by omitting the name of the stack builder when calling `buildpacks:stack-set`.
|
||||
The specified stack builder can also be unset by omitting the name of the stack builder when calling `buildpacks:set-property`.
|
||||
|
||||
```shell
|
||||
dokku buildpacks:stack-set node-js-app
|
||||
dokku buildpacks:set-property node-js-app
|
||||
```
|
||||
|
||||
A change in the stack builder value will execute the `post-stack-set` trigger.
|
||||
@@ -146,10 +146,10 @@ Finally, stack builders can be set or unset globally as a fallback. This will ta
|
||||
|
||||
```shell
|
||||
# set globally
|
||||
dokku buildpacks:stack-set --global gliderlabs/herokuish:latest
|
||||
dokku buildpacks:set-property --global gliderlabs/herokuish:latest
|
||||
|
||||
# unset globally
|
||||
dokku buildpacks:stack-set --global
|
||||
dokku buildpacks:set-property --global
|
||||
```
|
||||
|
||||
### Displaying buildpack reports for an app
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
SUBCOMMANDS = subcommands/add subcommands/clear subcommands/list subcommands/remove subcommands/report subcommands/set subcommands/stack-set
|
||||
SUBCOMMANDS = subcommands/add subcommands/clear subcommands/list subcommands/remove subcommands/report subcommands/set subcommands/set-property
|
||||
TRIGGERS = triggers/buildpack-stack-name triggers/install triggers/post-app-clone-setup triggers/post-app-rename-setup triggers/post-delete triggers/post-extract triggers/report
|
||||
BUILD = commands subcommands triggers
|
||||
PLUGIN_NAME = buildpacks
|
||||
|
||||
@@ -42,7 +42,7 @@ func reportComputedStack(appName string) string {
|
||||
|
||||
b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_IMAGE"}...)
|
||||
if dokkuImage := strings.TrimSpace(string(b[:])); dokkuImage != "" {
|
||||
common.LogWarn("Deprecated: use buildpacks:stack-set instead of specifying DOKKU_IMAGE environment variable")
|
||||
common.LogWarn("Deprecated: use buildpacks:set-property instead of specifying DOKKU_IMAGE environment variable")
|
||||
return dokkuImage
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ Additional commands:`
|
||||
buildpacks:remove <app> <buildpack>, Remove a buildpack set on the app
|
||||
buildpacks:report [<app>] [<flag>], Displays a buildpack report for one or more apps
|
||||
buildpacks:set [--index 1] <app> <buildpack>, Set new app buildpack at a given position defaulting to the first buildpack if no index is specified
|
||||
buildpacks:stack-set <app> <stack>, Sets the stack of an app
|
||||
buildpacks:set-property [--global|<app>] <key> <value>, Set or clear a buildpacks property for an app
|
||||
`
|
||||
)
|
||||
|
||||
|
||||
@@ -57,17 +57,19 @@ func main() {
|
||||
appName := args.Arg(0)
|
||||
buildpack := args.Arg(1)
|
||||
err = buildpacks.CommandSet(appName, buildpack, *index)
|
||||
case "stack-set":
|
||||
args := flag.NewFlagSet("buildpacks:stack-set", flag.ExitOnError)
|
||||
case "set-property":
|
||||
args := flag.NewFlagSet("buildpacks:set-property", flag.ExitOnError)
|
||||
global := args.Bool("global", false, "--global: set a global property")
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
stack := args.Arg(1)
|
||||
property := args.Arg(1)
|
||||
value := args.Arg(2)
|
||||
if *global {
|
||||
appName = "--global"
|
||||
stack = args.Arg(0)
|
||||
property = args.Arg(0)
|
||||
value = args.Arg(1)
|
||||
}
|
||||
err = buildpacks.CommandStackSet(appName, stack)
|
||||
err = buildpacks.CommandSetProperty(appName, property, value)
|
||||
default:
|
||||
common.LogFail(fmt.Sprintf("Invalid plugin subcommand call: %s", subcommand))
|
||||
}
|
||||
|
||||
@@ -139,12 +139,16 @@ func CommandSet(appName string, buildpack string, index int) error {
|
||||
return common.PropertyListSet("buildpacks", appName, "buildpacks", buildpack, index)
|
||||
}
|
||||
|
||||
// CommandStackSet implements buildpacks:stack-set
|
||||
func CommandStackSet(appName string, stack string) error {
|
||||
oldStack := common.PropertyGet("buildpacks", appName, "stack")
|
||||
common.CommandPropertySet("buildpacks", appName, "stack", stack, DefaultProperties, GlobalProperties)
|
||||
if oldStack != stack {
|
||||
return common.PlugnTrigger("post-stack-set", []string{appName, stack}...)
|
||||
// CommandSetProperty implements buildpacks:set-property
|
||||
func CommandSetProperty(appName string, property string, value string) error {
|
||||
oldStack := ""
|
||||
if property == "stack" {
|
||||
oldStack = common.PropertyGet("buildpacks", appName, "stack")
|
||||
}
|
||||
|
||||
common.CommandPropertySet("buildpacks", appName, property, value, DefaultProperties, GlobalProperties)
|
||||
if property == "stack" && oldStack != value {
|
||||
return common.PlugnTrigger("post-stack-set", []string{appName, value}...)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -25,7 +25,7 @@ func TriggerBuildpackStackName(appName string) error {
|
||||
b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_IMAGE"}...)
|
||||
dokkuImage := strings.TrimSpace(string(b[:]))
|
||||
if dokkuImage != "" {
|
||||
common.LogWarn("Deprecated: use buildpacks:stack-set instead of specifying DOKKU_IMAGE environment variable")
|
||||
common.LogWarn("Deprecated: use buildpacks:set-property instead of specifying DOKKU_IMAGE environment variable")
|
||||
fmt.Println(dokkuImage)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user