Control Jenkins tasks with Siri shortcuts voiceShortcutsSiri shortcuts
The new version of IOS12 hides an important feature that allows Siri to be greatly expanded by using the shortcut (shortcuts), which makes it easy for users to build their own automated streams through shortcuts.
Our company to start every afternoon before the demo will be starting Jenkins to build this day's code submission firmware, each time to open the page and then click Very annoying, so I would like to give Siri a voice command,
The background lets jeninks automatically perform the build.
Premise
Here we use Siri shortcuts's Web API to remotely invoke Jenkins's web interface to complete.
First Jenkins Configuration
- to allow Jenkins to be remotely invoked through the API, you need to open the remote call interface for each task. You first log on to Jenkins and click on the selected task to go to the Task item page, select "Configure" on the left to go to the Task Configuration screen, under "Build Trigger" tick "trigger remote Build", then enter "authentication token", such as 1234. Then save the configuration.
- in order for cross-site access to Jenkins to turn off the cross-site access check for Jenkins, you can go to the Jenkins home page, select "System Management", and then select "Configure Global Security" To remove the selected " Prevent cross-site request forgery ".
- then go back to the Jenkins home page, click the current user name in the upper right corner to enter the user interface, select "Configure" to view "API Token", such as user ID:AAA API Token:e55e602720442a31fa1dccf3bbb4dbee
- can access Http://<user_id>:<api_token>@<jenkins_url>/job/<job_name>/build via curl or browser ?token=<job_token> test can trigger the build, according to our above configuration access example is as follows
- Curl-x POST Http://aaa:[email protected]<jenkins_url>/job/<job_name>/build?token=1234
Configuration of Siri shortcuts
First, search for shortcuts in the App Store and install it. Shortcut shortcuts to automate a lot of things by providing some action ction, such as getting a dictionary, visiting a webpage, etc., and being able to perform these actions by asking Siri. Here we mainly use the action action that automatically accesses the Web API.
Reference
Jenkins API Integration:trigger Job remotely via Jenkins API
Error 403 No Valid crumb is included in the request solution
Shortcuts User Guide
2018-9-30- [email protected]
Control Jenkins tasks with Siri shortcuts voice