Skip to content

Commit

Permalink
add documentation for GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
geokats7 committed Dec 24, 2021
1 parent 05874e3 commit f91a3db
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Jenkins client
Use this package to perform various jenkins actions such as:
trigger jobs remotely, poll the jenkins server for the result of a specific build,
get status of last builds and many more.
get status of last builds and more.


#### Required to use the client
Expand All @@ -19,6 +19,37 @@ jc = JenkinsClient(jenkins_base_url="https://my-jenkins-instance.com",

jc.start_job(job_name, params) # params must be a python dictionary
~~~
### GitHub Action usage
You can use this package as a GitHub Action to trigger a job remotely and optionally wait for the job's result.
The action parameters are the following:

| Parameter | Required | Description |
|------------------------------------|-----------|------------------------------------------------------------------------------|
| `jenkins_job_name` | Yes | The name of the job to trigger |
| `jenkins_job_parameters` | No | A dictionary of parameters to pass to the job |
| `jenkins_base_url` | Yes | The url of the jenkins server |
| `jenkins_user` | Yes | The username for the jenkins server |
| `jenkins_password` | Yes | The password/token for the jenkins server |
| `wait_for_result` | No | If set to true, the action will wait for the job to finish _(default: True)_ |

**Note**
`jenkins_job_parameters` and `wait_for_result` should be quoted as in the example below.

#### Example of usage:
~~~yaml
jobs:
start-jenkins-job:
runs-on: ubuntu-latest
steps:
- name: Start Jenkins job
uses: geokats7/jenkins_client@main
with:
jenkins_job_name: 'Job_folder/my_job'
jenkins_job_parameters: '{"APP_ENV_NAME": "staging"}'
jenkins_base_url: 'https://my-jenkins-instance.com/'
jenkins_user: ${{ secrets.JENKINS_USER }}
jenkins_password: ${{ secrets.JENKINS_PASSWORD }}
wait_for_result: 'False'
~~~
---
###### Contact QA team in order to add more actions to the package.

0 comments on commit f91a3db

Please sign in to comment.