refactor: remove support for the nixpacks no-cache property

This replicates the docker-options functionality.
This commit is contained in:
Jose Diaz-Gonzalez
2025-11-15 23:30:15 -05:00
parent 50b2836e52
commit 93cf9cc118
4 changed files with 6 additions and 63 deletions

View File

@@ -80,28 +80,10 @@ dokku builder-nixpacks:set --global nixpackstoml-path
### Disabling cache ### Disabling cache
Cache is enabled by default, but can be disabled by setting the `no-cache` property to `true`: Disable cache using the [docker-options] plugin:
```shell ```shell
dokku builder-nixpacks:set node-js-app no-cache true dokku docker-options:add node-js-app build "--no-cache"
```
The default value may be set by passing an empty value for the option:
```shell
dokku builder-nixpacks:set node-js-app no-cache
```
The `no-cache` property can also be set globally. The global default is `false`, and the global value is used when no app-specific value is set.
```shell
dokku builder-nixpacks:set --global no-cache true
```
The default value may be set by passing an empty value for the option.
```shell
dokku builder-nixpacks:set --global no-cache
``` ```
### Displaying builder-nixpacks reports for an app ### Displaying builder-nixpacks reports for an app
@@ -117,23 +99,14 @@ dokku builder-nixpacks:report
Builder-nixpacks computed nixpackstoml path: nixpacks2.toml Builder-nixpacks computed nixpackstoml path: nixpacks2.toml
Builder-nixpacks global nixpackstoml path: nixpacks.toml Builder-nixpacks global nixpackstoml path: nixpacks.toml
Builder-nixpacks nixpackstoml path: nixpacks2.toml Builder-nixpacks nixpackstoml path: nixpacks2.toml
Builder-nixpacks computed no cache: true
Builder-nixpacks global no cache: false
Builder-nixpacks no cache: true
=====> python-sample builder-nixpacks information =====> python-sample builder-nixpacks information
Builder-nixpacks computed nixpackstoml path: nixpacks.toml Builder-nixpacks computed nixpackstoml path: nixpacks.toml
Builder-nixpacks global nixpackstoml path: nixpacks.toml Builder-nixpacks global nixpackstoml path: nixpacks.toml
Builder-nixpacks nixpackstoml path: Builder-nixpacks nixpackstoml path:
Builder-nixpacks computed no cache: false
Builder-nixpacks global no cache: false
Builder-nixpacks no cache:
=====> ruby-sample builder-nixpacks information =====> ruby-sample builder-nixpacks information
Builder-nixpacks computed nixpackstoml path: nixpacks.toml Builder-nixpacks computed nixpackstoml path: nixpacks.toml
Builder-nixpacks global nixpackstoml path: nixpacks.toml Builder-nixpacks global nixpackstoml path: nixpacks.toml
Builder-nixpacks nixpackstoml path: Builder-nixpacks nixpackstoml path:
Builder-nixpacks computed no cache: false
Builder-nixpacks global no cache: false
Builder-nixpacks no cache:
``` ```
You can run the command for a specific app also. You can run the command for a specific app also.
@@ -147,17 +120,14 @@ dokku builder-nixpacks:report node-js-app
Builder-nixpacks computed nixpackstoml path: nixpacks2.toml Builder-nixpacks computed nixpackstoml path: nixpacks2.toml
Builder-nixpacks global nixpackstoml path: nixpacks.toml Builder-nixpacks global nixpackstoml path: nixpacks.toml
Builder-nixpacks nixpackstoml path: nixpacks2.toml Builder-nixpacks nixpackstoml path: nixpacks2.toml
Builder-nixpacks computed no cache: true
Builder-nixpacks global no cache: false
Builder-nixpacks no cache: true
``` ```
You can pass flags which will output only the value of the specific information you want. For example: You can pass flags which will output only the value of the specific information you want. For example:
```shell ```shell
dokku builder-nixpacks:report node-js-app --builder-nixpacks-no-cache dokku builder-nixpacks:report node-js-app --builder-nixpacks-nixpackstoml-path
``` ```
``` ```
true nixpacks2.toml
``` ```

