Skip to content

alalkamys/apigee-core-yaml-pipeline-templates

Repository files navigation

apigee-core-yaml-pipeline-templates

Key FeaturesThe Why?Developed ByGetting StartedAuthor

Awesome Badge Stars Badge

apigee-core-yaml-pipeline-templates is a centralized build and release Azure DevOps Pipelines framework developed with the purpose to modernize CI/CD as a code for Apigee core components including: API Proxies, Shared Flows, KVMs, ...etc


Key Features

The Why?

    As an SRE myself, I've been working with API gateways for some time, wondering how to automate API life-cycle as a code. In my case, I have been working with Apigee X / Hybrid to manage, secure, monetize and monitor the full life-cycle of the APIs. I wanted to create CI/CD pipeline for API proxies as code.

    Unfortunately I wasn't able to find good references for Azure DevOps pipelines implementation. So, I decided to work on a high quality pipeline code to help those struggling with a similar approach.

Getting Started

  • Create a GitHub repository for the framework

    GIT_URL='https://github.com/ORG/REPO.git'
    git clone https://github.com/ShehabEl-DeenAlalkamy/apigee-core-yaml-pipeline-templates.git
    cd apigee-core-yaml-pipeline-templates
    git init
    git remote add origin2 "${GIT_URL}"
    git checkout -b feature/cicd-framework
    git add .
    git commit -m "initial commit"
    git push -u origin2 feature/cicd-framework
  • In your framework repository, update build.yaml and release.yaml resources[0].endpoint with a proper service connection.

  • In your API proxy repository, create a cicd/build.yaml for your build pipeline and a cicd/release.yaml for your release pipeline.

  • cicd/build.yaml:

    resources:
        repositories:
          - repository: self
            clean: true
          - repository: {{ repository_identifier }} # an ID of your choice. for example: 'apigee-core'
            type: github
            name: {{ github_org }}/{{ created_or_forked_framework_repository }}
            ref: main
            endpoint: {{ service_connection }} # service connection created in your ADO project to access the repository
    
    extends:
      template: build.yaml@{{ repository_identifier }} # for example: build.yaml@apigee-core
      parameters:
        buildProfile: # determines how the pipeline will behave
          type: {{ build_profile_type }} # type of the build profile e.g. 'api-proxies', 'sharedflows', ..etc. 'api-proxies' value is the only supported value
          name: {{ build_profile_name }} # can be 'mvn-plugins' or 'oas2apigee'
                                         # 'mvn-plugins': build api proxies using Apigee Deploy & Apigee Config Maven Plugins
                                         # 'oas2apigee': build api proxies using apigeecli to deploy API proxies using OAS3.x files
          version: {{ build_profile_version }} # '1' is the only supported version currently      
        variableGroups:
          - {{ common_variable_group }} # variable group for common variables across all environments, e.g gcpServiceAccount, org & proxyDesc
  • cicd/release.yaml:

    resources:
        repositories:
          - repository: self
            clean: true
          - repository: {{ repository_identifier }} # an ID of your choice. for example: 'apigee-core'
            type: github
            name: {{ github_org }}/{{ created_or_forked_framework_repository }}
            ref: main
            endpoint: {{ service_connection }} # service connection created in your ADO project to access the repository
    
    extends:
        template: release.yaml@{{ repository_identifier }} # for example: release.yaml@apigee-core
        parameters:
          releaseProfile: {{ release_profile }} # which Azure DevOps environments to deploy to, currently 'custom-release' is the only supported value
          deploymentProfile: # how to deploy your API proxy
            type: {{ deployment_profile_type }} # 'api-proxies' value is the only supported value
            name: {{ deployment_profile_name }} # 'mvn-plugins' or 'oas2apigee' are supported
            version: {{ deployment_profile_version }} # '1' is the only supported value
          artifactAlias: {{ build_pipeline_resource_identifier }} # can be specified in resources.pipelines[0].pipeline
          artifactName: {{ proxy_bundle_artifact_name }} # by default it is named 'proxy-bundle-artifacts' in your build pipeline
          commonVariableGroups:
            - {{ common_variable_group }} # your common variables e.g gcpServiceAccount, org & proxyDesc
          releaseList: # required for 'custom-release' release profile, specify list of your deployment environments
            - stageName: {{ stage_name }} # identifier for you stage, for example 'Dev'
              displayName: {{ display_name }} # display name shown in your release pipeline run, for example 'Dev'
              variableGroups: # your environment specific variables
                - {{ env_variable_group }} 
                ...
              environment: {{ azure_devops_environment }} # your deployment environment
            ...
          apigeeConfigList: # required if deploymentConfig.customApigeeConfig is true, contains all the list of configurations you wish to create only regardless of source code
            - {{ apigee_config_item }} # supported values are [references, keystores, aliases, targetservers, keyvaluemaps, resourcefiles, apiproducts, developers, reports, flowhooks]
            ...
          deploymentConfig: # (optional) alters the deployment templates framework behavior
            customApigeeConfig: {{ true || false }} # enable/disable custom apigee configuration creation, default is false and will attempt to create all the supported configs

💡 Tip: Refer to abomis-airports for a full example.


⚔️ Developed By

LinkedIn

Shehab El-Deen Alalkamy

📖 Author

Shehab El-Deen Alalkamy

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages