Habitat reserves some names for internal use. You can set all of these values in your plan and use them as variables in your Habitat code.
For example:
# Set the packag name
pkg_name=two-tier-app
# Call the package by name
${pkg_name}
# Set the packag name
pkg_name=two-tier-app
# Call the package by name
${"pkg_name"}
pkg_name, pkg_origin, and pkg_version to create the fully-qualified package name. Type: string. Required.pkg_name=zlib
$pkg_name="zlib"
HAB_ORIGIN environment variable overrides the pkg_origin Type: string. Required.pkg_origin=Habitat
$pkg_origin="Habitat"
pkg_name, pkg_origin, and pkg_version to create the fully-qualified package name. You can set the value through the pkg_version() function. Type: string. Required.pkg_version=1.2.8
$pkg_version="1.2.8"
Note
pkg_maintainer="Your Name <[email protected]>"
$pkg_maintainer="Your Name <[email protected]>"
pkg_license=('Apache-2.0')
$pkg_license=("'Apache-2.0'")
Note
pkg_license=('Boost Software License') for the cmake plan. wget url will work. Typically, the relative path for the URL typically contains the pkg_name and pkg_version values. Type: URL. Optional.pkg_source=http://downloads.sourceforge.net/project/libpng/$pkg_name/${pkg_version}/${pkg_name}-${pkg_version}.tar.gz
$pkg_source="http://downloads.sourceforge.net/project/libpng/$pkg_name/${pkg_version}/${pkg_name}-${pkg_version}.tar.gz"
pkg_name and pkg_version. Type: string. Optional.pkg_filename=${pkg_name}-${pkg_version}.tar.gz
$pkg_filename="${pkg_name}-${pkg_version}.tar.gz"
pkg_source. If you do not have the checksum, generate it by downloading the source and using the sha256sum or gsha256sum tools. Override with do_verify(). When the value is unset or incorrect and you do not override it with do_verify(), then the build output of your package will show the expected value. Type: varchar(64) or char(64). Required when providing a valid URL is provided for pkg_source, but is otherwise Optional.pkg_shasum=36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d
$pkg_shasum="36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d"
pkg_deps=(core/glibc core/pcre core/openssl core/zlib)
$pkg_deps="(core/glibc core/pcre core/openssl core/zlib)"
pkg_build_deps=(core/gcc core/linux-headers)
$pkg_build_deps="(core/gcc core/linux-headers)"
LD_FLAGS and LD_RUN_PATH for software that depends on your package. Optional.pkg_lib_dirs=(lib)
CFLAGS for software that depends on your package. Optional.pkg_include_dirs=(include)
PATH for software that depends on your package. Optional.pkg_bin_dirs=(bin)
PKG_CONFIG_PATH for software that depends on your package. Optional.pkg_pconfig_dirs=(lib/pkgconfig)
pkg_bin_dirs to place package binaries in the path. If your package hs complex start-up behaviors, use a run hook instead. Omit this setting for packages that are designed for consumption by other packages instead of being run directly by a Supervisor. Optional.pkg_svc_run="haproxy -f $pkg_svc_config_path/haproxy.conf"
pkg_exposes and for any consuming services that set pkg_binds or pkg_binds_optional. An associative array in Bash or a hashtable in Powershell. Type: array. Optional.pkg_exports=(
[port]=server.port
[host]=server.host
[ssl-port]=ssl.port
)
In this example, the corresponding default.toml file would have the following key/value pairs defined:
[server]
port = 80
host = "www.example.com"
[ssl]
port = 443
pkg_exports keys containing default values for the ports that this package exposes. These values are used as sensible defaults for other tools, such as when exporting a package to a container format. Optional.pkg_exposes=(port ssl-port)
Note
pkg_exports, you must have a default.toml file indicating the port values to expose. hashtable in Powershell) representing services which you depend on and the configuration keys that you expect the service to export (by their pkg_exports). These binds must be set for the Supervisor to load the service. The loaded service will wait to run until its bind becomes available. If the bind does not contain the expected keys, the service will not start successfully. Optional.pkg_binds=(
[database]="port host"
)
pkg_binds but these represent optional services to connect to. Optional.pkg_binds_optional=(
[storage]="port host"
)
bin/bash or libexec/neverland, since binaries can be located in directories besides bin. This list of interpreters will be written to the metadata INTERPRETERS file, located inside a package, with their fully-qualified path. Then these can be used with the fix_interpreter function. For more information on declaring shebangs in Chef Habitat, see Plan hooks, and for more information on the fix_interpreter function, see Plan utility functions. Optional.pkg_interpreters=(bin/bash)
hab. On Windows, if the hab user does not exist then the service will run under the same account as the Supervisor. Optional.pkg_svc_user=hab
plan.ps1. Type: string. Default: hab. Optional.pkg_svc_group=$pkg_svc_user
plan.ps1. Default: TERM. Optional.pkg_shutdown_signal=HUP
plan.ps1. Default: 8. Optional.pkg_shutdown_timeout_sec=$pkg_shutdown_timeout_sec
pkg_description=$(cat << EOF
# My package description
This is the package for the foo library. It's pretty awesome.
EOF
)
Note
#. The hab-plan-build script interprets unescaped characters as code during the package build. pkg_upstream_url=https://github.com/myrepo
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/habitat/plan_settings/