I'm working on automating deployment for dev and prod with sqoop jobs that have to be scped onto specific servers for each type. With these jobs, the scripts associated for each sqoop job needs to change based on dev vs prod. Currently, I have a git repo containing a dev and prod folder where approved dev changes are put onto the prod folder but with the variables (references to dev database vs prod database) changed. Then I have two jenkins pipelines that associate with each and have independent triggers. This is incredibly hacky.
My current plan is to consolidate into a single folder and replace all the variables with a pseudo variable such as %DBPREFIX% and then having each associated pipeline regex and replace all matches with its associated database prefix on compilation.
The files that need to be changed are shell scripts and hive scripts, so I can't just define a environment variable within the Jenkins node shell.
Is there a better way to handle this?
tl;dr: I need to set variables in different files that can be automatically changed through a jenkins pipeline.