apigee config maven plugin - deploy certain configuration only

Former Community Member
Not applicable

Hi, My goal is to create a jenkins job that will to deploy a certain configuration only. I have a parameterized job.

ConfigName is the choice from the following options: choice(choices: ['all', 'caches', 'kvms', 'targetservers', 'resourcefiles', 'flowhooks','maskconfigs','apiproducts','developers', 'apps', 'virtualhosts', 'extensions', 'reports'], description: '', name: 'ConfigName').

Here is the pipeline script:

if ("${params.ConfigName}" == 'all') {

sh "'${mvnHome}/bin/mvn' -f pom.xml clean install -Dorg=non-prod -Dapigee.config.options=${params.Operation} -P${params.Environment} -Denv=${params.Environment} -Dusername=$un -Dpassword=$pw -Dauthtype=oauth -Dapigee.config.dir=resources/edge -X" }

else {

sh "'${mvnHome}/bin/mvn apigee-config:${params.ConfigName}' -f pom.xml clean install -Dorg=non-prod -Dapigee.config.options=${params.Operation} -P${params.Environment} -Denv=${params.Environment} -Dusername=$un -Dpassword=$pw -Dauthtype=oauth -Dapigee.config.dir=resources/edge -X"

}

When I choose kvms, this is the error I am seeing:

+ '/usr/bin/apache-maven-3.6.1/bin/mvn apigee-config:kvms' -f pom.xml clean install -Dorg=non-prod -Dapigee.config.options=create -Pexplore -Denv=explore -Dusername=**** -Dpassword=**** -Dauthtype=oauth -Dapigee.config.dir=resources/edge -X /app/jenkins/workspace/configuration_to_nonprod_pipeline_params@tmp/durable-fef09736/script.sh: line 1: /usr/bin/apache-maven-3.6.1/bin/mvn apigee-config:kvms: No such file or directory.

Am i using the right command "apigee-config"?

Thanks in advance!

Solved Solved
1 7 1,002
1 ACCEPTED SOLUTION

HI @maneesh m

I see you are using the particular config goal "apigee-config:kvms" and also "install". If you call "install" it will configure all the other configurations as well - please remove that from your command or pass all the necessary goals for kvms config to work.

I believe the error could be due to the single quote, it assumes its a directory. Try changing it to

sh "'${mvnHome}/bin/mvn' -f pom.xml clean apigee-config:${params.ConfigName} -Dorg=non-prod -Dapigee.config.options=${params.Operation} -P${params.Environment} -Denv=${params.Environment} -Dusername=$un -Dpassword=$pw -Dauthtype=oauth -Dapigee.config.dir=resources/edge -X"

I have moved the config goal next to "clean" and removed "install".

If you have other tasks you perform using "process-resources" goals, then you will need to pass that to the mvn command as well in the same order. Try it out and let me know if that works

View solution in original post

7 REPLIES 7

your config file has to be either absolute or relative to your project dir, that is the same dir where you pom.xml is, is resources dir next to pom.xml?

Former Community Member
Not applicable

@isaias.arellano.delgado, Yes. Everything works fine when I deploy all the configurations. I am only having issue when I use apigee-config:${params.ConfigName} to deploy targetservers or kvms only.

Can you issue a tree command inside your resources directory and share the output to check your file structure?

HI @maneesh m

I see you are using the particular config goal "apigee-config:kvms" and also "install". If you call "install" it will configure all the other configurations as well - please remove that from your command or pass all the necessary goals for kvms config to work.

I believe the error could be due to the single quote, it assumes its a directory. Try changing it to

sh "'${mvnHome}/bin/mvn' -f pom.xml clean apigee-config:${params.ConfigName} -Dorg=non-prod -Dapigee.config.options=${params.Operation} -P${params.Environment} -Denv=${params.Environment} -Dusername=$un -Dpassword=$pw -Dauthtype=oauth -Dapigee.config.dir=resources/edge -X"

I have moved the config goal next to "clean" and removed "install".

If you have other tasks you perform using "process-resources" goals, then you will need to pass that to the mvn command as well in the same order. Try it out and let me know if that works

Former Community Member
Not applicable

That worked!

Glad it worked !

optimism
Participant V

The solution helped me too! Thanks a lot!