{"id":238276,"date":"2022-07-22T02:33:00","date_gmt":"2022-07-22T06:33:00","guid":{"rendered":"https:\/\/wordpress-756359-3782526.cloudwaysapps.com\/?p=238276"},"modified":"2025-05-30T07:23:45","modified_gmt":"2025-05-30T07:23:45","slug":"22-07-22-buildimports","status":"publish","type":"post","link":"https:\/\/www.travis-ci.com\/blog\/22-07-22-buildimports\/","title":{"rendered":"Build Imports in Travis"},"content":{"rendered":"\n<p>Sometimes you need a really dynamic configuration when setting up your pipeline. With imported configs, those configs can themselves include other configs, making this feature very composable (cyclic imports will be skipped). Let\u2019s get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"getting-started-with-build-imports\">Getting started with Build Imports<\/h2>\n\n\n\n<p>When using Build Imports, remember that the main source of configuration for your build is the&nbsp;<code>.travis.yml<\/code>&nbsp;file stored in the root directory of your project. So for example, here\u2019s my root&nbsp;<code>.travis.yml<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>language: ruby\n\nscript: echo \"It's Friday, which means blog day by Montana Mendy!\"\n\nimport:\n  - .\/.travis\/all-the-rubies.yml\n  - .\/.travis\/only-some-branches.yml<\/code><\/pre>\n\n\n\n<p>Now, let\u2019s make a folder called in your project called\u00a0<code>.travis<\/code>, and in there, we\u2019ll have a file called\u00a0<code>all-the-rubies.yml<\/code>, here\u2019s the content of this configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rvm:\n  - 2.2\n  - 2.3<\/code><\/pre>\n\n\n\n<p>You\u2019ll see the second imported configuration entitled\u00a0<code>only-some-branches.yml<\/code>\u00a0in the\u00a0<code>.travis<\/code>\u00a0folder in our project. Now here\u2019s the content of that configuration file I made:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>branches:\n  only:\n    - master\n    - develop<\/code><\/pre>\n\n\n\n<p>So you can see above, there\u2019s one master&nbsp;<code>.yml<\/code>&nbsp;config, and you can think of the other two configurations as&nbsp;<code>child<\/code>&nbsp;configurations. You can imagine with our Build Matrix feature and using Build Imports how flexible your builds can really be.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>You\u2019ve just used Build Imports in Travis like a pro! As per usual here\u2019s an example&nbsp;<a href=\"https:\/\/github.com\/Montana\/travis-build-import\">repo<\/a>&nbsp;I\u2019ve made so you can follow it step by step and start using Build Imports.<\/p>\n\n\n\n<p>As always, if you have any questions about Build Imports, please email me at&nbsp;<a href=\"mailto:montana@travis-ci.org\">montana@travis-ci.org<\/a>&nbsp;and I will assist you.<\/p>\n\n\n\n<p>Happy building!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you need a really dynamic configuration when setting up your pipeline. With imported configs, those configs can themselves include other configs, making this feature very composable (cyclic imports will be skipped). Let\u2019s get started. Getting started with Build Imports When using Build Imports, remember that the main source of configuration for your build is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_breakdance_hide_in_design_set":false,"_breakdance_tags":"","footnotes":""},"categories":[16],"tags":[7,19,20,5],"class_list":["post-238276","post","type-post","status-publish","format-standard","hentry","category-news","tag-community","tag-feature","tag-infrastructure","tag-news"],"_links":{"self":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/comments?post=238276"}],"version-history":[{"count":1,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238276\/revisions"}],"predecessor-version":[{"id":242645,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238276\/revisions\/242645"}],"wp:attachment":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/media?parent=238276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/categories?post=238276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/tags?post=238276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}