vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Publish release and run artifacts as file trees
5f2a0b0a7f84ec1bb43af5213e5c788039b72222 · Keenan Nemetz · 20d ago · parent 6d574bec
Publish release and run artifacts as file trees Release pointers and run outputs are now slash-separated paths. A flat name is a one-segment path, so every existing release, pointer, URL, and workflow that uses dist/* keeps working. - metadata validates artifact paths, lists and loads them recursively, and refuses a tag that would make the tag/path boundary ambiguous - vole release attach keeps a directory's relative paths; a plain file keeps its base name - a workflow match is published relative to the declaration's static root, so dist/* stays flat while dist/*/* keeps one directory level - release and run download routes accept nested paths; Content-Disposition still saves the base name - one internal rule is shared by the pointer writer, metadata validator, run record, CLI, and routes so they cannot disagree Refs: 01M7BPH6RRPK2934FCHVJPQNGY
ci/agent/agent.go +39−3
| @@ -1555,10 +1555,12 @@ func publishSite(remote string, co checkout, job *runnerJob, log io.Writer) erro | |||
| 1555 | 1555 | } | |
| 1556 | 1556 | ||
| 1557 | 1557 | // artifactFile is one matched output. Pattern is the declaration that matched it, | |
| 1558 | // because a pattern can also mean "publish this to the release". | ||
| 1558 | // because a pattern can also mean "publish this to the release". Name is the | ||
| 1559 | // path the artifact is published under: the file path relative to the declaration's | ||
| 1560 | // root, so a nested pattern can describe a tree. | ||
| 1559 | 1561 | type artifactFile struct { | |
| 1560 | 1562 | Path string // slash-separated, relative to the checkout | |
| 1561 | Name string // the download name: the file's base name | ||
| 1563 | Name string // slash-separated published path | ||
| 1562 | 1564 | Pattern string // the declaration that matched | |
| 1563 | 1565 | } | |
| 1564 | 1566 | ||
| @@ -1622,7 +1624,10 @@ func collectArtifactFiles(root string, patterns []string) ([]artifactFile, error | |||
| 1622 | 1624 | if !info.Mode().IsRegular() { | |
| 1623 | 1625 | return nil // a symlink or device: not an artifact | |
| 1624 | 1626 | } | |
| 1625 | name := path.Base(rel) | ||
| 1627 | name := artifactTarget(pat, rel) | ||
| 1628 | if err := metadata.ValidArtifactPath(name); err != nil { | ||
| 1629 | return fmt.Errorf("artifact %s would be published as %q: %w", rel, name, err) | ||
| 1630 | } | ||
| 1626 | 1631 | if prev, dup := byName[name]; dup { | |
| 1627 | 1632 | return fmt.Errorf("two files would be published as %q (%s and %s); rename one "+ | |
| 1628 | 1633 | "or narrow the patterns", name, prev, rel) | |
| @@ -1645,6 +1650,37 @@ func collectArtifactFiles(root string, patterns []string) ([]artifactFile, error | |||
| 1645 | 1650 | return files, nil | |
| 1646 | 1651 | } | |
| 1647 | 1652 | ||
| 1653 | // artifactTarget is the path a declaration publishes a matched file under. It is | ||
| 1654 | // the file path relative to the segments before the declaration's first glob, so | ||
| 1655 | // every existing flat pattern keeps its base name: | ||
| 1656 | // | ||
| 1657 | // dist/* -> vole.deb | ||
| 1658 | // dist/apt/* -> Packages | ||
| 1659 | // dist/*/* -> apt/Packages | ||
| 1660 | // dist/apt/Packages -> Packages (a literal pattern names one file) | ||
| 1661 | // | ||
| 1662 | // A pattern with a glob in its first segment is rooted at the checkout, which is | ||
| 1663 | // what its matches describe. | ||
| 1664 | func artifactTarget(pattern, file string) string { | ||
| 1665 | segments := strings.Split(pattern, "/") | ||
| 1666 | root := "" | ||
| 1667 | globbed := false | ||
| 1668 | for i, segment := range segments { | ||
| 1669 | if strings.ContainsAny(segment, "*?[") { | ||
| 1670 | root = strings.Join(segments[:i], "/") | ||
| 1671 | globbed = true | ||
| 1672 | break | ||
| 1673 | } | ||
| 1674 | } | ||
| 1675 | if !globbed { | ||
| 1676 | return path.Base(file) | ||
| 1677 | } | ||
| 1678 | if root == "" { | ||
| 1679 | return file | ||
| 1680 | } | ||
| 1681 | return strings.TrimPrefix(file, root+"/") | ||
| 1682 | } | ||
| 1683 | |||
| 1648 | 1684 | // execStep runs one shell step, heartbeating while it works. It returns the exit | |
| 1649 | 1685 | // code, whether the lease was lost, and whether a maintainer asked the run to stop. | |
| 1650 | 1686 | func (s *runnerSession) execStep(runID string, sandbox *container.Container, step runnerStep, limit time.Duration, lease time.Duration, out io.Writer) (int, bool, bool) { | |