I need to automate the CI/CD pipeline for an SpringBoot application. This application has application.properties file which contains few obvious env specific properties like DB properties, Kafka properties etc.
For each of my env. where the gitlab runner tuns, we have commands which provides properties to be used in that env. e.g. user which runs the gitlab runner has script getDBURL which returns DB URL of that env. Same script is available in all env which returns those env. specific values.
So, if the build is running in QA env, I need to replace DBURL, DBPass, etc. in apllication.properties file & generate it as an artefact along with jar/war build for the app.
How to write gitlab-ci.yml for such configuration?
My existing file that generates jar looks like:
stages:
- build
- publish
build-code-job:
stage: build
before-script: #some cleanup
script:
- echo "build app1"
- mvn $MAVEN_CLI_OPTS clean package
publish-nexus:
stage: publish
script:
- mvn $MAVEN_CLI_OPTS deploy -Dmaven.test.skip=true
- echo "Publishing to local repository"
only:
- master
Appreciate any help to generate application.properties file which will generate env specific configuration in it for gitlab runner.