{"id":37806,"date":"2017-11-15T12:00:00","date_gmt":"2017-11-15T12:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/devops\/?p=37806"},"modified":"2019-02-14T15:50:33","modified_gmt":"2019-02-14T23:50:33","slug":"pipeline-as-code-yaml-preview","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/pipeline-as-code-yaml-preview\/","title":{"rendered":"Pipeline as code (YAML) preview"},"content":{"rendered":"<p>The ability to <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/330519-visual-studio-team-services\/suggestions\/2037625-provide-a-way-to-version-control-build-definitions\">store your CI build in source control<\/a> has been a long running request for VSTS and TFS garnering more than 650 votes on user voice.\u00a0 Having your CI defined alongside your application source gives you the ability to evolve your CI as your code evolves and to apply source centric workflows like pull requests and code reviews to your CI.\u00a0 Today we are excited to preview support for defining your VSTS Build pipelines using YAML files checked into your source repository.<\/p>\n<p>To get started you will first need to opt-in to the \u201cBuild YAML definitions\u201d preview feature for your account.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/image223.png\"><img decoding=\"async\" width=\"208\" height=\"244\" title=\"image\" style=\"margin: 0px\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/11\/image_thumb200.png\" border=\"0\" \/><\/a><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/image224.png\"><img decoding=\"async\" width=\"464\" height=\"272\" title=\"image\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2017\/11\/image_thumb201.png\" border=\"0\" \/><\/a><\/p>\n<p>Once that flag is on you can simply create a<strong> .vsts-ci.yml<\/strong> file in the root of your Git repository in VSTS and paste the following content<\/p>\n<p><span style=\"font-family: Consolas\">queue: Hosted VS2017 <\/span><\/p>\n<p><span style=\"font-family: Consolas\">steps: <\/span><\/p>\n<p><span style=\"font-family: Consolas\">&#8211; script: echo hello world<\/span><\/p>\n<p>finally commit your changes and you should see a new build definition in your account with the same name as your repo automatically configured to run on any change to the master branch.<\/p>\n<p>The preview today only works for CI but as we continue to mature the feature set we will bring CD online as well.\u00a0 It is also important to note that this is really just a new definition type over the same automation system that you have been using on VSTS for years.\u00a0 All of the inbox, custom and marketplace tasks can be used and it is fully supported on both private and hosted agents.<\/p>\n<p>To learn more please checkout the <a href=\"https:\/\/docs.microsoft.com\/vsts\/build-release\/actions\/build-yaml-get-started\">tutorials on docs<\/a> and the <a href=\"https:\/\/github.com\/Microsoft\/vsts-agent\/blob\/master\/docs\/preview\/yamlgettingstarted.md\">details on github<\/a>.<\/p>\n<p>For feedback please feel free to open an <a href=\"https:\/\/github.com\/Microsoft\/vsts-agent-docker\">issue on Github<\/a> or <a href=\"https:\/\/twitter.com\/chrisrpatterson\">send me a tweet<\/a>.\u00a0 I look forward to hearing from you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ability to store your CI build in source control has been a long running request for VSTS and TFS garnering more than 650 votes on user voice.\u00a0 Having your CI defined alongside your application source gives you the ability to evolve your CI as your code evolves and to apply source centric workflows like [&hellip;]<\/p>\n","protected":false},"author":167,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[226,1],"tags":[],"class_list":["post-37806","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ci","category-devops"],"acf":[],"blog_post_summary":"<p>The ability to store your CI build in source control has been a long running request for VSTS and TFS garnering more than 650 votes on user voice.\u00a0 Having your CI defined alongside your application source gives you the ability to evolve your CI as your code evolves and to apply source centric workflows like [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/37806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/167"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=37806"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/37806\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=37806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=37806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=37806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}