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:

  1. the task type: maven build/release
  2. 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)

  1. 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
  2. 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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -