When: condition not working for tag

I’m trying to get drone to deploy to a staging server if a tag is set in git.

I have this:

pipeline:
  build-and-push-staging-test:
    image: registry.docker/ll-lang/gobuild:1.11-go-workdir
    commands:
      - export BUCKET_NAME=www.test.staging.tilia-inc.com
      - make build BUCKET_NAME=$${BUCKET_NAME} BASE_DOMAIN=test.staging.tilia-inc.com
      - make upload BUCKET_NAME=$${BUCKET_NAME}
    when:
      tag: test-staging*

I did set the setting to get tag events. Indeed, I see drone kick off the build. However, the commands associated with this condition do not run. It’s like the when condition is not met. I’m at a loss as to how to debug this. Any ideas?

The SCM event is the trigger you want. Try changing:

when
  tag: something

to

when:
  event: tag

In the latest version drone v1.0.0, you could use the following when configuration to archive this goal.

when:
      ref:
        include:
          - refs/tags/services/*

After that, if you git tag services/x.x.x and push to the remote repository, the drone will start work for the tasks.

More detail here: https://docs.drone.io/config/pipeline/conditions/ see the By Reference section.