Apigee maven deployment plugin: Creation of products without proxy in it

Hello All,

While deploying the apigee proxy, products using the azure devops pipeline, i observed that products getting created but no proxy available inside the products.

is this a bug ? Please help me.

1 13 319
13 REPLIES 13

Maybe @ssvaidyanathan has some ideas?

hi can you share how you are defining these product configurations. Is it Apigee Edge/x.

It works for us in Azure Devops.

thanks

@Murthy - The plugin configures what you have in your configuration file (edge.json or apiproducts.json). Please check your file and see if the apiproxies are added to the payload

Hello @ssvaidyanathan 

 

We have 3 setups test, stage and prod.  i have created test-edge.json,  stage-edge.json and prod-edge.json

 

products info is already added into the json files. Problem is products getting created but the proxies are not getting attached to respective products.

 

Eg: test-edge.json

 

{
"version": "1.0",
"envConfig": {
"test": {
"targetServers": [
{
"name": "ApigeeTemplate_V2",
"host": "10.xx.xx",
"isEnabled": true,
"port": 4420
}
],
"kvms": [
{
"name": "CourtsVariables",
"encrypted": false,
"entry": [
{
"name": "username",
"value": "IntegrationUser"
},
{
"name": "password",
"value": "xxxxx"
}
]
}
]
},
"public-test": {
"targetServers": [
{
"name": "ApigeeTemplate_V2",
"host": "10.xxxxx",
"isEnabled": true,
"port": 4420
}
],
"kvms": [
{
"name": "CourtsVariables",
"encrypted": false,
"entry": [
{
"name": "username",
"value": "IntegrationUser"
},
{
"name": "password",
"value": "xxxxx"
}
]
}
]
},
"mxx-internal-clients": {
"targetServers": [
{
"name": "ApigeeTemplate_V2",
"host": "10.xxx.xx.xx",
"isEnabled": true,
"port": 4420
}
],
"kvms": [
{
"name": "CourtsVariables",
"encrypted": false,
"entry": [
{
"name": "username",
"value": "IntegrationUser"
},
{
"name": "password",
"value": "12xxxx"
}
]
}
]
},
"trusted_test": {
"targetServers": [
{
"name": "ApigeeTemplate_V2",
"host": "10.xxxx.xxx",
"isEnabled": true,
"port": 4420
}
],
"kvms": [
{
"name": "CourtsVariables",
"encrypted": false,
"entry": [
{
"name": "username",
"value": "IntegrationUser"
},
{
"name": "password",
"value": "12xxxx"
}
]
}
]
}
},
"orgConfig": {
"apiProducts": [
{
"apiResources": [],
"approvalType": "manual",
"attributes": [
{
"name": "access",
"value": "public"
},
{
"name":"Portal-Role-Name",
"value":"developers, external_developers_, public_developers"
}
],
"description": "ApigeeTemplate_V2 Desc",
"displayName": "ApigeeTemplate_V2prod",
"environments": [
"test",
"public-test",
"moj-internal-clients",
"trusted_test"
],
"name": "Proxy-ApigeeTemplate_V2",
"proxies": [
]
}
]
}
}

@Murthy - As I mentioned, your proxies section within apiProducts is empty

"proxies":[]

Add the appropriate proxy names to the json and it should work.

Hello Vaidyanathan,

 

I have added the proxy name under api products section. But getting error in the build. Please check below

 

"orgConfig": {
"apiProducts": [
{
"apiResources": [],
"approvalType": "manual",
"attributes": [
{
"name": "access",
"value": "public"
},
{
"name":"Portal-Role-Name",
"value":"developers, external_developers_, public_developers"
}
],
"description": "Proxy-ApigeeTemplate_stage_venkat Desc",
"displayName": "Proxy-ApigeeTemplate_stage_venkat",
"environments": [
"public-clients",
"stg",
"moj-external-clients",
"moj-internal-clients"
],
"name": "Proxy-ApigeeTemplate_stage_venkat",
"proxies": [ "SMS-Template-venkat-new1"

]
}
]
}

 

 

 

Error

 

2021-09-01T20:28:55.7490415Z {"environments":["public-clients","stg","moj-external-clients","moj-internal-clients"],"displayName":"Proxy-ApigeeTemplate_stage_venkat","apiResources":[],"approvalType":"manual","name":"Proxy-ApigeeTemplate_stage_venkat","description":"Proxy-ApigeeTemplate_stage_venkat Desc","attributes":[{"name":"access","value":"public"},{"name":"Portal-Role-Name","value":"developers, external_developers_, public_developers"}],"proxies":["SMS-Template-venkat-new1"]}
2021-09-01T20:28:55.8163875Z [ERROR] Apigee call failed 400 Bad Request
2021-09-01T20:28:55.8164267Z {
2021-09-01T20:28:55.8164997Z "code" : "keymanagement.service.InvalidProxy",
2021-09-01T20:28:55.8165797Z "message" : "Invalid apiproxy SMS-Template-venkat-new1",
2021-09-01T20:28:55.8166138Z "contexts" : [ ]
2021-09-01T20:28:55.8166404Z }
2021-09-01T20:28:55.8167885Z [INFO] ------------------------------------------------------------------------
2021-09-01T20:28:55.8168259Z [INFO] BUILD FAILURE
2021-09-01T20:28:55.8170125Z [INFO] ------------------------------------------------------------------------
2021-09-01T20:28:55.8186238Z [INFO] Total time: 1.953 s
2021-09-01T20:28:55.8189815Z [INFO] Finished at: 2021-09-01T23:28:55+03:00
2021-09-01T20:28:55.8191224Z [INFO] ------------------------------------------------------------------------
2021-09-01T20:28:55.8202552Z [ERROR] Failed to execute goal com.apigee.edge.config:apigee-config-maven-plugin:1.4.3:apiproducts (create-config-apiproduct) on project SMS-Template-venkat-new1: Apigee network call error 400 Bad Request
2021-09-01T20:28:55.8203353Z [ERROR] {
2021-09-01T20:28:55.8203736Z [ERROR] "code" : "keymanagement.service.InvalidProxy",
2021-09-01T20:28:55.8205400Z [ERROR] "message" : "Invalid apiproxy SMS-Template-venkat-new1",
2021-09-01T20:28:55.8205776Z [ERROR] "contexts" : [ ]
2021-09-01T20:28:55.8206065Z [ERROR] }

@Murthy - the error response is very clear. It says 

 

Invalid apiproxy SMS-Template-venkat-new1

 

Please check if you have that proxy in your org. The proxy must be deployed if you want to configure the API Product. 

 

Hello Vaidyanathan,

 

It's the first time, i'm creating a new proxy  (ofcourse downloaded another proxy, changed the basepath, names, modified) and building it. This i want to attach it to the new product which gets created as a part of this pipeline.

 

Regards,

Murthy.

Then you need to tweak your pipeline to update the apiproducts.json to use that proxy name and then push it to Apigee using the Maven plugin

Hello Vaidyanathan and All,

For the products section like below

 

 

"apiProducts": [
{
"apiResources": [],
"approvalType": "manual",
"attributes": [
{
"name": "access",
"value": "public"
},
{
"name":"Portal-Role-Name",
"value":"developers, external_developers_, public_developers"
}
],
"description": "Proxy-ApigeeTemplate_stage_venkat Desc",
"displayName": "Proxy-ApigeeTemplate_stage_venkat",
"environments": [
"public-clients",
"stg",
"external-clients",
"internal-clients"
],
"name": "Proxy-ApigeeTemplate_stage_venkat",
"proxies": [ "SMS-Template-venkat-new1"

]
}
]
}

The single proxy  getting attached to product , however multiple proxies are not getting attached to same product.

Even single proxy getting attached in below scenario

 

1.  While creating the proxy "SMS-Template-venkat-new1" and product "Proxy-ApigeeTemplate_stage_venkat" first time via the maven deployment plugin, getting the error "Invalid apiproxy SMS-Template-venkat-new1"  and proxy not creating in the environment and not deploying

If i create a proxy before itself, uploading the bundle directly as revision 1 in environment and later run the same pipeline and plugin, the proxy getting deployed as revision 2 and getting attached to product ( product is getting created).

 

Multiple proxies not getting attached to single product

 

"apiProducts": [
{
"apiResources": [],
"approvalType": "manual",
"attributes": [
{
"name": "access",
"value": "public"
},
{
"name":"Portal-Role-Name",
"value":"developers, external_developers_, public_developers"
}
],
"description": "Proxy-ApigeeTemplate_stage_venkat Desc",
"displayName": "Proxy-ApigeeTemplate_stage_venkat",
"environments": [
"public-clients",
"stg",
"external-clients",
"internal-clients"
],
"name": "Proxy-ApigeeTemplate_stage_venkat",
"proxies": [ "SMS-Template-venkat-new2"

]
}
]
}

 

2. If i create a new proxy "SMS-Template-venkat-new2" with same product "Proxy-ApigeeTemplate_stage_venkat", this time proxy getting created as revision 1 in the environment but not getting attached to product "Proxy-ApigeeTemplate_stage_venkat", still the product is having the old proxy only "SMS-Template-venkat-new1"

 

even i tried like below in apiproducts

 

 

"description": "Proxy-ApigeeTemplate_stage_venkat Desc",
"displayName": "Proxy-ApigeeTemplate_stage_venkat",
"environments": [
"public-clients",
"stg",
"external-clients",
"internal-clients"
],
"name": "Proxy-ApigeeTemplate_stage_venkat",
"proxies": [ "

"SMS-Template-venkat-new2",

"SMS-Template-venkat-new1"

]
}
]
}

 

this time proxySMS-Template-venkat-new2 getting created as revision 2 in the environment but not getting attached to product "Proxy-ApigeeTemplate_stage_venkat", still the product is having the old proxy only "SMS-Template-venkat-new1"

 

tried like below

 

even i tried like below in apiproducts

 

 

"description": "Proxy-ApigeeTemplate_stage_venkat Desc",
"displayName": "Proxy-ApigeeTemplate_stage_venkat",
"environments": [
"public-clients",
"stg",
"external-clients",
"internal-clients"
],
"name": "Proxy-ApigeeTemplate_stage_venkat",
"proxies": [ "

"SMS-Template-venkat-new1",

"SMS-Template-venkat-new2"

]
}
]
}

 

 

this time proxySMS-Template-venkat-new2 getting created as revision 3 in the environment but not getting attached to product "Proxy-ApigeeTemplate_stage_venkat", still the product is having the old proxy only "SMS-Template-venkat-new1"

Second proxy not getting attached to product at all in all the scenarios.

 

Regards,

Venkat Murthy

Are you using -Dapigee.config.options="update" ?? If its create, then the plugin will skip if the API Product already exist. Please check the logs and see what the plugin is doing

Hello Sai,

Thanks. -Dapigee.config.options="update"  is working fine. The proxies are getting attached to product.

 

However by using this option -Dapigee.config.options="update" , we observed that developers can edit the target servers and KVM's. We don't developers to update the target servers and KVM's. Can we restrict them after using the "update" variable. 

 

Please suggest here.

 

Regards,

Murthy.

@Murthy - Thats a different question. Any new topics, please submit a different post in the community. However to your question, it has nothing to do with the plugin. All these operations are controlled by the RBAC roles. Create a custom role for the developers and do not include the update operation permission in that role. They will not be able to update. Please mark this post as answered.