Plugins ECR, dynamic custom tag

I’m using Drone version 0.8.x for Java Application CI/CD. I want to release ECR image with my app and tag it with my application version (from Maven - java build tool).

So in first step I’m building app and exporting version number into a file (to pass it to next step and container). But next step is ECR plugin where I don’t know how to pass tag computed before and saved into file.

I’m saving file into version.tmp and here’s my ECR plugin usage step:

    image: plugins/ecr
    dockerfile: docker/Dockerfile
    context: docker
    region: eu-central-1
    repo: ${DRONE_REPO_NAME}
      - VERSION_TAG=$(cat version.tmp)
    tags: ${VERSION_TAG}
      event: push
      branch: release

I was trying also with

tags: $${VERSION_TAG}


tags: $(cat version.tmp)

but it’s also not working.

Any idea how I can make it work? Is it possible or I should use docker plugin and build, tag and push image on my own there?

- VERSION_TAG=$(cat version.tmp)

the reason this does not work is because environment is an array of Go string literal. It is not a bash string and is not run through a bash interpreter. Therefore it literally sets the environment variable value to $(cat version.tmp)

the docker plugin, however, support reading tags written to .tags file in the root of your git repository. There is an example at

1 Like

Thanks! it works with drone ECR plugin
:+1: confirmed

Hi @Ferdezo , I’ve been struggling with the same version tagging myself. @bradrydzewski sugested to try drone-docker because it works with .tags file. But in your reply you say “thanks, it works with drone ECR plugin”. Did you manage to get it working with drone ECR or drone docker plugin? Could you share how you resolved this?
I’ve been thinking of using drone docker, but Drone ECR makes it easy to authenticate with ECR, while with Drone docker I’m finding it harder to do…

you can use the .tags file with the ecr plugin as well.


the documentation could be clearer on that - the ecr plugin documentation doesnt mention a .tags file at all.

1 Like