{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • General /
avatar image
1
Question by Rajeev S · Jun 23, 2017 at 01:09 PM · 3.4k Views deploymentjenkinsapigee-maven-plugin

Deploying APIs using Jenkins and Apigee maven Plugin

Hi,

We were able to deploy a proxy from Jenkins using the apigee maven plugin as described here.

Now the question is

1)How do we deploy multiple proxies in a single shot. The link explains how to deploy a single proxy.

2)Do we need to create a new Jenkins Job for every proxy we deploy or should we have just one Job and edit it when we deploy new proxy? What is the best practice?

Thanks,

Rajeev S

Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

2 Answers

  • Sort: 
avatar image
1

Answer by Rahul M · Jun 23, 2017 at 05:23 PM

There are multiple ways to achieve this depending on the level of auditability and RBAC you want to enforce in deploying these proxies(within Jenkins).

If you had a single Job, and you wanted to restrict certain people from deploying certain proxies - there is no way you can control that in Jenkins unless you build additional custom controls (AFAIK). You could

  • enhance the job asking the user to provide deployment credentials (rather than using accounts implicitly)
  • have different deployment accounts for different environments in Apigee and enforce it that way.

If RBAC for deployments isn't a concern for you and you store your proxies in a git repository (each proxy in its own repository)

Your first step of the Jenkins job should be to clone/checkout the proxy repository. You can add a job parameter to ask the user to provide that repo url. If you are using Git, you can also pull down a list of proxy repositories and ask the user to pick from the list(explore invoking your SCM's REST API's from Jenkins to pull a list of repositories and filtering down the list based on naming patterns)

When the repository you clone is selected dynamically , you can now reuse the existing job without making edits to its configuration.

If you were trying to deploy multiple proxies with a single click, you could allow the user to select a list of proxy repositories, use bash to iterate over the list of repos and invoke the maven plugins, this however is a flawed implementation because your job outcome now depends on deployment outcome of multiple proxies. Jenkins job will fail on first failure detection, so some proxies might end up being deployed even if the job has failed

HTH

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Sai Saran Vaidyanathan   · Jun 26, 2017 at 08:52 PM

Hi

There is a concept of multiple modules in Maven where you can build many modules. You just need to declare them in your parent pom and that can trickle down to each child project. More info here.

You just need to declare a parent workspace and place all the proxy folders within that have their individual pom files. The parent folder pom can just be as simple as

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>


    <groupId>apigee</groupId>
    <artifactId>proxy-parent</artifactId>
    <packaging>pom</packaging>
    <version>1.0</version>
    <name>Multi proxy Parent Project</name>


    <modules>
        <module>apigee-proxy1</module>
        <module>apigee-proxy2</module>
    </modules>


    <build>
        <pluginManagement/>
    </build>
</project>

The modules are the proxy folder that have their own pom files. If you have anything common that can be shared within these sub-modules, you can define them in the parent pom

Regarding best practice in Jenkins - you can have individual jobs or if you use Jenkins 2.x (Pipeline jobs), you can use the same Jenkins build file and connect to your repository through hooks so that they automatically trigger.

As @rmishra mentioned in his answer above, there are different solutions and recommendations around that. Its tightly aligned to your SDLC and release management processes your company follows.

Hope this helps !!

Comment
Add comment Show 4 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image abhishekranjan · Mar 09, 2018 at 10:51 AM 0
Link

@Sai Saran Vaidyanathan

If we are trying to deploy multiple proxies in one go , what should be the configuration in "Root POM" in jenkins if apiproxy1 , apiproxy2... and apiproxy n have their own child POM and share common parent POM ??

avatar image Sai Saran Vaidyanathan ♦ abhishekranjan   · Mar 09, 2018 at 04:52 PM 0
Link

the above example I provided is the parent pom (root) that has modules in it. And each module will have its own pom file. If you want to execute all, try executing the root and see if it executes the child as well.

avatar image Mohsin Khan Sai Saran Vaidyanathan ♦ · Nov 23, 2018 at 11:14 AM 0
Link

I have done the same as you mention here but didnt succeed @Sai Saran Vaidyanathan

avatar image Ilyas shah · Jun 26, 2018 at 06:37 AM 0
Link

in my case, jenkins the trying the deploy the parent folder as well which results in error, i have a folder named proxies in which i have sub folders as api proixies, and a parent pom in which i have defined modules, but there is an error.

jenkins-error.png

jenkins-error.png (42.5 kB)

Follow this Question

Answers Answers and Comments

41 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to deploy API proxy using with declarative pipeline in jenkins from scratch? 1 Answer

Maven build creates target but fails to complete build 0 Answers

API proxy (.zip file) deployment issue -downloading artifact from Nexus and deploy on Apigee cloud 1 Answer

How to properly deploy node app with node modules included with trial account? 1 Answer

Deployment issues on administration: Unknown error 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Articles
  • Ideas
  • Badges