<?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 L. Armstrong on Medium]]></title>
        <description><![CDATA[Stories by David L. Armstrong on Medium]]></description>
        <link>https://medium.com/@daversomethingsomething?source=rss-9ac56f739a0e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by David L. Armstrong on Medium</title>
            <link>https://medium.com/@daversomethingsomething?source=rss-9ac56f739a0e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:11:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@daversomethingsomething/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[Troubleshooting Conan ZFS GitHub ARC Container Initialization slowness]]></title>
            <link>https://daversomethingsomething.medium.com/troubleshooting-conan-zfs-github-arc-container-initialization-slowness-ba3ee7be6fb0?source=rss-9ac56f739a0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba3ee7be6fb0</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[openebs]]></category>
            <category><![CDATA[zfs]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[David L. Armstrong]]></dc:creator>
            <pubDate>Fri, 30 Jan 2026 17:08:03 GMT</pubDate>
            <atom:updated>2026-02-09T14:04:00.421Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Continuing our work with <a href="https://daversomethingsomething.medium.com/conan-and-zfs-and-kubernetes-ci-oh-my-0ebef5beb244">GitHub ARC with ZFS and Conan</a>…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2A49S2VeNeqImhbCYW0kpQ.png" /><figcaption><em>Check out </em><a href="https://excalidraw.com/"><em>Excalidraw</em></a><em> and their nifty diagramming tool!</em></figcaption></figure><p>When we left off, we were seeing that our GitHub ARC workflows were taking a significant amount of time to start when using containerMode: kubernetes as opposed to containerMode: dind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5dKKPRH2_D61U6Yc986pTw.png" /><figcaption>Example: ARC K8s Runner “Initialize containers” workflow step</figcaption></figure><p>This step normally takes no more than 1–3seconds, but is consistently taking 30+ seconds in our current setup. In our small-scale example, that delay is even longer than the time our ZFS caching solution saves us! <em>(When compared to downloading our dependencies from artifact management.)</em></p><p>We did not experience anything odd or unexpected related to performance in our <a href="https://daversomethingsomething.medium.com/optimizing-the-inner-loop-with-conan-and-zfs-in-remote-devcontainers-bac5d19b874a">devContainer</a> demo, so this new development is concerning. This issue is critical to resolve for the success of this project!</p><p>Since I’ve already been documenting each step of setting up this solution, this was a prime opportunity to document the process of troubleshooting a performance issue. Hopefully gaining some more insight into how the infrastructure is working in the process as well as I try to explain it here.</p><p>I’ve left out much of the drudgery and trial &amp; error involved, but tried to share some of the more interesting misdirections and bad guesses. They’re just part of the fun.</p><h3>Environment</h3><h4>Hardware</h4><p>We’ll be using the same hardware as our previous demos. All performance optimizations in this demo are done in the software configuration, we’re not doing any hardware optimization. This solution should perform regardless of the hardware involved.</p><ul><li>Server — AMD 8945HS/64GB/SSD</li><li>Workstation — AMD 9900X/32GB/SSD</li><li>Notebook — Macbook Pro M4 Pro</li><li>Network — Ubiquiti UniFi 2.5Gb/s Switch</li></ul><h4>Software</h4><ul><li><a href="https://github.com/actions/actions-runner-controller/blob/master/README.md">GitHub Actions Runner Controller (ARC)</a></li><li><a href="https://openzfs.org/">OpenZFS</a> filesystem and storage platform</li><li><a href="https://openebs.io/">OpenEBS</a> with <a href="https://github.com/openebs/zfs-localpv/blob/develop/README.md">Local PV ZFS plugin</a></li><li><a href="https://conan.io/">Conan C/C++ Package Manager</a></li><li>Docker — <a href="https://github.com/DaverSomethingSomethingOrg/conan-toolchain-demo/tree/main/demos/gcc-toolchain/conan-build-container/README.md">ConanToolchain Docker Container Image</a></li><li><a href="https://www.sonatype.com/products/nexus-community-edition-download">Sonatype Nexus Community Edition</a></li></ul><h3>GitHub ARC built-in debugging</h3><p>We’ll start by enabling the maximum logging GitHub Actions can provide. We’ll add two new variable definitions to the repo for GitHub Actions to use.</p><p>Reference: <a href="https://docs.github.com/en/actions/how-tos/monitor-workflows/enable-debug-logging">https://docs.github.com/en/actions/how-tos/monitor-workflows/enable-debug-logging</a></p><ul><li>ACTIONS_RUNNER_DEBUG: true (string)</li><li>ACTIONS_STEP_DEBUG: true (string)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fubvbnnOQ1OOkvM9aBWmkw.png" /><figcaption><em>View from GitHub UI</em></figcaption></figure><h3>Breaking it down</h3><p>While GitHub does not provide granular timing data in its log files, it can show us precise timestamps for each log entry in the web UI by pressing Shift + T while on the job log screen. Combined with enabling debug logging this gives us something to work with at least.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ge_RawQre8CE1X-ffHcGHA.png" /></figure><p>Breaking this down, we can see where the majority of the time is going:</p><pre>12  Fri, 30 Jan 2026 00:09:53 GMT ##[debug]Job pod created, waiting for it to come online linux-x86-64-5fgk8-runner-8299r-workflow<br>13  Fri, 30 Jan 2026 00:10:25 GMT ##[debug]Job pod is ready for traffic</pre><p>For this particular job, 32s of the total 33s of the “Initialize containers” step is spent waiting for the created Pod to start running. Looking at the source code we can locate the debug messages to see what’s going on in between the log messages.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c1bb2746bbded9bf281968959392a94d/href">https://medium.com/media/c1bb2746bbded9bf281968959392a94d/href</a></iframe><h3>waitForPodPhases()</h3><p>While waitForPodPhases() is probably not going to be the source of our slowness, it&#39;s not providing much insight into what&#39;s happening either.</p><p>Let’s take a look at the source to see what it does.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cacb9e71daf276a7e0181b8b9b517c2/href">https://medium.com/media/2cacb9e71daf276a7e0181b8b9b517c2/href</a></iframe><p>waitForPodPhases() uses a typical binary exponential backoff to poll Kubernetes for our workflow container until it gets from <strong>Pending</strong>to <strong>Running</strong>state. This is not ideal but it does have a max delay interval and a maximum wait time set, so we&#39;re not going to worry about it.</p><h3>Conclusion</h3><p>waitForPodPhases() is not the source of our delay, but the exponential backoff may be making the problem appear worse than it is. For some reason Kubernetes is delaying our pod startup with ARC but not with our devContainer.</p><p>We’ll need to go look at the Kubernetes logs for our next clues.</p><h3>Kubernetes Pod startup troubleshooting</h3><p>Now that we’re focused specifically on Kubernetes, we can directly compare our devContainer pod startup to our GitHub ARC Workflow pod startup.</p><p>We need to gather more information before we’re ready to try out any changes.</p><h4>Monitoring devContainer startup</h4><p>The first step we’ll take is to start one of each of our workflow and devContainer pods, watching the timing on our devContainer to verify that our startup delay doesn’t occur.</p><p>We’ll use the below manifest to test our devContainer pod startup. We’ve changed it a bit since our devContainer demo to use the same volume syntax as our GitHub ARC hook extension.</p><p>Previously we created the conan-home PersistentVolumeClaim separately from the pod and then mounted it. We&#39;ll switch to including the conan-home PVC as an ephemeral volume defined using a volumeClaimTemplate. We&#39;re not expecting this to be the cause of our startup delay, but we do want to elimintate it as a variable before going further.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61e0833c689ca7b79dcd9d0b0407c1bc/href">https://medium.com/media/61e0833c689ca7b79dcd9d0b0407c1bc/href</a></iframe><p>We’ll use a simple bash script to time the pod startup until the pod reaches “Running” status.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/384056e90d22bd9e0c58e6d68579bf9a/href">https://medium.com/media/384056e90d22bd9e0c58e6d68579bf9a/href</a></iframe><blockquote>Trying it out</blockquote><pre>❯ ./timeStartup.sh devcontainer-pod-test.yaml<br>pod/devcontainer-pod-test created<br>[0s] Status: Pending.  Looping...<br>[1s] Status: Pending.  Looping...<br>[2s] Status: Pending.  Looping...<br>[3s] Status: Pending.  Looping...<br>[4s] Status: Running.<br>real    0m4.417s<br>user    0m0.473s<br>sys     0m0.208s<br><br>dave@hephaestus ~/projects/K3sDevContainer/devContainer                                                                                                         09:38:34<br>❯</pre><blockquote><strong>DevContainer Pod Events</strong></blockquote><pre>❯ kubectl describe pod devcontainer-pod-test -n devcontainer<br>[...]<br>Events:<br>  Type     Reason            Age                    From               Message<br>  ----     ------            ----                   ----               -------<br>  Warning  FailedScheduling  2m19s                  default-scheduler  0/1 nodes are available: waiting for ephemeral volume controller to create the persistentvolumeclaim &quot;devcontainer-pod-test-conan-home&quot;. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.<br>  Warning  FailedScheduling  2m19s (x2 over 2m19s)  default-scheduler  0/1 nodes are available: pod has unbound immediate PersistentVolumeClaims. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.<br>  Warning  FailedScheduling  2m18s (x2 over 2m18s)  default-scheduler  0/1 nodes are available: pod has unbound immediate PersistentVolumeClaims. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.<br>  Normal   Scheduled         2m18s                  default-scheduler  Successfully assigned devcontainer/devcontainer-pod-test to hephaestus.homelab<br>  Normal   Pulled            2m18s                  kubelet            Container image &quot;nexus.homelab/conan-docker-build-ubuntu:x86_64-latest&quot; already present on machine<br>  Normal   Created           2m18s                  kubelet            Created container: code-init<br>  Normal   Started           2m18s                  kubelet            Started container code-init<br>  Normal   Pulled            2m17s                  kubelet            Container image &quot;nexus.homelab/conan-docker-build-ubuntu:x86_64-latest&quot; already present on machine<br>  Normal   Created           2m17s                  kubelet            Created container: conan-container<br>  Normal   Started           2m17s                  kubelet            Started container conan-container</pre><p>The pod status entries confirm the lack of delay as well:</p><blockquote><strong>DevContainer Pod Status Changes</strong></blockquote><pre>❯ kubectl get pod devcontainer-pod-test -n devcontainer -o yaml<br>[...]<br>status:<br>  conditions:<br>  - lastProbeTime: null<br>    lastTransitionTime: &quot;2026-01-19T17:38:31Z&quot;<br>    status: &quot;True&quot;<br>    type: PodScheduled<br>  - lastProbeTime: null<br>    lastTransitionTime: &quot;2026-01-19T17:38:32Z&quot;<br>    status: &quot;True&quot;<br>    type: PodReadyToStartContainers<br>  - lastProbeTime: null<br>    lastTransitionTime: &quot;2026-01-19T17:38:32Z&quot;<br>    status: &quot;True&quot;<br>    type: Initialized<br>  - lastProbeTime: null<br>    lastTransitionTime: &quot;2026-01-19T17:38:33Z&quot;<br>    status: &quot;True&quot;<br>    type: ContainersReady<br>  - lastProbeTime: null<br>    lastTransitionTime: &quot;2026-01-19T17:38:33Z&quot;<br>    status: &quot;True&quot;<br>    type: Ready<br>[...]</pre><h4>Comparing to GitHub ARC workflow pod startup</h4><p>Checking the same logs for our GitHub ARC workflow pod we can clearly see a difference, but it’s not quite clear why yet.</p><blockquote><strong>GitHub ARC Workflow Pod Events</strong></blockquote><pre>❯ kubectl describe pod linux-x86-64-5fgk8-runner-v84xb-workflow -n devcontainer<br>[...]<br>Events:<br>  Type     Reason       Age   From     Message<br>  ----     ------       ----  ----     -------<br>  Warning  FailedMount  107s  kubelet  Unable to attach or mount volumes: unmounted volumes=[conan-home], unattached volumes=[], failed to process volumes=[conan-home]: error processing PVC devcontainer/linux-x86-64-5fgk8-runner-v84xb-workflow-conan-home: PVC is not bound<br>  Normal   Pulled       91s   kubelet  Container image &quot;nexus.homelab/conan-build-almalinux:x86_64-latest&quot; already present on machine<br>  Normal   Created      91s   kubelet  Created container: job<br>  Normal   Started      91s   kubelet  Started container job</pre><blockquote><strong>GitHub ARC Workflow Pod Status Changes</strong></blockquote><pre>❯ kubectl get pod linux-x86-64-5fgk8-runner-v84xb-workflow -n devcontainer -o yaml<br>[...]<br>status:<br>  conditions:<br>  - lastProbeTime: null<br>    lastTransitionTime: &quot;2026-01-30T00:17:15Z&quot;<br>    status: &quot;True&quot;<br>    type: PodScheduled<br>  - lastProbeTime: null<br>    lastTransitionTime: &quot;2026-01-30T00:17:15Z&quot;<br>    status: &quot;True&quot;<br>    type: Initialized<br>  - lastProbeTime: null<br>    lastTransitionTime: &quot;2026-01-30T00:17:32Z&quot;<br>    status: &quot;True&quot;<br>    type: PodReadyToStartContainers<br>  - lastProbeTime: null<br>    lastTransitionTime: &quot;2026-01-30T00:17:32Z&quot;<br>    status: &quot;True&quot;<br>    type: ContainersReady<br>  - lastProbeTime: null<br>    lastTransitionTime: &quot;2026-01-30T00:17:32Z&quot;<br>    status: &quot;True&quot;<br>    type: Ready</pre><p>A few observations here:</p><ul><li>There is a noticeable jump from -91s to -107s after that FailedMount event.</li><li>The devContainer pod shows a series of FailedScheduling warnings from default-scheduler. We see no events from default-scheduler for the GitHub ARC pod at all.</li><li>The GitHub ARC pod shows a FailedMount message that the devContainer pod does not.</li></ul><p>We have confirmed the issue is within the Kubernetes realm, and it appears to be happening after Initialized but before PodReadyToStartContainers.</p><h4>Duct tape and bailing wire</h4><p>Did you notice that the pod only took 16s to get to Ready status? Why was GitHub Actions waiting 30s+?</p><p>It looks like we’re not very lucky in the waitForPodPhases() cycle. Since it uses a binary exponential backoff cycle from 1s, the series of backOff() sleeps looks like:</p><blockquote>1s + 2s + 4s + 8s + 16s = 31s</blockquote><p>If we’re not able to resolve the root cause of our performance issue, it looks like we can tune backOff() to punish us less. It would not be a comprehensive fix, and it would likely work with varying levels of success in other environments.</p><p>We could probably reclaim the majority of the last 16s sleep, cutting the delay in half. It would still be significantly slower than the 1–3s timing we’re looking for however, only slightly faster than downloading from artifact management.</p><h4>Digging Deeper</h4><p>With the FailedMount warning there are a couple experiments for us to try.</p><ol><li>Modify GitHub ARC hook extension to remove the conan-home PVC only, isolate our OpenEBS ZFS volume from GitHub ARC.</li><li>Diff our DevContainer Pod manifest against the manifest that GitHub ARC hook applies, there has to be something significant there.</li></ol><h3>Experiment 1: Evaluate GitHub ARC performance without conan-home PVC</h3><p>Probably the easiest and fastest experiment to test is simply modifying the <a href="https://gist.github.com/daversomethingsomething/5f065731187d1678f95a536dc81951f6">GitHub ARC Hook Extension ConfigMap</a> that we set up.</p><p>Since mounting our conan-home PVC is essentially the only thing our hook extension does, there isn&#39;t much left. Rather than remove the ConfigMap, we&#39;ll leave a single debugging environment setting to make sure the PVC provisioning and mount are the only changes.</p><p>This configuration should build and run cleanly, but will not benefit from the ZFS cloned Conan cache at all.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39d6189fd63f3dc502056b6eaa8cf469/href">https://medium.com/media/39d6189fd63f3dc502056b6eaa8cf469/href</a></iframe><p>Once the ConfigMap change is applied, the GitHub ARC Runners will pick up the change <em>automatically</em> once the cluster nodes have a chance to resync their state. We can verify that our runners have picked up the change before running our test job by connecting to the runner container and checking the file where we chose install our hook extension.</p><pre>runner@linux-x86-64-st6ng-runner-5dskd:~$ cat pod-template/content<br>metadata:<br>  annotations:<br>    example: &quot;extension&quot;<br>    annotated-by: &quot;extension&quot;<br>  labels:<br>    labeled-by: &quot;extension&quot;<br>spec:<br>  containers:<br>    - name: $job<br>      imagePullPolicy: IfNotPresent<br>      env:<br>        - name: DEBUG_CONAN_HOME<br>          value: /CONAN_HOME<br>runner@linux-x86-64-st6ng-runner-5dskd:~$</pre><p>When we run a test job with this updated hook extension, the delay is no longer present.</p><h4>BEFORE</h4><pre>Fri, 30 Jan 2026 00:09:53 GMT ##[debug]Job pod created, waiting for it to come online linux-x86-64-5fgk8-runner-8299r-workflow<br>Fri, 30 Jan 2026 00:10:25 GMT ##[debug]Job pod is ready for traffic</pre><h4>AFTER</h4><pre>Wed, 21 Jan 2026 17:08:58 GMT ##[debug]Job pod created, waiting for it to come online linux-x86-64-st6ng-runner-ql7f4-workflow<br>Wed, 21 Jan 2026 17:08:59 GMT ##[debug]Job pod is ready for traffic</pre><p>The delay appears to be a conflict or compatibility issue between our GitHub ARC configuration and our OpenEBS ZFS configuration. Examining the Pod manifests further should expose the issue.</p><h3>Experiment 2: DevContainer and ARC Pod Manifest differences</h3><p>In order to understand why this difference is occurring, we need to look at the YAML specs for the pods. In addition to our hook extension, the k8s hook adds other environment settings and volume mounts to the workflow pod.</p><p>Since the workflow pods are ephemeral, we’ll add some debugging to the GitHub ARC Kubernetes Hook at workflow pod creation time. Alternatively we could try to catch a workflow pod while a job is running and examine its manifest. We’ll start with dumping the workflow pod spec template to the debug log.</p><h4>Deprecated?</h4><p>The default GitHub ARC k8s hook in the default GitHub Actions Runner container we’re using is an older version, <strong>v0.7.0</strong>. We need to be careful to make sure the changes we make are to the correct version!</p><p>Snippet from the Runner container image <a href="https://github.com/actions/runner/blob/main/images/Dockerfile#L7">Dockerfile</a>:</p><pre>ARG RUNNER_CONTAINER_HOOKS_VERSION=0.7.0<br><br>[...]<br><br>RUN curl -f -L -o runner-container-hooks.zip https://github.com/actions/runner-container-hooks/releases/download/v${RUNNER_CONTAINER_HOOKS_VERSION}/actions-runner-hooks-k8s-${RUNNER_CONTAINER_HOOKS_VERSION}.zip \<br>    &amp;&amp; unzip ./runner-container-hooks.zip -d ./k8s \<br>    &amp;&amp; rm runner-container-hooks.zip</pre><p>The change we’ll make is simple, just send the pod spec to the debug log:</p><pre>root@1ab970f2f7fb:/workspaces/runner-container-hooks/packages/k8s/src# git diff -U3 k8s/index.ts<br>diff --git a/packages/k8s/src/k8s/index.ts b/packages/k8s/src/k8s/index.ts<br>index 021b383..cf8c794 100644<br>--- a/packages/k8s/src/k8s/index.ts<br>+++ b/packages/k8s/src/k8s/index.ts<br>@@ -17,6 +17,7 @@ import {<br>   useKubeScheduler,<br>   fixArgs<br> } from &#39;./utils&#39;<br>+import * as yaml from &#39;yaml&#39;<br><br>const kc = new k8s.KubeConfig()<br>@@ -127,6 +129,8 @@ export async function createPod(<br>     mergePodSpecWithOptions(appPod.spec, extension.spec)<br>   }<br>+  core.debug(`Creating workflow pod using spec: \n${yaml.stringify(appPod.spec)}`)<br>+<br>   const { body } = await k8sApi.createNamespacedPod(namespace(), appPod)<br>   return body<br> }</pre><p>We’ll build a custom container image for our runners to use our modified k8s hook. It&#39;s as simple as replacing /home/runner/k8s/index.js with our custom build.</p><p><strong>Forked Runner Dockerfile with enhanced debugging</strong></p><pre>FROM ghcr.io/actions/actions-runner:latest<br><br>COPY --chown=runner:docker index.js /home/runner/k8s/index.js</pre><p>With our updated runner container image we now see the following in our “Initialize containers” workflow step log:</p><p><strong>Initialize containers log with debugging patch applied</strong></p><pre>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]Using image &#39;nexus.homelab/conan-build-almalinux:x86_64-latest&#39; for job image<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]Creating workflow pod using spec:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]containers:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]  - name: job<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]    image: nexus.homelab/conan-build-almalinux:x86_64-latest<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]    ports: []<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]    workingDir: /__w/test-actions-dev/test-actions-dev<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]    command:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - tail<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]    args:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - -f<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - /dev/null<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]    env:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - name: GITHUB_ACTIONS<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        value: &quot;true&quot;<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - name: CI<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        value: &quot;true&quot;<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - name: CONAN_HOME<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        value: /CONAN_HOME<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]    volumeMounts:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - name: work<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        mountPath: /__w<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - name: work<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        mountPath: /__e<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        subPath: externals<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - name: work<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        mountPath: /github/home<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        subPath: _temp/_github_home<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - name: work<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        mountPath: /github/workflow<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        subPath: _temp/_github_workflow<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      - name: conan-home<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        mountPath: /CONAN_HOME<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]    imagePullPolicy: IfNotPresent<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]restartPolicy: Never<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]nodeName: hephaestus.homelab<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]volumes:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]  - name: work<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]    persistentVolumeClaim:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      claimName: linux-x86-64-st6ng-runner-mh2j6-work<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]  - name: conan-home<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]    ephemeral:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]      volumeClaimTemplate:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]        spec:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]          accessModes:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]            - ReadWriteOncePod<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]          storageClassName: openebs-zfspv<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]          volumeMode: Filesystem<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]          dataSource:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]            name: gcc12-toolchain-main<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]            kind: PersistentVolumeClaim<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]          resources:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]            requests:<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]              storage: 200Gi<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]<br>Mon, 19 Jan 2026 19:10:47 GMT ##[debug]Job pod created, waiting for it to come online linux-x86-64-st6ng-runner-mh2j6-workflow</pre><p>Next we’ll take that spec, remove the ##[debug] line prefixes, and diff it against our devContainer spec using yq/jq.</p><p><a href="https://stackoverflow.com/questions/31930041/using-jq-or-alternative-command-line-tools-to-compare-json-files">Using jq or alternative command line tools to compare JSON files</a></p><p>After ignoring the initContainer differences we are reduced to the following diff:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bca2e37e2ace2f1d715c2c088aa47a98/href">https://medium.com/media/bca2e37e2ace2f1d715c2c088aa47a98/href</a></iframe><p>Further ignoring the standard GitHub ARC volumes/mounts that are not showing any issues when used without conan-home, the only remaining part of the diff that&#39;s significant is this:</p><pre>+  &quot;restartPolicy&quot;: &quot;Never&quot;,<br>+  &quot;nodeName&quot;: &quot;hephaestus.homelab&quot;,</pre><p>This nodeName spec stands out particularly because we originally configured node affinity for our OpenEBS storage classes.</p><ul><li><a href="https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-zfs/configuration/zfs-create-storageclass#zfs-pool-availability">https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-zfs/configuration/zfs-create-storageclass#zfs-pool-availability</a></li></ul><pre>allowedTopologies:<br>- matchLabelExpressions:<br>  - key: kubernetes.io/hostname<br>    values:<br>      - hephaestus.homelab</pre><p>We also noticed the default-scheduler warnings with our devContainer, so the delay we&#39;re seeing could easily be related to scheduling.</p><p>We don’t have anything conclusive yet, but we do have a solid lead to chase.</p><h3>Best Guess</h3><p>My best guess at this point is that mixing use of allowedTopologies and nodeName in Kubernetes scheduling constraints is probably the source of the issue. Even when the node specified is the same one used by both OpenEBS and GitHub ARC. Even when there&#39;s only one node in the cluster.</p><p>Some searching turns up <a href="https://github.com/openebs/openebs/issues/3667">OpenEBS — Issue #3667</a>.</p><p><a href="https://github.com/openebs/openebs/issues/3667">PVC is not bound when using spec.nodeName · Issue #3667 · openebs/openebs</a></p><p>It’s not 100% conclusive that this is the same issue, but there is a fair likelyhood of it being related. We have some questions we have that issue doesn’t answer however:</p><ul><li>Issue #3667 is reported against localpv-hostpath, but we are using ZFS Local PV.</li><li>Issue #3667 seems to indicate the Pod should fail to start up, ours is just slow/delayed.</li><li>Why does ours successfully start with our conan-home volume mounted after FailedMount?</li><li>Does it try again differently somehow? Why is ours just slow?</li></ul><p>Rather than relentlessly pursue the answers, we can simply try one more experiment to see if we can implement a workaround.</p><h3>Experiment 3: ARC Pod Manifest without nodeName</h3><p>Our next experiment is to simply remove nodeName constraint from the pod spec manifest that the GitHub ARC k8s hook applies.</p><p>We’ll need to rebuild our runner container image once more for this modified hook.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9dae4465c531fd234b5a81399b6bf02f/href">https://medium.com/media/9dae4465c531fd234b5a81399b6bf02f/href</a></iframe><p>Running a test job we see:</p><pre>Fri, 23 Jan 2026 17:25:14 GMT ##[debug]Job pod created, waiting for it to come online linux-x86-64-st6ng-runner-d4n2f-workflow<br>Fri, 23 Jan 2026 17:25:17 GMT ##[debug]Job pod is ready for traffic</pre><p><strong>It worked!</strong> Performance was restored to ~3s on workflow pod startup.</p><h3>Eureka!</h3><p>It worked… but. While we were so busy patching that code in the ARC k8s Hook, we had time to think more about the code than our particular problem, and found something else! …hiding directly in plain sight.</p><p>That code we patched…</p><pre>const nodeName = await getCurrentNodeName()<br>if (useKubeScheduler()) {<br>  appPod.spec.affinity = await getPodAffinity(nodeName)<br>} else {<br>  appPod.spec.nodeName = nodeName<br>}</pre><h3>What’s a useKubeScheduler()?</h3><p>Since we’re seeing the warnings regarding the default-scheduler for our devContainer that we&#39;re not seeing with ARC, this option to potentially change ARC&#39;s scheduling behavior and not set nodeName seems like a great option to test.</p><p>Using appPod.spec.affinity instead of appPod.spec.nodeName sounds more compatible with our use of allowedTopologies in OpenEBS, but we&#39;ll have to see what getPodAffinity(nodeName) returns.</p><p>We can test it in parallel though if we can enable useKubeScheduler().</p><p>Well, here it is…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/efc83294742e6f92617a6f3aca490e6c/href">https://medium.com/media/efc83294742e6f92617a6f3aca490e6c/href</a></iframe><p>Like so many other features of GitHub ARC, it turns out triggering this behavior is not very well documented, but some quick searching turned up the <strong>ACTIONS_RUNNER_USE_KUBE_SCHEDULER</strong> environment setting.</p><p>I can’t find much documentation on it beyond it’s original pull request <a href="https://github.com/actions/runner-container-hooks/pull/111"><strong>runner-container-hooks PR#111</strong></a>. The community seems to be aware of it enough to try and use it, though. Some of the reported issues around it were similar to our use case and also educational in general.</p><p><a href="https://github.com/actions/runner-container-hooks/pull/111">Add option to use the kubernetes scheduler for workflow pods by Wielewout · Pull Request #111 · actions/runner-container-hooks</a></p><p>We’ll add this environment variable to our RunnerScaleSet’s values.yaml.</p><pre>template:<br>  spec:<br>    containers:<br>    - name: runner<br>      env:<br>        - name: ACTIONS_RUNNER_USE_KUBE_SCHEDULER<br>          value: &quot;true&quot;</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/79d0fd10b11f5c077e371b97e0e27c9b/href">https://medium.com/media/79d0fd10b11f5c077e371b97e0e27c9b/href</a></iframe><p>Running another test job we see:</p><pre>Sat, 24 Jan 2026 19:32:21 GMT ##[debug]Job pod created, waiting for it to come online linux-x86-64-nx2ns-runner-5ln6x-workflow<br>Sat, 24 Jan 2026 19:32:24 GMT ##[debug]Job pod is ready for traffic</pre><p><strong>Looks good!</strong> Same ~3s performance on workflow pod startup.</p><p>Reading the manifest on the newly running workflow pod we can see what getPodAffinity(nodeName) contributed to the spec:</p><pre>affinity:<br>  nodeAffinity:<br>    requiredDuringSchedulingIgnoredDuringExecution:<br>      nodeSelectorTerms:<br>        - matchExpressions:<br>            - key: kubernetes.io/hostname<br>              operator: In<br>              values:<br>                - hephaestus.homelab</pre><p>Which looks compatible with the OpenEBS constraint we showed earlier..</p><pre>allowedTopologies:<br>- matchLabelExpressions:<br>  - key: kubernetes.io/hostname<br>    values:<br>      - hephaestus.homelab</pre><p>Both are now using kubernetes.io/hostname: hephaestus.homelab and with the same scheduler.</p><h3>Are We There Yet?</h3><p>Running on the default runner image with a clean working values.yaml for our RunnerScaleSet, and a clean hook extension connecting our conan-home ZFS clone. Awesome.</p><p>One more thing…</p><p>While troubleshooting this issue we found that the default k8s hook is old (v0.7.0). It&#39;s not clear why the newer hook release (v0.8.0) has a new name (k8s-novolume) and does not(?) appear to be the default version at this point.</p><p>Let try “just one more” experiment to try the k8s-novolume hook and see how well it works with our conan-home OpenEBS PVC. It may be feasible to switch directly to v0.8.0 if it handles our data volumes better than v0.7.0 does.</p><h3>Experiment 4: GitHub ARC containerMode: k8s-novolume</h3><p>For this test we only had to modify our RunnerScaleSet values.yaml.</p><pre>containerMode:<br>-   type: &quot;kubernetes&quot;<br>+   type: &quot;kubernetes-novolume&quot;<br><br>[...]<br>  template:<br>    spec:<br>      containers:<br>      - name: runner<br>        env:<br>          - name: ACTIONS_RUNNER_CONTAINER_HOOKS<br>-           value: /home/runner/k8s/index.js<br>+           value: /home/runner/k8s-novolume/index.js</pre><p>It appears that v0.8.0 of the k8s hook has removed all of the node affinity requirements and implementation. Rather than relying on volumes shared between the runner pod and the workflow pod, the updated k8s hook will copy files around the cluster as necessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UE81A2WpRXFCnw8XyG4HLw.png" /><figcaption>GitHub ARC `k8s-novolume` Initialize Containers debug log</figcaption></figure><p>The unfortunate downside of this is that it slows down our workflow container initialization significantly. We’ve traded the node affinity issue for a data transfer issue.</p><pre>Mon, 26 Jan 2026 16:57:34 GMT ##[debug]Job pod created, waiting for it to come online linux-x86-64-dtm9h-runner-jqjvt-workflow<br>Mon, 26 Jan 2026 16:57:49 GMT ##[debug]Job pod is ready for traffic</pre><p>It’s only 15s in this case, but some basic debugging has shown this delay appears to be in the initContainers moving data around at runtime rather than more Kubernetes scheduling issues.</p><p>We will table this until a future point when we’re ready to look at optimization of the externals and other data transfers that the runner applies to the workflow job container.</p><p>While we are well-equipped to continue tackling performance issues like this, we need to move on. The default version we’re using (v0.7.0) is working very well and is apparently stable given that it’s no longer maintained. v0.7.0 also seems like a closer fit to our use case since it requires the same sort of node affinity for data volumes. We won’t escape without any tech debt at all..</p><h3>What’s Next</h3><p>We need to continue testing and optimizing this solution before we can go to production with it. Functionality is proven to be working and correct, and the single major performance issue we found is now resolved. There are still many things we need to look at regarding security, performance, and ease-of-use.</p><p>For our next steps, we’ll continue looking at performance optimization and security hardening. We’ll also need to circle back on saving broken builds and promoting our updated cache on successful build.</p><h3>References</h3><ul><li><a href="https://docs.github.com/en/actions/how-tos/monitor-workflows/enable-debug-logging">GitHub Actions — Enable debug logging</a></li><li><a href="https://github.com/actions/runner/blob/main/images/Dockerfile#L7">GitHub Actions — Runner container image</a></li><li><a href="https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-zfs/configuration/zfs-create-storageclass#zfs-pool-availability">OpenEBS — Local PV ZFS — Configuration</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba3ee7be6fb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Conan and ZFS and Kubernetes CI (Oh my!)]]></title>
            <link>https://daversomethingsomething.medium.com/conan-and-zfs-and-kubernetes-ci-oh-my-0ebef5beb244?source=rss-9ac56f739a0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ebef5beb244</guid>
            <category><![CDATA[conan]]></category>
            <category><![CDATA[c-programming]]></category>
            <category><![CDATA[zfs]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[openebs]]></category>
            <dc:creator><![CDATA[David L. Armstrong]]></dc:creator>
            <pubDate>Mon, 15 Dec 2025 16:38:31 GMT</pubDate>
            <atom:updated>2025-12-16T11:10:41.752Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Continuing our work with <a href="https://daversomethingsomething.medium.com/optimizing-c-c-build-performance-using-conan-and-openzfs-f648a31086bc">Conan Sandboxes with ZFS</a> and <a href="https://daversomethingsomething.medium.com/optimizing-the-inner-loop-with-conan-and-zfs-in-remote-devcontainers-bac5d19b874a">Conan DevContainers with ZFS in Kubernetes</a>, this time we’ll explore implementing a CI solution in our Kubernetes environment using GitHub Actions Runner Controller (ARC) with OpenEBS.</p><p>We’ll skip over most of the boilerplate and default setup and focus on just the special configuration details required for leveraging our ZFS Conan Cache with GitHub Actions in Kubernetes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ACHkWAFneBYUrn-w.png" /><figcaption><em>Check out </em><a href="https://excalidraw.com/"><em>Excalidraw</em></a><em> and their nifty diagramming tool!</em></figcaption></figure><h3>Environment</h3><h4>Hardware</h4><p>We’ll be using the same hardware as we did in our previous demos.</p><ul><li>Server — AMD 8945HS/64GB/SSD</li><li>Workstation — AMD 9900X/32GB/SSD</li><li>Notebook — Macbook Pro M4 Pro</li><li>Network — Ubiquiti UniFi 2.5Gb/s Switch</li></ul><p>We’ve added a few new services onto our server, but at idle we’re still using only 10GB of RAM and just a fraction of a single CPU core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0qgeKrfLO_JVsLdj.png" /></figure><p>Since we’re making heavy use of build avoidance through caching, we’re able to use a power-efficient CPU and don’t need a very elaborate storage configuration. We are running a significant number of processes however; we’ll want to have a flexible number of CPU cores and a good amount of memory to avoid thrashing.</p><h4>Software</h4><ul><li><a href="https://github.com/actions/actions-runner-controller/blob/master/README.md">GitHub Actions Runner Controller (ARC)</a></li><li><a href="https://openzfs.org/">OpenZFS</a> filesystem and storage platform</li><li><a href="https://openebs.io/">OpenEBS</a> with <a href="https://github.com/openebs/zfs-localpv/blob/develop/README.md">Local PV ZFS plugin</a></li><li><a href="https://conan.io/">Conan C/C++ Package Manager</a></li><li>Docker — <a href="https://github.com/DaverSomethingSomethingOrg/conan-toolchain-demo/tree/main/demos/gcc-toolchain/conan-build-container/README.md">ConanToolchain Docker Container Image</a></li><li><a href="https://www.sonatype.com/products/nexus-community-edition-download">Sonatype Nexus Community Edition</a></li></ul><h3>OpenEBS ZFS Setup</h3><p>We’ll reuse the ZFS installation from our previous demo as well, including the toplevel dataset we populated with a toolchain build to clone our DevContainers from.</p><p><a href="https://daversomethingsomethingorg.github.io/ConanToolchain/latest/ConanK8sDevContainerDemo/#openebs-zfs-setup">Click here for more information</a></p><p><strong>Warning: </strong>OpenEBS does not support advanced ZFS operations such as promote or rename, so we&#39;ll need to look at a different approach to replace these parts of the workflow we used outside of Kubernetes. <a href="https://daversomethingsomethingorg.github.io/ConanToolchain/latest/ConanZFSDemo/#promote-the-successful-builds-clone">Conan ZFS Demo Workflow</a></p><h3>Comparing GitHub ARC Configurations</h3><p>GitHub Actions Runner Controller is <em>complicated</em>, and documentation is fairly sparse. It ships with reasonable defaults that make ARC easy to get deployed and working, but customizing its behavior requires a strong understanding of ARC and GitHub Runners in general.</p><p>I’ve included links in the <strong><em>References</em></strong> section below for the most directly applicable documentation I found in setting up this demo.</p><p>In order to work with our ZFS Conan cache using GitHub ARC Runners, we first need to look at how GitHub Actions Runners behave when using GitHub ARC. Out of the box, GitHub ARC’s <a href="https://github.com/actions/actions-runner-controller/blob/master/docs/gha-runner-scale-set-controller/README.md">RunnerScaleSet</a> includes a <a href="https://docs.github.com/en/actions/tutorials/use-actions-runner-controller/deploy-runner-scale-sets#using-docker-in-docker-or-kubernetes-mode-for-containers">containerMode</a> configuration option which probably affects the Runner’s behavior more than all other options. On the workflow side, choosing whether to <a href="https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/run-jobs-in-a-container">run in a container</a> or not will affect the behavior of this solution the most.</p><p>We&#39;ll compare different configurations of these two primary variables here.</p><h4>containerMode: kubernetes with containerized workflows</h4><p>This mode has the distinct advantage over all other modes in that it waits until the workflow job starts in order to snapshot and clone our ZFS Conan cache. This ensures that the cache is as up-to-date as it can be, while keeping warm standby Runner processes ready to take on new jobs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WrcUb0n-i9pgphEG.png" /><figcaption>containerMode: kubernetes with containerized workflows</figcaption></figure><p>Optimizing performance is beyond the scope of this demo, but keeping Runners on stand-by, ready to launch new jobs seems like a reasonable step towards minimizing job startup time.</p><p><strong>How it works</strong></p><p>There’s a lot going on here, but in a nutshell:</p><ol><li>We set the ACTIONS_RUNNER_CONTAINER_HOOKS in the Runner container environment. This will point to a wrapper script that the Runner will use to run our workflow actions and script steps rather than running them directly itself. We&#39;ll use the hook package included in the default Runner image: <a href="https://github.com/actions/runner-container-hooks/blob/main/packages/k8s/README.md">/home/runner/k8s/index.js</a></li><li>ACTIONS_RUNNER_CONTAINER_HOOK_TEMPLATE points the k8s/index.js hook to our workflow pod spec &quot;extension&quot; to connect our ZFS cache PVC to the workflow $job container. We&#39;ll use a ConfigMap and volumeMount it for this piece of the puzzle.</li><li>At job start time, the k8s/index.js wrapper creates the workflow pod and starts the $job container.</li><li>As the $job container is started, our PVC volume specification causes OpenEBS to snapshot and clone our ZFS Conan cache DataSet. It&#39;ll be volumeMount&#39;d just as we did with our devContainer.</li><li>Runner.Worker hands off each workflow job step to the k8s/index.js wrapper for execution in the $job container.</li><li>Upon job completion, the ZFS cache PVC, $job container, and the runner and workflow jobs are all destroyed and resources freed up.</li></ol><p>For all of this complex functionality, the configuration involved is remarkably minimal (details below). Understanding how the Runner and hook operate is critical to setting it up correctly and troubleshooting any issues with your workflows in the future.</p><h4><strong>Issues with </strong><strong>containerMode: kubernetes</strong></h4><p>This solution satisfies our functional requirements nicely, but still has some rough spots and limitations we’ll need to work around.</p><p><strong>k8s/index.js doesn&#39;t show its work</strong></p><p>When compared with containerMode: dind, or a shell runner operating a containerized workflow, k8s/index.js doesn&#39;t log much information unless an error is encountered. This is especially evident in the container orchestration done to prepare a job for running prior to starting it.</p><ul><li>For troubleshooting workflow issues at runtime, the GitHub Actions logs do not give us much information to work with. This probably benefits our security posture by not exposing as many details about our infrastructure, but it also limits our diagnostic capability.</li><li>To illustrate this issue, check out the screenshots below with the log output from running the same containerized workflow using shell and kubernetes runners (particularly the “Initialize containers” step):</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FZI3mzQCf5y7XDqc.png" /><figcaption>Example: Shell Runner “Initialize containers” workflow step</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Krt7GwUf0r0mNZwR.png" /><figcaption>Example: ARC K8s Runner “Initialize containers” workflow step</figcaption></figure><p><strong>k8s/index.js is slow!</strong></p><ul><li>From those same screenshots above we can also see a significant difference in the time taken by k8s/index.js vs. orchestrating docker. Without more logging and timing data it&#39;s difficult to understand where this additional time is spent, but we&#39;ll look into that in the future.</li></ul><p><strong>The </strong><strong>k8s/index.js hook extension is limited to the Workflow Pod definition only</strong></p><ul><li>The hook extension template is only able to modify or extend the Workflow Pod template; it is not capable of orchestrating resources outside of provisioning the Workflow Pod. While this is already a plus over the other configurations discussed below, it is still an inconvenient limitation for our use case.</li><li>Since we cannot create a PersistentVolume within a Pod definition, we can only leverage the automatic snapshot PV provisioning OpenEBS provides when creating a clone PVC. This results in sub-optimal names for each of our snapshots, not directly associated with our clones. If we were able to provision our snapshot PVs directly, we would be able to give them better names to match our clone PVCs.</li></ul><p><strong>Warning:</strong> Take particular note of the other limitations listed in the k8s/index.js <a href="https://github.com/actions/runner-container-hooks/blob/main/packages/k8s/README.md#limitations">documentation</a>. The limitations listed there did not restrict any functionality of our demo, but YMMV (Your Mileage May Vary) with your own workflows.</p><h4>containerMode: dind with containerized workflows</h4><p>containerMode: dind behaves similarly to containerMode: kubernetes overall, but using a DinD sidecar container to orchestrate the workflow $job container using Docker rather than calling the Kubernetes API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n_Jhysb49rMQ6Zjk.png" /><figcaption>containerMode: dind</figcaption></figure><h4>Issues with containerMode: dind</h4><p><strong>Docker-in-Docker offers no Kubernetes/OpenEBS integration</strong></p><ul><li>Without a means to work with the Kubernetes API, we cannot leverage OpenEBS to provision snapshot PVs or clone PVCs when starting the $job container for the workflow.</li><li>We do have access to the Runner container spec, so we can provision a snapshot/clone at Runner start time. Making this clone PVC available to the workflow $job container is awkward at best, however.</li></ul><p><strong>Docker-in-Docker security options are more limited.</strong></p><ul><li>When using Docker-in-Docker, the workflow $job container is running in the same pod as the Runner container. This means they share the same network and IPC namespace, potentially exposing your Runner infrastructure to security vulnerabilities introduced by the workflow and it&#39;s specified container image.</li></ul><h3>Non-Containerized Workflows</h3><p>Non-containerized workflows generally work very similarly with either containerMode. No workflow $job container will be created, and workflows will run directly in the Runner container. In effect they are very similar to using the Runner container as a dynamically scaled shell runner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9nIyt0rYQ_lHF8v3.png" /><figcaption>Non-Containerized Workflows</figcaption></figure><h4>Issues with Non-containerized Workflows</h4><p>Non-Containerized Workflows with GitHub ARC are sub-optimal for a variety of reasons.</p><p><strong>Customizing the container</strong></p><ul><li>Customizing the Runner container requires redeploying the RunnerScaleSet with an updated container image, or making the modifications at workflow runtime. In order to modify the Runner container image, the Runner software needs to be installed, along with any dependencies for actions or the workflows.</li><li>Customizing the container image requires maintaining the customized container image! Here’s a warning from the GitHub docs:<strong> </strong>“<em>Any updates released for the software, including major, minor, or patch releases, are considered as an available update. If you do not perform a software update within 30 days, the GitHub Actions service will not queue jobs to your runner. In addition, if a critical security update is required, the GitHub Actions service will not queue jobs to your runner until it has been updated.”</em> <a href="https://docs.github.com/en/actions/reference/runners/self-hosted-runners#runner-software-updates-on-self-hosted-runners"><strong><em>GitHub Actions Reference — Self-hosted runners</em></strong></a></li></ul><p><strong>OpenEBS ZFS snapshot and clone are provisioned at Runner start time</strong></p><ul><li>Similar to containerMode: dind with containerized workflows, we are able to mount our OpenEBS ZFS Conan cache PVC to the Runner container, but this is done at Runner start time, not job start time. The snapshot will be as old as the Runner has been idle prior to receiving a job to run.</li><li>For a highly utilized RunnerScaleSet, this is probably not a big deal. If you have RunnerScaleSets assigned to quieter branches however, you may want to minimize the number of standby Runners to ensure the Conan cache clone is up-to-date. This will delay job startup however.</li></ul><p><strong>Security is minimal</strong></p><ul><li>Your workflows are running with the same privilege and access as your Runner processes. While Kubernetes generally provides a higher level of security in general when compared to shell runners, this is still not recommended.</li></ul><p><strong><em>For best results with our ZFS Conan cache it is recommended to fully disable support for non-containerized workflows.</em></strong></p><h3>Configuring GitHub ARC</h3><p>For this demo we’ll be using the containerMode: kubernetes with containerized workflows configuration. Having the Conan Cache snapshot taken as late as possible (when the job starts) ensures that it is current with the latest component builds available.</p><p>A second significant benefit to this approach is the ability to extend the workflow pod configuration without having to redeploy or “upgrade” our RunnerScaleSets, or even restart the runners.</p><h3>RunnerScaleSet Helm Chart</h3><p>First, we configure our RunnerScaleSet to run in kubernetes containerMode and to look for our github-arc-container-hooks hook extension. See the footnotes in the snippet below for more information.</p><pre>containerMode:<br>  type: &quot;kubernetes&quot; # Enable containerMode: kubernetes!<br><br>template:<br>  spec:<br>    containers:<br>    - name: runner<br>      image: ghcr.io/actions/actions-runner:latest # note: #1<br>      command: [&quot;/home/runner/run.sh&quot;]<br>      env:<br>        - name: ACTIONS_RUNNER_CONTAINER_HOOKS # note: #2<br>          value: /home/runner/k8s/index.js<br>        - name: ACTIONS_RUNNER_CONTAINER_HOOK_TEMPLATE # note: #3<br>          value: /home/runner/pod-template/content<br>        - name: ACTIONS_RUNNER_REQUIRE_JOB_CONTAINER # note: #4<br>          value: &quot;true&quot;<br>      volumeMounts:<br>        - name: work<br>          mountPath: /home/runner/_work<br>        - name: container-hooks-volume # note: #5<br>          mountPath: /home/runner/pod-template<br>    volumes:<br>    - name: work<br>      ephemeral:<br>        volumeClaimTemplate:<br>          spec:<br>            accessModes: [ &quot;ReadWriteOnce&quot; ]<br>            storageClassName: &quot;local-path&quot;<br>            resources:<br>              requests:<br>                storage: 1Gi<br>    - name: container-hooks-volume # note: #6<br>      configMap:<br>        name: github-arc-container-hooks<br><br><br>#1 We&#39;re using the default Runner container image maintained by GitHub<br><br>#2 `ACTIONS_RUNNER_CONTAINER_HOOKS` identifies the location where the<br>#  k8s/index.js hook is installed in the Runner container image<br><br>#3 `ACTIONS_RUNNER_CONTAINER_HOOK_TEMPLATE` is the location where our<br>#  hook extension template will be mounted<br><br>#4 `ACTIONS_RUNNER_REQUIRE_JOB_CONTAINER` - If a job doesn&#39;t specify<br>#  a container, exit with an Error<br><br>#5 Mount our hook extension volume where<br>#  `ACTIONS_RUNNER_CONTAINER_HOOK_TEMPLATE` can locate it<br><br>#6 Set up the volume attached to our hook extension ConfigMap</pre><p><a href="https://github.com/DaverSomethingSomethingOrg/conan-toolchain-demo/blob/main/demos/ZFS-clone/GitHub-ARC/clusters/values.yaml"><em>original source in GitHub</em></a></p><h3>Attach $CONAN_HOME PersistentVolumeClaim using Hook Extension</h3><p>Next, we’ll define our $CONAN_HOME PersistentVolumeClaim in a ConfigMap within the same namespace as the RunnerScaleSet.</p><p>This is done using the ACTIONS_RUNNER_CONTAINER_HOOK_TEMPLATE hook extension functionality of the k8s/index.js hook. See: <a href="https://docs.github.com/en/actions/tutorials/use-actions-runner-controller/deploy-runner-scale-sets#configuring-hook-extensions"><em>GitHub ARC Documentation</em> - Configuring hook extensions</a> for more details. This hook &quot;extension&quot; is specifically intended to provide for customization of the $job workflow container Pod.</p><p>Reference: <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#mounted-configmaps-are-updated-automatically">Mounted ConfigMaps are updated automatically</a></p><pre>apiVersion: v1<br>kind: ConfigMap<br>metadata:<br>  name: github-arc-container-hooks # note: #1<br>data:<br>  content: \| # note: #2<br>    metadata:<br>      annotations:<br>        example: &quot;extension&quot;<br>        annotated-by: &quot;extension&quot;<br>      labels:<br>        labeled-by: &quot;extension&quot;<br>    spec:<br>      containers:<br>        - name: $job<br>          volumeMounts:<br>            - name: conan-home<br>              mountPath: /CONAN_HOME<br>          env:<br>            - name: CONAN_HOME # note: #3<br>              value: /CONAN_HOME<br>      volumes:<br>        - name: conan-home<br>          ephemeral:<br>            volumeClaimTemplate:<br>              spec:<br>                accessModes: [ &quot;ReadWriteOnce&quot; ]<br>                storageClassName: &quot;openebs-zfspv&quot;<br>                dataSource:<br>                  name: gcc12-toolchain-main # note: #4<br>                  kind: PersistentVolumeClaim<br>                resources:<br>                  requests:<br>                    storage: 200Gi # note: #5<br><br><br>#1 The name we use to identify the `container-hooks-volume` in our<br>#  RunnerScaleSet `values.yaml` above<br><br>#2 The file will be named `content` and needs to match<br>#  `ACTIONS_RUNNER_CONTAINER_HOOK_TEMPLATE` in our RunnerScaleSet<br>#  `values.yaml` above.  It is technically yaml, but it&#39;s not part of this<br>#  ConfigMap manifest, it&#39;s copied into a separate mainfest.<br>#<br>#  Warning: We escape the `|` here with `\` to allow the yaml syntax<br>#  highlighting to work, it must not be escaped in the actual ConfigMap!<br><br>#3 Let Conan know where we mount our OpenEBS ZFS Conan cache volume<br><br>#4 The name of our parent OpenEBS ZFS PersistentVolumeClaim to snapshot<br>#  and clone from<br><br>#5 Make sure this matches the storage requested by the parent PVC!</pre><p><a href="https://github.com/DaverSomethingSomethingOrg/conan-toolchain-demo/blob/main/demos/ZFS-clone/GitHub-ARC/hookExtensionConfigMap.yaml"><em>original source in GitHub</em></a></p><h3>GitHub Actions Workflow</h3><p>For this demo I’ve implemented a simple GitHub Actions Workflow <a href="https://github.com/DaverSomethingSomethingOrg/conan-toolchain-demo/blob/main/.github/workflows/ConanZFSDemo-ARC.yml">ConanZFSDemo-ARC.yml</a>.</p><p>Since all of the ZFS work is done by the Runner on job setup, we only need to configure the <a href="https://github.com/DaverSomethingSomethingOrg/conan-github-workflows/blob/main/.github/workflows/conan-toolchain.yml">conan-toolchain.yml</a> workflow to locate our Conan Cache PVC in /CONAN_HOME.</p><pre>jobs:<br>  conan_toolchain:<br>    uses: DaverSomethingSomethingOrg/conan-github-workflows/.github/workflows/conan-toolchain.yml@main<br>    with:<br>      conan_home: &quot;/CONAN_HOME&quot; <br>      [...]</pre><h3>Limitations and Open Issues</h3><h4>The PVC and ZFS clone are removed at job completion</h4><p>When the runner pod is destroyed, our cache clone PVC and underlying ZFS snapshot and clone are all destroyed, regardless of build success or failure.</p><ul><li><a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#ephemeralvolumesource-v1-core">https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#ephemeralvolumesource-v1-core</a></li></ul><p>If we wish to retain the build or any cache modifications made during the workflow, we’ll need to add additional workflow steps to save them outside of the Runner prior to job completion.</p><p>Using this mechanism, failed builds cannot be saved through the cache clone directly.</p><h4>The PVC is provisioned against a static clone</h4><p>Since we specify the clone parent in the Hook Extension ConfigMap, this clone is not updated dynamically like we do in our non-Kubernetes workflow using zfs promote.</p><p>If our RunnerScaleSet is deployed to the Organization rather than a single repo, then all workflows accessing the RunnerScaleSet will share the same cache. In order to accommodate distinct parent clones, independent RunnerScaleSets would be required.</p><p>This is good for efficiency and performance, but requires coordination to update the original parent clone.</p><p>Modifying the hook extension ConfigMap is a mechanism we could use to replace the zfs promote operation in our workflow. We can simply swap out the PVC parent clone dataSource the runner pod will snapshot from at job startup time.</p><h3>What’s Next</h3><p>By this point the skeleton of our solution is pretty complete! We’ve shown the direct build performance improvement delivered by our ZFS Conan Cache. We’ve also shown how to provide this benefit to Developers with Kubernetes-hosted devContainers, and we’ve tied it into CI with GitHub ARC as well.</p><p>For next steps we need to start looking at bringing this solution to production. We need to dig in on end-to-end performance and security. We’ll also start attacking ease-of-use for both adminstrators and users.</p><h4>Performance Optimization</h4><p>While this solution demonstrates our ability to leverage ZFS for maximum Conan build performance/avoidance, there are still a few steps we can take to optimize GitHub ARC and Runner performance, especially in job startup time.</p><h4>Security Concerns</h4><p>There are many security implications and configuration options with this solution along with the performance concerns. While GitHub ARC ships with reasonable defaults for many environments, we’ll need to explore and refine the configuration for our own environment and needs prior to promoting this solution for production use.</p><h4>Cache Promotion</h4><p>When we build updated components in our cloned cache, we’re not able to promote the updated clone to parent for future builds to leverage.</p><p>The ConfigMap we’re using to identify the parent dataset to clone from can certainly help us here, but we need to be careful to avoid race conditions when doing so. We don’t want a clone being pulled from a cache that’s in the process of being updated!</p><h4>Saving Broken Builds for Troubleshooting</h4><p>With this setup we have the advantage of having an entire Pod setup we can use to reproduce issues. Not only do we have the cache clone available, we also have the container used for the build.</p><p>By default these Runner and Workflow Pods are not persisted after job completion. We’ll want to work out a mechanism that allows those Pods to persist after job completion, but also be careful not to leave too many Runner Pods laying around using up our cluster resources, even if they are idle.</p><h3>Conclusions</h3><p>GitHub ARC with OpenEBS for our ZFS Conan Cache is a highly scalable and flexible system providing strong integration between the infrastructure and the workflow.</p><p>There are a couple drawbacks however:</p><ul><li>While it’s fairly simple to maintain, it is complicated to set up.</li><li>While our CI snapshots and clones are neatly provisioned and cleaned up, we don’t get the benefit of zfs promote, zfs rename, or other more complicated ZFS operations. This requires additional management automation working behind the scenes.</li></ul><h3>References</h3><ul><li><a href="https://github.com/actions/actions-runner-controller/blob/master/docs/about-arc.md"><em>GitHub ARC Documentation</em> — About ARC</a></li><li><a href="https://github.com/actions/actions-runner-controller/blob/master/docs/gha-runner-scale-set-controller/README.md"><em>GitHub ARC Documentation</em> — Autoscaling Runner Scale Sets mode</a></li><li><a href="https://github.com/actions/runner-container-hooks/blob/main/packages/k8s/README.md"><em>GitHub ARC Documentation</em> — K8s Hooks</a></li><li><a href="https://docs.github.com/en/actions/tutorials/use-actions-runner-controller/deploy-runner-scale-sets#using-kubernetes-mode"><em>GitHub ARC Documentation</em> — Using Kubernetes mode</a></li><li><a href="https://docs.github.com/en/actions/tutorials/use-actions-runner-controller/deploy-runner-scale-sets#configuring-hook-extensions"><em>GitHub ARC Documentation</em> — Configuring hook extensions</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ebef5beb244" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing the Inner Loop with Conan and ZFS in Remote DevContainers]]></title>
            <link>https://daversomethingsomething.medium.com/optimizing-the-inner-loop-with-conan-and-zfs-in-remote-devcontainers-bac5d19b874a?source=rss-9ac56f739a0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/bac5d19b874a</guid>
            <category><![CDATA[c-programming]]></category>
            <category><![CDATA[zfs-snapshot]]></category>
            <category><![CDATA[openebs]]></category>
            <category><![CDATA[conan]]></category>
            <category><![CDATA[zfs]]></category>
            <dc:creator><![CDATA[David L. Armstrong]]></dc:creator>
            <pubDate>Sun, 02 Nov 2025 14:17:18 GMT</pubDate>
            <atom:updated>2025-12-13T17:00:01.699Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>We’ve demonstrated the benefits of Conan build avoidance with OpenZFS for cloning our <a href="https://daversomethingsomethingorg.github.io/ConanToolchain/">Conan Toolchain</a> build cache <a href="https://daversomethingsomething.medium.com/optimizing-c-c-build-performance-using-conan-and-openzfs-f648a31086bc">in our previous demo</a>. Now how do we extend that benefit to enhance our Developer Experience as well?</p><p>The answer is remote <a href="https://code.visualstudio.com/docs/devcontainers/containers">DevContainers</a> hosted in Kubernetes!</p><p>In addition to build performance and storage optimization, remote DevContainers will also help secure endpoints by keeping our source code and builds hosted in our datacenter!</p><p>We’ll get the benefit of being able to set up our runtime environment more similar to how we deploy production too. Using the same container images that our CI workflows use, with all of the same dependencies deployed in the same manner.</p><p>“Works on my machine” is really starting to mean something now!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iNnBBocst38ggGECJW_nHQ.png" /><figcaption><em>Check out </em><a href="https://excalidraw.com/"><em>Excalidraw</em></a><em> and their nifty diagramming tool!</em></figcaption></figure><h3>Inspiration</h3><p>This was originally inspired by an article from vxlabs where they set up Kubernetes on their development machine in order to gain remote access to their shared VS Code development environment.</p><blockquote>Botha, Dr. Charl P., vxlabs (2021). “<a href="https://vxlabs.com/2021/11/21/using-kubernetes-for-development-containers">Using Kubernetes for development containers”</a></blockquote><p>It turns out that VS Code can do most of the work once we have a container Pod deployed in Kubernetes and the required VS Code plugins installed.</p><p>We’re going to take this a bit further here and assume <strong><em>all</em></strong> access is remote for an Enterprise-ready implementation. We’ll leverage our centralized Kubernetes cluster for all development in order to take full advantage of our centrally managed, scalable ZFS storage there as well.</p><h3>Related Tools</h3><p>There are a few free/open-source and commercial/SaaS tool offerings in this space, some of which provide significant value over the solution we’re presenting here.</p><ul><li><a href="https://coder.com/">Coder</a> / <a href="https://github.com/coder/envbuilder/blob/main/README.md">Envbuilder</a></li><li><a href="https://devpod.sh/">DevPod</a></li><li><a href="https://docs.github.com/en/codespaces">GitHub Codespaces</a></li><li><a href="https://www.loft.sh/blog/comparing-coder-vs-codespaces-vs-gitpod-vs-devpod">Gitpod vs. Codespaces vs. Coder vs. DevPod: 2024 Comparison</a></li></ul><h3>Scope</h3><p>None of those other tools directly address the use case we’re showing here though; leveraging our copy-on-write filesystem to rapidly clone a large build cache. So that part is what we’ll focus on in this demo.</p><p>We’ll set up and detail the configuration for the plumbing required to utilize DevContainer technology in bare-bones form, connecting it to our ZFS Conan Cache clones. We want our developers to benefit from our ZFS-optimized builds just as much as our CI workflows do!</p><p>By standardizing on OpenEBS for our backend storage management, it should be pretty straightforward to leverage ZFS in those 3rdParty solutions as well.</p><h3>Environment</h3><h4>Hardware</h4><p>We’ll be using the same lan and hardware setup as our previous demos.</p><ul><li>Server — AMD 8945HS/64GB/SSD</li><li>Workstation — AMD 9900X/32GB/SSD</li><li>Notebook — Macbook Pro M4 Pro</li><li>Network — Ubiquiti UniFi 2.5Gb/s Switch</li></ul><h4>Software</h4><ul><li><a href="https://code.visualstudio.com/">Visual Studio Code</a><br>- <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers">DevContainer Extension</a><br>- <a href="https://marketplace.visualstudio.com/items?itemName=ms-kubernetes-tools.vscode-kubernetes-tools">Kubernetes Extension</a></li><li><a href="https://openzfs.org/">OpenZFS</a> filesystem and storage platform</li><li><a href="https://openebs.io/">OpenEBS</a> with <a href="https://github.com/openebs/zfs-localpv/blob/develop/README.md">Local PV ZFS plugin</a></li><li><a href="https://conan.io/">Conan C/C++ Package Manager</a></li><li>Docker — <a href="https://github.com/DaverSomethingSomethingOrg/conan-toolchain-demo/tree/main/demos/gcc-toolchain/conan-build-container/README.md">ConanToolchain Docker Container Image</a></li></ul><h3>OpenEBS ZFS Setup</h3><h4>Installing OpenEBS</h4><p>Reference: <a href="https://openebs.io/docs/quickstart-guide/installation">OpenEBS Installation</a></p><pre>❯ helm repo add openebs https://openebs.github.io/openebs<br>❯ helm repo update</pre><pre>❯ helm install openebs \<br>  --namespace openebs openebs/openebs \<br>  --set engines.replicated.mayastor.enabled=false \<br>  --set zfs-localpv.zfsNode.kubeletDir=/var/lib/kubelet \<br>  --create-namespace<br><br>NAME: openebs<br>LAST DEPLOYED: Wed Oct 15 08:23:30 2025<br>NAMESPACE: openebs<br>STATUS: deployed<br>REVISION: 1<br>TEST SUITE: None<br>NOTES:<br>Successfully installed OpenEBS.<br><br>Check the status by running: kubectl get pods -n openebs<br><br>The default values will install both Local PV and Replicated PV. However,<br>the Replicated PV will require additional configuration to be fuctional.<br>The Local PV offers non-replicated local storage using 3 different storage<br>backends i.e Hostpath, LVM and ZFS, while the Replicated PV provides one replicated highly-available<br>storage backend i.e Mayastor.<br><br>For more information,<br>- view the online documentation at https://openebs.io/docs<br>- connect with an active community on our Kubernetes slack channel.<br>        - Sign up to Kubernetes slack: https://slack.k8s.io<br>        - #openebs channel: https://kubernetes.slack.com/messages/openebs<br>❯</pre><h4>OpenEBS StorageClass definitions</h4><p>Now that OpenEBS is installed with Local PV ZFS, we’ll create our PV and snapshot StorageClass definitions. We’ll need to give the PV StorageClass the name of our toplevel ZFS pool/dataset, and it’s a good idea to specify our worker node in here as well since these are Local PVs.</p><p>Reference: <a href="https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-zfs/configuration/zfs-create-storageclass">OpenEBS Local PV ZFS — Create StorageClass(s)</a></p><pre>apiVersion: storage.k8s.io/v1<br>kind: StorageClass<br>metadata:<br>  name: openebs-zfspv<br>allowVolumeExpansion: true<br>parameters:<br>  recordsize: &quot;128k&quot;<br>  compression: &quot;off&quot;<br>  dedup: &quot;off&quot;<br>  fstype: &quot;zfs&quot;<br>  poolname: &quot;zpool-conancache&quot;<br>provisioner: zfs.csi.openebs.io<br>allowedTopologies:<br>- matchLabelExpressions:<br>  - key: kubernetes.io/hostname<br>    values:<br>      - hephaestus.homelab<br><br>---<br><br>kind: VolumeSnapshotClass<br>apiVersion: snapshot.storage.k8s.io/v1<br>metadata:<br>  name: openebs-zfspv-snapshot<br>  annotations:<br>    snapshot.storage.kubernetes.io/is-default-class: &quot;true&quot;<br>driver: zfs.csi.openebs.io<br>deletionPolicy: Retain</pre><h4>Kubernetes Namespace</h4><p>When creating ZFS snapshot and clone PVCs, they all need to exist in the same namespace and all need to request the same size storage resource, or things will mysteriously not work at all.</p><p>For this demo we’ll create a devcontainer namespace <a href="https://vxlabs.com/2021/11/21/using-kubernetes-for-development-containers/#create-and-set-namespace">like vxlabs</a>.</p><h4>Initial Parent/Toplevel DataSet</h4><p>We’re using the same zpool-conancache ZFS pool from our previous demo, but we want to create a new toplevel dataset to clone from for our Runners and DevContainers. Primarily to isolate our Kubernetes operations from our raw ZFS operations in our previous demo.</p><p>Reference: <a href="https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-zfs/configuration/zfs-create-pvc">OpenEBS Local PV ZFS — Create PersistentVolumeClaim</a></p><pre># Initial PVC for gcc12-toolchain main branch dataset<br>kind: PersistentVolumeClaim<br>apiVersion: v1<br>metadata:<br>  name: gcc12-toolchain-main<br>spec:<br>  storageClassName: openebs-zfspv<br>  accessModes:<br>    - ReadWriteOnce<br>  resources:<br>    requests:<br>      storage: 200Gi</pre><pre>❯ kubectl apply -f gcc12-toolchain-main_dataset.yaml --namespace devcontainer<br>persistentvolumeclaim/gcc12-toolchain-main created<br>❯ kubectl get pvc -n devcontainer<br>NAME                                           STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS    VOLUMEATTRIBUTESCLASS   AGE<br>gcc12-toolchain-main                           Bound    pvc-4f9dd102-cf04-44a2-845f-733d77138a6c   200Gi      RWO            openebs-zfspv   &lt;unset&gt;                 13d<br>❯</pre><h3>DevContainer Pod</h3><p>With OpenEBS set up, and ZFS ready to go, we’re all set to deploy our DevContainer! We’ll create a Pod and attach a PersistentVolumeClaim for our Conan Cache.</p><p>Within the Pod we’ll run an initContainer in order to clone our git repo into a volume that gets attached to our devContainer once the clone is ready.</p><p>In order to avoid file permission issues we’ll want to make sure we configure the securityContext to use the same uid/gid that owns the files in the original dataset. Since GitHub Actions run as root/0 by default, we&#39;ll continue that here also for convenience.</p><p>Warning: Changing to a non-privileged user is an obvious/needed step in securing this solution, but will need to be applied consistently throughout all users of the ZFS dataset.</p><p>Reference: <a href="https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-zfs/advanced-operations/zfs-clone">OpenEBS Local PV ZFS — Clone</a></p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: devcontainer-pod<br>  labels:<br>    app: conan<br>    cache: gcc12-toolchain-main<br>spec:<br>  initContainers:<br>  - name: code-init<br>    image: &quot;nexus.homelab/conan-docker-build-ubuntu:x86_64-latest&quot;<br>    securityContext:<br>      runAsUser: 0<br>      runAsGroup: 0<br>      #fsGroup: 2000<br>    command: [&quot;/bin/sh&quot;, &quot;-c&quot;, &quot;git clone https://github.com/DaverSomethingSomethingOrg/conan-toolchain-demo.git /workspace/conan-toolchain-demo&quot;]<br>    volumeMounts:<br>    - mountPath: /workspace<br>      name: code-volume<br><br>  containers:<br>  - name: conan-container<br>    image: &quot;nexus.homelab/conan-docker-build-ubuntu:x86_64-latest&quot;<br>    imagePullPolicy: IfNotPresent<br>    securityContext:<br>      runAsUser: 0<br>      runAsGroup: 0<br>      #fsGroup: 2000<br>    env:<br>    - name: CONAN_HOME<br>      value: /CONAN_HOME<br>    workingDir: /workspace/conan-toolchain-demo<br>    command: [&quot;/bin/sh&quot;, &quot;-c&quot;, &quot;while sleep 1000; do :; done&quot;]<br>    volumeMounts:<br>    - mountPath: /workspace<br>      name: code-volume<br>    - mountPath: /home/vscode/.cache<br>      name: cache-volume<br>    - mountPath: /CONAN_HOME<br>      name: conan-home<br><br>  volumes:<br>  - name: code-volume<br>    # https://kubernetes.io/docs/concepts/storage/volumes/#emptydir<br>    emptyDir: {}<br>  - name: cache-volume<br>    emptyDir: {}<br>  - name: conan-home<br>    persistentVolumeClaim:<br>      claimName: &quot;gcc12-toolchain-main-hephaestus-devcontainer&quot;<br><br>---<br><br># Clone CONAN_HOME directly from PVC (internal snapshot)<br>kind: PersistentVolumeClaim<br>apiVersion: v1<br>metadata:<br>  name: gcc12-toolchain-main-hephaestus-devcontainer<br>spec:<br>  storageClassName: openebs-zfspv<br>  dataSource:<br>    name: gcc12-toolchain-main<br>    kind: PersistentVolumeClaim<br>  accessModes:<br>    - ReadWriteOnce<br>  resources:<br>    requests:<br>      storage: 200Gi</pre><h3>Using the DevContainer</h3><h4>Provisioning</h4><pre>❯ kubectl apply -f devContainer-pod.yaml --namespace devcontainer<br>persistentvolumeclaim/gcc12-toolchain-main created<br>❯ kubectl get pvc --namespace devcontainer --type all<br>NAME                                           STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS    VOLUMEATTRIBUTESCLASS   AGE<br>gcc12-toolchain-main                           Bound    pvc-4f9dd102-cf04-44a2-845f-733d77138a6c   200Gi      RWO            openebs-zfspv   &lt;unset&gt;                 13d<br>gcc12-toolchain-main-hephaestus-devcontainer   Bound    pvc-005c989b-75e4-485f-9a19-59877deaa3af   200Gi      RWO            openebs-zfspv   &lt;unset&gt;                 11d<br>❯</pre><p>We can verify the snapshot/clone linkage in ZFS. The naming is chosen by OpenEBS internally.</p><pre>❯ zfs list -t all |grep &#39;\(pvc-4f9dd102\|pvc-005c989b\)&#39;<br>zpool-conancache/pvc-4f9dd102-cf04-44a2-845f-733d77138a6c                                           20.6G   161G  20.6G  legacy<br>zpool-conancache/pvc-4f9dd102-cf04-44a2-845f-733d77138a6c@pvc-005c989b-75e4-485f-9a19-59877deaa3af     0B      -  20.6G  -<br>zpool-conancache/pvc-005c989b-75e4-485f-9a19-59877deaa3af                                            496K   161G  20.5G  legacy<br>❯</pre><h4>Connecting VS Code</h4><p>The Pod is running, source repo has been git cloned, and cache volume has been zfs cloned. We&#39;re ready to connect our VS Code instance and get to productive!</p><ul><li><a href="https://code.visualstudio.com/docs/devcontainers/attach-container#_attach-to-a-container-in-a-kubernetes-cluster">VS Code Documentation: Attach to a container in a Kubernetes cluster</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UIsbMjnluEqqcTDj.png" /></figure><p>Once attached, chose “Open Folder” and navigate to the /workspace/repoName directory where we mounted our code-volume.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rtPQRSvSMtrF4j4u.png" /></figure><p><strong>DONE!</strong> We have a working Conan dev environment with a pre-populated local cache.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*24_5SUxi1WlsdMQz0uUiAQ.png" /></figure><h3>Benefits</h3><h4>No waiting for source clone or initial build</h4><p>Remote-managing our developer sandboxes means we can keep a few spare devcontainer pods waiting in a warm-standby pool. Similar to the way we also keep a minimum number of CI runners ready to start jobs with no delay.</p><p>When a developer needs a new workspace, we’ll just assign one of our standby devcontainer pods to them, switch to their desired branch, and they’re off to the races.</p><h4>No downloading source code to endpoints</h4><p>We already take a variety of steps to avoid having developers download our company’s intellectual property onto their notebooks and mobile endpoints. Let’s make this a positive aspect of their experience rather than a source of friction to getting their job done.</p><p>Not only does this solution avoid having our code exposed on a stolen or compromised endpoint, developers won’t want to wait for it to download!</p><h4><strong>Native platform development</strong></h4><p>When your development environments run in a similar or the same environment as production, your endpoint platform is less of a concern. In this demo the Kubernetes worker node is running Ubuntu x86_64, while the developer notebook is an Apple Silicon ARM-based Macbook. With Docker Desktop and DevContainers it is pretty straightforward to run our x86_64 DevContainers, but we pay a severe performance penalty with all commands being wrapped by QEMU emulation.</p><p>Allowing developers to work on their preferred productivity platform while eliminating any potential compatibility issues is a huge win for developer happiness.</p><h4>Remote development with optimal text input latency and response time</h4><p>Remote desktop display and VDI options have always been a sub-optimal developer experience due to high latency in textual input due to transmitting the full graphical environment. This solution keeps the graphics interaction local. Just the text input and output are transmitted while editing code.</p><h3>Demo Limitations</h3><p>We’ve taken some shortcuts in setting up this demo. Here are some of the areas we’d definitely want to tackle before implementing this solution in a production engineering environment.</p><h4>Provisioning is not fully optimized</h4><p>In order to eek out every bit of performance from a remote DevContainer, we’d want to install <a href="https://code.visualstudio.com/docs/remote/vscode-server">vscode-server</a> using our initContainer and have it running and waiting for remote connection prior to the developer attaching to it.</p><p>For this demo we rely on VS Code doing the legwork of finalizing the DevContainer setup for us, including downloading and installing vscode-server and Node.js when attaching. This can be very slow if done over a low-bandwidth remote connection. <em>(I&#39;ve done this from a coffee shop and it&#39;s not an enjoyable developer experience!)</em></p><h4>Custom Certificate Authority</h4><p>The container image we use in our DevContainer is already configured with our custom internal Certificate Authority (CA). For CI jobs, GitHub Actions Runner Controller (ARC) provides custom certificates through a Vault or ConfigMap mounted into the Runner containers. Ideally we would do the same for DevContainers for consistency and to avoid needing a customized container base image.</p><h4>Security and Resource Quotas</h4><p>Yeah, we didn’t bother with any of this nonsense (tongue-in-cheek) for this demo, but our GitHub ARC solution (coming up in our next demo!) handles these issues from the CI point of view. We’ll want to set up our DevContainers with a compatible security model.</p><h3>Conclusion</h3><p>Modern technologies like Kubernetes and DevContainers bring a lot to the table for delivering the full power of scalable high-performance infrastructure right to the developer’s desktop environment without having to sacrifice on developer experience.</p><p>In this demo we showed how to leverage our ZFS snapshot and clone functionality for Conan build optimization in the developer’s sandbox.</p><p>Many engineering organizations are already using NetApp storage and Kubernetes. With some creativity and a few config files and integration scripts we can extract far more value out of the infrastructure we already have. Improving our developer happiness significantly in the process.</p><h3>What’s Next</h3><p>For our next demo we’ll reimplement our <a href="https://daversomethingsomething.medium.com/optimizing-c-c-build-performance-using-conan-and-openzfs-f648a31086bc">raw ZFS CI solution</a> for Conan build performance using OpenZFS, OpenEBS, and GitHub Actions Runner Controller (ARC).</p><h3>References</h3><ul><li><a href="https://daversomethingsomething.medium.com/optimizing-c-c-build-performance-using-conan-and-openzfs-f648a31086bc">Optimizing C/C++ Build Performance using Conan and OpenZFS</a></li><li><a href="https://daversomethingsomethingorg.github.io/ConanToolchain/">Toolchain Build System using Conan</a></li><li><a href="https://vxlabs.com/2021/11/21/using-kubernetes-for-development-containers/">vxlabs — Using Kubernetes for development containers</a></li><li><a href="https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-zfs/zfs-overview">OpenEBS Local PV ZFS — Overview</a></li><li><a href="https://github.com/openebs/zfs-localpv/blob/develop/README.md">OpenEBS Local PV ZFS — GitHub / docs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bac5d19b874a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing C/C++ Build Performance using Conan and OpenZFS]]></title>
            <link>https://daversomethingsomething.medium.com/optimizing-c-c-build-performance-using-conan-and-openzfs-f648a31086bc?source=rss-9ac56f739a0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f648a31086bc</guid>
            <category><![CDATA[zfs-snapshot]]></category>
            <category><![CDATA[conan]]></category>
            <category><![CDATA[zfs]]></category>
            <category><![CDATA[c-programming]]></category>
            <dc:creator><![CDATA[David L. Armstrong]]></dc:creator>
            <pubDate>Fri, 03 Oct 2025 18:27:04 GMT</pubDate>
            <atom:updated>2025-11-02T17:55:23.901Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In this demo we’ll show how to use Conan for build-avoidance along with OpenZFS for build-caching. This solution can provide the highest level of build optimization for very, very large C/C++ projects. Multi-million LoC and the like.</p><p>We’ll use Conan for build avoidance with pre-built binary packages and local caching with artifact management as our backing store. We’ll employ OpenZFS to snapshot and clone our Conan Cache to minimize time to seed the cache for future builds. OpenZFS will also optimize storage utilization across multiple build workspaces, such as massively-parallel CI builds.</p><h3>A Question of Scale</h3><p>For smaller projects this solution probably carries a prohibitive amount of storage maintenance. This solution shines in environments where artifact management service is not local to the build servers, or where downloading 50GB or 500GB worth of build artifacts is not practical for every CI build or developer workspace.</p><p>With this solution we are able to optimize our utilization of CPU, storage space, and network bandwidth all in one shot. Not only are we saving the time to drag package artifacts across our network, we’re also saving duplicated storage on the build side when the same package versions are used across multiple SCM workspaces and branches.</p><p>When we’re supporting multiple compiler configurations (such as optimized, debug, coverage, and the various sanitizer options) across multiple branches, the storage space required for very large projects can be quite significant.</p><p>The cost of this solution is in storage architecture. In order to maximize the value we’ll need to design our storage infrastructure specifically around this solution. We’ll either need to centralize all CI and developer workspaces onto the same storage cluster, or set aside local storage on each build host specifically for build cache use. Or some structured compromise in between..</p><p>Sharing this cache across multiple users is certainly practical and can be very effective with this solution. It brings its own complications such such as file ownership however. Supporting multiple users is beyond the scope of this demo.</p><h3>Conan</h3><p><a href="https://conan.io/">Conan</a>, the C/C++ Package Manager provides us with the most sophisticated build caching technology available, with features such as:</p><ul><li>Component package versioning.</li><li>Binary package support using hashed platform and compiler configurations.</li><li>Local package cache that allows packages to be shared across multiple CI or developer workspaces (with limitations!).</li><li>Native artifact management support in both <a href="https://jfrog.com/help/r/jfrog-artifactory-documentation/supported-package-types">JFrog Artifactory</a> and <a href="https://help.sonatype.com/en/formats.html">Sonatype Nexus</a>, with GitLab support <a href="https://gitlab.com/groups/gitlab-org/-/epics/8258#note_2726326123">in-progress</a>.</li><li>Build system agnostic, with many integrations including CMake, Bazel, GNU Autotools/Make, and <a href="https://docs.conan.io/2/integrations.html">more</a>.</li></ul><p>With these features Conan provides a very strong build-avoidance solution at a component level, not just individual objects/targets. With the build system integration, object build-avoidance technologies can still be integrated as well. That’s beyond the scope of this demo however.</p><p>Using versioned packages still leaves a lot of room for optimization. Downloading pre-built binary packages requires significant network I/O, and only partially helps manage storage use in supporting multiple developer or CI workspaces. One fundamental limtation of Conan’s package cache is that <a href="https://github.com/conan-io/conan/issues/15840">it does not support concurrency</a>. Given enough developer workspaces or CI builds trying to share a local Conan cache, we <em>will</em> run into race conditions eventually, resulting in a corrupted cache.</p><h3>OpenZFS</h3><p><a href="https://openzfs.org/wiki/Main_Page">OpenZFS</a> or other copy-on-write filesystems that support clone functionality provide a reliable, high performance solution to these Conan limitations. Use of filesystem clones allows multiple CI jobs to operate concurrently with safety. Each parallel runner/job can own its own clone without duplicating storage. Further, developers may even clone from last-night’s CI builds as long as they’re operating within the same filesystem (or storage cluster).</p><h4>Proven</h4><p>The original inspiration for this solution comes from NetApp, where I was part of the SCM team supporting ONTAP developer builds in Perforce. For our very large source code trees with their resulting large C/C++ builds, we leveraged NetApp’s own thin-provisioned FlexClone technology. This enabled us to construct developer workspaces pre-seeded with the latest nightly CI build virtually instantaneously.</p><p>NetApp and Perforce have published their Perforce implementation of this solution:</p><ul><li><a href="https://swarm.workshop.perforce.com/projects/netapp-p4flex/">https://swarm.workshop.perforce.com/projects/netapp-p4flex/</a></li><li><a href="https://swarm.workshop.perforce.com/view/guest/netapp/p4flex/extras/docs/P4Flex_Overview_20160511.pdf">https://swarm.workshop.perforce.com/view/guest/netapp/p4flex/extras/docs/P4Flex_Overview_20160511.pdf</a></li></ul><p>This solution provided a very significant developer productivity gain, in most cases. Developers no longer needed to do an initial ONTAP build in their workspaces. They could simply clone last-night’s CI build workspace, sync their client to pick up today’s changes, and then perform an incremental build from there.</p><p>Reliability was not perfect however, and broken builds could result in the developer having to do a clean full build to get back on track.</p><p>Conan improves reliability and error-recovery significantly. If the Conan cache is corrupted somehow, rebuilding the cache is as simple as creating a new cache clone. Or worst-case, re-populate the cache from artifact management. Incremental builds become incremental downloads instead. Additionally, Conan separates the cache storage from the developer workspace. The impact of any cache issue is isolated from the SCM workspace, and vice-versa.</p><h3>Environment and Initial Setup</h3><h3>Hardware</h3><ul><li>Server — 8945HS/64GB/SSD</li><li>Workstation — 9900X/32GB/SSD</li><li>Network — Ubiquiti UniFi 2.5Gb/s Switch</li></ul><h3>Software</h3><ul><li>Sonatype Nexus Community Edition</li><li>OpenZFS filesystem</li><li>Conan C/C++ Package Manager</li><li>Docker — <a href="https://github.com/DaverSomethingSomethingOrg/conan-toolchain-demo/tree/main/demos/gcc-toolchain/conan-build-container/README.md">ConanToolchain Docker Container Image</a></li><li>GitHub Actions with a self-hosted Runner</li></ul><h3>OpenZFS Setup</h3><p>For this example, we’ve got 200GB of storage on our NVMe drive unallocated, so we’ll give it to ZFS and set up a pool to use it. We don’t care about tracking file access time in our Conan cache, so we want to make sure we turn that off to improve performance.</p><p><strong>Creating the ZFS Pool</strong></p><pre>zpool create zpool-conancache /dev/nvme0n1p7<br>zfs set atime=off zpool-conancache</pre><p>In order to delegate management of this pool for this demo, we’ll simply grant sudo access for our CI user github-runner to run /usr/sbin/zfs.</p><p>Sudo is absolutely not a recommended solution for production use, but works fine for this single-user demo. For some alternative suggestions, see the discussion below: sudo vs. zfs allow vs. SSH command key.</p><p><strong>/etc/sudoers entry</strong></p><pre>github-runner    ALL=NOPASSWD: /usr/sbin/zfs</pre><h3>Conan Center Index</h3><p>For use throughout my <a href="https://daversomethingsomethingorg.github.io/ConanToolchain/latest/">ConanToolchain</a> project, I’ve been maintaining a fork of the <a href="https://github.com/conan-io/conan-center-index/blob/master/README.md">Conan Center Index recipe repo</a>.</p><p>In this fork I’ve modified the recipes to download source bundles from GNU mirrors rather than the primary GNU FTP site, and in some cases commit the source bundle into the fork to avoid repeated downloads hammering GNU’s mirror sites.</p><h3>GitHub Actions Workflow</h3><p>For this demo I’ve implemented a simple GitHub Actions Workflow <a href="https://github.com/DaverSomethingSomethingOrg/conan-toolchain-demo/tree/main/.github/workflows/ConanZFSDemo.yml">ConanZFSDemo.yml</a> to manage ZFS, leveraging my existing reusable ConanToolchain workflow <a href="https://github.com/DaverSomethingSomethingOrg/conan-github-workflows/blob/main/.github/workflows/conan-toolchain.yml">conan-toolchain.yml</a> to assemble a project with enough components to be interesting. The <a href="https://conan.io/center">Conan Center Index</a> provided all of the components used here (with some minor modifications).</p><p>The ConanZFSDemo.yml workflow mixes a combination of shell jobs directly on the runner host to manipulate ZFS, and a Docker job to run the conan-toolchain.yml workflow leveraging the ZFS cache.</p><h4>Create snapshot and clone for our new build cache</h4><p>The first workflow job creates a new temporary snapshot and clone for our new build cache.</p><pre>zfs snapshot &quot;${ZFS_BUILD_SNAPSHOT}&quot;<br>zfs clone &quot;${ZFS_BUILD_SNAPSHOT}&quot; &quot;${ZFS_BUILD_CLONE}</pre><p>Our snapshot naming looks like:</p><ul><li>${ZPOOL_NAME}/${PROJECT}/${GITHUB_REF_NAME}@${JOB_HOST}-pre${GITHUB_RUN_ID}</li></ul><p>Example: zpool-conancache/gcc12-toolchain/main@hephaestus-pre18171656687</p><p>We give our snapshot a prefix pre because the snapshot is readonly, and we don’t really know when or how the original cache state was established. We only know that this was the state prior to this build workflow.</p><p>Our clone naming represents the cache state throughout this build:</p><ul><li>${ZPOOL_NAME}/${PROJECT}/${GITHUB_REF_NAME}_${JOB_HOST}-${GITHUB_RUN_ID}</li></ul><p>Example: zpool-conancache/gcc12-toolchain/main_hephaestus-18171656687</p><p><strong>Example ZFS status with CI snapshots and clones provisioned</strong></p><pre>$ zfs list -r -o name,used,avail,refer<br>NAME                                                           USED  AVAIL  REFER<br>zpool-conancache                                              7.97G   183G    24K<br>zpool-conancache/gcc12-toolchain                              7.96G   183G    25K<br>zpool-conancache/gcc12-toolchain/main                         7.96G   183G  7.96G<br>zpool-conancache/gcc12-toolchain/main_hephaestus-18171656687     1K   183G  7.96G<br>$ <br><br>$ zfs list -t snapshot -o name,used,refer<br>NAME                                                              USED  REFER<br>zpool-conancache/gcc12-toolchain/main@hephaestus-pre18171656687     0B  7.96G<br>$</pre><h4>Running the build</h4><p>Running our build is the same as any other Conan project. We’re just connecting a special cache directory and making sure our CONAN_HOME environment is pointed at it.</p><p>For our CI workflow we reuse the <a href="https://github.com/DaverSomethingSomethingOrg/conan-github-workflows/blob/main/.github/workflows/conan-toolchain.yml">conan-toolchain.yml</a> workflow, but in a shell script it looks something like this:</p><p><strong>Containerized Build Startup</strong></p><pre>DOCKER_IMAGE=&quot;nexus.homelab/conan-docker-build-ubuntu:x86_64-latest&quot;<br>$ docker run -it --rm \<br>    --volume=&quot;/${BUILD_CLONE}:${CONTAINER_CONAN_HOME}&quot; \<br>    --volume=&quot;${SERVER_WORKSPACE_ROOT}:${CONTAINER_WORKSPACE_ROOT}&quot; \<br>    --env=&quot;CONAN_HOME=${CONTAINER_CONAN_HOME}&quot; \<br>    --env=&quot;INSTALL_PREFIX=${INSTALL_PREFIX}&quot; \<br>    --env=&quot;CONTAINER_WORKSPACE_ROOT=${CONTAINER_WORKSPACE_ROOT}&quot; \<br>    --env=&quot;COMPONENT_SUBDIR=${CONTAINER_WORKSPACE_ROOT}/${WORKSPACE_SUBDIR}&quot; \<br>    &quot;${DOCKER_IMAGE}&quot; \<br>    &quot;${CONTAINER_WORKSPACE_ROOT}/${CONAN_BUILD_SCRIPT}&quot;<br><br># Detect build failures<br>$ retval=$?</pre><p><strong>Conan Build Script</strong></p><pre>conan profile detect<br>conan config install https://github.com/DaverSomethingSomethingOrg/conan-system-packaging.git<br><br>conan remote add -t local-recipes-index conan-local-recipes &quot;${CONTAINER_WORKSPACE_ROOT}/conan-center-index&quot;<br>conan remote update conan-local-recipes --index 0<br>conan remote add conan-local-repo https://nexus.homelab/repository/conan-homelab<br>conan remote update conan-local-repo --index 0<br>conan install --build=missing \<br>              --options=&quot;*:install_prefix=${INSTALL_PREFIX}&quot; \<br>              &quot;${COMPONENT_SUBDIR}&quot;</pre><h4>Promote the Successful Build’s clone</h4><p>In order to make sure we don’t lose data, we’ll follow the typical process of renaming the old dataset clone in-place before renaming the new clone to the old name. Only then can we destroy the original (now legacy) clone and snapshot.</p><pre>zfs promote &quot;${ZFS_BUILD_CLONE}&quot;<br>zfs rename &quot;${ZFS_BRANCH_DATASET}&quot; &quot;${ZFS_BRANCH_DATASET}-legacy&quot;<br>zfs rename &quot;${ZFS_BUILD_CLONE}&quot; &quot;${ZFS_BRANCH_DATASET}&quot;<br>zfs destroy &quot;${ZFS_BRANCH_DATASET}-legacy&quot;<br>zfs destroy &quot;${ZFS_BUILD_SNAPSHOT}</pre><h4>Save or Destroy a Failed Build’s clone</h4><p>If our build is configured to save failed builds, we simply do nothing. We can leave the new snapshot and clone created for our build just as they are, and this ensures all access paths remain the same for troubleshooting as well.</p><p>Future builds will snapshot/clone against the original branch dataset just as our current build did.</p><pre>zfs destroy &quot;${ZFS_BUILD_CLONE}&quot;<br>zfs destroy &quot;${ZFS_BUILD_SNAPSHOT}</pre><h4>Updated cache state</h4><p>Following a promoted successful build or destroyed failed build, our cache state returns to its initial ready state for the branch. No snapshots, and only a dataset representing a the latest good cache for the branch we’re working on.</p><p><strong>Example ZFS status with CI snapshots and clones provisioned</strong></p><pre>$ zfs list -r -o name,used,avail,refer<br>NAME                                                           USED  AVAIL  REFER<br>zpool-conancache                       8.62G   182G    24K<br>zpool-conancache/gcc12-toolchain       8.61G   182G    25K<br>zpool-conancache/gcc12-toolchain/main  8.61G   182G  8.61G<br>$ <br><br>$ zfs list -t snapshot -o name,used,refer<br>no datasets available<br>$</pre><h3>Performance Comparisons</h3><p>As mentioned previously, my test environment is hardly representative of real-world scenarios this solution would be used for, but showing these results at least helps frame the amount of computation and resource utilization for each type of operation.</p><p><strong>Empty cache, clean build without Artifact Management available</strong></p><figure><img alt="Full Build without Artifact Management or seeded cache takes 46m 21s" src="https://cdn-images-1.medium.com/max/1024/1*T_7vgtIWgvhCHcGN_AEBLg.png" /></figure><p><strong>Empty cache, clean build with full download from Artifact Management</strong></p><figure><img alt="Full Download from Artifact Management takes 29s" src="https://cdn-images-1.medium.com/max/1024/1*ApwjbVOohzPckhVuCLWnpA.png" /></figure><p><strong>Fully seeded cache, clean build</strong></p><figure><img alt="Fully seeded cache takes 2s" src="https://cdn-images-1.medium.com/max/1024/1*u9L5e4aDaZ27_MB-3yQnYA.png" /></figure><h4>Snapshot and Clone Provisioning Overhead</h4><p>To be completely fair, we do need to factor in the time it takes to create the ZFS snapshot and clone too</p><p><strong>Snapshot and Clone Provisioning time</strong></p><figure><img alt="ZFS Clone Provisioning takes 0s" src="https://cdn-images-1.medium.com/max/1024/1*utFWKL-VhuSlwW2TIEio5A.png" /></figure><p>Since it’s is hard to get a precise timing on this operation in CI, here’s the same operation from our interactive shell:</p><pre>❯ time zfs snapshot zpool-conancache/gcc12-toolchain/main@hephaestus-pre18171656687; \<br>  time zfs clone zpool-conancache/gcc12-toolchain/main@hephaestus-pre18171656687 \<br>                 zpool-conancache/gcc12-toolchain/main_hephaestus-18171656687<br><br>zfs snapshot   0.00s user 0.01s system 37% cpu 0.021 total<br>zfs clone      0.00s user 0.00s system 21% cpu 0.027 total<br>❯</pre><p><strong>Special Note</strong></p><p>An important consideration here is that both “clean build” and “full download” timings will scale linearly with the size of the project.</p><p>ZFS snapshot/clone timing <strong>should not vary</strong> in relation to the size of the project, depending more on the storage speed and kernel load instead.</p><h3>Limitations and Issues</h3><h3>Linking and Deployment performance is not optimized</h3><p>While this represents the ultimate compile-avoidance solution, other phases of the “build” remain unaffected. If our application is statically linked, bundled into an “image”, or even repackaged for deployment, we’ll need to optimize those steps differently.</p><p>Conan itself does support “vendoring” of dependencies, and this could be very useful in building “sub-assemblies” or “subsystem” component packages. This is very effective when development is highly focused on a few specific components in our product. The rest of the components can be packaged together (such as archiving static libraries together) to simplify the dependency graph and reduce random-access I/O at linking time.</p><ul><li><a href="https://docs.conan.io/2/devops/vendoring.html">https://docs.conan.io/2/devops/vendoring.html</a></li></ul><p>Optimizing the full deployment process for our application will be very specific to the system architecture and infrastructure.</p><h3>sudo vs. zfs allow vs. SSH command key</h3><p>For the sake of expediency in this demo we used sudo to enable our automation user to manipulate ZFS snapshots and clones. In the real world, with multiple users and different use cases we would want a solution with stronger security.</p><p>The zfs allow command looks like it should enable this functionality, but on Linux the mount (and zfs mount) cannot be delegated so easily for our use case. We can delegate creation of our dataset snapshots and clones directly, but if we cannot mount/umount them, we can&#39;t use them!</p><ul><li><a href="https://github.com/openzfs/zfs/discussions/10648">Possible Workarounds for Inability to Mount as non-root under Linux</a></li></ul><p>An approach I’d recommended would be to call zfs from behind an SSH command key. With SSH we can implement a server-side script run by a special automation user account. We would only need to grant that one account delegated ZFS permissions, and the script could validate the authorization for the command being run against our rules for maintaining the filesystem.</p><p>Rob Napier at Cisco wrote this excellent and concise whitepaper on implementing such solutions for the USENIX LISA Conference. It’s worth a read!</p><ul><li><a href="https://www.usenix.org/legacy/publications/library/proceedings/lisa04/tech/napier.html">Secure Automation: Achieving Least Privilege with SSH, Sudo and Setuid</a></li></ul><h3>What’s Next</h3><p>In our next demo we’ll implement a similar solution for use in our Kubernetes cluster. Kubernetes brings some significant benefits for security and delegated storage management, but also introduces some new limitations and challenges to overcome.</p><p>We start with focusing on the Inner Developer Loop:</p><ul><li><a href="https://daversomethingsomething.medium.com/optimizing-the-inner-loop-with-conan-and-zfs-in-remote-devcontainers-bac5d19b874a">Optimizing the Inner Loop with Conan and ZFS in Remote DevContainers</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f648a31086bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>