View File

@@ -36,7 +36,6 @@ trigger-builder-nixpacks-builder-build() {
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE") local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE") DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
DOCKER_ARGS+=" $DOKKU_GLOBAL_BUILD_ARGS" DOCKER_ARGS+=" $DOKKU_GLOBAL_BUILD_ARGS"
[[ "$(fn-builder-nixpacks-computed-no-cache "$APP")" == "true" ]] && DOCKER_ARGS+=" --no-cache"
DOCKER_ARGS=" $DOCKER_ARGS " DOCKER_ARGS=" $DOCKER_ARGS "
eval set -- "$DOCKER_ARGS" eval set -- "$DOCKER_ARGS"

View File

@@ -38,9 +38,6 @@ cmd-builder-nixpacks-report-single() {
"--builder-nixpacks-computed-nixpackstoml-path: $(fn-builder-nixpacks-computed-nixpackstoml-path "$APP")" "--builder-nixpacks-computed-nixpackstoml-path: $(fn-builder-nixpacks-computed-nixpackstoml-path "$APP")"
"--builder-nixpacks-global-nixpackstoml-path: $(fn-builder-nixpacks-global-nixpackstoml-path "$APP")" "--builder-nixpacks-global-nixpackstoml-path: $(fn-builder-nixpacks-global-nixpackstoml-path "$APP")"
"--builder-nixpacks-nixpackstoml-path: $(fn-builder-nixpacks-nixpackstoml-path "$APP")" "--builder-nixpacks-nixpackstoml-path: $(fn-builder-nixpacks-nixpackstoml-path "$APP")"
"--builder-nixpacks-computed-no-cache: $(fn-builder-nixpacks-computed-no-cache "$APP")"
"--builder-nixpacks-global-no-cache: $(fn-builder-nixpacks-global-no-cache "$APP")"
"--builder-nixpacks-no-cache: $(fn-builder-nixpacks-no-cache "$APP")"
) )
if [[ -z "$INFO_FLAG" ]]; then if [[ -z "$INFO_FLAG" ]]; then
@@ -91,26 +88,3 @@ fn-builder-nixpacks-nixpackstoml-path() {
fn-plugin-property-get "builder-nixpacks" "$APP" "nixpackstoml-path" "" fn-plugin-property-get "builder-nixpacks" "$APP" "nixpackstoml-path" ""
} }
fn-builder-nixpacks-computed-no-cache() {
declare APP="$1"
file="$(fn-builder-nixpacks-no-cache "$APP")"
if [[ "$file" == "" ]]; then
file="$(fn-builder-nixpacks-global-no-cache "$APP")"
fi
echo "$file"
}
fn-builder-nixpacks-global-no-cache() {
declare APP="$1"
fn-plugin-property-get "builder-nixpacks" "--global" "no-cache" "false"
}
fn-builder-nixpacks-no-cache() {
declare APP="$1"
fn-plugin-property-get "builder-nixpacks" "$APP" "no-cache" ""
}

View File

@@ -9,13 +9,13 @@ cmd-builder-nixpacks-set() {
declare cmd="builder-nixpacks:set" declare cmd="builder-nixpacks:set"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3" declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("nixpackstoml-path" "no-cache") local VALID_KEYS=("nixpackstoml-path")
[[ "$APP" == "--global" ]] || verify_app_name "$APP" [[ "$APP" == "--global" ]] || verify_app_name "$APP"
[[ -z "$KEY" ]] && dokku_log_fail "No key specified" [[ -z "$KEY" ]] && dokku_log_fail "No key specified"
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then
dokku_log_fail "Invalid key specified, valid keys include: nixpackstoml-path, no-cache" dokku_log_fail "Invalid key specified, valid keys include: nixpackstoml-path"
fi fi
if [[ -n "$VALUE" ]]; then if [[ -n "$VALUE" ]]; then