posit-dev / posit-dev/images-shared

Centralize Goss tests for use across multiple projects

Open
#458 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cvp:0 docker tdp:3
Dominant language
Python
Stars
2
Forks
0
Avg merge
4d 13h
Merged PRs (30d)
22

Description

[!NOTE]
Moved from rstudio/platform-team#411

Context

Each product image repo has its own goss test templates that follow similar patterns — user/group checks, file permissions, process/port assertions, package verification. These patterns are duplicated across repos with no shared test library.

Proposed Approach: goss.d/ with shared include files

Goss supports a gossfile directive that includes other goss files using local paths with glob patterns:

# goss.yaml
gossfile:
    goss.d/*.yaml: {}

This is the pattern used in rstudio/marketplaces, where tests are split into modular files per concern:

tests/
├── goss.yaml              # 3 lines — just the gossfile include
└── goss.d/
    ├── apt-packages.yaml
    ├── apt-dpkg-lock.yaml
    ├── r-versions.yaml
    ├── python-versions.yaml
    ├── posit-connect.yaml
    └── ...
Shared files for the images ecosystem

Reusable goss test files would live in images-shared and be copied into each product repo's test path before dgoss runs. Organized as:

goss.d/
├── shared/
│   ├── users.yaml           # Common user/group assertions
│   ├── apt-locks.yaml       # No held apt/dpkg locks
│   └── file-permissions.yaml
├── r.yaml                   # R version checks
├── python.yaml              # Python version checks
├── quarto.yaml              # Quarto installation verification
└── tinytex.yaml             # TinyTeX installation verification

Goss supports Go templates natively with {{ .Env.VAR }} for environment variables and {{ .Vars.key }} for variables passed via --vars. This means shared files can be parameterized without Jinja2:

# goss.d/r.yaml
command:
  "R version installed":
    exec: "/opt/R/{{ .Env.BUILD_ARG_R_VERSION }}/bin/R --version"
    exit-status: 0

Each product repo's goss.yaml includes shared files plus product-specific tests:

# images-connect goss.yaml
gossfile:
    goss.d/shared/*.yaml: {}
    goss.d/connect/*.yaml: {}
Integration with bakery

The shared goss files need to be available in the test path when bakery run dgoss executes. Options:

  1. setup-bakery copies shared goss files into the image's test directory as a setup step
  2. bakery itself copies them during run dgoss if a shared goss path is configured
  3. Symlinks or git submodules in each product repo pointing to images-shared

Option 1 is simplest and matches the existing setup-bakery / setup-goss action pattern.

Current State

Shared infrastructure:

  • setup-goss/ — GitHub Action that installs goss/dgoss
  • goss.j2 — 6-line Jinja2 macro (build-arg env var helper only)
  • bakery run dgoss — CLI command to execute goss tests, sets GOSS_FILES_PATH to the image's test directory

Per-repo goss templates:

Reference implementation:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing setup-goss/, the goss.j2 macro, and the bakery run dgoss entry point, then compare the existing product-repo templates with rstudio/marketplaces/tests/. Done means shared goss.d files are organized in images-shared, made available in the test path, and usable across the listed product repositories.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, yaml
Domain
build-system, devops, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.