在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):apigee/apigee-deploy-maven-plugin开源软件地址(OpenSource Url):https://github.com/apigee/apigee-deploy-maven-plugin开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):About the Pluginapigee-edge-maven-plugin is a build and deploy utility for building and deploying the Apigee ApiProxy's/Application bundles into Apigee Edge Platform. The code is distributed under the Apache License 2.0. NOTE: Log4J libraries are upgraded to v2.17.1 in v1.3.2 TL;DRThe samples folder provides a Readme with Getting Started steps and commands to hit the ground quickly. VideoLearn more, check out this video! Ask the Expert Detailed documentation on the use of pluginContents
PrerequisitesYou will need the following to run the samples:
NOTE
<dependency>
<groupId>io.apigee.build-tools.enterprise4g</groupId>
<artifactId>apigee-edge-maven-plugin</artifactId>
<version>2.x</version>
</dependency>
<dependency>
<groupId>io.apigee.build-tools.enterprise4g</groupId>
<artifactId>apigee-edge-maven-plugin</artifactId>
<version>1.x</version>
</dependency> Getting StartedOften the most difficult and confusing aspect of application development is figuring out how to build a common framework for creating new applications. Over time, development teams have started using tools like Maven, Ant and Ivy to automate some of these functions. This plugin uses the Maven plugin for deploying Apigee bundles to the Edge platform. Why this deployment plugin is developed?
Building API bundlesWhat is an Apigee bundle?Apigee bundles can be described as a zipped file system composed of configuration, scripts and code. The file system when extracted is composed of the following structure.
Create a new APIInstructions for creating a new API can be found at this link Export your APIInstructions for exporting your API via an API can be found at this link To export your API via Apigee Edge select the organization that contains the proxy you wish to export. From the navigation bar on the top, under APIs select the API Proxies. Select the proxy, on the far left of the screen, under the drop down menu titled Project, select Download Current Revision. Steps to set it upFollow below steps to set up your local development environment
And you are ready for deploy to Apigee Edge using the plugin Step 1 Create a Maven compatible file structureBelow is the recommended structure for the project. However only the folder structure below the folder gateway is mandatory
Decompress API BundleThe API bundle will come zipped, use the unarchiving utility of your choice to unzip the file. Once unzipped you will have a folder named apiproxy, this folder contains all of the configuration for your proxy and the folder structure needed for re-importing of the configuration. The composition of the folder can be described as below.
Note: when creating scripts, place your script/jar files in the proper folders based on the script type (e.g. javascript in jsc, node.js in node, java in java). Step 2 Create and configure pom filesIn a standard configuration typically we have parent-pom (pom.xml inside the parent-pom directory) and a child pom (pom file at the peer level as folder apiproxy). The contents of the parent pom folder will contain a single pom.xml file. This file typically contains most of the configuration of Maven and the plugin, it also contains credentials for the Apigee platform. In case of manual creation of Maven compatible file structure, "parent-pom" directory should be in peer level with other application folders. Here we configure information that is common across multiple apiproxys. Eg: Profile configurations which has the org/env info etc. parent-pom-pom-xml SampleRefer parent-pom template parent-pom
Child-pom: Here we configure all the details specific to the particular proxy. pom-xml SampleRefer child-pom template child-pom.
Step 3 Create and configure config.jsonThe config.json contains rules to perform build time configuration update. This JSON file's root object is "configurations" and is an array of proxy or sharedflow configurations scoped to an environment. Note: it is important that the name of the configurations match the name of the profiles in the parent-pom. For instance in the example below you have two configurations one for the test profile and one for the production profile. This example also shows how you can use xpath to replace environment specific settings. Config.json SampleRefer config.json template config.json Commands for deploying the proxy using mavenTo deploy the proxy
For example:
To deploy the proxy and run jmeter tests
Advanced Configuration OptionsNote 1The following entries in some XML file elements could be changed to match the customer's environment:
Note 2The"apigee.override.delay", "apigee.delay,apigee.options" are optional elements. The "apigee.delay" could be specified (in milliseconds). This will ensure to add a delay between the operations like delete, import, activate, deactivate etc. Note 3The "apigee.options" element can have the following values: clean (this option will delete the last deployed revision in an environment), validate (this option will validate a bundle before importing. Thus if you want strict validation then its required), inactive (this option will import the bundle without activating the bundle), override (this option is used for seamless deployment and should be supplied with apigee.override.delay parameter. The apigee.override.delay expects delay to be given in seconds), update (this option will update the revision). This is similar to import with validation but no new revision is created. If there are any errors in the bundle, an error is thrown and the existing bundle is left intact. In case the revision they are trying to update is deployed, it will internally trigger undeployment and deployment. It is completely in the background and not visible in the response. Note 4The "apigee.options" combination could be given with comma separated values. The precedence order of options are -> override, update, (clean, inactive, validate). To configure a proxySupported from v1.2 Please refer to this doc that explains how to setup proxy settings in your settings.xml usually in your $HOME/.m2 directory. Only OAuth and Two-Factor AuthenticationApigee management APIs are secured using OAuth tokens as an alternative to the Basic Auth security. Additionally Two-Factor authentication (MFA) using TOTP can also be configured as an additional layer of security. This plugin has the capability to acquire OAuth tokens and invoke management API calls. Refer to How to get OAuth2 tokens and Two-Factor authenticationfor details. Using OAuthOAuth capability when enabled is seamless and the plugin acquires OAuth tokens and uses it subsequently to call management APIs. To enable OAuth add the following options to all profiles as required. Refer to shared-pom.xml example.
To invoke, add command line flags to enable OAuth.
"tokenurl" is optional and defaults to the cloud version "https://login.apigee.com/oauth/token" Two-Factor AuthenticationTwo-Factor authentication is based on TOTP tokens. When the apigee account is enabled for Two-Factor Authentication it applies to management APIs as well. The plugin can accept TOTP tokens generated by an external utility and use it to acquire OAuth tokens. TOTP can be generated using command line tools for use in CI tools like Jenkins. Using Two-Factor Authentication tokenNote OAuth needs to be enabled before Two-Factor Authentication can be used. To enable Two-Factor Authentication, add the following options to all profiles as required. Refer to shared-pom.xml example.
Provide the token when invoking the plugin.
If the API takes a long time to package up then it is likely that the token till have expired before it is used. To mitigate against this, from version 1.1.3, an initmfa goal can be called during the validate phase:
Depending on where the plugin is in the order, and how much validation is requird, it is possible that this may still result in token timeout. Passing the Bearer Token as a parameterIf you would like to generate the bearer token outside of this plugin and provide it as a command line parameter, you can add the following:
Provide the token when invoking the plugin.
Passing the Refresh Token as a parameterIf you would like to generate the refresh token outside of this plugin and provide it as a command line parameter, you can add the following:
Provide the token when invoking the plugin.
NOTE: If you are providing refresh token, you need to provide the bearer token as well Deploying API Proxies with Node.js appsStarting at version 1.0.1 of the plugin, support for API proxies that contain node.js applications is included. The plugin
will compress the The plugin also supports moving node.js application source into
Note: In above example, if you have code in The above structure follows the same pattern when developing with java source code outside of the Building Shared Flow bundlesWhat is a Shared Flow bundle?Shared Flow bundles can be described as a zipped file system composed of policies, steps and code. The file system when extracted is composed of the following structure.
The build steps and the options available for building and deploying Shared Flows are the same as API Proxy. Most widely used options are
This is required to differentiate the build and deployment process. Recommended Convention for ContributionsRefer Guide for Plugin Developers People InvolvedThe plugin is initially developed by Santany Dey. With major contributions from Sai Saran Vaidyanathan, Madhan Sadasivam. The plugin is open sourced by Priyanky Thomas. SupportIssues filed on Github are not subject to service level agreements (SLAs) and responses should be assumed to be on an ad-hoc volunteer basis. The Apigee community board is recommended as for community support and is regularly checked by Apigee experts. Apigee customers should use formal support channels for Apigee product related concerns. DisclaimerThis is not an officially supported Google product. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论