-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reference YAML template from another VSTS project #1633
Comments
@patrickcarnahan is variable-group-support within the yaml file rolling out with the current deployment? |
Yes this is rolling out with our current sprint, allowing variables/variable groups both at the root level and at the phase level. The variables are an ordered list and will be applied in the order defined within the file. @wsmckenz once this reaches the scale unit where your account is hosted would you like for us to enable the feature for you so you can take advantage and provide early feedback? Given where your account is located (one of our last rings for deployment) it may take up to a week or more before the variable group changes reach your account. |
Excellent news, and yes, absolutely would like to do that. Who do I have to bribe to get ussc up into an earlier ring? |
So, what about request #1? Are cross-project repository resources on the road map at all? Just trying to figure out if it is coming at some point, or really hard to do for some reason? |
@wsmckenz it's not that it is hard to do we just haven't implemented it yet. I will see if I can fit it in to our current sprint, which would roll out in approximately 3 weeks. If it turns out to be low risk and simple I can certainly looking at back-porting to our current rollout. I will let you know once I know more. |
Excellent, thanks for the response. Love what you guys are doing with these features. |
Hello everyone, any update about this issue ? |
Sorry for the delay @wsmckenz we haven't forgotten about this. It's on the backlog, and we just haven't gotten to it yet. |
@camillemahaut variable groups has rolled out everywhere I believe, I don't think we have docs for this yet. Here is the syntax: variables:
- name: var1 # this is a regular variable named var1
value: val1
- group: group1 # this is a reference to a variable group named group1 @patrickcarnahan @vtbassmatt fyi do we have docs for this in a user branch or anywhere? |
I'm interested in this bit as well:
Looking at the example from here: #1307 (comment) That issue is closed so commenting here. In this example, do the template and the 'entry' YAML need to be in the same repository? If not, how do you specify a template in a remote repository? The requirement is to have a shared template, and then multiple projects with the 'entry' in their own repositories could reference it. I'm also struggling to find definitive resource documentation for how to use templates in Azure Pipelines/DevOps - can someone point me to it? |
You can have templates in a different repo. You'll have to refer to the external repo in the In MyOrg/Service, your YAML might look like this: resources:
repositories:
- repository: templates
type: github
name: templates
steps:
- template: common_template.yml@templates And in MyOrg/Templates, we'd expect to find steps:
- script: ./build.sh
displayName: Build
- script: ./test.sh
displayName: Test If there are things I can do to make the docs more clear, please feel free to open an issue at https://github.com/MicrosoftDocs/vsts-docs/issues. Thanks! |
Thanks @vtbassmatt, that schema reference doc explains most things in detail. Just what I was looking for 👍 |
looks like you can now reference repos in another project. just tried this out and it works great. Thanks! |
Does this reference still need to be at the root of the template repository? I would like to have one repository for my templates and then split the release and build templates into their own folders. |
No, and I see how my comment a few years ago was misleading - but it never did 😁 It was only in that example where it looked at the root. You could just as easily have said: resources:
repositories:
- repository: templates
type: github
name: templates
steps:
- template: some/nested/dir/common_template.yml@templates And then it would look in |
I did something very similar with resources:
repositories:
- name: templates
type: git
repository: MyProject/template-repo
steps:
- template: templates/build/template-steps-build.yml@templates and I was told that there was no YAML file at that location. |
Hmm... maybe I'm missing a leading |
When I'm back in work I'll take a look, but it sounds like it needs to be resources:
repositories:
- name: templates
type: git
repository: MyProject/template-repo
steps:
- template: /templates/build/template-steps-build.yml@templates |
Is there a way where I would want to reference a file path from the current yml location into the template from other repository? |
Have you tried trouble shooting?
Trouble shooting doc
Agent Version and Platform
2.115
OS of the machine running the agent? Linux
VSTS Type and Version
VisualStudio.com
If VisualStudio.com, what is your account name? http://chevron.visualstudio.com
What's not working?
Repository resources. Do you have plans to allow a reference to a repository in another project? This is super critical for us. We have several hundred projects, and would like share common build phases across them. The syntax of Project/Repo in the name field would be ideal.
Library Variable Groups. Any plans to make those available as a resource in the yaml? This would greatly reduce the number of manual steps required to modify the build after pushing the initial .vsts-ci.yml. Again, cross-project would be nice, but really not as critical as sharing build steps across projects.
Agent and Worker's Diagnostic Logs
n/a
The text was updated successfully, but these errors were encountered: