Documentation
¶
Overview ¶
Project configuration file for Turbo Bob
Index ¶
Constants ¶
View Source
const ( Name = ".config/turbobob.json" FileDescriptionBoilerplate = "https://github.com/function61/turbobob" )
View Source
const (
CurrentVersionMajor = 1
)
Variables ¶
View Source
var ( ErrBuilderNotFound = errors.New("builder not found") ErrBobfileNotFound = errors.New("turbobob.json does not exist. Run $ bob tools init") ErrInitBobfileExists = errors.New("cannot init; Bobfile already exists") ErrUnsupportedBobfileVersion = errors.New("unsupported Bobfile version") ErrInvalidDockerCredsEnvFormat = errors.New("invalid format for DOCKER_CREDS") ErrUnableToParseDockerTag = errors.New("unable to parse Docker tag") ErrIncorrectFileDescriptionBp = errors.New("you are not supposed to change FileDescriptionBoilerplate") )
Functions ¶
This section is empty.
Types ¶
type Bobfile ¶
type Bobfile struct {
Schema string `json:"$schema"` // JSON schema URL
FileDescriptionBoilerplate string `json:"for_description_of_this_file_see"` // link which explains what this file is about
VersionMajor int `json:"version_major"` // major version, for indicating backwards-incompatible version breaks
ProjectName string `json:"project_name"` // the project's name, prefer filesystem-safe & URL-safe characters
Meta ProjectMetadata `json:"meta,omitempty"` // metadata about this project
Builders []BuilderSpec `json:"builders"` // builders used to build components of this project
DockerImages []DockerImageSpec `json:"docker_images,omitempty"` // container images to build during the build
Subrepos []SubrepoSpec `json:"subrepos,omitempty"` // subrepos to check out
OsArches *OsArchesSpec `json:"os_arches,omitempty"` // operating systems and CPU architectures to build for
Experiments experiments `json:"experiments_i_consent_to_breakage,omitempty"` // unstable experiments to enable. by defining any of these, you consent to your builds breaking on new versions of Turbo Bob.
Deprecated1 string `json:"project_emoji_icon,omitempty"` // moved to `ProjectMetadata`
}
func Read ¶
FIXME: Bobfile should actually be read only after correct revision has been checked out from VCs
func (Bobfile) ProjectEmojiIcon ¶
type BuilderCommands ¶
type BuilderCommands struct {
Prepare []string `json:"prepare,omitempty"` // command for preparing the build
Build []string `json:"build"` // command for building the project
Publish []string `json:"publish,omitempty"` // command for publishing the artefacts of the project
Dev []string `json:"dev"` // command for entering the development shell of the project
}
Suppose you have three builders: 1) backend, 2) frontend and 3) documentation.
Here's the order in which the commands are executed:
Start ────────────────┐ ┌───────────────┐ ┌───────────────┐
│ ▲ │ ▲ │
┌──────────▼┐ │ ┌──────────▼┐ │ ┌──────────▼┐
Backend │ Prepare ││ │ │ Build ││ │ │ Publish ││
└──────────┼┘ │ └──────────┼┘ │ └──────────┼┘
│ │ │ │ │
│ │ │ │ │
┌──────────▼┐ │ ┌──────────▼┐ │ ┌──────────▼┐
Frontend │ Prepare ││ │ │ Build ││ │ │ Publish ││
└──────────┼┘ │ └──────────┼┘ │ └──────────┼┘
│ │ │ │ │
│ │ │ │ │
┌──────────▼┐ │ ┌──────────▼┐ │ ┌──────────▼┐
Documentation │ Prepare ││ │ │ Build ││ │ │ Publish ││
└──────────┼┘ │ └──────────┼┘ │ └──────────┼┘
│ │ │ │ │
│ │ │ │ │
└─────┘ └─────┘ ▼
Rationale:
- backend needs some codegenerated stuff from documentation, like URLs so backend can link to documentation,
so backend build can use stuff from documentation.prepare step.
- you'll want to publish artefacts only if all builders succeeded (*.build before *.publish),
so there's no unnecessary uploads.
type BuilderSpec ¶
type BuilderSpec struct {
Name string `json:"name" jsonschema:"example=default,example=backend"` // name of the builder
Uses string `json:"uses" jsonschema:"example=docker://alpine:latest,example=dockerfile://build-default.Dockerfile"` // image used for container of this builder
MountSource string `json:"mount_source,omitempty"`
MountDestination string `json:"mount_destination"`
Workdir string `json:"workdir,omitempty"`
Commands BuilderCommands `json:"commands"` // commands used to build / develop / etc. the project
DevPorts []string `json:"dev_ports,omitempty"`
DevHTTPIngress string `json:"dev_http_ingress,omitempty" jsonschema:"example=80"`
DevProTips []string `json:"dev_pro_tips,omitempty"` // pro-tips e.g. commands the user can run inside the builder to lint / launch / etc. the project
DevShellCommands []DevShellCommand `json:"dev_shell_commands,omitempty"` // injected as history for quick recall (ctrl + r)
Envs map[string]string `json:"env,omitempty"`
PassEnvs []string `json:"pass_envs,omitempty"`
ContextlessBuild bool `json:"contextless_build,omitempty"` // (DEPRECATED) build without uploading any files to the build context
}
type DevShellCommand ¶
type DockerImageSpec ¶
type DockerImageSpec struct {
Image string `json:"image" jsonschema:"example=myorg/myproject"` // image ref (without the tag) to which to push the image
DockerfilePath string `json:"dockerfile_path" jsonschema:"example=Dockerfile"` // where to find the `Dockerfile` from
AuthType *string `json:"auth_type"` // creds_from_env
Platforms []string `json:"platforms,omitempty"` // platforms to build for, in `$ docker build --platform=...` syntax
TagLatest bool `json:"tag_latest"` // whether to publish the `:latest` tag
}
type OsArchesSpec ¶
type OsArchesSpec struct {
Neutral bool `json:"neutral"` // works across all OSes and arches, example: native JavaScript project or a website
LinuxNeutral bool `json:"linux-neutral"` // works on Linux, arch doesn't matter
LinuxAmd64 bool `json:"linux-amd64"`
LinuxArm bool `json:"linux-arm"`
LinuxArm64 bool `json:"linux-arm64"`
LinuxRiscv64 bool `json:"linux-riscv64"`
WindowsNeutral bool `json:"windows-neutral"` // works on Windows, arch doesn't matter
WindowsAmd64 bool `json:"windows-amd64"`
DarwinAmd64 bool `json:"darwin-amd64"`
}
documents os/arch combos which this project's build artefacts support. follow constants from Go's GOOS/GOARCH
func (*OsArchesSpec) AsBuildEnvVariables ¶
func (o *OsArchesSpec) AsBuildEnvVariables() []string
type ProjectMetadata ¶
type ProjectMetadata struct {
Description string `json:"description,omitempty"` // what this project is used for
Website string `json:"website,omitempty"` // URL of homepage or such
Documentation string `json:"documentation,omitempty"` // URL of documentation website
ProjectEmojiIcon string `json:"project_emoji_icon,omitempty"` // to quickly differentiate projects in e.g. workspace switcher
}
type SubrepoSpec ¶
type SubrepoSpec struct {
Source string `json:"source"`
Kind versioncontrol.Kind `json:"kind"`
Destination string `json:"destination"`
Revision string `json:"revision"`
}
Click to show internal directories.
Click to hide internal directories.