I would like to have a environment variable COMPOSE_PROJECT_NAME with the value denpal-4 for a Jenkins job with build_id 4.
environment { COMPOSE_PROJECT_NAME = 'denpal-$(BUILD_ID)' } The alternative would be writing this in every sh-block
sh ''' export COMPOSE_PROJECT_NAME = 'denpal-$(BUILD_ID)' code... ''' This would go against the DRY (Don't repeat yourself) principle however. Is something in environment {} possible?
UPDATE/ANSWER: double quotes instead of single quotes fixed it.