Drone-jsonnet not working

I’m running in kubernetes and my deployment for the server looks like

apiVersion: extensions/v1beta1
kind: Deployment
    deployment.kubernetes.io/revision: "8"
  creationTimestamp: "2019-05-01T16:42:11Z"
  generation: 8
    app: drone
    chart: drone-2.1.0
    component: server
    heritage: Tiller
    release: drone
  name: drone-drone-server
  namespace: default
  resourceVersion: "137855879"
  selfLink: /apis/extensions/v1beta1/namespaces/default/deployments/drone-drone-server
  uid: 11098e22-6c30-11e9-bb02-02482baa4ce0
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
      app: drone
      component: server
      release: drone
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
        checksum/secrets: 8c044c14a28189593f4e250e0b6f1e533247d63609cf538a8a723e0af809630b
      creationTimestamp: null
        app: drone
        component: server
        release: drone
      - env:
          value: "true"
          value: default
          value: drone-drone-pipeline
        - name: DRONE_GIT_ALWAYS_AUTH
          value: "false"
        - name: DRONE_SERVER_HOST
          value: drone.domain.com
        - name: DRONE_SERVER_PROTO
          value: http
        - name: DRONE_USER_CREATE
          value: username:mzupan,machine:false,admin:true
        - name: DRONE_RPC_SECRET
              key: secret
              name: drone-drone
          value: /var/lib/drone/drone.sqlite
          value: sqlite3
        - name: DRONE_LOGS_DEBUG
          value: "true"
        - name: DRONE_YAML_ENDPOINT
        - name: DRONE_YAML_SECRET
          value: 0aaffaaxxxxx
        - name: DRONE_LOGS_PRETTY
          value: "true"
        - name: DRONE_GITHUB_CLIENT_ID
          value: fe5527xxxxx
        - name: DRONE_GITHUB_SERVER
          value: https://github.com
              key: clientSecret
              name: drone-drone-source-control
        image: docker.io/drone/drone:1.1.0
        imagePullPolicy: IfNotPresent
          failureThreshold: 3
            path: /
            port: http
            scheme: HTTP
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
        name: server
        - containerPort: 80
          name: http
          protocol: TCP
        - containerPort: 443
          name: https
          protocol: TCP
        - containerPort: 9000
          name: grpc
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        - mountPath: /var/lib/drone
          name: data
      - env:
        - name: PLUGIN_SECRET
          value: 0aaffaaxxxxx
        - name: GITHUB_TOKEN
          value: 2c6f714xxxx
        image: drone/drone-jsonnet
        imagePullPolicy: IfNotPresent
        name: jsonnet
        - containerPort: 3000
          name: jsonnet
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: drone-drone
      serviceAccountName: drone-drone
      terminationGracePeriodSeconds: 30
      - name: data
          claimName: drone-drone

I’m trying to run jsonnet as a sidecar. I can exec into the server and curl

In my repo I have a .drone.jsonnet file and my config in drone i’ve tried to set that or keep it blank. When I set that it seems to try to parse it as yaml

yaml: line 2: mapping values are not allowed in this context

My jsonnet file looks like

