This repository contains the source code for the in-toto provenance plugin for Jenkins.
As of now, this is still WIP, although the core features are implemented.
You can compile the plugin by running mvn package
(note, make sure
you have the in-toto-java jar available)
and manually install the .hpi
file in your Jenkins installation.
We intend to move this to the plugin site for Jenkins once a more mature implementation is reached.
This plugin exposes a "post build" entry in the task menu. When selecting it you will be prompted to fill the following information in:
* You should either fill the credentialId or keyPath to assign a key for signing the link metadata.
Once this is done, the plugin will take care of generating and tracking information of the build process.
You can also use it in declarative pipelines by using the in_toto_wrap
syntax. It takes the same arguments as before. For example, to wrap a simple
shell script step you would add the following to your Jenkinsfile:
pipeline {
agent none
stages {
stage('Build') {
agent { label 'worker 1' }
steps {
in_toto_wrap(['stepName': 'Build',
'credentialId': 'keyId01',
'transport': 'redis://redis']){
echo 'Building..'
}
}
}
}
}
This will produce a piece of link metadata and post it to a redis server. Currently, we have transport handlers for redis, etcd and an unauthenticated POST request with the link metadata.
If using the keypath parameter, the path must be located on the remote worker. The plugin uses a
MasterToSlave
handler to serialize in-toto code to capture the in-toto
metadata natively in any worker. This both serves to not expose the slave's key
unnecessarily in the master's filesystem and to authenticate any worker that
performed the pipeline step.
The transport is chosen by specifying the protocol header on the URI. For
example, for a redis transport you'd use redis://
and for an etcd transport
you'd specify etcd://
. https
and http
are handled using a generic HTTP
POST request with the link metadata as the body of the request.
You can easily extend transports by extending the abstract class Transport
in
the io.jenkins.plugins.intotorecorder.transport
package. Discovery of new
handlers is not automatic (yet!) though.
As of now, the current limitations exist: