<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by David Dooling on Medium]]></title>
        <description><![CDATA[Stories by David Dooling on Medium]]></description>
        <link>https://medium.com/@dooling?source=rss-2362b8f065cd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*I3__GF2ACxgDxsDz.</url>
            <title>Stories by David Dooling on Medium</title>
            <link>https://medium.com/@dooling?source=rss-2362b8f065cd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:14:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dooling/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Atomist blog has moved…]]></title>
            <link>https://medium.com/the-composition/the-atomist-blog-has-moved-54cf7507bf79?source=rss-2362b8f065cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/54cf7507bf79</guid>
            <category><![CDATA[developer-experience]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[atomist]]></category>
            <dc:creator><![CDATA[David Dooling]]></dc:creator>
            <pubDate>Mon, 26 Aug 2019 18:51:28 GMT</pubDate>
            <atom:updated>2019-08-26T18:51:28.028Z</atom:updated>
            <content:encoded><![CDATA[<p>Please visit <a href="https://blog.atomist.com/">blog.atomist.com</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WP-fyCQ-B5fcTd5lFBjyDQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54cf7507bf79" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-composition/the-atomist-blog-has-moved-54cf7507bf79">The Atomist blog has moved…</a> was originally published in <a href="https://medium.com/the-composition">The Composition</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes, the easy way]]></title>
            <link>https://medium.com/the-composition/kubernetes-the-easy-way-b65c212b7f2d?source=rss-2362b8f065cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/b65c212b7f2d</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[atomist]]></category>
            <dc:creator><![CDATA[David Dooling]]></dc:creator>
            <pubDate>Wed, 13 Jun 2018 05:55:48 GMT</pubDate>
            <atom:updated>2019-06-24T15:57:59.662Z</atom:updated>
            <content:encoded><![CDATA[<h4>Atomist: the fastest way to deploy your services to Kubernetes</h4><p><a href="https://kubernetes.io/">Kubernetes</a> has come a long way since its release a few short years ago, so has the ecosystem of tools surrounding it. What began as a single command-line tool, kubectl, for interacting with the Kubernetes API has grown into a rich ecosystem of tools for developing, deploying, and reporting on applications in Kubernetes.</p><p>We were early adopters of Kubernetes at <a href="https://atomist.com/">Atomist</a>, having used it to host our services for over two years. We love Kubernetes’ simplicity and reliability and appreciate its rapidly growing feature set. We’ve also watched with keen interest the growing ecosystem of tools around Kubernetes, tools like <a href="https://helm.sh/">Helm</a>, <a href="https://ksonnet.io/">ksonnet</a>, <a href="https://jenkins.io/blog/2018/03/19/introducing-jenkins-x/">Jenkins X</a>, <a href="https://github.com/GoogleContainerTools/skaffold">Skaffold</a> and <a href="https://github.com/Azure/draft">Draft</a> for smoothing the development and deployment workflow. While these tools are great, as we began to manage running more services on more Kubernetes clusters across a variety of environments, we really wanted something that better fit <em>our</em> workflow. We wanted a solution that was simple, yet flexible, a solution that allowed us, as developers, to leverage our tools and expertise to deliver our software with a minimum of fuss and ceremony. Naturally, we turned to our Software Delivery Machine (SDM) for a better solution.</p><p><a href="https://the-composition.com/why-you-need-a-software-delivery-machine-85e8399cdfc0">Why You Need a Software Delivery Machine</a></p><p>Using our knowledge of Kubernetes, we knew we could provide a seamless onramp onto Kubernetes for new and existing services alike. Using the SDM, we knew we could provide a powerfully customizable experience for services that don’t quite fit the generic build-test-deploy mold. At Atomist, we think how you deliver software is as important as how you develop software. After all, software that just sits on your laptop isn’t helping anyone. We’ve created the idea of an SDM to encapsulate this belief: <em>delivery as development</em>. Delivering software is not distinct from developing software. As such, we should be able to use our entire developer toolkit to engineer our delivery, not be limited to Bash and YAML. Plus, with an SDM we are integrated into Atomist’s other features: rich, actionable development lifecycle notifications and messages providing a rich ChatOps interface.</p><p><a href="https://the-composition.com/slack-integrations-459b2f1e6bf6">Slack Integrations++</a></p><p>Let’s take a look at how you can deploy applications to Kubernetes using Atomist.</p><h3>Deploying to Kubernetes</h3><p>At Atomist, we think of delivery more holistically than adding some Bash scripts into your CI pipeline. In the beginning there’s an idea for a new service and a need to create a new project. The SDM fulfills this need via <em>generators</em> which, eschewing templates or copy-and-paste, transform any existing real, compilable project into a new, properly restructured and refactored project for your service.</p><p><a href="https://the-composition.com/turn-any-repo-into-a-software-factory-exploring-spring-5-and-kotlin-2f58283421a2">Turn Any Repo Into a Software Factory: Exploring Spring 5 and Kotlin</a></p><p>Once the project is created, the SDM is able to inspect the project and, since Atomist understands code, it is able to build and test the project <em>and</em> can offer to add a technology appropriate Dockerfile to the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oGPVafl5SG0m4H6rhp1MZg.png" /><figcaption>The SDM checks out the project, checks and builds it, and offers to add a Dockerfile.</figcaption></figure><p>When you click the “Add Dockerfile” button, the SDM checks out the project, creates a branch, makes, commits &amp; pushes the change, and then opens a pull request (PR) for you to review. Atomist development lifecycle messages keeps you up to date on the SDM’s activity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sEM9LIpAJB0KLEhguq0kBQ.png" /><figcaption>Dockerfile branch build and PR. Note the additional Docker build goal.</figcaption></figure><p>Notice how the list of goals have changed from the previous commit to this one. The SDM has recognized that this branch has a Dockerfile and it knows how our team builds and pushes Docker images, so it does that for us without us having to modify a build script or CI configuration. After the build passes, we have the option to merge the PR right in chat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3MJHGqPdK5RtbsFFmZiozg.png" /><figcaption>After we merge the PR, the SDM builds and deploys the new commit in master.</figcaption></figure><p>When we click the “Merge” button, Atomist merges the commit into master and the SDM sees the new commit and responds with a further expanded set of goals. Now that we have a Dockerfile on the default branch, the SDM, knowing how to deploy our services to Kubernetes, goes ahead and deploys the new Docker container to the testing namespace of our Kubernetes cluster.</p><p>At this point we could have the SDM run integration tests in our testing environment or, as we do here, have it provide a button to allow a qualified user to approve the testing deployment, effectively promoting it to production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4xfgTZ5tXCJHNMyeOJ5mA.png" /><figcaption>In a matter of minutes, our new service is running in production.</figcaption></figure><p>After pushing the button, the SDM promotes the service to production and, for good measure, creates a tag for the released semantic version and promotes that tag to a GitHub release.</p><h3>Closing the ChatOps Loop</h3><p>You may have noticed near the bottom of the development lifecycle messages the attachments for Services and Containers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N_468b_-Fz-v3ElH7Wxunw.png" /><figcaption>Reporting of running services in Kubernetes.</figcaption></figure><p>The Services tell us what is running where from the service’s perspective. When each instance of our service spins up, it posts an application payload to an Atomist webhook endpoint. The Containers tell us what is running where from Kubernetes’ perspective. Atomist listens for Kubernetes pod changes and uses them to learn what images are running in what pods. Atomist connects these running services and container images with their commits and renders them all together in chat. With a glance, you can see what is running where and assess if a service is functioning properly.</p><p>At some later point, let’s say we deploy a version that, despite our best efforts, has a bug. Since we used an actual service as the basis for our new project, our new service already has <a href="https://sentry.io/">Sentry</a> wired up and capturing errors. Atomist receives the alerts from Sentry, correlates them to a commit and running instance of the service, and offers to roll back to previous known good versions, i.e., versions with no Sentry alerts, of the service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fa3qdgZkCLyXCOww03xdUw.png" /><figcaption>Closing the ChatOps loop, surfacing alerts and providing means for resolution.</figcaption></figure><h3>Easy Kubernetes</h3><p>It’s worth taking note of all the things we <em>didn’t</em> do to get our new service deployed to our Kubernetes cluster:</p><ul><li>We didn’t have to configure CI.</li><li>We didn’t have to encrypt secrets.</li><li>We didn’t have to copy a deployment script from some other project.</li><li>We didn’t have to provide a deployment spec.</li><li>We didn’t have to provide a service spec.</li><li>We didn’t have to create or modify an ingress.</li><li>We didn’t have to install any command-line utility.</li><li>We didn’t have to download the credentials for our Kubernetes cluster and yet were able to securely deploy our application to the cluster.</li><li>We didn’t have to learn any new technology or tool.</li></ul><p>This list of things we didn’t have to do highlights one of the most powerful benefits of using an SDM to deliver your software: an SDM is a tool to distribute expertise across your organization. When someone implements a better way to build, test, deploy, or monitor your services, that improvement is immediately available to <strong>all</strong> the projects in your team.</p><blockquote>The SDM collects the best practices from across your organization into a shared, EXECUTABLE best-practices document.</blockquote><p>If you’re deploying applications and services to Kubernetes, you need start using <a href="https://atomist.com/">Atomist</a>. Here’s a video walking through creating, deploying, and managing services in Kubernetes:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F272814275%3Fapp_id%3D122963&amp;dntp=1&amp;url=https%3A%2F%2Fvimeo.com%2F272814275%2F86a9aa1a7c&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F704468030_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed69a0678533f74ec26e875322161927/href">https://medium.com/media/ed69a0678533f74ec26e875322161927/href</a></iframe><p>If you’re interested in a tighter development feedback loop, like that provided by Skaffold, see how you can use the Atomist local mode to <a href="https://blog.atomist.com/deploy-your-spring-boot-application-to-kubernetes-in-3-mins/">automatically deploy as you develop</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b65c212b7f2d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-composition/kubernetes-the-easy-way-b65c212b7f2d">Kubernetes, the easy way</a> was originally published in <a href="https://medium.com/the-composition">The Composition</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Slack Integrations++]]></title>
            <link>https://medium.com/the-composition/slack-integrations-459b2f1e6bf6?source=rss-2362b8f065cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/459b2f1e6bf6</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[David Dooling]]></dc:creator>
            <pubDate>Mon, 30 Oct 2017 14:06:22 GMT</pubDate>
            <atom:updated>2018-04-24T21:51:50.387Z</atom:updated>
            <content:encoded><![CDATA[<p>Lots of software development teams use <a href="https://slack.com/">Slack</a> to improve communication and, hopefully, their velocity. One way teams do this is by using integrations that post messages summarizing commits, builds, issues, and deployments in their Slack team. Unfortunately, these stock integrations tend to be noisy and either put in a channel no one looks at or removed entirely. At <a href="https://atomist.com/">Atomist</a>, we wanted more meaningful information on our source code, so we built <a href="https://the-composition.com/automating-our-development-flow-with-atomist-6b0ec73348b6">custom notifications using our Atomist Slack Bot</a>. It’s one of the things we’ve done to make <a href="https://the-composition.com/effective-use-of-slack-2189896aba67">more effective use of Slack</a> and avoid the <a href="https://ux.useronboard.com/slack-i-m-breaking-up-with-you-54600ace03ea">Slack blues</a>.</p><p>While we set out to simply have improved <em>development lifecycle messages</em> in Slack, it has become an amazingly powerful tool for keeping our team in sync without a lot of overhead and is one of the more popular features with teams using Atomist. Rather than exiling integrations to the lonely wasteland of silenced and unsubscribed Slack channels, teams using Atomist get relevant and meaningful updates in the same channels where they discuss development. <em>Atomist notifications are part of the conversation.</em> In this post, we’ll see how some new features we’ve added help us be more productive by reducing context switching.</p><h3>Optics</h3><p>Last time we wrote about the Atomist <a href="https://the-composition.com/automating-our-development-flow-with-atomist-6b0ec73348b6">development lifecycle messages</a>, we focused on the improved display of information:</p><ul><li>One integration for many systems instead of one per system</li><li>Correlation of information from those systems into fewer, more meaningful messages</li><li>Enrichment of existing messages as new information comes in instead of spamming channels with many new messages</li></ul><p>Put more visually, instead of this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSDpmRmceCNbv6Dq3e7fbw.png" /></figure><p>you get this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dr607JjzcbOQPDJAEZH9_g.png" /><figcaption>Links! Context! Bears! Oh my! No bears you say? Sometimes you eat the bear.</figcaption></figure><p>This message gives you more information in less space. Notice how the push and build are in a single message, a single line! But nicer visuals aren’t the whole story. Just seeing the information isn’t enough. We demand action! So let’s look at the full message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*61bgepEUrJaKl7ea49jUOw.png" /><figcaption>What?!? You can raise a PR right from Slack? Why not?</figcaption></figure><h3>Action</h3><p>There’s a “Raise PR” button right there! No need to go to GitHub.com to open a PR. Don’t worry, that button only appears on pull requests where all checks have passed, so, for example, you won’t see it if a build fails. After we click that button, the <em>original</em> message gets updated with the new stuff that has come to light. That’s right, rather than message after message after message spamming your channel, as new information related to a push becomes available, it is <em>added</em> the original push message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dv-T7rds7grASKbWe0InSg.png" /></figure><p>The updated message contains a link to the PR and the commit statuses for the commit in the PR.</p><p>But the fun does not stop there. Your standard GitHub integration will provide you with a message about the new PR:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*hesNkya2UGPRfBGt572Twg.png" /><figcaption><em>&lt;Cute&gt;</em></figcaption></figure><p>The Atomist Bot provides something quite a bit more actionable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*87iD_td-z_alPfkjYB-5mg.png" /><figcaption>Links! Context! Action!</figcaption></figure><p>In this <em>one</em> message you:</p><ul><li>See the PR title, which is a link to the PR on GitHub.com</li><li>Can request reviews using either GitHub user logins <strong>or</strong> Slack IDs</li><li>Enable automatically merging when all checks have passed and there is an “approve” review</li><li>Add a comment to the PR</li><li>Thumbs up the PR</li><li>See the commit(s) in the PR</li><li>See that all checks have passed</li><li>Merge the PR, or Squash and Merge the PR, or Rebase and Merge the PR</li><li>See the issue that the PR refers to</li></ul><p>That’s a lot of action! Anything you might want to do to a PR you can do from the comfort of Slack. No more bouncing from one web site to another to another to monitor and manage your development. When you push commits, no need to check your CI web interface. If it fails, you’ll get a DM in Slack. If it succeeds, next time you check Slack just click the “Raise PR” button. Hate waiting for PR reviews, not to worry! The Atomist Bot will DM those you’ve requested a review from and they can set reminders on that message to make sure they add their reviews. Frustrated when an approved PR just sits there open? Just enable auto-merge on the PR and once everything is green, voila!</p><h3>Reaction</h3><p>Is your development workflow different? Do you use <a href="https://datasift.github.io/gitflow/IntroducingGitFlow.html">GitFlow</a> instead of merging feature branches right into master? You’re in luck, these messages are highly configurable. Plus, we recently open-sourced the code that creates these beautiful, actionable messages so it’s easier for everyone to consume and learn from. Take a look at the <a href="https://github.com/atomist/lifecycle-automation">lifecycle-automations</a> code, <a href="https://atm.st/2wiDlUe">install the Atomist Bot in your Slack team</a>, and maybe even <a href="https://the-composition.com/extending-your-slack-bot-part-1-commands-aaa4dbd47933">write your own bot command</a>.</p><figure><a href="https://atm.st/2wiDlUe"><img alt="" src="https://cdn-images-1.medium.com/max/278/1*jwCmkWOYSCMzw-oInZ9TWQ.png" /></a></figure><p>Add the Atomist Bot to your Slack team and <a href="http://help.atomist.com/">let us know what you think</a> about development lifecycle messages!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=459b2f1e6bf6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-composition/slack-integrations-459b2f1e6bf6">Slack Integrations++</a> was originally published in <a href="https://medium.com/the-composition">The Composition</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Rugs on the Command Line]]></title>
            <link>https://medium.com/@dooling/creating-rugs-on-the-command-line-5ec28042be77?source=rss-2362b8f065cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ec28042be77</guid>
            <category><![CDATA[rugs]]></category>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[atomist]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[David Dooling]]></dc:creator>
            <pubDate>Mon, 06 Feb 2017 17:52:01 GMT</pubDate>
            <atom:updated>2017-02-06T18:02:11.414Z</atom:updated>
            <content:encoded><![CDATA[<h4>Capturing Your Automation in Rugs</h4><p>In a <a href="https://the-composition.com/rugs-on-the-command-line-eca46492db09#.3w8s9c9pa">recent post</a>, we introduced the <a href="https://github.com/atomist/rug-cli#readme">Rug CLI</a>, an open source tool for working with <a href="http://docs.atomist.com/reference-docs/rug/">Rugs</a> on the command line. Rugs automate all manner of tasks within and around software development. The previous post showed how to use various CLI subcommands to find (search), learn about (describe), and run (edit &amp; generate) Rugs. But what happens when you can’t find an existing Rug that does what you want? Or perhaps you want to change a few things an existing generator creates. In other words, you’d like to develop your own Rugs. Since the <a href="http://docs.atomist.com/rug/rug-dsl/">Rug DSL</a> is quite small, you can become productive in it rapidly. Plus, the Rug CLI provides complete lifecycle support for developing, testing, and distributing Rugs, allowing you to employ your standard development workflow when developing Rugs.</p><figure><a href="https://github.com/atomist-rugs"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HTJiOlvwJR1h9brxWRayXA.png" /></a><figcaption>GitHub atomist-rugs organization, the home of our public Rugs</figcaption></figure><p>In this post we’ll show you how to get started creating, developing, and testing your own Rugs using the Rug CLI so you can start automating your development process. As you read through this post, be thinking about the parts of your development process you’d like to automate away so you can spend less time with busy work and more time coding the real business logic.</p><h3>Creating Rugs</h3><p>Our starting point is a single command away:</p><pre>$ rug generate atomist-rugs:rug-archive:NewRugArchiveProject \<br>    rug-cli-post \<br>    group_id=atomist-rugs \<br>    description=&quot;Rug archive for second Rug CLI post&quot;</pre><p>We’re using the Rug CLI to create a <a href="http://docs.atomist.com/rug/rug-archive/">Rug archive</a> project, just as we used it in the previous Rug CLI post to create our Rug koans project. This time we are using the <a href="https://github.com/atomist-rugs/rug-archive#newrugarchiveproject">NewRugArchiveProject</a> to create a new Rug archive project. We could have also generated a Rug archive using a button or converted an existing project into a Rug archive using an <a href="https://github.com/atomist-rugs/rug-editors#convertexistingprojecttorugarchivewitheditor">editor</a> from <a href="https://github.com/atomist-rugs/rug-editors">rug-editors</a>.</p><p>Let’s look more closely at what we just did. Here’s what it looks like when you run the command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECseKCwzeT51QVpHAyll3w.png" /><figcaption>Rug generate Rug</figcaption></figure><p>We see from the output of the command that, after downloading the required dependencies, the directory rug-cli-post was created as a Rug archive. A Rug archive is no more than a standard project directory that has a .atomist directory at the top level. The .atomist directory holds the various Rugs and their tests. Our .atomist directory has a manifest.yml file and two directories: editors and tests. Each of these directories has a sample in it, an editor and a test, respectively. Our new Rug archive also has a README, a <a href="https://git-scm.com/docs/gitignore">gitignore</a> file, and a .atomist.yml file. We saw the latter file in our previous post; it contains a record of Rugs run on the project. Let’s take a closer look at some some of the files.</p><h4>Manifest</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*7uPB35T1xJ-PYnQws_pbEw.png" /><figcaption>manifest.yml: Rug archive metadata</figcaption></figure><p>The manifest.yml file above is a standard <a href="http://yaml.org/">YAML</a> file that Rug uses to hold the metadata, or configuration, for a Rug archive. The first four lines are simple key-value pairs. The first line contains the group name we supplied as a parameter to the generator, “atomist-rugs”. The second line is the name of our archive, “rug-cli-post”, also provided on the command line. We did not supply an initial version as a command-line parameter so we got the default, “0.1.0”. The requires key refers to the version or, as in this case, version range of Rug needed to run the Rugs in this archive. The last line of the file begins an array of other Rug archives this archive depends on. The Rugs in this archive do not call any Rugs in other archives, so the array is empty. The rug-archive generator project has an <a href="https://github.com/atomist-rugs/rug-archive/blob/master/.atomist/manifest.yml#L5-L6">example</a> of how to use dependencies.</p><h4>Sample Editor</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yha_FQlDpT-MXZz0ZwwvjA.png" /><figcaption>AddReadme editor</figcaption></figure><p>The sample editor provided in .atomist/editors/AddReadme.rug is a simple editor that, you guessed it, adds a README to a project. The first editor in a .rug file must have the same name as the file, without the .rug extension. We see that is the case with the AddReadme editor, declared on line 4 using the editor keyword. Rugs are named using <a href="http://docs.atomist.com/reference-docs/rug/rug-conventions/#rug-naming">UpperCamelCase</a>. Lines 1–3 contain annotations applied to the editor. In this case, a text description of the editor and two tags, “readme” and “documentation”, are applied. We saw in the <a href="https://medium.com/the-composition/rugs-on-the-command-line-eca46492db09#.xtlhj85t5">previous CLI post</a> you can search for Rugs by tag using the search functionality in the CLI.</p><p>In lines 6–11 we define a parameters, description, using the param keyword. It is <a href="http://docs.atomist.com/reference-docs/rug/rug-conventions/#parameters">convention</a> to use <a href="https://en.wikipedia.org/wiki/Snake_case">lower snake_case</a> for Rug parameters. The second argument to the param keyword is a <a href="http://www.regular-expressions.info/">regular expression</a> used to validate user-provided parameter values. In this example, we use a <a href="http://docs.atomist.com/reference-docs/rug/rug-editors/#annotations">canned regular expression made available by Rug</a>. If you write your own regular expressions, they must be compatible with both the <a href="https://en.wikipedia.org/wiki/Comparison_of_regular_expression_engines#Language_features">Java and JavaScript regular expression engines</a> and be anchored, that is, begin with ^ and end with $. Prior to declaring the parameter we have annotations that provide information about the parameter. This information, display name, description, a valid input description, and length restrictions, are used by web forms and the CLI to provide users with helpful information when prompting them for parameter values. While these annotations are optional, they are highly recommended.</p><p>After the parameter definitions, we declare two variables, readme &amp; content, using the let keyword (lines 13–17). The value of the content variable is set using triple-double quotes, which allow embedded newlines. With the parameters and variables defined, we get to what this editor actually does: add a README to a project. Before we can change something, we need to say what we want to change. We do that using the with keyword. In this example, with Project tells us we are working on a project (line 19). Within the context of that with statement, all <a href="http://docs.atomist.com/reference-docs/rug/types/rug-core-types-project/">operations available on the </a><a href="http://docs.atomist.com/reference-docs/rug/types/rug-core-types-project/">Project type</a> are available to us. The context of the with statement is either a single operation or <a href="http://docs.atomist.com/reference-docs/rug/rug-editors/#a-quick-tour-of-rug-editor-syntax">multiple operations enclosed in a </a><a href="http://docs.atomist.com/reference-docs/rug/rug-editors/#a-quick-tour-of-rug-editor-syntax">begin/</a><a href="http://docs.atomist.com/reference-docs/rug/rug-editors/#a-quick-tour-of-rug-editor-syntax">end block</a>. In the Project context we invoke two operations within its begin/end block (lines 21–22). Each operation consists of the do keyword followed by the operation and its arguments. Let’s first look at the second operation: addFile (line 22). As the name suggests, this operation adds a file to the project being operated on (whatever project someone runs this editor on). The first argument to addFile is the path to the file and the second argument is the file contents. All paths supplied to these operations are relative to the root of the project, so here we are adding the README.md, as referenced by the readme variable, to the root of the project being edited. Since we want to replace the README file if one already exists, we first delete the README file using deleteFile operation, again acting on the readme variable (line 21).</p><p>We now have our README file in place, but with the contents of the content variable, which just has placeholders, not the values we want. So within the project context we enter a new sub-context using with File (line 24) so we can edit the contents the README file. This with statement includes a conditional: when path = readme. This conditional ensures we only act on the README.md file at the root of the project being edited and not other files in the project. In the subsequent begin/end block, we replace the placeholders we had in our content variable. First, we replace the project name placeholder with the name of the project being operated on. The name of the project is obtained by escaping into JavaScript, using curly braces, and calling the name() method on the project variable p (line 26). We can’t call project’s name function directly in the DSL because the DSL parser only expects operations immediately after the do keyword, not as arguments to operations. We then replace the project description placeholder with the value of the description parameter supplied by the person running the editor (line 27).</p><h4>Sample Test</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VtdBw1uQCzrn7dNQLFEepw.png" /><figcaption>BDD test for AddReadme</figcaption></figure><p>The tests for the sample editor are located in .atomist/tests/AddReadme.rt. Above we see the first test scenario in that file. Rug tests are BDD-style tests and an <a href="https://medium.com/the-composition/bdd-with-rug-371e85d7a1a9#.gdonigk3g">earlier post</a> describes the syntax of Rug tests in more detail, so we’ll only briefly describe the first test shown above. Each test begins with the scenario keyword. The text after the scenario keyword provides a description of the scenario being tested. We define variables using the let keyword in lines 3–4. We then provide a starting point for our test with the given keyword (line 7). For this test we start with the project holding this test, the ArchiveRoot. Since this project has a README, this test will make sure the editor can handle situations where a README file already exists. These tests operate completely in memory, so even though we are operating on the current project, changes are all cached in memory and no changes are made to the files on disk. Once we have the setup, we perform the action we want to test using the when keyword: we run the editor, supplying a value for its parameter (line 10). Finally, after the then keyword, we supply our predicates, separated by the and keyword. Since our tests operate on projects, our context for the predicates is the resulting project. In this example we see three examples of calling Project operations natively using the Rug DSL (lines 13–15) and three examples of using JavaScript (lines 16–18). Currently the Rug testing DSL does not have a negation operator so we break into JavaScript to negate the return values of our predicates. Line 14 shows an example of using JavaScript to supply an argument value. Our tests ensure the README exists, has the content we want, and does not have the content from the original README. When using the Rug DSL, the resulting project is implicit when calling the predicates. When using JavaScript we must explicitly use the result object when calling the predicates. Similarly, while the DSL does not surround operator arguments with parentheses, we use normal JavaScript function syntax when calling predicates. Parameter and variable values are available in both the DSL and JavaScript.</p><h3>Testing Rugs</h3><p>The Rug archive generator provided us with an editor and some tests, so let’s run them. You can run the following command from anywhere in the rug-cli-post project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aq9LcM1_GJVYDKXQCPeaJQ.png" /><figcaption>Running Rug tests</figcaption></figure><p>They pass! That was easy enough. Let’s make this a little more interesting. We will modify our editor to add information on who created the README. Before we do that, we will add a test for our desired behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MVvPZLSfapW4iFMR43JtpA.png" /><figcaption>Add a new predicate to our test</figcaption></figure><p>We add a creator parameter to the invocation of the AddReadme editor (line 11). We also add the predicate on line 17, which is another example of using a JavaScript block to supply a single operator argument value, this time taking advantage of JavaScript’s string concatenation. When we run our new test, we see that it fails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ugWvHZWw5waF8hQXPJNyAg.png" /><figcaption>FAIL!</figcaption></figure><p>The CLI provides a summary of the test(s) and predicate(s) that fail and exits with a non-zero status.</p><h3>Writing Rugs</h3><p>Our next task is to turn that failing test into a passing text by updating our editor to add information on who created the project. We’ll do this by adding a creator parameter (lines 13–18), updating the content variable to include a placeholder for the creator (line 25), and add an operation to replace that placeholder with the value of the creator variable (line 37). When we are done, our editor looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xz7eFRvcPmNBTFB0E6E5DQ.png" /><figcaption>Add creator to README</figcaption></figure><p>We run our tests again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_n4Td8pq8XMaNomVWUXwuQ.png" /><figcaption>FAIL?!?</figcaption></figure><p>Now we have even more failures than before! What happened? The test output tells us that two tests are failing because we did not supply all the editor parameters: Editor failed due to missing parameters: Missing parameters: [creator]. Well I guess that makes sense. We added a new parameter to our editor and we only changed one test to supply that parameter. After supplying a value for the creator parameter in the other tests, we run our tests again and see that they all pass.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LKk9RcufHFSKU5ob_zyI3w.png" /><figcaption>Pass!</figcaption></figure><h3>Installing Rugs</h3><p>We now have an editor that we’d like to run on various projects. One way to do this is to run the CLI from within the Rug archive project and use the -C /—-change-dir command-line option. This command-line option tells the CLI to operate on the directory provided as its argument. For example, if you wanted to add a README file to the project under ~/develop/project-that-needs-a-readme, you would run the following command from within the rug-cli-post directory.</p><pre>$ rug edit -l -C ~/develop/project-that-needs-a-readme AddReadme \<br>    project_name=project-that-needs-a-readme \<br>    description=&quot;Some project that has no README&quot; \<br>    creator=Me</pre><p>While the above works, it is not convenient to change to your Rug project directory to run the editor on another project directory. To make our editor available from anywhere on our local system, we need to install it. Installing a Rug archive locally involves packaging the archive and installing it in the local repository, ~/.atomist/repository by default. Sound complicated? Well, it’s actually quite easy. You just need to run the install subcommand from within your rug-cli-post project directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ocue6TyW4azqaUYZnUGNvg.png" /><figcaption>Rug install</figcaption></figure><p>With that accomplished, you can now run this editor from any project directory, as long as you use the fully-qualified name of the editor. The fully-qualified has three parts: the group, the archive name, and the editor name. The three parts of the fully-qualified name are separated by colons, so the fully-qualified name of the AddReadme editor in our example is atomist-rugs:rug-cli-post:AddReadme.</p><h3>Publishing Rugs</h3><p>Now that we have installed our editor locally, we can run it on any project on our system, but true joy comes when you share your Rugs with others. To make our editor available to others, we need to publish our Rug archive. Before we can publish our archive, we need to do some CLI configuration. The CLI configuration is located at ~/.atomist/cli.yml and its default contents are:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0038732338b3d87ba87894432468f336/href">https://medium.com/media/0038732338b3d87ba87894432468f336/href</a></iframe><p>The CLI configuration file is standard <a href="http://yaml.org/">YAML</a> and defines where the CLI will look for Rugs and other dependencies. It first defines a local repository under your home directory (where we installed our archive previously) and then several remote repositories needed to download Rug archives and Rug CLI &amp; runtime dependencies (lines 7–16). It also configures the default Rug catalog used when searching for Rugs (lines 19–20). Notice that all remote repositories by default have publishing set to false.</p><p>As the comment above the remote repositories configuration states, you can set one, and only one, of the remote repository’s publish key to true (lines 5–6). But simply setting one of those repositories publish key to true will not make it so: you need to have write access to the repository to successfully publish there. Rug repositories are standard <a href="https://maven.apache.org/">Maven</a> repositories. If you have write access to a Maven repository, you can add that repository and your login credentials to the CLI configuration.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a15ced13444ccaefd154ecffb115e3ee/href">https://medium.com/media/a15ced13444ccaefd154ecffb115e3ee/href</a></iframe><p>Lines 17–22 in the above CLI configuration demonstrate how to add a repository for publishing. Lines 20–22 show how to add login credentials using environment variables.</p><p>Once you have your CLI configuration set up for publishing, actually publishing it is as simple as running the rug publish command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h7_irdXG8JIodtwRKXnrgQ.png" /><figcaption>Rug publish</figcaption></figure><p>Now your editor will be available to anyone who has read access to your Rug repository. If you want to make your Rugs available to everyone using Atomist, please contact us in the <a href="https://join.atomist.com/">Atomist community Slack</a>.</p><p>Now that you have a functioning Rug archive project, you can use Rug to automatically configure and enable <a href="https://medium.com/the-composition/automating-infrastructure-with-atomist-c15262f985ab#.ly24z4w79">Travis CI</a> builds for it. We hope these Rug CLI posts have helped to get you started using Rug and the CLI.</p><p>To get more information about the Rug CLI and DSL, see the <a href="http://docs.atomist.com/">Rug documentation</a>. If you have questions, please join our <a href="https://join.atomist.com/">Atomist community Slack</a> and ask away! If you would like to learn more about using the Rug CLI and Atomist in your everyday work, please <a href="https://atomist.typeform.com/to/I9k0Ab">contact us</a>. We hope you enjoy using Rugs and the Rug CLI to automate away your busy work!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ec28042be77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rugs on the Command Line]]></title>
            <link>https://medium.com/@dooling/rugs-on-the-command-line-eca46492db09?source=rss-2362b8f065cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/eca46492db09</guid>
            <category><![CDATA[rugs]]></category>
            <category><![CDATA[atomist]]></category>
            <category><![CDATA[koans]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[David Dooling]]></dc:creator>
            <pubDate>Thu, 19 Jan 2017 21:42:43 GMT</pubDate>
            <atom:updated>2017-05-02T21:08:26.521Z</atom:updated>
            <content:encoded><![CDATA[<h4>Scripting Automation</h4><p>At <a href="https://www.atomist.com/">Atomist</a> we designed <a href="http://docs.atomist.com/">Rug</a> to automate all manner of tasks within and around software development. From generating new projects to upgrading libraries to refactoring code across multiple repositories to <a href="https://medium.com/the-composition/automating-infrastructure-with-atomist-c15262f985ab">configuring CI</a>, Rug allows you to describe, nay, capture your development process in code.</p><p>Once captured in generators and editors, collectively called Rugs, we want to make sure you can execute your Rugs in the right place at the right time. If you maintain an open source project, <a href="https://medium.com/the-composition/evolving-projects-using-atomist-editors-fd3b1f057c86#.458c6qbc7">buttons</a> may be the best fit for codifying a tutorial. If your team uses chat extensively, the <a href="https://medium.com/the-composition/automating-our-development-flow-with-atomist-6b0ec73348b6#.w9o4qxxfk">Atomist bot</a> might be the most comfortable interface for you. However, for many developers the command line is the most natural interface for interacting with and automating their tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uLQj6DxKNiWozZYpdU85Kg.png" /><figcaption>Rug CLI example output</figcaption></figure><p>Scripting common tasks in <a href="https://www.gnu.org/software/bash/">Bash</a> or <a href="https://msdn.microsoft.com/en-us/powershell/mt173057.aspx">PowerShell</a> is often a first step towards more complete automation. Shell scripting allows developers to quickly prototype in a language and runtime that is available for every modern platform.</p><p>At Atomist we are all about automating automation, so providing a way to interact with Rug on the command line was an absolute necessity. Enter the <a href="https://github.com/atomist/rug-cli#readme">Rug CLI</a>, a complete command-line interface for executing and developing Rugs.</p><p>This post will focus on getting started with the Rug CLI and using it to execute Rugs. A <a href="https://the-composition.com/creating-rugs-on-the-command-line-5ec28042be77#.h41lb76oa">later post</a> will describe how to use the Rug CLI to develop, test, and publish Rugs.</p><h4>Installing the Rug CLI</h4><p>We support installing the Rug CLI using common package tools for most platforms. On Mac OS X/macOS, you can install it using <a href="http://brew.sh/">Homebrew</a>:</p><pre>$ brew tap atomist/tap<br>$ brew install rug-cli</pre><p>More <a href="http://docs.atomist.com/user-guide/interfaces/cli/install/">detailed instructions for installing the Rug CLI</a> are available, including those for other platforms.</p><p>Once you have the Rug CLI installed, you can make sure it is working by running the following command:</p><pre>$ rug --version<br>rug 0.21.0<br>atomist/rug-cli.git (git revision d6adaee; last commit 2017-01-18)</pre><p>The version of the Rug CLI you installed may be different, but as long as you see output similar to that shown above, things are working.</p><p>We aim to support command-line interface standards like the —-help and ——version command-line options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hoH3FMMbso9BqdtF79o0bA.png" /><figcaption>Rug CLI help</figcaption></figure><p>If you install the Rug CLI using the package tools on GNU/Linux and Mac and have <a href="http://tldp.org/LDP/abs/html/tabexpansion.html">Bash autocompletion</a> configured properly, you will get proper autocompletion for rug in Bash as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SLbIi_H_GVTMNZTgZely7A.png" /><figcaption>Rug CLI Bash autocompletion</figcaption></figure><h4>Rug CLI Configuration</h4><p>The first time you run the Rug CLI, it will create a .atomist directory in your home directory and create a default Rug CLI configuration file named cli.yml in that directory. The default contents of the Rug CLI configuration file suffice for all operations described in this introduction. We’ll talk more about configuring the CLI in the next post.</p><h4>Searching for Rugs</h4><p>Before we can execute Rugs on the command line, we need to know what Rugs are available to us. The Rug CLI has built-in support for searching for available Rugs using the search subcommand. Since we are not only interested in learning about the Rug CLI but also about Rug itself, let’s search for all Rugs tagged with rug. You can search for Rugs with specific tags using the -T command-line option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nw3UAzm07jSmXHPWcLoAxA.png" /><figcaption>Invoking the Rug CLI for the first time</figcaption></figure><p>What’s going on here? We asked the CLI to search for Rugs and we get a bunch of unrelated output. Well, the CLI is just keeping you informed of what it is doing. As mentioned above, the first time you run the CLI, it will create a default configuration for you; that’s the first line of output. Next, the CLI downloads all dependencies it needs to execute the Rug runtime. There are quite a few dependencies, so it may take a little time to download them. Don’t worry though, all the dependencies are cached locally in your ~/.atomist/repository directory, so subsequent invocations of the CLI will be faster.</p><p>Once the CLI is ready to do what you asked, it will issue a request to the Rug catalog and display the results. Here is what the entire output will look like in subsequent runs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B2c00j4_OlAvFTSSneVz7w.png" /><figcaption>Rug search output</figcaption></figure><p>The output contains all Rug archives, a project that contains Rugs, that satisfy your search criteria.</p><p><strong>Tip:</strong> <em>running </em>rug search<em> without any other arguments will list all available Rug archives.</em></p><h4>Describing Rugs</h4><p>Now that we have a list of Rug archives that are tagged with rug, we need to decide which one we want to run. We may need more information to decide. The last line of output from rug search tells us how to get more information on the Rug archives: use the rug describe command. Since we want to learn about Rug, the rug-koans-project looks interesting. Let’s try describing it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e7Xh3y3foJjYla1uYHigrA.png" /><figcaption>Rug describe output</figcaption></figure><p>We see again that the Rug CLI first downloads what it needs to do what you ask it to. In this case, it downloads the archive you are asking it to describe and its dependencies. The rest of the output provides useful information about the Rug archive:</p><ol><li>Its GitHub repository and the commit for this version</li><li>Where is it located locally, that is, where it was downloaded and cached</li><li>What Rugs are in it, a <a href="http://docs.atomist.com/user-guide/rug/generators/">generator</a> named NewRugKoansProject in this case</li><li>What version(s) of the Rug runtime it requires</li><li>What other Rug archives it depends on</li></ol><p>The output ends with instructions on how to get more information. Let’s use that hint to get more information about NewRugKoansProject.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SI-8SoSFAnwSTB6gDKINNw.png" /><figcaption>Rug describe generator output</figcaption></figure><p>Other than some truly terrifying regular expressions used to validate parameter values (don’t fret, you understanding those regexes is not a prerequisite to using Rug!), we see that the NewRugKoansProject generator “creates a new Rug Koans project”, which stands to reason. It has a single tag, rug. It takes a single required parameter, project_name, and four optional parameters. Each parameter also has a plain-English name, a short description, and information on valid values (minimum &amp; maximum length and the regular expression used for validation).</p><p>Once again, the last bit of the output gives us information on what we can do next: run the generator. Let’s look more closely at how we run this generator:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lzGRawyjNzs5w3K2ZOhpXA.png" /></figure><p>We use the generate subcommand [1] with the fully-qualified name of the generator [2], optionally specify the version [3] (the latest version is used if -a is not used), provide a name for our new project [4], and finally set values for the named parameters [5]. If you leave off some parameters, the CLI will tell you which are missing; or you can add the -I option to be prompted for them.</p><h4>Running Rugs</h4><p>Before we run the generator, let’s talk a bit about what a generator <em>is</em>. A Rug generator is used to create a new project from an existing model project. Rug generators are different from typical project templates in that they are a fully functioning project operating under native tooling: there are no special characters or constructs that disrupt compiling, testing, and running the model project using its native toolchain.</p><p>When we execute a generator using the Rug CLI, it’s going to create the new project in a new directory under the current one. Therefore we’ll run it from the directory where we have all our projects. Rather than supply the parameters on the command line, we will use the CLI’s interactive mode, invoked using the -I/——interactive command-line option. In this mode, you are prompted for each parameter value rather than having to supply them all on the command line. If you specify some parameter values on the command line when using interactive mode, the values you do specify will be the default value provided when the CLI prompts for that parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HMYgMB5VJORCapYIAcoRLg.png" /><figcaption>Rug interactive generate</figcaption></figure><p>The project name we provide is used as the name of the directory created to hold the project contents. The output from rug generate states that directory, rug-koans, was created with a few files we need to start using Rug koans to learn more about Rug. It also created a file named .atomist.yml which maintains a record of what Rugs have been run on this project. Let’s commit our initial version before we do anything else.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xIjhrgLZsAO69hBdkq5hEQ.png" /></figure><p>Now that we have our initial version committed, we can safely run some <a href="http://docs.atomist.com/reference-docs/rug/rug-editors/">editors</a> on our project. The rug-koans-project archive we described above only contained the generator we already ran. Looking at the other Rug archives listed in the search output above, the rug-koans-editors looks promising.</p><p>We again use the describe subcommand to learn more about the archive. This time we run the describe command without the -a/—-archive-version command-line option. When we do not specify a version, the Rug CLI determines the latest version and uses it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4m5gfgazNwCSzX5cJdscOA.png" /><figcaption>Rug describe rug-koans-editors</figcaption></figure><p>The Step1 editor seems like a good place to start (or should it be Step0?). Let’s learn how to run it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3aWqtfvz5U9QIrL5vkTsQA.png" /></figure><p>Since there are no parameters to this editor, we’ll just copy and paste that last line of the output to run the editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LCFjK6A_R1p9TC8HONcneg.png" /></figure><p>We see that running the editor created two files under the .atomist directory, overwrites the README with instructions for the first koan, and updates the .atomist.yml log. The files created under the .atomist directory are where the work for this koan needs to be done. Start with the test file, tests/Step1.rt. Instructions for what to do are in the file. More instructions and hints if you get stuck are in the README.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sDwUOcPlkb9hly8Bktp-JQ.png" /><figcaption>Instructions from the Step1 README</figcaption></figure><p>Now you can apply Rug editors to your own projects! If you have a <a href="https://projects.spring.io/spring-boot/">Spring Boot</a> project, check the editors available for that:</p><pre>$ rug search -T spring-boot</pre><p>If you don’t have a Spring Boot project, you can use the CLI to run the <a href="https://github.com/atomist/spring-rugs#newspringbootrestservice">Spring Boot REST service generator</a>.</p><p>Our next Rug CLI post will describe in detail how to use the Rug CLI to create, test, install, and publish Rugs. But don’t wait! You can continue with the remaining Rug koans editors to learn how to create your own Rugs right now.</p><p>To get more information about the Rug CLI, see its <a href="http://docs.atomist.com/user-guide/interfaces/cli/">documentation</a>. If you have questions, please join our <a href="https://join.atomist.com/">Atomist community Slack</a> and ask away! If you would like to learn more about using the Rug CLI and Atomist in your everyday work, please <a href="https://atomist.typeform.com/to/I9k0Ab">contact us</a>. We hope you enjoy using Rugs and the Rug CLI to automate away your busy work!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eca46492db09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Infrastructure with Atomist]]></title>
            <link>https://medium.com/@dooling/automating-infrastructure-with-atomist-c15262f985ab?source=rss-2362b8f065cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c15262f985ab</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[atomist]]></category>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[continous-integration]]></category>
            <dc:creator><![CDATA[David Dooling]]></dc:creator>
            <pubDate>Mon, 09 Jan 2017 19:15:40 GMT</pubDate>
            <atom:updated>2017-11-20T04:25:42.245Z</atom:updated>
            <content:encoded><![CDATA[<h4>You say, “AUTOMATE ALL THE THINGS!!!”, but do you really mean it?</h4><blockquote><strong>Note:</strong> for current information on these concepts, see <a href="https://docs.atomist.com/">our doc site</a>.</blockquote><p>Software developers have long sought to automate as much of the process <em>around</em> software development as they could. Developers write tools to track changes in software. They automate building and testing of software using continuous integration (CI). More recently, deployment of software has been automated with continuous delivery (CD), often borrowing the infrastructure from CI. <a href="https://theagileadmin.com/what-is-devops/">DevOps</a> culture has pushed this automation into the running of software: alerting on and responding to incidents. In contrast, efforts to automate the process <em>of</em> software development have been more timid. Some teams use templates to standardize and ease project creation. Integrated development environments (IDEs) augment our understanding with features like syntax highlighting &amp; autocompletion and provide some automation, e.g., automated refactoring within a single source code repository.</p><p>At <a href="https://www.atomist.com/">Atomist</a>, we have been thinking about how to push the boundaries of automating software development. In recent posts we’ve talked about how our we enable <a href="https://medium.com/the-composition/evolving-projects-using-atomist-editors-fd3b1f057c86#.dmv3g7hwj">moving beyond templates to Generators and Editors</a> so we can not just create projects but evolve them as standards and dependencies change. We also introduced the notion of <a href="https://medium.com/the-composition/understand-automate-collaborate-1b5695ecb724#.f0bl6a7eg">Executors</a>, which expand upon the single-project capabilities of an IDE by allowing refactors and other changes to be applied across all repositories in an organization. But as the practice of DevOps has made obvious over the past few years, a software project is much more than just writing the software. If we can push the boundaries of evolving source code, can’t we do the same for CI, CD, and running software? After all, in the infrastructure-as-code world, building infrastructure, running builds, deploying, and monitoring are code too. Using <a href="https://aws.amazon.com/cloudformation/">AWS CloudFormation</a>, <a href="https://travis-ci.org/">Travis CI</a>, <a href="http://kubernetes.io/">Kubernetes</a>, <a href="https://newrelic.com/">New Relic</a>, <a href="https://www.datadoghq.com/">Datadog</a>, and <a href="https://www.pagerduty.com/">PagerDuty</a> APIs, you can fully automate with code the infrastructure, testing, deployment, monitoring, and alerting of your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*zab9o4CFb9fsBpaBcloidg.jpeg" /><figcaption><a href="https://memegenerator.net/instance/9449708">https://memegenerator.net/instance/9449708</a></figcaption></figure><blockquote>The convergence of the infrastructure-as-code and SOA models enables higher-order automation of infrastructure.</blockquote><p>The convergence of the infrastructure-as-code and service-oriented architecture (SOA) models provides a fertile ground for higher-order automation around infrastructure. For example, developers use CI systems to automatically build software, run tests, and even deploy the software. In contrast, the configuration of these CI systems is often manual, requiring copying a configuration from an existing project, error-prone editing, etc. For teams adopting microservices, where new projects can be created weekly or even more frequently, this is untenable! Most CI systems provide some sort of API, so why not use the API and automate the process of configuring and enabling the CI system for new source code repositories?</p><blockquote>Many infrastructure systems provide an API that can be used to automate everything from configuration to reporting</blockquote><h3>Automating Travis CI</h3><p>Travis CI provides free continuous integration services for open source projects. The manual <a href="https://docs.travis-ci.com/user/getting-started/#To-get-started-with-Travis-CI%3A">process for configuring and enabling Travis CI</a> on a GitHub repository requires several steps spread across web pages, the command line, and source code. First, you make sure Travis CI has an up-to-date list of your repositories. Next, on your Travis CI profile page, you enable the repository. Finally, you create a build configuration, add it to your repository, commit, and push to GitHub. Travis CI will notice the push and build your project using the configuration you have provided.</p><p>Unfortunately, the creation of the Travis CI build configuration is not always simple. While copying the .travis.yml configuration file from a similar project can provide a good starting point, customization is often needed. For example, the build configuration may contain encrypted secrets, e.g., authentication information for your artifact repository, whose encrypted values are repository specific. Thus creating the build configuration becomes a multistep process: copying, editing, encrypting values, etc.</p><p>As we began to release our Rug archives under the <a href="https://github.com/atomist-rugs">atomist-rugs</a> GitHub organization, currently over 20 repositories, this process became tedious and error prone. Since Atomist provides tools for automating code development, we immediately thought to use our own tools to automate the solution to this infrastructure-as-code problem.</p><blockquote>We immediately thought to use Atomist tools to automate the solution to this infrastructure-as-code problem.</blockquote><h4>Travis &amp; Rug</h4><p>Fortunately, Travis CI provides a fairly complete <a href="https://docs.travis-ci.com/api">API</a> for their service. Unfortunately, Rug knew nothing about it. While Rug natively understands projects, files, and even Java source code, it must be taught how to interact with Travis CI. Lucky for us, Rug has an extensible type library, allowing us to write a type for Travis CI that the Rug runtime can dynamically load and use. A detailed discussion of adding user-defined types to Rug is beyond the scope of this post. Conceptually, we teach the Travis type how to parse and understand the Travis CI build configuration file. We also write functions that query and modify this build configuration. For instance, the Travis type has functions that enable and disable the Travis CI build and encrypt environment variables. If you are interested in the details of the Travis Rug type, I encourage you to peruse the <a href="https://github.com/atomist-rugs/travis-rug-type">travis-rug-type</a> repository and ask questions in the <a href="https://join.atomist.com/">Atomist Community Slack</a>.</p><h4>Travis Editor</h4><p>Now that Rug understands Travis CI, how can we use it to enable CI builds on all of our Rug archive repositories? It’s often useful to take a working configuration and then transform it into an Editor. In our case, let’s look at the <a href="https://github.com/atomist-rugs/common-editors/blob/master/.travis.yml">build configuration</a> for the common-editors Rug archive:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*71MqgTeehpNTc4DAo51jSg.png" /><figcaption>Travis CI build configuration for a Rug archive</figcaption></figure><p>The build configuration looks pretty standard: it defines the platform, language, environment variables (some of which are encrypted), dependency installation, build script, notifications, and caches. The build does reference a script, .atomist/build/travis-build.bash, which in turn references other build files. We will have to make sure we include all those files when configuring the build on a repository. The only repository-specific information in the build configuration are the encrypted environment variables, which the Travis type knows how to deal with.</p><p>We now have all the information we need to create an Editor to configure Travis CI on Rug archive repositories. Let’s write it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aaqagyUqXIZN_L_IDJWMHw.png" /><figcaption>Excerpt of EnableTravisForRugArchiveDSL Rug Editor</figcaption></figure><p>The above shows the meat of the EnableTravisForRugArchiveDSL Editor. You can find the <a href="https://github.com/atomist-rugs/travis-editors/blob/master/.atomist/editors/EnableTravisForRugArchiveDSL.rug">complete source code</a> on GitHub. First we define some variables (lines 68–72). Once we establish that the project is a Rug archive (74), that is, it has a .atomist directory, we create the .travis.yml file (76). We then remove any existing Travis build script (78), create the build directory (79), and add all the files needed by the build (80–83). Finally, we use the Travis type (85) to enable the repository on Travis CI (87) and encrypt the environment variables needed for the build (87–90).</p><h4>Quick Aside: Rug DSL &amp; TypeScript</h4><p>One unique thing about the EnableTravisForRugArchive Editor is that it has been implemented using both the Rug DSL and <a href="https://www.typescriptlang.org/">TypeScript</a>. Above we discuss the Rug DSL implementation. The <a href="https://github.com/atomist-rugs/travis-editors/blob/master/.atomist/editors/EnableTravisForRugArchiveTS.ts">TypeScript implementation</a> is available in the same repository. Equivalent implementations are provided so people wishing to develop their own Rugs can compare and contrast the Rug DSL and TypeScript approaches to determine which one they prefer. In general, if your Rugs require mostly features and functions available in the Rug DSL, then the Rug DSL approach is likely more concise. If you find that your Rug requires many JavaScript blocks to express changes you wish to make, then it may be better to use TypeScript. Of course, if you are very comfortable in the TypeScript/JavaScript ecosystem, you my prefer the TypeScript approach regardless. The TypeScript implementation uses <a href="https://www.npmjs.com/package/@atomist/rug">interface definitions</a> for Rug types so developers can take advantage of existing IDE support for TypeScript syntax highlighting, autocompletion, compilation, etc. We will talk more about how we are using TypeScript with Rug in a future post.</p><h4>Running the Editor</h4><p>Now we are ready to run the Editor on our Rug archive repositories. As detailed in the travis-editors&#39;s <a href="https://github.com/atomist-rugs/travis-editors#parameters">README</a>, this Editor requires several input parameters. We can also get information about the EnableTravisForRugArchiveTS Editor and its parameters using the <a href="https://github.com/atomist/rug-cli">Rug CLI</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wyYItZlARdhC8H_VBlt_Xw.png" /></figure><p>The Rug CLI’s describe command provides information about an Editor’s tags and parameters, and ends with instructions on how to run the Editor. Using the those instructions, we can run the Editor on the common-editors repository:</p><pre>$ cd ~/develop/atomist-rugs/common-editors<br>$ rug edit atomist-rugs:travis-editors:EnableTravisForRugArchiveTS \<br>    repo_slug=atomist-rugs/common-editors \<br>    github_token=$GITHUB_TOKEN \<br>    maven_base_url=https://atomist.jfrog.io/atomist \<br>    maven_user=$MAVEN_USER \<br>    maven_token=$MAVEN_TOKEN \<br>    org=.org</pre><p>We provide the values for the encrypted environment variables as shell variables to avoid showing them here or having them in our shell history. The output from the above command looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kJNJyD0TRE3h6M1AhPxk7g.png" /><figcaption>Output from running the EnableTravisForRugArchiveTS Editor</figcaption></figure><p>Looking at the output we can see the Rug CLI resolves all the dependencies of the travis-editors Rug archive and loads everything into the runtime. It then tells Travis CI to synchronize the repositories for this user and waits for that to complete (sometimes this can take more than 20 seconds). The Editor then enables builds for the repository. Next, the Editor uses the parameter values provided on the command line to set and encrypt the GITHUB_TOKEN, MAVEN_USER, and MAVEN_TOKEN environment variables used by the build scripts. The astute reader will notice these steps are exactly those specified in the Editor. After it completes all the editing steps, it reports the changes made. In this case, it has created the Travis configuration and build files, updated the Travis configuration file three times (once for the addition of each encrypted environment variable), and created the .atomist.yml file, a record of what it has done. Once we commit and push those changes, we have continuous integration configured on Travis CI for the common-editors repository. You can view the current build status, see the build output, and look at historical builds on the <a href="https://travis-ci.org/atomist-rugs/common-editors">common-editors</a> Travis CI page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2mRmoZHiWfILUYtzTCdJA.png" /></figure><h3>Get More Done</h3><p>The infrastructure-as-code revolution is good only inasmuch as we continually push the boundaries of automation. As described in a previous <a href="https://medium.com/the-composition/evolving-projects-using-atomist-editors-fd3b1f057c86#.qye1s0ocw">post</a>, Rug understands your code, so it can push code automation further, whether that code be Java, Javascript, Clojure, Python, Go, <a href="https://aws.amazon.com/">AWS</a>, <a href="https://www.terraform.io/">Terraform</a>, <a href="https://www.docker.com/">Docker</a>, or Kubernetes. From configuring CI to adding a local <a href="https://www.vagrantup.com/">Vagrant</a> testing environment to automatically generating a Kubernetes resource specification, Rug can automate common DevOps tasks across all repositories, improving standardization and compliance along the way.</p><p>At Atomist, we are proposing a new way to think about the relationship between developers and software. Please <a href="https://join.atomist.com/">join the conversation</a> and help us shape the future of software.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c15262f985ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>