Skip to content

Commit

Permalink
Add documentation for PackageDependencies (#510)
Browse files Browse the repository at this point in the history
* Add documentation for PackageDependencies and update relevant docs with links to it

* Update dependenceies with better descriptions and info
  • Loading branch information
bchuo authored Feb 7, 2025
1 parent 273fa5d commit 9a8651c
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
97 changes: 97 additions & 0 deletions website/docs/dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: Dependencies
---

`PackageDependencies` specifies dependency information for a particular package. This includes dependencies for runtime, which will be installed along with the package by the package manager, as well as any dependencies needed to build and/or test the resulting package. Configuration for any additional package repositories which are required may also be added here.

### Fields

- **Build**: The list of packages required to build the package.
```yaml
build:
package_name:
version: [">=1.0.0", "<2.0.0"]
arch: ["amd64", "arm64"]
```
- **Runtime**: The list of packages required to install/run the package.
```yaml
runtime:
package_name:
version: [">=1.0.0", "<2.0.0"]
arch: ["amd64", "arm64"]
```
- **Recommends**: The list of packages recommended to install with the generated package.
```yaml
recommends:
package_name:
version: [">=1.0.0", "<2.0.0"]
arch: ["amd64", "arm64"]
```
:::note
Each of the above fields is a list of [PackageConstraints](https://pkg.go.dev/github.com/Azure/dalec#PackageConstraints).
:::
- **Test**: Lists and extra packages required for running tests. These are only installed for tests which have steps that require running a command in the built container. See [TestSpec](https://pkg.go.dev/github.com/Azure/dalec#TestSpec) for more information
```yaml
test:
- package_name_1
- package_name_2
```
- **ExtraRepos**: Used to inject extra package repositories that may be used to satisfy package dependencies in various stages.
```yaml
extra_repos:
- keys:
mykey:
http:
URL: "https://example.com/mykey.gpg"
permissions: 0644
config:
myrepo:
http:
url: "https://example.com/myrepo.list"
data:
- dest: "/path/to/dest"
spec: source
envs: ["build", "test", "install"]
```
See [repositories](repositories.md) for more details on repository configs.
### Example
```yaml
dependencies:
build:
gcc:
version: [">=9.0.0"]
arch: ["amd64"]
runtime:
libc6:
version: [">=2.29"]
recommends:
curl:
version: [">=7.68.0"]
test:
- bats
extra_repos:
- keys:
mykey:
http:
url: "https://example.com/mykey.gpg"
permissions: 0644
config:
myrepo:
http:
url: "https://example.com/myrepo.list"
# this assumes that a build context named `my-local-repo` containing a local repository will be passed
# to the Dalec build.
# /opt/repo can now be referenced as a local repository in a repository config imported to dalec
data:
- dest: "/opt/repo"
spec:
context:
name: "my-local-repo"
envs: ["build", "install"]
```
16 changes: 16 additions & 0 deletions website/docs/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,24 @@ dependencies:
runtime:
- libfoo
- libbar
recommends:
- libcafe
test:
- kind
extra_repos:
- libdecaf
```

`Build` dependencies are the list of packages required to build the package.

`Runtime` dependencies are the list of packages required to install/run the package.

`Recommends` dependencies are the list of packages recommended to install with the generated package.

`Test` dependencies list packages required for running tests. These packages are only installed for tests which have steps that require running a command in the built container.

See [dependencies](dependencies.md) for more details on dependency options.

Sometimes you may need to add extra repositories in order to fulfill the
specified dependencies.
You can do this by adding these to the `extra_repos` field.
Expand Down
1 change: 1 addition & 0 deletions website/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const sidebars: SidebarsConfig = {
items: [
'spec',
'sources',
'dependencies',
'targets',
'testing',
'artifacts',
Expand Down

0 comments on commit 9a8651c

Please sign in to comment.