<?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 Allan Kilpatrick on Medium]]></title>
        <description><![CDATA[Stories by Allan Kilpatrick on Medium]]></description>
        <link>https://medium.com/@allankp?source=rss-260a1fd2cdb7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*PWwyM3U-7mXtyOG2t5Wvbw.jpeg</url>
            <title>Stories by Allan Kilpatrick on Medium</title>
            <link>https://medium.com/@allankp?source=rss-260a1fd2cdb7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 03:01:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@allankp/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[GitHub Shared Workflows: How to Version‑Control, Test, and Release]]></title>
            <link>https://medium.com/@allankp/github-shared-workflows-how-to-version-control-test-and-release-39f734c7573d?source=rss-260a1fd2cdb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/39f734c7573d</guid>
            <category><![CDATA[github-workflow]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Allan Kilpatrick]]></dc:creator>
            <pubDate>Fri, 02 May 2025 12:27:38 GMT</pubDate>
            <atom:updated>2025-05-02T12:27:38.288Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MT1uZbQNWliMDGztakU8Lw.jpeg" /></figure><p>Modern software teams live or die by their delivery pipeline. A flaky test job or a missing security scan costs time, confidence, and — ultimately — customer trust. Every repo can have its own flavour of linting, testing, caching, and release logic. Copy‑and‑paste drift crept in, fixes landed in some places but not others, and new starters never knew which file to copy in the first place.</p><p><strong>Shared Workflows</strong> is a new, central catalogue of reusable GitHub Actions that any repository can consume with a single uses: line. Think of it as <em>npm for CI</em>—versioned, semver‑tagged, and fully tested before promotion to production.</p><h3>Why bother? 🎯</h3><ol><li><strong>One source of truth</strong> — Hard‑won pipeline tweaks live in one place. Fix it once, <em>everyone</em> benefits.</li><li><strong>Speed</strong> — New repos get a first‑class pipeline in minutes.</li><li><strong>Safety</strong> — Every workflow revision runs through its own CI and integration matrix <em>before</em> it goes live.</li><li><strong>Reproducibility</strong> — Need to pin to an exact build? Just lock to a semver tag (@v1.2.0) or even a commit SHA.</li><li><strong>Upgrades without drama</strong> — A floating @v1 tag lets us roll out improvements gradually and roll back instantly if anything misbehaves.</li></ol><h3>Under the hood: the release pipeline 🛠️</h3><p>We treat workflows like production code. A new version graduates through three gates:</p><h4><strong>Pullrequest to </strong><strong>main </strong>👊</h4><ul><li>Basic checks are perform to ensure that the proposed change is stuiable for merging; yaml linting and commit linting to ensure that SemVer is able to process the change.</li></ul><pre>name: Lint workflows<br>on:<br>  pull_request:<br><br>permissions:<br>  contents: read<br>  pull-requests: read<br><br>jobs:<br>  lint:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - uses: actions/checkout@v4<br>      - name: yaml-lint<br>        uses: ibiqlik/action-yamllint@v3<br>        with:<br>          file_or_dir: .github/workflows/*.yml<br>          config_file: .yamllint.yml<br><br>      - name: Commit message lint<br>        uses: wagoid/commitlint-github-action@v6<br>        with:<br>          configFile: .commitlintrc.yml</pre><h4><strong>Merge to </strong><strong>main </strong>📦</h4><ul><li>The merge triggers semantic‐version tagging (v1.2.0) and auto‑generates release notes . v1 has <strong>not</strong> moved yet.</li></ul><pre>name: Tag and Release<br><br>on:<br>  push:<br>    branches:<br>      - main<br><br>permissions:<br>  contents: write<br><br>jobs:<br>  tag_and_release:<br>    if: ${{ github.event.head_commit.author.name != &#39;CI&#39; }}<br>    runs-on: ubuntu-latest<br><br>    steps:<br>      - name: Checkout repository<br>        uses: actions/checkout@v4<br>        with:<br>          fetch-depth: 0<br><br>      - name: Get next version (SemVer)<br>        id: semver<br>        uses: ietf-tools/semver-action@v1<br>        with:<br>          skipInvalidTags: true<br>          branch: main<br><br>      - name: Tag commit<br>        run: |<br>          VERSION=${{ steps.semver.outputs.next }}<br>          echo &quot;Version to release: $VERSION&quot;<br><br>          git config user.name &quot;CI&quot;<br>          git config user.email &quot;ci@github.com&quot;<br>          git tag -a &quot;$VERSION&quot; -m &quot;Release $VERSION&quot;<br>          git push origin &quot;$VERSION&quot;<br><br>      - name: Trigger Workflow Tests<br>        uses: benc-uk/workflow-dispatch@v1<br>        with:<br>          workflow: test.yml<br>          repo: &lt;ORG&gt;/shared-workflows<br>          inputs: &#39;{&quot;tag&quot;:&quot;${{ steps.semver.outputs.next }}&quot;}&#39;<br>          ref: main</pre><h4><strong>Workflow Tests ✅</strong></h4><ul><li>The Test Action Workflow fires automatically for each new tag.</li><li>It exercises the fresh tag against real example repositories.</li><li>When the matrix is green, CI stamps a release‑X.X.X tag and publishes a GitHub Release.</li></ul><pre>name: Workflow Tester<br><br>on:<br>  workflow_dispatch:<br>    inputs:<br>      tag:<br>        description: &quot;Tag to test&quot;<br>        required: true<br>        default: &quot;&quot;<br><br>concurrency:<br>  group: workflow-tests<br>  cancel-in-progress: false<br><br>permissions:<br>  contents: write<br>  id-token: write<br><br>jobs:<br>  # You can call other internal repo workflows, or with a small change<br>  # other workflows in test repos<br>  test-workflows:<br>    uses: ./.github/workflows/test-pull-request.yml<br>    with:<br>      tag: ${{ github.event.inputs.tag }}<br><br>  workflow-checks:<br>    needs:<br>      - java-workflows<br>    runs-on: ubuntu-latest<br>    steps:<br>      - run: echo &quot;✅  All downstream releases succeeded for tag ${{ github.event.inputs.tag }}&quot;<br><br>      - name: Checkout repository<br>        uses: actions/checkout@v4<br>        with:<br>          fetch-depth: 0<br><br>      - name: Tag commit<br>        env:<br>          VERSION: release-${{ github.event.inputs.tag }}<br>        run: |<br>          set -euo pipefail<br>          echo &quot;Version to release: $VERSION&quot;<br>          git config user.name  &quot;CI&quot;<br>          git config user.email &quot;ci@github.com&quot;<br><br>          # create or update the annotated tag locally<br>          if git rev-parse &quot;$VERSION&quot; &gt;/dev/null 2&gt;&amp;1; then<br>            git tag -f &quot;$VERSION&quot;<br>          else<br>            git tag -a &quot;$VERSION&quot; -m &quot;Release $VERSION&quot;<br>          fi<br>          git push origin &quot;refs/tags/$VERSION&quot;<br><br>      - name: Publish GitHub release<br>        uses: ncipollo/release-action@v1.16.0<br>        with:<br>          tag: &quot;release-${{ github.event.inputs.tag }}&quot;<br>          name: &quot;release-${{ github.event.inputs.tag }}&quot;<br>          body: ${{ steps.changelog.outputs.changes }}<br>          draft: false<br>          makeLatest: true<br>          allowUpdates: true<br>          generateReleaseNotes: true<br><br>      - name: Build Summary<br>        run: |<br>          echo &quot;Tag: &#39;release-${{ github.event.inputs.tag }}&#39; created 🚀&quot; &gt;&gt; $GITHUB_STEP_SUMMARY</pre><h4><strong>Promote 🚀</strong></h4><ul><li>A release-team member runs the manual <strong>Promote Action</strong>, supplying the new release‑1.2.0 tag.</li><li>The script <em>force‑moves</em> the floating <strong>v1</strong> pointer. Every repository pointing to @v1 will automatically pick up the new workflow on its next run.</li></ul><pre>name: Promote release tag<br><br>on:<br>  workflow_dispatch:<br>    inputs:<br>      target_tag:<br>        description: &quot;Tag to promote (must start with release-)&quot;<br>        required: true<br>        type: string<br><br>concurrency:<br>  group: promote-release-tag<br>  cancel-in-progress: false<br><br>permissions:<br>  contents: write<br>  actions: write<br>  id-token: write<br><br>jobs:<br>  promote:<br>    if: ${{ github.ref == &#39;refs/heads/main&#39; }}<br>    runs-on: ubuntu-latest<br><br>    steps:<br>      - name: Ensure actor is in Release team<br>        env:<br>          ORG: &quot;&lt;ORG&gt;&quot;<br>          TEAM: &quot;release-team&quot;<br>          ACTOR: ${{ github.actor }}<br>        run: |<br>          set -e<br>          state=$(gh api \<br>            orgs/$ORG/teams/$TEAM/memberships/$ACTOR \<br>            --jq &#39;.state&#39; 2&gt;/dev/null || echo &quot;none&quot;)<br><br>          if [[ &quot;$state&quot; != &quot;active&quot; ]]; then<br>            echo &quot;::error::Only members of the $TEAM team can run this workflow&quot;<br>            exit 1<br>          fi<br><br>      - name: Checkout repository<br>        uses: actions/checkout@v4<br>        with:<br>          fetch-depth: 0<br><br>      - name: Validate target tag<br>        env:<br>          TAG_INPUT: ${{ github.event.inputs.target_tag }}<br>        run: |<br>          if [[ ! &quot;$TAG_INPUT&quot; =~ ^release- ]]; then<br>            echo &quot;::error ::Input must start with &#39;release-&#39;&quot;<br>            exit 1<br>          fi<br>          if ! git ls-remote --tags origin &quot;refs/tags/$TAG_INPUT&quot; | grep -q .; then<br>            echo &quot;::error ::Tag &#39;$TAG_INPUT&#39; does not exist in this repository&quot;<br>            exit 1<br>          fi<br><br>      - name: Promote to v1<br>        env:<br>          TAG_INPUT: ${{ github.event.inputs.target_tag }}<br>        run: |<br>          git config user.name &quot;CI&quot;<br>          git config user.email &quot;ci@github.com&quot;<br>          echo &quot;Promoting $TAG_INPUT → v1&quot;<br>          git tag -f v1 &quot;$TAG_INPUT&quot;<br>          git push -f origin v1<br><br>      - name: Build Summary<br>        run: |<br>          echo &quot;Tag: &#39;${{ github.event.inputs.target_tag }}&#39; promoted to v1 🚀&quot; &gt;&gt; $GITHUB_STEP_SUMMARY</pre><h4><strong>Rollback (phew!) 🔙</strong></h4><ul><li>If gremlins appear, just re‑run Promote with an earlier tag (v1.1.3). Pipelines self‑heal on their next execution—no repository edits needed.</li></ul><blockquote><strong><em>Pro tip:</em></strong><em> Building an experimental branch? Pin directly to </em><em>@v1.2.0 or a commit SHA to guarantee byte‑for‑byte reproducibility.</em></blockquote><h3>Consuming a workflow ☝️</h3><p>Pipelines are the skeletal system of a modern engineering org: invisible when healthy, excruciating when broken. Shared Workflows gives you a single, living standard for how we build, test, and release software — <em>without</em> slowing teams down or locking them into one‑size‑fits‑all YAML.</p><p>So try it today: add that three‑line uses: block, open a pull request, and watch a clean, green checkmark land before your coffee goes cold. Consistency never felt so lightweight.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39f734c7573d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Cost‑Effective AWS WAF Logging Pipeline with Terraform, CloudWatch, and S3]]></title>
            <link>https://medium.com/@allankp/building-a-cost-effective-aws-waf-logging-pipeline-with-terraform-cloudwatch-and-s3-c1a77fc4131c?source=rss-260a1fd2cdb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1a77fc4131c</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloudwatch]]></category>
            <category><![CDATA[waf]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Allan Kilpatrick]]></dc:creator>
            <pubDate>Tue, 22 Apr 2025 08:47:04 GMT</pubDate>
            <atom:updated>2025-04-22T08:47:04.391Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6r5WLe7FaahtzsSZguwfXw.jpeg" /></figure><p>Blocking malicious traffic with AWS WAF is only half the story — you also need clear, reliable logs so security and platform teams can investigate threats, spot false positives, and tune rules. This article walks through a lightweight logging architecture that captures <em>only</em> the requests that were actually blocked, keeping both noise and cost low. All examples are production‑ready and written in Terraform so you can drop them straight into your infrastructure‑as‑code repository.</p><pre><br>resource &quot;aws_s3_bucket&quot; &quot;waf_logs&quot; {<br>  bucket        = &quot;aws-waf-logs-eu-west-1&quot;<br>  force_destroy = true<br>}<br><br>resource &quot;aws_s3_bucket_public_access_block&quot; &quot;waf_logs&quot; {<br>  bucket                  = aws_s3_bucket.waf_logs.id<br>  block_public_acls       = true<br>  block_public_policy     = true<br>  ignore_public_acls      = true<br>  restrict_public_buckets = true<br>}<br><br>resource &quot;aws_cloudwatch_log_group&quot; &quot;waf_logs&quot; {<br>  name              = &quot;aws-waf-logs-eu-west-1-blocked&quot; #Note: The Log group must start with aws-waf-logs-<br>  retention_in_days = 14           # keep data two weeks—tune as needed<br>}<br><br>resource &quot;aws_wafv2_web_acl_logging_configuration&quot; &quot;application&quot; {<br>  log_destination_configs = [aws_cloudwatch_log_group.waf_logs.arn]<br>  resource_arn            = aws_wafv2_web_acl.waf.arn # Your WAF ARN<br><br>  # Only keep blocked requests to save storage and Insight query costs<br>  logging_filter {<br>    default_behavior = &quot;DROP&quot;<br><br>    filter {<br>      behavior    = &quot;KEEP&quot;<br>      requirement = &quot;MEETS_ANY&quot;<br><br>      condition {<br>        action_condition { action = &quot;BLOCK&quot; }<br>      }<br>    }<br>  }<br>}</pre><h3>Why this layout?</h3><p><strong>S3 bucket; </strong>Optional long‑term archive for log exports, and a landing zone if you later switch the WAF destination from CloudWatch to S3.force_destroy = true lets Terraform tear the bucket down safely in lower environments.</p><p><strong>CloudWatch Log Group; </strong>Primary destination for real‑time exploration with CloudWatch Logs Insights.retention_in_days = 14 keeps bills predictable; export to S3 if you need longer retention.</p><p><strong>Logging filter; </strong>Drops everything except BLOCK events so you pay only for the data you care about. You can extend the filter later to include COUNT or ALLOW actions.</p><h3>Real‑time tail</h3><ol><li>Open <strong>CloudWatch → Logs → Log groups</strong>.</li><li>Filter for aws-waf-logs-*.</li><li>Click the group you need and choose <strong>Live Tail</strong> to watch blocks in real time.</li></ol><h3>Ad‑hoc forensics with CloudWatch Logs Insights</h3><p>Set the log group(s) in the <strong>Selection criteria</strong> drop‑down, paste the query, and click <strong>Run query</strong>.</p><pre>fields @timestamp,<br>       httpRequest.clientIp,<br>       httpRequest.uri,<br>       terminatingRuleId,<br>       action<br>| filter action = &#39;BLOCK&#39;<br>| sort @timestamp desc<br>| limit 50</pre><p><strong>What this returns</strong></p><ul><li>The 50 most‑recent blocked requests.</li><li>Client IP and URI — handy for quick IP bans or rule tuning.</li><li>terminatingRuleId pinpoints which WAF rule actually stopped the request.</li></ul><blockquote><strong><em>Tip:</em></strong><em> Add </em><em>json and </em><em>parse statements to break out headers, user agents, or query‑string parameters when you need deeper context.</em></blockquote><h3>Improvements</h3><ol><li><strong>Export to S3</strong> automatically with a Log Group subscription if you need to keep logs &gt;30 days or feed them into Athena/Splunk/Elastic.</li><li><strong>Add a metric filter</strong> on “&gt;0 blocked requests” to create a CloudWatch Alarm for bursty attacks.</li><li><strong>Instrument dashboards</strong> per application so product teams can self‑serve insights without full CloudWatch access.</li></ol><h3>Conclusion</h3><p>By streaming AWS WAF logs straight into CloudWatch, filtered down to <em>only</em> the requests that matter, you get immediate visibility without a flood of data or eye‑watering bills. The Terraform shown here is battle‑tested: copy‑paste, adjust the naming locals, and push to production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1a77fc4131c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying ARC into AWS EKS: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@allankp/deploying-arc-into-aws-eks-a-step-by-step-guide-db7f275142bd?source=rss-260a1fd2cdb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/db7f275142bd</guid>
            <category><![CDATA[helm]]></category>
            <category><![CDATA[aws-eks]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[github-actions]]></category>
            <dc:creator><![CDATA[Allan Kilpatrick]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 09:18:43 GMT</pubDate>
            <atom:updated>2025-03-24T09:18:43.244Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="AWS EKS Github" src="https://cdn-images-1.medium.com/max/1024/1*q2xk7yWfg1foQnE9qEGFvQ.jpeg" /></figure><p>In today’s dynamic development environment, automating CI/CD workflows is critical to accelerate software delivery. In this article, we’ll explore how to deploy the Actions Runner Controller (ARC) into an AWS EKS cluster. ARC lets you dynamically scale self-hosted GitHub Actions runners on Kubernetes, ensuring you have the right compute resources when you need them.</p><h3>Prerequisites</h3><p>Before diving in, ensure you have the following tools installed on your local machine:</p><ul><li><strong>Helm:</strong> Package manager for Kubernetes.</li><li><strong>eksctl:</strong> CLI tool to create and manage EKS clusters.</li><li><strong>Homebrew:</strong> If you’re on macOS, you can install the above tools using:</li></ul><pre>brew install helm eksctl</pre><p>Additionally, you’ll need an AWS account with the necessary permissions and a GitHub Personal Access Token (PAT) for authenticating your ARC deployment.</p><h3>Step 1: Creating an EKS Cluster</h3><p>The first step is to create an EKS cluster. Using eksctl, you can spin up a new cluster in just one command. In this example, we name the cluster arc-cluster and deploy it in the eu-west-1 region, it also has EKS Auto Mode enabled :</p><pre>eksctl create cluster \<br>  --name arc-cluster \<br>  --region eu-west-1 \<br>  --with-oidc \<br>  --enable-auto-mode</pre><p>Once the cluster is created, update your local kubeconfig so that your kubectl can communicate with the new EKS cluster:</p><pre>aws eks --region eu-west-1 update-kubeconfig --name arc-cluster</pre><p>K9s provides an excellent CLI interface for seamless cluster management — discover more at <a href="https://k9scli.io/">k9scli.io</a>.</p><p>This configuration step is crucial for managing your cluster and deploying ARC components.</p><h3>Step 2: Deploying the ARC Controller</h3><p>The ARC Controller is responsible for managing the lifecycle of GitHub Actions runners. Before installing it, you must create a GitHub Personal Access Token (PAT). This token provides the necessary permissions for ARC to interact with your GitHub repositories. Once you’ve generated the token from your GitHub settings page, you’re ready to proceed.</p><p>For organization-based runners, ensure your PAT token has the necessary permissions: repo and admin:org.</p><p>Deploy the ARC Controller into your cluster using Helm:</p><pre>helm install arc \<br>    --namespace arc-runners \<br>    --create-namespace \<br>    --set authSecret.create=true \<br>    --set authSecret.github_token=&lt;GITHUB_PAT_TOKEN&gt; \<br>    oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller</pre><p>Replace &lt;GITHUB_PAT_TOKEN&gt; with your actual token. This command installs the controller into the arc-runners namespace and configures it to authenticate with GitHub.</p><h3>Step 3: Deploying ARC Runners</h3><p>With the controller up and running, the next step is to deploy ARC Runners. These runners execute your GitHub Actions jobs and scale based on demand. Use Helm to deploy the runner set:</p><p><strong>Note:</strong> Set the githubConfigUrl to your config repository&#39;s URL. If you&#39;re deploying to an organization, use your organization&#39;s URL instead.</p><pre>helm install arc-runner-set \<br>    --namespace arc-runners \<br>    --create-namespace \<br>    --set githubConfigUrl=&quot;https://github.com/&lt;ORG-NAME&gt;&quot; \<br>    --set githubConfigSecret.github_token=&lt;GITHUB_PAT_TOKEN&gt; \<br>    --set minRunners=1 \<br>    --set maxRunners=10 \<br>    oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set</pre><p>Again, make sure to substitute &lt;GITHUB_PAT_TOKEN&gt; with your GitHub token. The settings in this command specify a minimum of one runner and allow scaling up to ten runners as needed. Adjust these values based on your workload.</p><h3>Step 4: Running Your First GitHub Action Pipeline</h3><p>Now that ARC and its runners are deployed, you can integrate them into your GitHub workflows. Here’s a sample GitHub Actions pipeline that uses the ARC runners to check connectivity to Google:</p><pre>name: Test<br>on:<br>  push:<br>    branches: [ main ]<br>  workflow_dispatch:<br>jobs:<br>  check-google:<br>    runs-on: arc-runner-set<br>    steps:<br>      - name: Ping Google<br>        run: |<br>          echo &quot;Checking connectivity to google.com...&quot;<br>          curl -Is https://google.com | head -n 1</pre><p>This simple pipeline is triggered on pushes to the main branch or manually via the GitHub Actions UI. It runs a job on the ARC runners, which executes a script to verify connectivity by sending a curl request to Google.</p><h3>Conclusion</h3><p>Deploying ARC into AWS EKS unlocks powerful automation for your CI/CD pipelines. By leveraging Kubernetes to manage self-hosted GitHub Actions runners, you can efficiently scale your builds and tests based on workload demands. With just a few simple commands, you’ve set up an EKS cluster, deployed the ARC Controller and Runners, and configured a sample GitHub Actions workflow.</p><p>This approach not only improves resource utilization but also provides a flexible and scalable infrastructure for continuous integration. Experiment with different configurations and let ARC power your automated workflows!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db7f275142bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Load testing using Boto3 and Locust]]></title>
            <link>https://medium.com/@allankp/populating-dashboards-with-boto3-and-locust-ff38b113349a?source=rss-260a1fd2cdb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff38b113349a</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[load-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Allan Kilpatrick]]></dc:creator>
            <pubDate>Thu, 18 Jul 2019 07:48:37 GMT</pubDate>
            <atom:updated>2019-07-18T07:51:01.996Z</atom:updated>
            <content:encoded><![CDATA[<h3>Load Testing using Boto3 and Locust</h3><p>Having the means of pushing traffic through your service can be very helpful for finding issues, system tests, load testing, demoing the system to stakeholders or even just to make your dashboards show some numbers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BJyNkzaOlO2sgD3wLJZylQ.jpeg" /></figure><p>This post will take you through how to create a custom <a href="https://locust.io/">Locust </a>client using <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/index.html">Boto3 </a>, plus obtaining <a href="https://aws.amazon.com/api-gateway/">AWS API Gateway</a> resources via Boto3 and running locust tasks via the command line.</p><p>To start us off we need a couple of packages Boto3 and Locustio installed. With Python I would recommend setting up a <a href="https://virtualenv.pypa.io/en/latest/">Virtualenv</a>.</p><pre>pip install boto3 locustio</pre><p>For the API Gateway resources we will be calling a <a href="https://docs.locust.io/en/stable/writing-a-locustfile.html#taskset-class">Locust task</a>. We need to create a Boto3 client and filter down to the correct API Gateway. Once we have that we can grab the resources.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25b2efd10389a2ccc019b9673b8a7d65/href">https://medium.com/media/25b2efd10389a2ccc019b9673b8a7d65/href</a></iframe><p>This will return us a list of all the resources on your API Gateway, meaning the name of the resources (end points) that we can call with the test_invoke_method with the Boto3 client.</p><p>Next up we want to create the custom Boto3 class that will extend the base Locust class, using what we have built above.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37ee0636ce3df9f91fbbf3a0283d8beb/href">https://medium.com/media/37ee0636ce3df9f91fbbf3a0283d8beb/href</a></iframe><p>You will notice inside this class we have our methods to get the API Gateway resources and a method to perform the test_invoke_method to call the endpoint.</p><p>We have events in there as well. These are methods that allow Locust to report on the requests being sent and the status. There is also the response_time reporting on the time taken per request.</p><p>The last part we need is the Locust tasks. These methods define the logic being performed for each task.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9d18d052f0829f00614cdcf28670121/href">https://medium.com/media/f9d18d052f0829f00614cdcf28670121/href</a></iframe><p>Pieced together the full code looks like this <a href="https://gist.github.com/allankp/aa1f001c5e3fbc79f4e9e37a7a02b252">Github Gist</a>. These can also be run via a WebUI. The guide for this can be found on the <a href="https://docs.locust.io/en/stable/quickstart.html#start-locust">Locust site</a>.</p><p>Now let’s give it a go:</p><pre>python -m locust.main -f path/to/your/file.py SimpleSendRequest --host=&#39;&#39; --no-web --clients=5 --hatch-rate=1 --run-time=5m</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff38b113349a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Self service Code Coverage with SonarCloud]]></title>
            <link>https://medium.com/@allankp/self-service-code-coverage-with-sonarcloud-2bc74e574059?source=rss-260a1fd2cdb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bc74e574059</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[sonarcloud]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Allan Kilpatrick]]></dc:creator>
            <pubDate>Fri, 12 Jul 2019 08:19:39 GMT</pubDate>
            <atom:updated>2019-07-12T08:19:39.376Z</atom:updated>
            <content:encoded><![CDATA[<p>Any testing or development professional has been asked at some point in their career:</p><blockquote>“I need to know our overall code coverage, I need it for the TPS report!”</blockquote><blockquote>— Manager</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*czAHnEcybLtTeeaGaonMqQ.jpeg" /><figcaption>In case you didn’t know: <a href="https://movies.stackexchange.com/questions/88169/what-are-tps-reports">TPS Reports</a></figcaption></figure><p>Trying to get this on a weekly or monthly basis can be annoying, especially if you have a large number of repositories, so why not automate it and make it self service?</p><p>For this example we’ll be using <a href="https://sonarcloud.io/about">SonarCloud</a>, and an <a href="https://docs.aws.amazon.com/lambda/index.html">AWS Lambda</a> function to get the data we need.</p><p>SonarCloud can be plugged into your build pipeline. This will evaluate your code based on a rule set, with feedback including possible bugs, code smells and coverage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*NsVcvXmBfXz5NQ2O20mATw.png" /><figcaption>Source: <a href="https://sonarcloud.io/">SonarCloud.io</a></figcaption></figure><p>Let’s get started, you will have to create an API token on your SonarCloud account, Settings &gt; Security . This will allow us to call the API and grab the data we need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*aoQOl-omCoZKucIL_U6zjQ.png" /></figure><p>Next login to the<a href="https://aws.amazon.com/console/"> AWS Console</a> (create an account if don’t have one already, it has a free tier). Head over to the Lambda service and create a new function, select Python3.7 as the run time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wmzUyq4lOOrTCcG57fzNAw.png" /></figure><p>This is the lambda code used to call and format the data from the SonarCloud API:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d08c33915a0457843f2bfc08f97faea6/href">https://medium.com/media/d08c33915a0457843f2bfc08f97faea6/href</a></iframe><p>The above finds all the components in the organisation with the first call then makes second call to get the code coverage metric for each one. What we get returned is a dict with coverage for each repository and the average across all repositories.</p><p>Here’s the results, add to the TPS report, all done!</p><pre>{<br>    &quot;components&quot; {<br>       &quot;repo_one&quot;: &quot;99.05&quot;,<br>       &quot;repo_two&quot;: &quot;85.06&quot;,<br>       &quot;repo_three&quot;: &quot;40&quot;<br>},<br>    &quot;average&quot;: &quot;74.70&quot;<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bc74e574059" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>