Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Jenkins shared library #259

Closed
VermaSh opened this issue Mar 5, 2018 · 8 comments
Closed

Add Jenkins shared library #259

VermaSh opened this issue Mar 5, 2018 · 8 comments

Comments

@VermaSh
Copy link

VermaSh commented Mar 5, 2018

We want the library to be able to automate adding and maintaining machines on Jenkins. Here is a list of desired features

  • Adding machines to Jenkins based on the inventory list
  • Determine machine stats (CPU, RAM, Disk, etc)
  • Set machine description based on machine stats
  • Determine machine capabilities (arch, OS, tools, versions, etc)
  • Adding labels to nodes based on machine capabilities and inventory list
  • Support for all of the above features on Linux, Windows, OS X, AIX and z/OS
@VermaSh
Copy link
Author

VermaSh commented Mar 5, 2018

I have been working on a shared library. It has the below functionalities for Linux, Windows, OS X, AIX and z/OS

  • Add machines to Jenkins
  • Determine machines stats (CPU, RAM, Disk, etc)
  • Set machine description based on machine stats
  • Determine machine capabilities (only arch, OS)
  • Add labels to nodes based on machine capabilities

I'll open a pull request in couple of days

@gdams
Copy link
Member

gdams commented Mar 5, 2018

Hi @VermaSh, thanks for this issue. I would suggest that you take a look at my PR because it already does some of the described tasks #192

@VermaSh
Copy link
Author

VermaSh commented Mar 5, 2018

@gdams I went through your PR and yes it does do a bunch of stuff. However, we want to do the machine maintenance on a regular schedule and It didn't make sense to couple Jenkins with Ansible. So we decided that we were better off with a library that resides solely on Jenkins. The end goal is to have one job that runs weekly and keeps the machine labels updated.

Other reason behind this is that the test team wanted the ability to get machine stats in real time, directly from the machine instead of labels.

@gdams
Copy link
Member

gdams commented Mar 6, 2018

Ahh okay, that makes sense. So we can use ansible to get the machines into jenkins and then let your scripts handle the labels etc

@VermaSh
Copy link
Author

VermaSh commented Mar 6, 2018

Except, we may not always want to Ansible a machine. Also, the solution will be an API not a script; anyone who wants to use it will have to create a Jenkins job. I did create a Jenkins job but at the moment it's too specific to be checked in here. I'll add some use cases as comments in the API (or somewhere else).
Things will get clearer once I submit a PR.

@karianna
Copy link
Contributor

karianna commented Mar 6, 2018

I think I'm going to have to see the PR to understand what this is trying to achieve over and above ansible.

VermaSh added a commit to VermaSh/openjdk-infrastructure that referenced this issue Mar 8, 2018
The class NodeHelper partially addresses feature requests in adoptium#259
- Add machines to Jenkins: addNewNode()
- Determine machine stats
- getCpuCount(String computerName)
- getLocation(String computerName)
- getOsPatchLevel(String computerName)
- getMemory(String computerName)
- getSpaceLeftInGb(String computerName)
- getTotalSpace(String computerName)

- Set machine description based on machine stats
- Machine stats retrieved from the above functions are used for the description

- Determine machine capabilities
- getEndian(String computerName)
- getOsArch(String computerName)
- getOsInfo(String computerName)

- Add labels to nodes based on machine capabilities
- addLabel(String computerName, String label)
- Overwrites the labels with the ones in the arguments
- weekly maintaince job will call this function with labels from the inventory file plus labels returned from constructLabels(String computerName)
- appendLabel(String computerName, String label)
- does only an append

- Other useful functions
- constructLabels(String computerName)
- this function returns a string containing the default labels
- as of right now, it only returns OS, arch and Endian (only if it is ppc running linux)
- here is a list of labels which have been implemented so far:
- constructOsLabel(String computerName)
- constructCPULabel(String computerName)
- constructMemoryLabel(String computerName)
- constructEndianLabel(String computerName)
- constructPlatformLabel(String computerName)
- constructArchLabel(String computerName)
- constructKernelLabel(String computerName)

- Few side notes:
- computerName: is what the node name on Jenkins
- getComputer(String computerName)
- This was created with the intention to have computer name validations in one place.
  At the moment it's very basic but it can be extended to enforce a standardized naming convention
@gdams
Copy link
Member

gdams commented Mar 1, 2019

@VermaSh can this be closed?

@VermaSh
Copy link
Author

VermaSh commented Mar 1, 2019

yes

@karianna karianna closed this as completed Mar 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants