Skip to content

Commit

Permalink
Add docs for artifacts
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Goff <[email protected]>
  • Loading branch information
cpuguy83 committed Sep 20, 2024
1 parent 7333747 commit 5b54449
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 0 deletions.
221 changes: 221 additions & 0 deletions website/docs/artifacts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# Artifacts

Artifacts are used to configure what actually gets installed with a package.
Anything that needs to be installed needs an entry in the artifacts section.

There are different types of artifacts which are installed to different locations
on the target system.
What location this is depends on the target OS/distro and the kind of artifact.


## Artifact Configuration

Most artifact types share a common data type so can be configured similarly.
It is shown here as a reference which is linked to in the artifact descriptions
where it is pertinent.

Configuration options:

- *subpath*(string): The provided path is joined to the typicall install path,
e.g. `/usr/bin/<subpath>`, where the artifact will be
installed to.
- *mode*(octal): file permissions to apply to the artifact.


### Binaries

Binaries are binary files that may be executed.
On Linux these would typically get installed into `/usr/bin`.

Binaries are a mapping of file path to [artifact configuration](#artifact-configuration).
The file path is the path to a file that must be available after the build
section has finished.

Example:

```yaml
artifacts:
binaries:
build_output/my_bin:
subpath: ""
mode: 0o755
```
You may use a trailing wildcard to specify multiple binaries in a directory,
though behavior may differ between different OS's/distros.
### Manpages
Manpages is short for manual pages.
On Linux these are typically installed to `/usr/share/man`

Manpages are a mapping of file path to [artifact configuration](#artifact-configuration).
The file path is the path to a file that must be available after the build
section has finished.

```yaml
artifacts:
managpes:
src/man/*:
subpath: ""
mode: 0o755
```

You may use a trailing wildcard to specify multiple binaries in a directory,
though behavior may differ between different OS's/distros.

### Data Dirs

Data dirs are a list of read-only, architecture-independent data files.
On Linux these typically get placed into `/usr/share` on Linux.

Data dirs are a mapping of file path to [artifact configuration](#artifact-configuration).
The file path is the path to a file that must be available after the build
section has finished.

```yaml
artifacts:
data_dirs:
build_output/my_bin:
subpath: ""
mode: 0o755
```

### Directories

Directories allows you to create new directories when installing the package.
Two types of directory artifacts are supported:

1. *config*: This is a directory where configuration files typically go, e.g. /etc/my_package2. *State*: This is directory for persistant state, typically in `/var/lib` on Linux.


Unlinke many other artifact types, this does not reference any file produced
by build. Instead these are created as empty directories.

Example:

```yaml
artifacts:
createDirectories:
state:
mystate:
mode: 0o755
config:
myconfig:
mode: 0o755
```

### Config Files

Config files are, depending on the package manager, specially marked as configuration.
Typically these go under `/etc` on Linux.

Config files are a mapping of file path to [artifact configuration](#artifact-configuration).
The file path is the path to a file that must be available after the build
section has finished.

```yaml
artifacts:
configFiles:
src/my_config.json:
subpath: ""
mode: 0o755
```

### Docs

Docs are general documentation, not manpages, for your package.
On Linux these typically go under `/usr/share/doc/<package name>`

Docs are a mapping of file path to [artifact configuration](#artifact-configuration).
The file path is the path to a file that must be available after the build
section has finished.

```yaml
artifacts:
docs:
src/doc/info.md:
subpath: ""
mode: 0o755
```

You may use a trailing wildcard to specify multiple binaries in a directory,
though behavior may differ between different OS's/distros.

### Licenses

Licenses are license files to be installed with the package.

Licenses are a mapping of file path to [artifact configuration](#artifact-configuration).
The file path is the path to a file that must be available after the build
section has finished.

```yaml
artifacts:
licenses:
src/LICENSE.md:
subpath: ""
mode: 0o755
```

### Systemd

Systemd artifacts are used for installing systemd unit configurations.
Two different types of systemd configurations are currently supported:

1. Unit files - including services, sockets, mounts, or any other systemd unit type.
2. Drop-ins - Adds customization to an existing systemd unit

See the systemd documentation for more details on these types.

Example:

```yaml
artifacts:
systemd:
units:
src/contrib/init/my_service.service:
enable: false
name: ""
dropins:
src/contrib/init/customize-a-thing.service:
enable: false
name: ""
```

### Libs

Libs are library files to be included with your package.
On Linux these typically go under `/usr/lib/<package>`.

Licenses are a mapping of file path to [artifact configuration](#artifact-configuration).
The file path is the path to a file that must be available after the build
section has finished.

```yaml
artifacts:
libs:
my_output_dir/lib.o:
subpath: ""
mode: 0o755
```

You may use a trailing wildcard to specify multiple binaries in a directory,
though behavior may differ between different OS's/distros.

### Links

Links are a list of symlinks to be included with the package.
Unlike most other artifact typtes, links do not reference any specific build
artifact but rather a literal source to target mapping for the symlink.

Example:

This creates a symlink at /usr/bin/go pointing to /usr/lib/golang/go.

```yaml
artifacts:
links:
- source: /usr/lib/golang/go
dest: /usr/bin/go
```
2 changes: 2 additions & 0 deletions website/docs/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ artifacts:
subpath: man8
```

For more information, please see [Artifacts](artifacts.md)

## Tests section

Tests section is used to define the tests for the spec. These tests can be used to define the test cases, steps, or any other tests needed for the package.
Expand Down
1 change: 1 addition & 0 deletions website/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const sidebars: SidebarsConfig = {
'sources',
'targets',
'testing',
'artifacts',
],
},
{
Expand Down

0 comments on commit 5b54449

Please sign in to comment.