server
server copied to clipboard
feat(templates): support same-repo templates using build commit
When working with templates that are found in the same repo as the Vela file, any live edits to the templates requires the users to reference their specific branch in the templates block. Example:
templates:
- name: sample
source: https://github.com/<org>/<repo>/path/template.yml@feature-branch
type: github
With this change, users can specify the type commit
in their templates block, which will automatically fetch the template from the commit associated with the build. Example:
templates:
- name: sample
source: path/template.yml
type: commit
Codecov Report
Merging #713 (68d7183) into main (cd67f9a) will increase coverage by
0.00%
. The diff coverage is54.83%
.
@@ Coverage Diff @@
## main #713 +/- ##
=======================================
Coverage 54.79% 54.79%
=======================================
Files 216 216
Lines 16015 16046 +31
=======================================
+ Hits 8776 8793 +17
- Misses 6857 6869 +12
- Partials 382 384 +2
Impacted Files | Coverage Δ | |
---|---|---|
compiler/native/expand.go | 70.68% <54.83%> (-3.07%) |
:arrow_down: |
@ecrupper I feel like we should have the type
be either github-commit
or commit-github
incase we want to add additional source code systems in the future.
@ecrupper I feel like we should have the
type
be eithergithub-commit
orcommit-github
incase we want to add additional source code systems in the provider.
Naming is definitely a pain point with this PR 😅 . I agree github
should be somewhere in the name. github-commit
, github-repo
, github-relative
, github-local
all come to mind...
this would be really nice for local pipeline execution via vela exec pipeline
- even without checking code in. but i think the current implementation doesn't suit itself for that. part of the reason i thought this can be scm agnostic and the type be relative
or file
. thoughts around that?
this would be really nice for local pipeline execution via
vela exec pipeline
- even without checking code in. but i think the current implementation doesn't suit itself for that. part of the reason i thought this can be scm agnostic and the type berelative
orfile
. thoughts around that?
Is that what c.local
bit does?
https://github.com/go-vela/server/blob/56932446fdc545d44162da499f7318ad34994c77/compiler/native/expand.go#L170-L179
I kind of like relative
- but that might suggest that it is relative to the current file vs relative to the repo root.
I think I could grow to like file
even better. The more I think about this one, I think I like it a lot.
Is that what c.local bit does?
busted! forgot about that. 🫣
@cognifloyd i think your feedback is addressed
@ecrupper we will need to add to docs too