Perform actual hardware tests using jenkins pipeline and kubernetes

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Perform actual hardware tests using jenkins pipeline and kubernetes

touseef yousuf
Can anyone point me in right direction,

I have a use case as follow:

Kubernetes master running the jenkins and i have n number of physical machine connected with different hardwares,So what i want to achieve is when a specific job is triggered in jenkins to execute a test on hardware , k8's(kubernetes master) should route and connect to that machine in a pool which has requiste hardware and execute the tests.

Any pointer how to achieve is appreciated

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/28cda197-21e5-4ad3-8b31-eebed9e42039%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Perform actual hardware tests using jenkins pipeline and kubernetes

Björn Pedersen
Hi,

configure each HW-machine as an agent with appropirate labels and the request these labels in your job.
I recommend to use the modern pipeline jobs as there you only need to request all the wanted labels in a node().
Otherwise you probably need the multi-job plugin.

Björn

Am Montag, 20. Januar 2020 07:19:00 UTC+1 schrieb touseef:
Can anyone point me in right direction,

I have a use case as follow:

Kubernetes master running the jenkins and i have n number of physical machine connected with different hardwares,So what i want to achieve is when a specific job is triggered in jenkins to execute a test on hardware , k8's(kubernetes master) should route and connect to that machine in a pool which has requiste hardware and execute the tests.

Any pointer how to achieve is appreciated

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9a78e3e9-884f-41bc-b886-9ddf57c13c76%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Perform actual hardware tests using jenkins pipeline and kubernetes

Andrey Babushkin
In reply to this post by touseef yousuf

Hi,
As far as I understood you're using Jenkins Kubernetes plugin and you have your own Kubernetes cluster with a few physical nodes connected to it.
In that case you should label your Kubernetes nodes like this (assuming you have working kubectl setup):
kubectl label node node1.example.com hw_type=type1

kubectl label node node2.example.com hw_type=type2

Then you should specify label you need in podTemplate section of your Jenkins pipeline (I slightly changed code from examples folder in Kubernetes plugin repo - https://github.com/jenkinsci/kubernetes-plugin/blob/master/examples/maven.groovy)

podTemplate(nodeSelector: 'hw_type=type1', containers: [
    containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine',
                      ttyEnabled: true, command: 'cat',

    )
  ]) {

  node(POD_LABEL) {
    stage('Tests on hardware type 1') {
      git 'https://github.com/jenkinsci/kubernetes-plugin.git'
      container('maven') {
          sh 'mvn -B clean package'
      }
    }
  }
}


On Monday, January 20, 2020 at 9:19:00 AM UTC+3, touseef wrote:
Can anyone point me in right direction,

I have a use case as follow:

Kubernetes master running the jenkins and i have n number of physical machine connected with different hardwares,So what i want to achieve is when a specific job is triggered in jenkins to execute a test on hardware , k8's(kubernetes master) should route and connect to that machine in a pool which has requiste hardware and execute the tests.

Any pointer how to achieve is appreciated

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e8069c44-fab0-44b0-8708-d453d31724ad%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Perform actual hardware tests using jenkins pipeline and kubernetes

touseef yousuf
Thanks for the reply .It would work fine if the master and the nodes are on the same cluster under the same network.
However my use case is my nodes can be in different network and it will not work with kubernetes.
is there any other way without using kubernets perhaps

On Monday, 20 January 2020 22:07:31 UTC+5:30, Andrey Babushkin wrote:

Hi,
As far as I understood you're using Jenkins Kubernetes plugin and you have your own Kubernetes cluster with a few physical nodes connected to it.
In that case you should label your Kubernetes nodes like this (assuming you have working kubectl setup):
kubectl label node node1.example.com hw_type=type1

kubectl label node node2.example.com hw_type=type2

