Skip to main content

Defining a Resource

Order to intergrate custom functionality into Conveyor CI, you need to have some way to declare the state of your pipelines. Resources are objects in Conveyor CI that define the state of a pipeline. They are the core objects and all pipeline actions depend on them.

Take an example of a GitHub action, the tasks carried out by the action depend on what configuration you have defined in the workflow file. So even in Conveyor CI, the actions of the Drivers are defined in the resource.

Registering a Resource

Before a resource is can be added to Conveyor CI. its schema has to first be registed and this can be done using Resource Definitions. It this tutorial we aim to create a CI/CD pipeline tool that clones a git repository, conpressed the code into a zip file and uploads it to a defined Endpoint.

An example Resource Definition for such a resource would be.

name: zipper
version: 0.0.1
schema:
directory:
type: string
remote:
type: string

After defining the Resource Definition we apply it to the Conveyor CI API Server by making a POST request to the /resource-definitions/ endpoint.

curl -X POST http://your-api-url/resource-definitions/ \
-H "Content-Type: application/json" \
-d @data.json

You can now create a resource and apply it to Conveyor

name: example
resource: zipper
schema:
directory: /home/user/documents
remote: https://example.com/files.zip

Then you can make a POST request to the /resources/ endpoint to apply it to the Conveyor CI API where the Drivers will be waiting for it to apply it.