Fails to build on tag event in 0.8.0

Pushing a tag does not seem to trigger a build. Github webhook set to “Send me everything”, all the same.

Build config:

pipeline:
  publish:
    image: plugins/docker
    repo: my.registry.com/some-repo
    registry: ${DOCKER_REGISTRY}
    secrets: 
      - docker_username
      - docker_password
      - docker_registry
    tags: latest
    when:
      branch: [master]
  publish_tags:
    image: plugins/docker
    repo: my.registry.com/some-repo
    registry: ${DOCKER_REGISTRY}
    secrets: 
      - docker_username
      - docker_password
      - docker_registry
    tags: ${DRONE_TAG}
    when:
      event: [tag]
      branch: [refs/tags/*]

Tags need to be enabled in the drone user interface (screenshot below) otherwise they are ignored. Please note that the drone server logs a detailed message every time it ignores a hook from github. In this case, you probably would see the following in your server logs:

"ignoring hook. repo %s is disabled for tag events."

1 Like

@bradrydzewski In my case tag event is enabled, even then it isn’t working. Similar thread is being discussed at https://github.com/drone-plugins/drone-github-release/issues/32

i feel both event and branch are not working together

Just to provide an example, the below code was working fine

  publish_redis_cluster:
    group: release
    image: plugins/ecr
    create_repository: true
    secrets: [ ecr_access_key, ecr_secret_key, ecr_region ]
    repo: xxx.dkr.ecr.us-east-1.amazonaws.com/redis-cluster
    registry: xxx.dkr.ecr.us-east-1.amazonaws.com
    tags:
        - "v1.0"
    dockerfile: redis/Dockerfile
    context: redis
    force_tag: false
    insecure: false
    when:
        event: tag
        status: success
    volumes:
        - /var/run/docker.sock:/var/run/docker.sock

and when i changed it to below, it stopped working

  publish_redis_cluster:
    group: release
    image: plugins/ecr
    create_repository: true
    secrets: [ ecr_access_key, ecr_secret_key, ecr_region ]
    repo: xxx.dkr.ecr.us-east-1.amazonaws.com/redis-cluster
    registry: xxx.dkr.ecr.us-east-1.amazonaws.com
    tags:
        - "latest"
        - "${DRONE_TAG##redis-v}"
    dockerfile: redis/Dockerfile
    context: redis
    force_tag: false
    insecure: false
    when:
        event: tag
        status: success
        branch: refs/tags/redis*
    volumes:
        - /var/run/docker.sock:/var/run/docker.sock

The above example will not work in 0.8. Instead you should do this:

    when:
        event: tag
        status: success
-       branch: refs/tags/redis*
+       ref: refs/tags/redis*
2 Likes

Does ref support everything that branch does < 0.8
Like array ref: [refs/tags/redis*, refs/tags/abc*]
and include and exclude

2 Likes

It’s working @bradrydzewski. Awesome drone :slight_smile: