SDK Reference
package
The package
module provides functions for defining packages in Ocuroot.
Allowed in
- Main thread of
package.ocu.star
Usage
Load the module:
Example
API Reference
package(name, build=_default_build, policy=_default_policy, deploy=_default_deploy, destroy=_default_destroy, tasks=)
Define a package to manage builds and deployments for the code within this directory.
Arguments
name
: Unique package name within the repositorybuild
: Function defining the build process- Takes a build context (
ctx
) argument with:build
: Build informationid
: Build ID (string)sequence
: Build sequence number (integer)created
: Build creation timestamp (integer)attributes
: Build attributes dictionaryset_alias(alias)
: Set build alias
commit
: Commit informationmessage
: Commit messageref
: Git referencehash
: Commit hashclean
: Boolean indicating if working directory is clean
- Returns a result object with outputs
- Takes a build context (
policy
: Function defining deployment rules- Takes a policy context (
ctx
) argument with:build
: Build informationid
: Build ID (string)alias
: Build alias (string)sequence
: Build sequence number (integer)created
: Build creation timestamp (integer)attributes
: Build attributes dictionaryannotations
: Build annotations dictionary
environment
: Environment informationname
: Environment name (string)attributes
: Environment attributes dictionary
- Returns a policy result object
- Takes a policy context (
deploy
: Function defining the deployment process- Takes a deploy context (
ctx
) argument with:deploy
: Deployment informationid
: Deploy ID (string)inputs
: Input parameters dictionaryinputs_secret
: Secret input parameters dictionaryoutputs
: Output parameters dictionaryoutputs_secret
: Secret output parameters dictionary
build
: Build information (same as policy context)environment
: Environment information (same as policy context)
- Returns a result object with outputs
- Takes a deploy context (
destroy
: Function defining the cleanup process- Takes a deploy context (
ctx
) argument (same structure as deploy function) - No return value
- Takes a deploy context (
tasks
: Dictionary mapping task names to functions- Each function takes a task context (
ctx
) argument with:build
: Build information (same as policy context)environment
: Environment information (same as policy context)
- Returns a result object
- Each function takes a task context (