As a developer, you need a pipeline that fetches an automation cloud template from an on-premises GitHub instance every time you commit a change. You need the pipeline to deploy a WordPress application to either Amazon Web Services (AWS) EC2 or a data center. Automation Pipelines calls the cloud template from the pipeline and automates the continuous integration and continuous delivery (CICD) of that cloud template to deploy your application.

To create and trigger your pipeline, you'll need a cloud template in Automation Assembler.

For Template source in your Automation Pipelines cloud template task, you can select either:

  • Automation Assembler as the source control. In this case, you do not need a GitLab or GitHub repository.
  • Source Control if you use GitLab or GitHub for source control. In this case, you must have a Git webhook and trigger the pipeline through the webhook.

If you have a YAML cloud template in your GitHub repository, and want to use that cloud template in your pipeline, here's what you'll need to do.

  1. In Automation Assembler, push the cloud template to your GitHub repository.
  2. In Automation Pipelines, create a Git endpoint. Then, create a Git webhook that uses your Git endpoint and your pipeline.
  3. To trigger your pipeline, update any file in your GitHub repository and commit your change.

If you don't have a YAML cloud template in your GitHub repository, and want to use a cloud template from source control, use this procedure to learn how. It shows you how to create a cloud template for a WordPress application, and trigger it from an on-premises GitHub repository. Whenever you make a change to the YAML cloud template, the pipeline triggers and automates the release of your application.

  • In Automation Assembler, you'll add a cloud account, add a cloud zone, and create the cloud template.
  • In Automation Pipelines, you'll add an endpoint for the on-premises GitHub repository that hosts your cloud template. Then, you'll add the cloud template to your pipeline.

This use case example shows you how to use a cloud template from an on-premises GitHub repository.

The workflow helps you navigate the process that automates the release of an application that you deploy from a YAML cloud template.

Prerequisites

Procedure

  1. In Automation Assembler, follow these steps.
    1. Click Templates, then create a cloud template and a deployment for the WordPress application.
    2. Paste the WordPress YAML code that you copied to your clipboard into your cloud template, and deploy it.
      By using the YAML code, the cloud template creates the database tier, web tier, and network in your deployment.
  2. In Automation Pipelines, create endpoints.
    1. Create a Git endpoint for your on-premises GitHub repository where your YAML file resides.

      In the Git endpoint for an on-premises GitHub repository, you must select a cloud proxy.
    2. Add an Email endpoint that can notify users about the pipeline status when it runs.


      When you add an Email endpoint, you set the encryption method and set the outbound protocol.
  3. Create a pipeline, and add notifications for pipeline success and failure.

    When you add an email notification, you select one of the pipeline states, and select the Email server and recipients.
  4. Add a stage for development, and add a cloud template task.
    1. Add a cloud template task that deploys the machine, and configure the task to use the cloud template YAML for the WordPress application.
      resources:
        DBTier:    
          type: Cloud.Machine    
          properties:      
              name: mysql      
              image: 'ubuntu-16'      
              flavor: 'small'      
              constraints:        
                  -   tag: zone:dev
        WebTier:
          type: Cloud.Machine    
          properties:     
              name: wordpress      
              image: 'ubuntu-16'      
              flavor: 'small'      
              constraints:        
                  - tag: zone:dev
       WP-Network-Private:
          type: Cloud.Network
          properties:
              name: WP-Network-Private
              networkType: existing
              constraints:
                  - tag: 'type:isolated-net'
                  - tag: 'zone:dev'
    2. Add a cloud template task that destroys the machine to free up resources.
  5. Add a stage for production, and include approval and deployment tasks.
    1. Add a User Operation task to require approval to push the WordPress application to production.
    2. Add a cloud template task to deploy the machine and configure it with the cloud template YAML for the WordPress application.
      When you select Create, the deployment name must be unique. If you leave the name blank, Automation Pipelines assigns it a unique random name.
      Here's what you must know if you select Rollback in your own use case: If you select the Rollback action and enter a Rollback Version, the version must be in the form of n-X. For example, n-1, n-2, n-3, and so on. If you create and update the deployment in any location other than Automation Pipelines, rollback is allowed.
      The cloud template task can use a VMware cloud template in Automation Assembler or pull one from source control in a GitLab repository or a GitHub repository.
  6. Run the pipeline.

    To verify that each task completed successfully, click the task in the execution, and examine the status in the deployment details to see detailed resource information.

  7. In GitHub, modify the flavor of the WordPress server instance from small to medium.
    When you commit changes, the pipeline triggers. It pulls your updated code from the GitHub repository and builds your application.
    WebTier:
        type: Cloud.Machine    
        properties:     
            name: wordpress      
            image: 'ubuntu-16'      
            flavor: 'medium'      
            constraints:        
                - tag: zone:dev
  8. Run the pipeline again, verify that it succeeded, and that it changed the flavor of the WordPress instance from small to medium.

Results

Congratulations! You automated the release of your application that you deployed from a YAML cloud template.

What to do next

To learn more about how you can use Automation Pipelines, see Tutorials for using Automation Pipelines.

For more information, see the additional resources under Getting Started with VMware Aria Automation.