Thank you Carlos, i'll take a look at those two links, and come back to you.

Best regards,
Ivan

On Thu, May 16, 2024 at 8:25 PM Carlos Sanchez <car...@apache.org> wrote:

> It's been a while but I believe that for the declarative agent
> definition you need something like KubernetesDeclarativeAgent [1] In
> that dir you can find the other declarative pipeline code
>
> I would not bring all the options from the k8s plugin as it has a lot
> of accumulated cruft. You can do with just the declarative pipeline
> options and yaml definitions without needing UI setup as it the k8s
> plugin was initially implemented
>
> If you want to look at the very basics of the plugin implementation
> with declarative pipeline support you can back in history to [2]
>
> [1]
> https://github.com/jenkinsci/kubernetes-plugin/blob/master/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/KubernetesDeclarativeAgent.java
> [2]
> https://github.com/jenkinsci/kubernetes-plugin/tree/c12cb70b3118079b1054b4579eedc326c0e09ac7/src/main/java/org/csanchez/jenkins/plugins/kubernetes
>
>
> On Thu, May 16, 2024 at 4:41 PM Ivan Pavlović <i...@gr-oss.io> wrote:
> >
> > Hi all,
> >
> > I have been looking into the kubernetes plugin for jenkins as an
> inspiration for my own plugin i would like to write. This plugin should
> provide a new type of agent that can be used in the declarative pipeline.
> Also, it would need to provide users an option to create a new type of
> cloud.
> >
> > So far, i have been able to implement all that is needed for a new type
> of cloud, but i can't seem to figure out what would be extension points to
> provide a new type of agent.
> >
> > If you wonder why i am using kubernetes plugin for Jenkins as an
> inspiration, it's because this new agent will communicate with an open
> source batch job scheduler called Armada. Armada operates on top of k8s
> clusters, and it receives a yaml manifest that it interprets and knows how
> to communicate with k8s API to deploy pods and schedule jobs. So i don't
> need to integrate with k8s API directly.
> >
> > Example like this, taken from the homepage of kubernetes plugin:
> > ```
> > pipeline {
> >   agent {
> >     kubernetes {
> >       yaml '''
> >         apiVersion: v1
> >         kind: Pod
> >         metadata:
> >           labels:
> >             some-label: some-label-value
> >         spec:
> >           containers:
> >           - name: maven
> >             image: maven:alpine
> >             command:
> >             - cat
> >             tty: true
> >           - name: busybox
> >             image: busybox
> >             command:
> >             - cat
> >             tty: true
> >         '''
> >       retries 2
> >     }
> >   }
> >   stages {
> >     stage('Run maven') {
> >       steps {
> >         container('maven') {
> >           sh 'mvn -version'
> >         }
> >         container('busybox') {
> >           sh '/bin/busybox'
> >         }
> >       }
> >     }
> >   }
> > }
> > ```
> >
> > should now be:
> > ```
> > pipeline {
> >   agent {
> >     armada {
> >       yaml '''
> >         ...
> >         '''
> >       retries 2
> >     }
> >   }
> >   stages {
> >     ....
> >   }
> > }
> > ```
> >
> > Can you help me out in implementing something like this?
> >
> > Thanks!
> >
> > Best regards,
> > Ivan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANju_JBMozD-agmhYc-wpGc4sRa1gyMQZkdoX4%3Dc70MBgrQMuQ%40mail.gmail.com.

Reply via email to