{"id":18666943,"url":"https://github.com/adoptium/jenkins-helper","last_synced_at":"2025-04-11T23:33:22.272Z","repository":{"id":37743393,"uuid":"125084121","full_name":"adoptium/jenkins-helper","owner":"adoptium","description":"Jenkins Node helper API and helper jobs ","archived":false,"fork":false,"pushed_at":"2025-03-07T17:02:52.000Z","size":105,"stargazers_count":9,"open_issues_count":8,"forks_count":28,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-25T19:53:29.975Z","etag":null,"topics":["adoptium","groovy","jenkins","jenkins-helper"],"latest_commit_sha":null,"homepage":null,"language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adoptium.png","metadata":{"funding":{"github":"adoptium","custom":["eclipse.org/donate/adoptium"]},"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-13T16:45:56.000Z","updated_at":"2025-01-13T16:39:53.000Z","dependencies_parsed_at":"2024-01-29T15:46:03.025Z","dependency_job_id":"3aab5b30-d8d0-49d9-a457-a0f3f19d20ae","html_url":"https://github.com/adoptium/jenkins-helper","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adoptium%2Fjenkins-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adoptium%2Fjenkins-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adoptium%2Fjenkins-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adoptium%2Fjenkins-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adoptium","download_url":"https://codeload.github.com/adoptium/jenkins-helper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248495961,"owners_count":21113732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adoptium","groovy","jenkins","jenkins-helper"],"created_at":"2024-11-07T08:34:52.844Z","updated_at":"2025-04-11T23:33:21.364Z","avatar_url":"https://github.com/adoptium.png","language":"Groovy","funding_links":["https://github.com/sponsors/adoptium","eclipse.org/donate/adoptium"],"categories":[],"sub_categories":[],"readme":"# jenkins-helper\n\n## Files\n### API Functions (NodeHelper.groovy)\nThe NodeHelper API contains helper functions to query basic machine stats in real time, add new machines, update/overwrite labels.\n\n* Get CPU count ```String getCpuCount(String computerName)```\n* Get Installed memory ```Tuple  getMemory(String computerName)```\n* Get OS information ```Tuple  getOsInfo(String computerName)```\n* Get Kernel information ```Tuple  getOsKernelInfo(String computerName)```\n* Get Endian ```String getEndian(String computerName)```\n* Get Location ```String getLocation(String computerName)```\n* Get Description ```String getDescription(String computerName)```\n* Get Home directory ```String getHomeDirectoryPath(String computerName)```\n* Get free space in the home directory ```String getSpaceLeftInGb(String computerName)```\n* Get Total installed disk space ```String getTotalSpace(String computerName)```\n* Get Labels ```String getLabels(String computerName)``` \n* Add new Node ```String addNewNode(String newNodeName,String newNodeDescription,String newNodeRemoteFS,int newNodeNumExecutors,Mode newNodeMode,String newNodeLabelString,def launcher)```\n* Add Label ```String addLabel(String computerName, String label)```\n* Append Label ```String appendlabel(String computerName, String label)```\n* Node Exists ```static boolean nodeIsOnline(String nodeLabel)```\n\n### Space Monitoring (WorkspaceInfo.groovy)\nIterates over online nodes on Jenkins and prints the contents of the workspace directory along with the space they occupy\n\n* The computers it iterates over can be limited by input parameter, ```projectLabel```\n* As of now, it only works for linux, aix, and mac\n\n### Create New Node (CreateNewNode.groovy)\nUsed to create new nodes with any basic labels\n\n* This job expects 3 parameters\n    * ```String machineNames```\n        * Comma seperated host names of the machine(s)\n    * ```String machineIPs```\n        * Comma seperated IP address of the machine(s)\n    * ```String labelStrings```\n        * Labels you would like to be added to the machine.\n        * Each label must be separated by spaces and labels for different machines must be separated by `,`\n        * If identical labels need to be applied to all the machines, only one set of labels need to be supplied\n\n### Update Machine Identifiers (UpdateMachineIdentifiers.groovy)\nUsed to update machine labels and description\n\n* The computers it iterates over can be limited by input parameter, ```projectLabel```\n* The job expects 5 input parameters\n    * ```boolean overWriteLabels```\n        * Does excatly as the name suggests, completely wipes previous labels\n        * If set true, you do not need to pass a ```projectLabel```\n    * ```String labels```\n        * Labels you would like to be added to the machine.\n         * Each label must be separated by spaces and labels for different machines must be separated by `,` \n         * If identical labels need to be applied to all the machines, only one set of labels need to be supplied\n         * Use Cases:\n              * Multiple machines, unique labels: `machine1Label1 machine1Label2, machine2Label1 machine2Label2`\n              * Single or multiple machines, identical labels: `Label1 Label2`\n    * ```String machineNames```\n        * Can either enter a list of names or a single name. For list seperate them with \",\"\n    * ```boolean updateDescription```\n        * If this is set true, the job will update description\n        * This has higher precedence than overWriteLabels\n    * ```String projectlabel```\n        * This limits which machines will be touched\n* Use Cases:\n    * Update labels:\n        * Objective: add default labels(os, arch, and kernel)\n        * Procedure: overWriteLabels is not set and only the machine name(s) is supplied\n    * Overwrite Labels:\n        * Objective: overwrite previous labels with new ones\n        * Procedure: overWriteLabels is set and machine name(s) + labels are supplied\n    * Append labels:\n        * Objective: want to add a custom label.\n        * Procedure: supply labels and machine names\n    * Update description:\n        * It adds CPU count, Disk space and installed RAM to the description\n        * Procedure: have ```updateDescription``` parameter checked\n\n## How-to\n\n### Setup\n[Here](https://jenkins.io/doc/book/pipeline/shared-libraries/) are the instructions on how to add the library to Jenkins\n\n### Usuage\nTo use the API in a Jenkins job you'll need to add ```@Library('NodeHelper') _``` to import the API.\n\n## TODOs\n* A job that pulls machine list from a inventory file and validates the names with those already on Jenkins. It also adds any labels mentioned in the inventory file to the machine on Jenkins, [issue](https://github.com/AdoptOpenJDK/openjdk-jenkins-helper/issues/10)\n* CPU Information for a ZOS, [issue](https://github.com/AdoptOpenJDK/openjdk-jenkins-helper/issues/9)\n* Logic to get Hypervisor information, [issue](https://github.com/AdoptOpenJDK/openjdk-jenkins-helper/issues/4)\n* Move strings out to a config file, [issue](https://github.com/AdoptOpenJDK/openjdk-jenkins-helper/issues/2)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadoptium%2Fjenkins-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadoptium%2Fjenkins-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadoptium%2Fjenkins-helper/lists"}