phillbaker's solution works in theory, but it needs some modifications to work on the current (august 2020) version of Concourse. This is a snippet from the pipeline I built using his code as starting point:
resources:
- name: git-walangtext
type: git
source:
uri: git@bitbucket.org:wall-art/walangtext.git
branch: master
private_key: |
{{ bitbucket_walangtext_private_key }}
- name: walangtext-docker-image
type: docker-image
source:
email: {{ email }}
username: {{ username }}
password: {{ secret_docker_hub_password }}
repository: wallartnl/walangtext
jobs:
- name: walangtext
serial: true
plan:
- get: git-walangtext
trigger: true
- task: generate-tag
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/git-resource
inputs:
- name: git-walangtext
run:
path: sh
args:
- -c
- |
cd git-walangtext
git describe --tags --abbrev=0 > tag
outputs:
- name: git-walangtext
- put: walangtext-docker-image
params:
build: git-walangtext/src/WALangtextSite
dockerfile: git-walangtext/src/WALangtextSite/Docker/Dockerfile
tag_file: git-walangtext/tag
tag_as_latest: true
Note that the git-resource image is way too large for the simple action it performs, I'm still looking for a much smaller image.
Another note is that I need to adjust the git command to my situation: I need to get the last tag, not the tag exactly at HEAD.