canonical / canonical/spread

Feature Request: add common snippet to task.yaml that is run before the prepare, execute, and restore sections

Open
#108 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
127
Forks
81
PR merge metrics
No merged PRs in 30d

Description

Oftentimes we have code like this in our task.yamls:

```yaml
prepare: |
#shellcheck source=tests/lib/nested.sh
. "$TESTSLIB/nested.sh"
prepare_something_from_nested.sh

restore: |
#shellcheck source=tests/lib/nested.sh
. "$TESTSLIB/nested.sh"
restore_something_from_nested.sh

execute: |
#shellcheck source=tests/lib/nested.sh
. "$TESTSLIB/nested.sh"
execute_something_from_nested.sh
```

it would be nice if we could somehow simplify this with just

```yaml
common: |
#shellcheck source=tests/lib/nested.sh
. "$TESTSLIB/nested.sh"

prepare: |
prepare_something_from_nested.sh

restore: |
restore_something_from_nested.sh

execute: |
execute_something_from_nested.sh

```

this would reduce a lot of duplication we have in our spread task.yaml's in snapd.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the task.yaml handling and execution entry points in the spread repository, then trace how prepare, execute, and restore sections are run. Check the existing tests for task.yaml parsing and execution; done means a common section is accepted and run before each of those sections, with coverage confirming the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, shell, yaml
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.