maven - Jenkins SSH Plugin - Execute different shell script commands depending on task (build/release) - environment variable -
using same jenkins job, there way configure jenkins ssh plugin execute different commands depending on:
- the task type: maven build/release
- an environment variable
mvn clean install -denvironment=dev
i worked out first option (the execution of different commands depending on build type - build vs release)
we need following plugins:
- readonly parameter plugin: pass read parameter (environment=pro) when launching release.
- environment injector plugin: pass hidden parameter (environment=dev) when building.
- release plugin
job configuration:
execution environment -> configure release build override build parameters checked string parameter release_version string parameter development_version readonly string parameter environment - pro
inject environment variables build process checked properties content environment=dev
post steps: can access declared variable (environment) in shell script.
for instance:
if [ "$environment" = "dev" ] echo "development!" fi if [ "$environment" = "pro" ] echo "production!" fi
Comments
Post a Comment