I am using apigee deploy maven plugin for the deployments (which is working fine) but now trying to separate build and deploy phase but facing issues.
I am able to successfully create the package using below command (parameter buildNumber is added to create unique package name for every build)
mvn package -DbuildNumber={buildNumber}
Eg. Package Name created is "abc1.0-1-test.zip" wherein 1 is buildNumber
Now I want to deploy the already created package. I am using below command and getting below error :
Command : mvn deploy -Ptest -Dusername={username} -Dpassword={pwd} -Dorg=xyz
Error :
=============Importing App================ [INFO] Request prepared for the server ************************** POST https://api.enterprise.apigee.com/v1/organizations/xyz/apis?action=imp ort&name=abc accept: application/json accept-encoding: gzip authorization: Basic [Not shown in log] content-type: application/octet-stream [Request body contains data, not shown] [ERROR] 400 Bad Request { "code" : "repository.cassandra.UnableToReadApiProxy", "message" : "Unable to read/find APIProxy contents", "contexts" : [ ] } [ERROR]
Please help.
I am unable to edit question. Attaching the parent pom for reference.parent-apiproxy-pom.zip
@Sai Saran Vaidyanathan, please help.
Why do you need this build number ? You cant deploy two different proxies to the same environment with the same basepath. So if you deploy abc1.0-1-test and abc1.0-2-test with the same basepath, the deployment will fail.
Can you explain why you are doing this ?
@Sai Saran Vaidyanathan, By adding build number, I am trying to keep all the packages created for an apiproxy instead of overwriting the package and deploy the one which I want.
eg. In dev, let's say I want build#10 package to be deployed of api proxy abc whereas in qa build#8 package to be deployed and in prod build#5 package to be deployed.
So, I would want to keep all the packages.
Also, if I am don't add build number in the package name and deploy the package using below command I get below error :
Command : mvn deploy -Ptest -Dusername={username} -Dpassword={pwd}
Error : repository element was not specified in the POM inside distributionManagement element in maven deploy
Hi @Apoorva
I dont think its a good idea to do what you mentioned (have build number and use that across environments). The reasons being -
I think you should be using SCM and CI/CD to control the overall code promotion. Check this link, it talks about having branches for each environment. With this everything is controlled via your SCM and then audited.
Accordingly your CI/CD can just build the package from the appropriate environment branch and then push that to the appropriate Apigee environment.
Going back to your question, to create the package, you can run
mvn package -P<profile>
and to deploy, you can run
mvn apigee-enterprise:deploy -P<profile>
Make sure the package is in the target folder as the maven plugin expects the zip file to be in the target folder.
for deployment of Sharedflows: is there also a target folder with the zipped version needed or how is the folder structure expected in this case? Thx!!
Hi @maria thanner - I am happy to help if you can please open a new question regarding this? Don't want to mix two topics in the same post
thx for your comment. I created a new issue here:
https://community.apigee.com/questions/55683/apigee-deploy-shared-flows-using-maven-plugin.html