I’m hoping someone may be able to help please.
I can’t see why the following example gets ${DRONE_TAG}
set OK but not ${DRONE_SEMVER}
.
For my use case I thought I’d use a “by reference” trigger to limit build execution to tag operations, then pass environment variable ${DRONE_SEMVER_SHORT}
as a tag name to plugins/docker
, but this always seems to be empty.
Here’s a minimal .drone.yml
to illustrate (all build tags except - ${DRONE_SEMVER_SHORT}
work):
kind: pipeline
type: docker
name: default
steps:
- name: debug
image: alpine
commands:
- echo "DRONE_SEMVER=${DRONE_SEMVER}"
- echo "DRONE_SEMVER_SHORT=${DRONE_SEMVER_SHORT}"
- echo "DRONE_TAG=${DRONE_TAG}"
- name: docker
image: plugins/docker
settings:
repo: 192.168.16.42:5000/test
registry: 192.168.16.42:5000
insecure: true
dockerfile: test/image_files/Dockerfile
build_args:
- from_image=alpine:latest
- message=test
tags:
- latest
- ${DRONE_BUILD_NUMBER}
- ${DRONE_TAG}
- ${DRONE_SEMVER_SHORT}
trigger:
ref:
include:
- refs/tags/**
# - refs/tags/*+module-a*
In the Drone UI, the “debug” step’s output shows ${DRONE_TAG}
is set, but not ${DRONE_SEMVER}
or its variants:
1 + echo "DRONE_SEMVER="
2 DRONE_SEMVER=
3 + echo "DRONE_SEMVER_SHORT="
4 DRONE_SEMVER_SHORT=
5 + echo "DRONE_TAG=0.0.9"
6 DRONE_TAG=0.0.9
The reason for the above approach is that I have a multi-module project (GitLab based so I haven’t looked into this plugin-based solution); I may take a look at Starlark though.