Then you should specify label you need in podTemplate section of your Jenkins pipeline (I slightly changed code from examples folder in Kubernetes plugin repo - <a href="https://github.com/jenkinsci/kubernetes-plugin/blob/master/examples/maven.groovy" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fkubernetes-plugin%2Fblob%2Fmaster%2Fexamples%2Fmaven.groovy\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2h8zbiOvw5Dra7itiMLLfL1fuyA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fkubernetes-plugin%2Fblob%2Fmaster%2Fexamples%2Fmaven.groovy\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2h8zbiOvw5Dra7itiMLLfL1fuyA&#39;;return true;">https://github.com/jenkinsci/kubernetes-plugin/blob/master/examples/maven.groovy)

podTemplate(nodeSelector: 'hw_type=type1', containers: [
    containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine',
                      ttyEnabled: true, command: 'cat',

    )
  ]) {

  node(POD_LABEL) {
    stage('Tests on hardware type 1') {
      git '<a href="https://github.com/jenkinsci/kubernetes-plugin.git" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fkubernetes-plugin.git\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH9BuklddXOlBeFbheerhkbYQbRjQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fkubernetes-plugin.git\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH9BuklddXOlBeFbheerhkbYQbRjQ&#39;;return true;">https://github.com/jenkinsci/kubernetes-plugin.git'
      container('maven') {
          sh 'mvn -B clean package'
      }
    }
  }
}


On Monday, January 20, 2020 at 9:19:00 AM UTC+3, touseef wrote:
Can anyone point me in right direction,

I have a use case as follow:

Kubernetes master running the jenkins and i have n number of physical machine connected with different hardwares,So what i want to achieve is when a specific job is triggered in jenkins to execute a test on hardware , k8's(kubernetes master) should route and connect to that machine in a pool which has requiste hardware and execute the tests.

Any pointer how to achieve is appreciated

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/03ae521e-c73e-4761-8b7f-c682d1defddf%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Perform actual hardware tests using jenkins pipeline and kubernetes

JonathanRRogers
Jenkins has several methods of running and connecting to agents. The fact that Jenkins master is running in a Kubernetes cluster doesn't limit how it connects to agents. For example, you can use the SSH slaves plugin to connect to any machine running SSH and visible to the Jenkins master. https://plugins.jenkins.io/ssh-slaves

On Sunday, January 26, 2020 at 11:38:43 PM UTC-5, touseef wrote:
Thanks for the reply .It would work fine if the master and the nodes are on the same cluster under the same network.
However my use case is my nodes can be in different network and it will not work with kubernetes.
is there any other way without using kubernets perhaps

On Monday, 20 January 2020 22:07:31 UTC+5:30, Andrey Babushkin wrote:

Hi,
As far as I understood you're using Jenkins Kubernetes plugin and you have your own Kubernetes cluster with a few physical nodes connected to it.
In that case you should label your Kubernetes nodes like this (assuming you have working kubectl setup):
kubectl label node node1.example.com hw_type=type1

kubectl label node node2.example.com hw_type=type2

Then you should specify label you need in podTemplate section of your Jenkins pipeline (I slightly changed code from examples folder in Kubernetes plugin repo - <a href="https://github.com/jenkinsci/kubernetes-plugin/blob/master/examples/maven.groovy" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fkubernetes-plugin%2Fblob%2Fmaster%2Fexamples%2Fmaven.groovy\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2h8zbiOvw5Dra7itiMLLfL1fuyA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fkubernetes-plugin%2Fblob%2Fmaster%2Fexamples%2Fmaven.groovy\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2h8zbiOvw5Dra7itiMLLfL1fuyA&#39;;return true;">https://github.com/jenkinsci/kubernetes-plugin/blob/master/examples/maven.groovy)

podTemplate(nodeSelector: 'hw_type=type1', containers: [
    containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine',
                      ttyEnabled: true, command: 'cat',

    )
  ]) {

  node(POD_LABEL) {
    stage('Tests on hardware type 1') {
      git '<a href="https://github.com/jenkinsci/kubernetes-plugin.git" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fkubernetes-plugin.git\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH9BuklddXOlBeFbheerhkbYQbRjQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fkubernetes-plugin.git\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH9BuklddXOlBeFbheerhkbYQbRjQ&#39;;return true;">https://github.com/jenkinsci/kubernetes-plugin.git'
      container('maven') {
          sh 'mvn -B clean package'
      }
    }
  }
}


On Monday, January 20, 2020 at 9:19:00 AM UTC+3, touseef wrote:
Can anyone point me in right direction,

I have a use case as follow:

Kubernetes master running the jenkins and i have n number of physical machine connected with different hardwares,So what i want to achieve is when a specific job is triggered in jenkins to execute a test on hardware , k8's(kubernetes master) should route and connect to that machine in a pool which has requiste hardware and execute the tests.

Any pointer how to achieve is appreciated

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0ba6e415-3985-470e-b2e5-e77cb3e13f2b%40googlegroups.com.