Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
630 views
in Technique[技术] by (71.8m points)

how to populate spring.active.profiles values in azure devops build pipelines

I am using profiling in spring boot application and have below files.

application.properties
application-dev.properties
application-test.properties

To load dev related profiles,in local application I am using below property in application.properties file.

spring.profiles.active=dev

If I want to activate and use test then I make a change in application.properties file as below

spring.profiles.active=test

As I am new to AzureDevOps, want to know how this profile property value can be configured so as it is auto populated in CI/CD pipeline during release. The dev deployment stage should pick up dev code and test stage will pick up test related code.

How to set value for this spring.profiles.active property in CI CD pipelines ?

question from:https://stackoverflow.com/questions/66058802/how-to-populate-spring-active-profiles-values-in-azure-devops-build-pipelines

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There are extension tools you can use in azure ci/cd pipeline to replace the profile property value during release. Eg. RegEx Find & Replace task. See below steps:

1, Install the RegEx Find & Replace task from the market place.

2, Add RegEx Find & Replace task to the top of your pipeline. And configure it as below in dev stage:

enter image description here

Above configuration will match the spring.profiles.active=.* and replace it to spring.profiles.active=dev using RegEx in the in application.properties file.

3, In the test stage. Change the replace value to spring.profiles.active=test


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...