Compile

Learn how to compile a pipeline configuration with templates.

Endpoint

POST  /api/v1/pipelines/:org/:repo/:pipeline/compile

Parameters

The following parameters are used to configure the endpoint:

NameDescription
orgname of organization
reponame of repository
pipelinecommit SHA for pipeline from repository
outputformat the output for the compiled pipeline configuration

Permissions

COMING SOON!

Responses

Status CodeDescription
200indicates the request has succeeded
400unable to retrieve or compile the pipeline configuration and templates
401indicates the user does not have proper permissions
404unable to retrieve or compile the pipeline configuration or templates
500system error while retrieving or compiling the pipeline configuration templates

Sample

Request

curl \
  -X POST \
  -H "Authorization: Bearer <token>" \
  "http://127.0.0.1:8080/api/v1/pipelines/github/octocat/48afb5bdc41ad69bf22588491333f7cf71135163/compile"

Response

version: "1"
secrets:
- name: go_module
  key: github/octocat/template_secret
  engine: native
  type: repo
steps:
- commands:
  - go vet ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code)
  - go fmt ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code)
  image: golang:latest
  name: go_validate
  pull: not_present
- commands:
  - go test ./...
  image: golang:latest
  name: go_test
  pull: not_present
- commands:
  - go build -a -ldflags '-extldflags "-static"' -o release/heyvela {$GO_MODULE}
  image: golang:latest
  name: go_build
  pull: not_present
  environment:
    CGO_ENABLED: "0"
    GOOS: linux
templates:
- name: go
  source: github.com/github/octocat/go/template.yml
  type: github
{
  "version": "1",
  "metadata": {},
  "worker": {},
  "secrets": [
    {
      "name": "go_module",
      "key": "github/octocat/template_secret",
      "engine": "native",
      "type": "repo",
      "origin": {
        "ruleset": {
          "if": {},
          "unless": {}
        }
      }
    }
  ],
  "steps": [
    {
      "ruleset": {
        "if": {},
        "unless": {}
      },
      "commands": [
        "go vet ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code)",
        "go fmt ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code)"
      ],
      "template": {},
      "image": "golang:latest",
      "name": "go_validate",
      "pull": "not_present"
    },
    {
      "ruleset": {
        "if": {},
        "unless": {}
      },
      "commands": [
        "go test ./..."
      ],
      "template": {},
      "image": "golang:latest",
      "name": "go_test",
      "pull": "not_present"
    },
    {
      "ruleset": {
        "if": {},
        "unless": {}
      },
      "commands": [
        "go build -a -ldflags '-extldflags \"-static\"' -o release/heyvela {$GO_MODULE}"
      ],
      "template": {},
      "image": "golang:latest",
      "name": "go_build",
      "pull": "not_present",
      "environment": {
        "CGO_ENABLED": "0",
        "GOOS": "linux"
      }
    },
    {
      "ruleset": {
        "if": {},
        "unless": {}
      },
      "commands": [
        "go vet ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code)",
        "go fmt ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code)"
      ],
      "template": {},
      "image": "golang:latest",
      "name": "go-tag_validate",
      "pull": "not_present"
    },
    {
      "ruleset": {
        "if": {},
        "unless": {}
      },
      "commands": [
        "go test ./..."
      ],
      "template": {},
      "image": "golang:latest",
      "name": "go-tag_test",
      "pull": "not_present"
    },
    {
      "ruleset": {
        "if": {},
        "unless": {}
      },
      "commands": [
        "go build -a -ldflags '-extldflags \"-static\"' -o release/heyvela {$GO_MODULE}"
      ],
      "template": {},
      "image": "golang:latest",
      "name": "go-tag_build",
      "pull": "not_present",
      "environment": {
        "CGO_ENABLED": "0",
        "GOOS": "linux"
      }
    },
  ],
  "templates": [
    {
      "name": "go",
      "source": "github.com/github/octocat/go/template.yml",
      "type": "github"
    }
  ]
}