local Pipeline(version) = {
  kind: "pipeline",
  name: version,
  steps: [
      name: "test",
      image: "dpirotte/fpm-cookery:" + version,
      commands: [
        "bash ./package.sh"


Did you go into your repository settings (in the drone user-interface) and change the configuration file from .drone.yml to .drone.jsonnet ?

Brad , I have the some problem exactly and yes I change on the drone setting to jsonnet.
when I run drone jsonnet to test the value its valid.
This is from drone server container
/ # curl -I http://localhost:3000
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Sun, 26 May 2019 19:54:40 GMT
Content-Length: 29

@ihakimi this is expected, you cannot curl the endpoint like this. The endpoint requires a signed request, per the http-signatures spec. So this error is expected.

this is what I see on the agent logs
2019/05/26 20:41:17 [DEBUG] POST opsys-drone-grpc://localhost:8080/rpc/v1/request: retrying in 10s (22 left)
2019/05/26 20:41:17 [ERR] POST opsys-drone-grpc://localhost:8080/rpc/v1/request request failed: Post opsys-drone-grpc:/

this is not a valid http endpoint. the scheme should be http or https, not opsys-drone-grpc. Also are you sure this is an issue with drone-jsonnet? Nothing about this error demonstrates a problem with drone-jsonnet. Is there additional information that leads you to believe this is a problem with drone-jsonnet that you are not providing?

maybe the issue is the connection between client-server, when I might misunderstand the grpc on the server port 9000
what should be the value for DRONE_RPC_SERVER?

this is what I am getting in the log
2019/05/26 20:50:33 [ERR] POST http://opsys-drone/rpc/v1/request request failed: Post http://opsys-drone/rpc/v1/request: context deadline exceeded
2019/05/26 20:50:33 [ERR] POST http://opsys-drone/rpc/v1/request request failed: Post http://opsys-drone/rpc/v1/request: context deadline exceeded
2019/05/26 20:50:33 [ERR] POST http://opsys-drone/rpc/v1/request request failed: Post http://opsys-drone/rpc/v1/request: context deadline exceeded

drone 1.0 does not use grpc and does not listen on 9000. In Drone 1.x the communication protocol is plain old http(s) on the standard ports.

also drone does long polling and after 30 seconds will cancel and then re-try the request. Those error messages can be completely normal. But if there is an issue there is extensive documentation to help you troubleshoot agent communication issues. See Builds are Stuck in Pending Status

either way, I do not see any evidence of issues with drone-jsonnet. If you still have issues with agent-to-server communication after reading the troubleshooting guide, please either search for an existing topic related to the errors you are seeing or start a new topic if none exists.

Ok, server-clinet working ablo to run pipeline using .drone.yml
I put on server DRONE_JSONNET_ENABLED: “true”
and when I change the file on setting to .drone.jsonnet nothing happened

this is the error for JSON
{“commit”:“55f7a8eb4cd42b578bee97a9810c9b731cbb762f”,“event”:“push”,“level”:“debug”,“msg”:“trigger: received”,“ref”:“refs/heads/11.11”,“repo”:“tlv-opsys/ops-deployer”,“time”:“2019-05-26T21:00:32Z”}
{“commit”:“55f7a8eb4cd42b578bee97a9810c9b731cbb762f”,“error”:“RUNTIME ERROR: stream mode: top-level object was a object, should be an array whose elements hold the JSON for each document in the stream.\n\tDuring manifestation\t\n”,“event”:“push”,“level”:“warning”,“msg”:“trigger: cannot find yaml”,“ref”:“refs/heads/11.11”,“repo”:“tlv-opsys/ops-deployer”,“time”:“2019-05-26T21:00:33Z”}
{“arch”:“amd64”,“kernel”:"",“level”:“debug”,“msg”:“manager: context canceled”,“os”:“linux”,“time”:“2019-05-26T21:00:41Z”,“variant”:""}

top-level object was a object, should be an array whose elements hold the JSON for each document in the stream

This appears to be a jsonnet parsing error. Please provide the jsonnet file. Specifically the jsonnet file should return an array.

local docker(name, branch, tag) = {
name: name,
image: “plugins/docker”,
settings: {
repo: “octocat/hello-world”,
tags: tag,
when: {
branch: branch

kind: “pipeline”,
name: “default”,
steps: [
name: “build”,
image: “golang”,
commands: [ “go build”, “go test” ],
docker(“build-master”, “master”, “latest”),
docker(“build-develop”, “develop”, “develop”),

this is from example

can you format the code snippet for better readability?

It looks like you are not returning an array. The jsonnet file should end with an array. Since the final character in the jsonnet appears to be a } this would tell me you are returning an object and not an array.

yep, you need to return an array [], so wrap your return object in an array

thanks works!!! regarding jsonnet I first configure it using the plugin but then I saw it already pluggeable on 1.0.0 so worth to mention it on the docs people will know

just be aware when drone cli I am getting the following error
2019/05/27 00:25:57 yaml: unmarshal errors:
line 1: cannot unmarshal !!seq into yaml.RawResource

but on the server everything is working

00:26 $ drone --version
drone version 1.1.0