This project creates a small stand alone binary and container image for triggering pipelines in remove Jenkins servers.
It helps bridge the gap between Jenkins and Jenkins X around ChatOps.
Download the binary and put it on your $PATH
or use the trigger-pipeline container image in a pipeline step in Jenkins or Jenkins X / Tekton.
To trigger a pipeline in the default Jenkins server:
tp trigger
If you have multiple Jenkins server custom resources in the current namespace then specify the Jenkins custom resource name on the command line:
tp trigger --jenkins myJenkinsServer
If you are not sure what Jenkins names are available in the current namespace run:
kubectl get jenkins
Which will list all of the available Jenkins custom resource names.
If you make a mistake and use a name which does not exist the tp
executable will give you a meaninful error message togehter with listing all the available Jenkins custom resource names.
### Using Environment Variables
To make it easier to configure inside pipelines you can specify the Jenkins instance name via the $TRIGGER_JENKINS_SERVER
environment variable
export TRIGGER_JENKINS_SERVER="someJenkinsCrdName"
tp trigger
For more information type:
tp trigger --help
trigger-pipeline
can automatically discover Jenkins servers created via the Jenkins Operator.
In addition you can register any Jenkins servers you wish to the Jenkins Server Registry via the tp add
command.
To add a new Jenkins server with a guided wizard:
tp add
If you already know the name, URL, username and API Token then you can use:
tp add
You can remove a Jenkins server via:
tp remove
Note that this only removes it from the registry; it doesn't affect the actual Jenkins Server.
To list the servers you can use try:
tp list
To maintain a registry of Jenkins Servers trigger-pipeline
uses a Kubernetes Secret
for each Jenkins Server with details of the URL, username and API Token
If you see this error when trying to trigger a pipeline:
403 No valid crumb was included in the request
Then until we figure out a better workaround you need to go into Manage Jenkins
-> Configure Global Security
then make sure you uncheck Prevent Cross Site Request Forgery exploits