Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Keptn API Import Resource Package Endpoint

Christian Kreuzberger edited this page Jul 5, 2022 · 1 revision

Import Resource Package

A import resource package is a .zip file containing a manifest.yaml and all other files that are referenced in the API payloads or resources fields.

Example file: webhook-example.zip

manifest.yaml

The manifest.yaml must be a valid .yaml file defining the apiVersion and a list of tasks as shown in the example:

apiVersion: v1beta1
tasks:

  # API Call
  - name: "Unique name of the current task"
    type: api
    action: "keptn-api-v1-create-service"    # Pre-defined endpoint
    payload: "api/create-service.json"       # Payload for the request body
    context:                                 # context available for templating in the payload
      service: "my-service-name"             # Can also use go template syntax: [[ .payloadContext.service ]]

  # [...]

  # Add a webhook config
  - name: "Webhook config"
    type: resource
    resource: "resources/webhook.yaml"       # where is the file stored in the package
    resourceUri: "webhook.yaml"              # what should the file be called in the upstream repo
    stage: "example"
    context:                                 # Placeholders for templating in resources/webhook.yaml
      event: "{{ .tasks.create-subscription.context.event }}"
      subscriptionId: "{{ .tasks.create-subscription.response.id }}"

Note:

  • Currently only api and resource are allowed types for tasks
  • All files referenced in payload or resource must exist in the provided archive
  • The archive can contain any other files, these files will be ignored by the import endpoint
  • We support templating in the context of the manifest.yaml and in the provided payload and resource files. We use [[ .context.<key> ]] to access these values
  • [[ .inputs.project ]] can be used to access the project name provided in the POST request
  • All archives larger than 50MiB will not be processed by the endpoint
  • The format of the manifest.yaml has not been finalized and can still change

Testing

The endpoint can be tested via the Swagger UI in the api-server: http://<API_ENDPOINT>/api/swagger-ui/#/Import/import