{"id":2983,"date":"2019-09-25T19:10:13","date_gmt":"2019-09-25T07:10:13","guid":{"rendered":"https:\/\/www.deltics.co.nz\/blog\/?p=2983"},"modified":"2019-09-25T19:10:21","modified_gmt":"2019-09-25T07:10:21","slug":"duget-push-ing-packages","status":"publish","type":"post","link":"https:\/\/www.deltics.co.nz\/blog\/posts\/2983\/","title":{"rendered":"Duget &#8211; PUSH-ing Packages"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span>\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.deltics.co.nz\/blog\/posts\/2979\">We now know a little more about this <\/a><strong><a href=\"https:\/\/www.deltics.co.nz\/blog\/posts\/2979\">duget<\/a><\/strong><a href=\"https:\/\/www.deltics.co.nz\/blog\/posts\/2979\"> thing, and have seen how to create a package<\/a>.  But a package cannot be consumed &#8216;in situ&#8217; &#8211; it must be made available via a feed.  Which brings us to the <strong>PUSH<\/strong> command.<br><br><strong><em>NOTE: <\/em><\/strong><em>Don\u2019t worry, I have my priorities straight.  This post was written before <a href=\"https:\/\/www.deltics.co.nz\/blog\/posts\/2915\">Liev arrived<\/a>. \ud83d\ude42<\/em><\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">The PUSH Command<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To make a package available for consumption by other projects, it must be <strong>push<\/strong>ed to a feed.  The feeds available are identified in a <strong>duget<\/strong> configuration file named <strong>duget.config<\/strong>.  Actually, <em>multiple<\/em> <strong>duget.config<\/strong> files may be involved.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first is the &#8216;global&#8217; configuration, which is not strictly global but actually specific to the current user account.  Here&#8217;s mine:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-json\" data-line=\"\">{\n    packagesFolder: &quot;packages&quot;,\n    feeds: [\n        { name: &quot;alpha&quot;, folder: &quot;\\\\\\\\nuc\\\\duget\\\\alpha&quot; },\n        { name: &quot;release&quot;, folder: &quot;\\\\\\\\nuc\\\\duget\\\\feed&quot; },\n        { name: &quot;duget.org&quot;, url: &quot;https:\/\/api.duget.org\/v1\/index.json&quot; }\n    ],\n    disabledFeeds: [\u201cduget.org\u201d]\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>duget<\/strong> will load this configuration first and then look \u2019up\u2019 the folder hierarchy from the working location, looking for additional <strong>duget.config<\/strong> files.  If found these are then applied, furthest first.  This allows &#8220;local&#8221; configuration changes to be based on the &#8220;inherited&#8221; configuration to that point.  So for example I might introduce an additional <strong>feed<\/strong> to be used by projects in a certain folder, but projects in <em>another<\/em> folder won&#8217;t be aware of that additional feed (unless they are in a sub-folder).<\/p>\n\n\n\n<p class=\"has-background has-pale-cyan-blue-background-color wp-block-paragraph\">There are other variations that can be accomplished with local configs which I won&#8217;t go into here.  But if you&#8217;re familiar with <strong>nuget<\/strong> configuration, you will find this all very familiar.  \ud83d\ude09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>packagesFolder<\/strong> property identifies a folder to act as the package cache.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The Package Cache<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This is the first place that <strong>duget<\/strong> looks for packages when resolving dependencies.  Obviously when <strong>duget<\/strong> encounters a dependency on a package for the first time (either a new package <strong>id<\/strong> or a new version of a known package) it will not be in the cache and so <strong>duget<\/strong> will attempt to fetch that package from one of the configured feeds.  If successful, the package is stashed in the cache for future reference.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>feeds<\/strong> property then identifies the feeds that <strong>duget<\/strong> will use to try to find those packages that aren&#8217;t in the cache.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the example above you can see that I have multiple feeds configured.  The first two are the only two that are actually of any use currently.  The <strong>duget.org<\/strong> http feed is non-functional &#8211; <strong>duget<\/strong> ignores (or rejects) all <em>http<\/em> feeds for now.  In this case I have simply disabled the feed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Local configuration files can enable\/disable \u201cinherited\u201d feeds in the configuration as well as introducing new feeds.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The two file system feeds configured identify two folders that are shared by my build machine, each representing two feeds &#8211; an alpha feed or \u201cpre-release channel\u201d and a regular feed.  A similar configuration exists on that build machine.  So when a successful build produces an updated package, my dev machines can immediately consume both pre-release and release packages directly from the build machine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I can of course also push new packages from my dev machine as well, as long as I have the necessary permissions to the file share in question (this is the extent of any security in <strong>duget<\/strong> currently).<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"has-drop-cap wp-block-paragraph\">Pushing a new or updated package is the same whether from a build machine and uses the <strong>push<\/strong> command.  Again, to push <em>all<\/em> packages from the current folder to the default push feed you would simply:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code class=\"\" data-line=\"\">duget push<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With the configuration above this would fail since there is no default push feed configured and so one must be specified on the command line, e.g.:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code class=\"\" data-line=\"\">duget push --feed:alpha<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If there are multiple package files in the folder, specific packages may be selected for pushing by specifying those as arguments to the command (just the package id is needed):<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code class=\"\" data-line=\"\">duget push deltics.smoketest --feed:alpha<\/code><\/p>\n\n\n\n<p class=\"has-background has-luminous-vivid-amber-background-color wp-block-paragraph\">By default the package file will delete any pushed packages from the original folder.  This can be prevented by adding a <code class=\"\" data-line=\"\">&lt;strong&gt;--noDelete&lt;\/strong&gt;<\/code> switch.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"has-text-color has-background has-very-light-gray-color has-very-dark-gray-background-color wp-block-paragraph\">Thus far we&#8217;ve seen how <strong>duget<\/strong> can be used to create packages and make them available for use via one or more feeds.  Tomorrow we&#8217;ll look at how projects consume packages from those feeds with the <strong>restore<\/strong> and <strong>update<\/strong> commands.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span>We now know a little more about this duget thing, and have seen how to create a package. But a package cannot be consumed &#8216;in situ&#8217; &#8211; it must be made available via a feed. Which brings us to the PUSH command. NOTE: Don\u2019t worry, I have my priorities straight. This post was written before [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2981,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Duget - how to publish packages to make them available for consumption in projects.","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[324,323,4,321,346],"tags":[292,344,345],"class_list":["post-2983","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-automation","category-ci-cd","category-delphi","category-devops","category-duget","tag-delphi","tag-duget","tag-packages"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/duget-warriors.png?fit=929%2C256&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1TKYv-M7","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/2983","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/comments?post=2983"}],"version-history":[{"count":4,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/2983\/revisions"}],"predecessor-version":[{"id":2996,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/2983\/revisions\/2996"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/media\/2981"}],"wp:attachment":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/media?parent=2983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/categories?post=2983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/tags?post=2983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}