Publish On Pull Request

I noticed in the documentation:

Deployments are triggered at the end of a successful build. Note that deployment steps are not executed for pull requests or failed builds.

I’m wondering if this has to be the case. I’d like to publish pull request builds to our private registry under their own repo. This is because I want to be able to run the code in a production like environment prior to merging.

I could see being able to filter by pull_request and then creating a separate publish step for that trigger. However, it seems that isn’t possible.

Can I accomplish a publish on PR? Or is that not supported by Drone?

This restriction is eliminated in drone/drone0.5 :slight_smile:

Excerpt from the 0.5 documentation

Plugins are not executed for pull request. You can override the default behavior by configuring the types of events for which the plugin is executed.

pipeline
  ...
  notify:
    image: plugins/slack
    channel: dev
+   when:
+     event: [ push, tag, deployment, pull_request ]

Ah, I must have missed that, terribly sorry.

So something like

publish:
  docker:
    when:
      event: pull_request
    dockerfile: Dockerfile

Should suffice?

@therynamo it looks like you are using drone/drone:0.4 so unfortunately this will not be possible without upgrading to the latest unstable version of drone.

note that in order to enable this behavior, as well as more flexible ordering for publish and deployment steps, the latest unstable version of drone includes breaking yaml changes:

-build:
-  image: golang
-  commands:
-    - go build
-    - go test

-publish:
-  docker:
-    repo: foo/bar

+pipeline:
+  build:
+    image: golang
+    commands:
+      - go build
+      - go test
+  publish_to_docker: # step names are arbitrary
+    image: plugins/docker
+    repo: foo/bar

Sorry, we do have pipeline available, I just didn’t know any better. I will switch over to that. I must be looking at outdated docs somehow. Is there a better place than http://readme.drone.io/usage/overview/?

Thanks for your quick replies!

@therynamo readme.drone.io/0.5 for the latest 0.5 version. It is still technically unstable, which is why we keep the docs separate from the stable branch.

Ah, I understand now, that makes sense! Thank you so much.

Actually, it seems that I’m getting a 403 when visiting.

unfortunately this is because we use amazon S3 to host the website, which has overly-aggressive cache rules. Loading the page without cache will resolve and load the new docs
http://readme.drone.io/0.5/

Loading the page without cache

I did attempt to load with Disable Cache in developer tools, incognito, etc. Maybe you could elaborate on what you mean by view without cache. Sorry, I’m sure it seems straight forward, I think I’m just missing something.