I have following gitlab-ci conf. file:
before_script:
- echo %CI_BUILD_REF%
- echo %CI_PROJECT_DIR%
stages:
- createPBLs
- build
- package
creat
below could be more readable, see only:varibles@gitlab-ci docs with refs:tags
only:
refs:
- tags
variables:
- $CI_COMMIT_TAG =~ /^[Tt]icket-.*/
You need to use only syntax:
only:
- tags
This would trigger for any Tag
being pushed. If you want to be a bit more specific you can do:
only:
- /Ticket\/ticket\_.*/
which would build for any push with the Ticket/ticket_
tag.
I recommend to use pattern in varibles-expression
using commits
Example
build_api:
stage: build
script:
- docker build --pull -t $CONTAINER_TEST_IMAGE .
- docker push $CONTAINER_TEST_IMAGE
only:
variables:
- $CI_COMMIT_MESSAGE =~ /(\[pipeline\]|(merge))/
Here i am saying that only
execute that job when have [pipeline] or merge inside the commit. More info, here in
gitlab