apigee.option update with revision not working

Hi All,

We have multiple Apigee environments(e.g. dev, test, qa, etc.) under one org. We want to deploy the same api proxy revision to different environments through apigee deploy maven plugin however it doesn't seem to be working.

e.g. We have any api proxy having latest revision 3 (not deployed to any env) in Apigee Edge UI. When we configure the following parameters in pom.xml to deploy revision 3 in dev or test environment, it doesn't perform any deployment in dev environment.

If XML tags apigee.options and apigee.revision are removed from the profile, new revision 4 is created and deployed in dev

Here is the profile created under the pom.xml.

<profile> <id>dev</id> <properties> <apigee.profile>dev</apigee.profile> <apigee.hosturl>https://api.enterprise.apigee.com</apigee.hosturl> <apigee.apiversion>v1</apigee.apiversion> <apigee.org>lowerenvironment</apigee.org> <apigee.env>dev</apigee.env> <apigee.username>${username}</apigee.username> <apigee.password>${password}</apigee.password> <apigee.options>update</apigee.options> <apigee.revision>3</apigee.revision> </properties> </profile>

Many Thanks,

0 2 669
2 REPLIES 2

HI @Jinesh Thakkar

The plugin is built to deploy code from your SCM to Apigee (which is what we recommend as well). In your case if you push the same revision to multiple environments, then when you make a change to the same revision, it gets applied to all the other environments as well.

The best practice is to use your SCM and tie that for your SDLC and code promotion. In this case, you will know what code is pushed to which environment and everything is tracked.

However, if you still think you need to push, the plugin wont be able to do that, you can do that using the Mgmt API. Again, I am not recommending you to do this though

Hi @Sai Saran Vaidyanathan

I have similar requirement where I want to deploy same revision I already deployed to org, as I don't want to create multiple revisions of same code base and came across this post.

I am seeing same behaviour from plugin. based on your comment you suggested plug-in doesn't do this.

Document suggest option update with revision parameter will simply deploy existing revision and doesn't import new bundle.

Also checked plug-in code from repository and found below

DeployMojo.java

inside Init method, it read revision param and set revisionInArg variable.

case update:

	Options.update=true;
//set the revision that is passed as argument
if 
	(this.getRevision() != null) { 
	revisionInArg = String.valueOf(this.getRevision()); 
	} 
	break;

in execute method it checks if revisionInArg is passed then it simply doen't import and doUpdate.

else if (Options.update) {
							String latestRev = "";
							
							//If revision to be updated is passed in the maven command as an argument, update that revision
							if(revisionInArg.length()>0){
								logger.info("Updating Revision passed: "+ revisionInArg);
								doUpdate(revisionInArg);
								break;
							}
							
							//Check if there is a revision deployed
							activeRevision=RestUtil.getDeployedRevision(this.getProfile());
							if (activeRevision.length() > 0){
								logger.info("Active Revision: "+ activeRevision);
								logger.info("Updating Active Revision: "+ activeRevision);
								doUpdate(activeRevision);
								break;
							}else {
								doImport();
								doActivateBundle();
							}

based on above code update with revision should work fine but somehow it doesn't. So I am not clear if I am calling mvn correctly.

following command I am executing

mvn install -Pdev -Dusername=user@user.com -Dpassword=****** -Dorg=myorg -Denv=dev -Dapigee.config.options=update -Drevision:3

Also tried revision option as -Dapigee.revision:3 and -Drevision:3 but nothing works

My shared pom file has following entry for revision

<apigee.revision>${revision}</apigee.revision>

Thanks for your help and suggestion.

Regards

Harmeet