Skip to content

Repository layout

Alex Santisteban edited this page Oct 22, 2026 · 3 revisions

This page describes the template contents and how to organize your own files.

Template contents

.github/
├── ci.yaml                  # CI configuration (see CI configuration reference)
└── workflows/
    ├── rock.yml             # "Rock pipeline": validate, build, test, upload
    └── threats.yml          # "Threat monitor": scheduled vulnerability scan
.gitignore                   # Ignores *.rock files, spread state and IDE files
CODEOWNERS                   # Placeholder, fill in
README.md                    # Placeholder, replace with your rock's README
File Purpose
.github/ci.yaml Tells the CI which rocks to build and where to publish them.
.github/workflows/rock.yml Calls canonical/rocks-actions' rock.yaml. Triggered on push/PR to main and manually. Has packages: write permission to publish to GHCR.
.github/workflows/threats.yml Calls canonical/rocks-actions' Security.yaml. Triggered daily at 01:00 UTC and manually. Has read-only permissions.
.gitignore Ignores *.rock, .craft-spread*/, .spread-reuse* and editor folders.
CODEOWNERS GitHub code owners. The last matching rule wins.

Both workflows reference rocks-actions by a pinned commit SHA.

Adding your rock

Single rock at the repository root (default)

The default .github/ci.yaml builds an image from the repository root (directory: "."), so the simplest layout is:

.github/...
rockcraft.yaml               # Rock project file
spread.yaml                  # Spread test configuration (optional, enables tests)
spread/
└── general/
    └── test/
        └── task.yaml        # A test

Hosting several rocks

A repository can hold any number of rocks. Each rock lives in its own directory, next to its own rockcraft.yaml and tests.

Single branch layout

A common convention is one directory per rock and version/base:

.github/...
my-rock/
├── 0.1-24.04/
│   ├── rockcraft.yaml
│   ├── spread.yaml
│   └── spread/general/test/task.yaml
└── 0.2-24.04/
    ├── rockcraft.yaml
    ├── spread.yaml
    └── spread/general/test/task.yaml
other-rock/
└── 1.0-22.04/
    └── rockcraft.yaml

Then list the directories in .github/ci.yaml:

images:
  - directory: "my-rock/0.1-24.04"
  - directory: "my-rock/0.2-24.04"
  - directory: "other-rock/1.0-22.04"

or build every directory containing a rockcraft.yaml with the wildcard:

images:
  - directory: "*"

Note

The directory names are free-form: the rock's name and image tag come from the rockcraft.yaml, not from the path. The path is however used to name the build artifact, so two images must not resolve to the same artifact name.

Important

If you move from the root layout to the multi-rock layout, remember to update (or remove) the directory: "." entry in .github/ci.yaml.

Multiple branch layout

A multiple branch layout is used when different branches correspond to different versions or bases of the rocks. Each branch contains its own set of directories for the rocks it maintains.

For example, you might have a main branch for the latest (devel) Ubuntu LTS base and a series of release branches for each track (e.g. 1.0-24.04, 2.0-26.04, etc.), maintaining the same layout across branches (rockcraft.yaml at the root).

main/
├── rockcraft.yaml
├── spread.yaml
└── spread/general/test/task.yaml

1.0-24.04/
├── rockcraft.yaml
├── spread.yaml
└── spread/general/test/task.yaml

Note

This layout will require to modify the rock.yml workflow to trigger builds for the appropriate branches.

Optional files

File Where Purpose
spread.yaml Next to rockcraft.yaml Enables rockcraft test; the CI runs the tests when this file exists.
.trivyignore Next to rockcraft.yaml Vulnerability IDs to ignore in the scheduled scan.
SECURITY.md Repository root Your security policy. See GitHub's guide for guidance on adding a security policy to your repository.

Clone this wiki locally