Hello Chad,

Continuing where Sloka left off.
We have been able to build the GoCD agent and it does run the SBT commands. 
However, while trying to build an image using Buildah we are seeing certain 
errors like this:
---
Error during unshare(CLONE_NEWUSER): No space left on device
User namespaces are not enabled in /proc/sys/user/max_user_namespaces.
time="2024-09-16T07:06:05Z" level=error msg="error parsing PID \"\": 
strconv.Atoi: parsing \"\": invalid syntax"
time="2024-09-16T07:06:05Z" level=error msg="(unable to determine exit 
status)"
Error during unshare(CLONE_NEWUSER): No space left on device
User namespaces are not enabled in /proc/sys/user/max_user_namespaces.
time="2024-09-16T07:06:05Z" level=error msg="error parsing PID \"\": 
strconv.Atoi: parsing \"\": invalid syntax"
time="2024-09-16T07:06:05Z" level=error msg="(unable to determine exit 
status)"
---

This makes me believe that there are certain storage constraints on the 
Elastic agent container. However, if I look at the elastic agent Pod 
configuration, I don't see any volume being attached. The pod configuration 
is mentioned below:
---
apiVersion: v1
kind: Pod
metadata:
  name: gocd-agent-{{ POD_POSTFIX }}
  labels:
    app: web
spec:
  serviceAccountName: default
  containers:
    - name: gocd-agent-container-{{ CONTAINER_POSTFIX }}
      image: 
366611831214.dkr.ecr.us-east-1.amazonaws.com/gocd/agent:ea-sbt-jdk11-build-2-1
      volumeMounts:
      - name: ssh-secrets
        readOnly: true
        mountPath: /home/go/.ssh
      - name: dev-fuse
        mountPath: /dev/fuse
      env:
        - name: _BUILDAH_STARTED_IN_USERNS
          value: ""
        - name: STORAGE_DRIVER
          value: "overlay"
        - name: STORAGE_OPTS
          value: "overlay.mount_program=/usr/bin/fuse-overlayfs"
      securityContext:
        privileged: true
        capabilities:
          add:
            - SYS_ADMIN
      resources:
        limits:
          memory: "8192M"
          cpu: "2"
        requests:
          memory: "8192M"
          cpu: "2"
  volumes:
    - name: ssh-secrets
      secret:
        defaultMode: 420
        secretName: gocd-bitbucket-kube-secret
    - name: dev-fuse
      hostPath:
        path: /dev/fuse
        type: CharDevice
...

In case, I want to attach a volume to these agents how do I go about doing 
it? If that's not an option then do i need to increase the memory to 
accomodate larger materials for build?

Thank you,
Raghu
On Wednesday 11 September 2024 at 13:35:56 UTC+5:30 Chad Wilson wrote:

> You don't appear to have actually installed the GoCD agent in your image - 
> it needs to be there by default. You are better to base your container 
> image off one of the existing GoCD agent images from 
> https://www.gocd.org/download/#docker rather than trying to 
> hand-construct your own from scratch. There are Ubuntu variants available 
> similar to your current base e.g 
> https://hub.docker.com/r/gocd/gocd-agent-ubuntu-24.04 or 
> https://hub.docker.com/r/gocd/gocd-agent-ubuntu-22.04
>
> -Chad
>
> On Wed, Sep 11, 2024 at 3:54 PM Sloka Roy <slokar...@gmail.com> wrote:
>
>> Hi, 
>>
>> I am trying to create GoCD custom elastic agent which supports Buildah 
>> for building docker images and pushing to ECR and SBT and JAVA 11 for 
>> compilation.
>>
>> Below dockerfile I plan to use as GoCD elastic agent.
>>
>> FROM eclipse-temurin:11.0.24_8-jdk-jammy # Install required packages 
>> including Buildah dependencies RUN apt-get update && \ apt-get install 
>> -y \ curl \ git \ zip \ unzip \ jq \ buildah \ runc \ fuse-overlayfs \ 
>> iptables 
>> && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Install sbt ARG 
>> SBT_VERSION=1.5.6 ENV SBT_HOME /usr/local/sbt ENV PATH 
>> ${PATH}:${SBT_HOME}/bin RUN curl -sL "
>> https://github.com/sbt/sbt/releases/download/v1.5.6/sbt-1.5.6.tgz"; | 
>> gunzip | tar -x -C /usr/local && \ echo -ne "- with sbt $SBT_VERSION\n" 
>> >> /root/.built # Setup GoCD user and environment ENV HOME /var/go RUN 
>> groupadd -g 496 go && \ useradd -c "go user" -d $HOME -m go -g 496 -u 
>> 498 VOLUME /var/go WORKDIR /var/go USER go 
>> However the agent is not getting registered.
>> Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal 
>> Scheduled 2m15s default-scheduler Successfully assigned 
>> gocd/k8s-ea-d21bcaab-f333-40ad-a371-22fe1a433017 to 
>> ip-10-75-110-207.ec2.internal Normal Pulled 33s (x5 over 2m15s) kubelet 
>> Container image "
>> 366611831214.dkr.ecr.us-east-1.amazonaws.com/gocd/agent:es-jdk11-build" 
>> already present on machine Normal Created 33s (x5 over 2m15s) kubelet 
>> Created container k8s-ea-d21bcaab-f333-40ad-a371-22fe1a433017 Normal 
>> Started 32s (x5 over 2m15s) kubelet Started container 
>> k8s-ea-d21bcaab-f333-40ad-a371-22fe1a433017 Warning BackOff 3s (x10 over 
>> 2m8s) kubelet Back-off restarting failed container 
>> k8s-ea-d21bcaab-f333-40ad-a371-22fe1a433017 in pod 
>> k8s-ea-d21bcaab-f333-40ad-a371-22fe1a433017_gocd(8fe96d7b-ea06-4f80-a17b-13042f59c548)
>>  
>>
>> [image: Screenshot 2024-09-11 at 12.39.49 PM.png]
>>
>> Can you please help me here, with what are the minimum requirements to 
>> create an custom elastic agent 
>>
>>  
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "go-cd" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to go-cd+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/go-cd/cd320acc-2836-4d87-9a30-fa1d7233ce94n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/go-cd/cd320acc-2836-4d87-9a30-fa1d7233ce94n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to go-cd+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/go-cd/5c17788e-422f-4f32-b5e3-bb709c73a3a9n%40googlegroups.com.

Reply via email to