carash
(Wibisana Bramawidya)
November 28, 2019, 4:28am
1
Hi, I’m new to drone and I have a quick question on drone consuming github deployment events.
I created a simple pipeline to see what I’m working with which just triggers on any event
kind: pipeline
type: docker
name: testing
steps:
- name: test
image: busybox
commands:
- printenv
but then I tried to trigger it via github deployment, and somehow it tried to clone from a tag ref. Is there something I’m doing wrong? or is this a bug?
curl -X POST \
https://api.github.com/repos/***/***/deployments \
-H 'Authorization: Basic *************************************' \
-H 'Content-Type: application/json' \
-d '{
"ref": "*************************************695",
"auto_merge": false
}'
Initialized empty Git repository in /drone/src/.git/
+ git fetch origin +refs/tags/*************************************695:
fatal: Couldn't find remote ref refs/tags/*************************************695
genisd
(Daniel)
November 28, 2019, 12:37pm
2
Add a filter when the pipeline should trigger.
i.e. for pull_request at the end of the pipeline:
trigger:
event:
- pull_request
or for deployment at the end of the pipeline:
trigger:
target:
- test
(this will trigger when deployment towards “test” is triggered).
Note deployment event in github is translated into a “promote” event.
trigger:
event:
- promote
carash
(Wibisana Bramawidya)
November 29, 2019, 4:12am
3
Okay… I tried that… The pipeline now looks like this
kind: pipeline
type: docker
name: testing
steps:
- name: test
image: busybox
commands:
- printenv
trigger:
event:
- promote
target:
- production
Now the drone tries to get from heads ref… which is still wrong
curl -X POST \
https://api.github.com/repos/***/***/deployments \
-H 'Authorization: Basic *************************************' \
-H 'Content-Type: application/json' \
-d '{
"ref": "*************************************145",
"auto_merge": false
}'
Initialized empty Git repository in /drone/src/.git/
+ git fetch origin +refs/heads/*************************************145:
fatal: Couldn't find remote ref refs/heads/*************************************145
and when I tried to use a head ref as the target… it just appends a refs/heads/
as a prefix
curl -X POST \
https://api.github.com/repos/***/***/deployments \
-H 'Authorization: Basic *************************************' \
-H 'Content-Type: application/json' \
-d '{
"ref": "refs/heads/test-triggers",
"auto_merge": false
}'
Initialized empty Git repository in /drone/src/.git/
+ git fetch origin +refs/heads/refs/heads/test-triggers:
fatal: Couldn't find remote ref refs/heads/refs/heads/test-triggers
I’m starting to think that this is an actual bug… and I should put this under the bugs category