GitHub: Automation

GitHub: Automation

Many organizations use the terms DevOps and Automation interchangeably. DevOps can be defined as a combination of process and technology automations along with a collaborative culture intended to deliver increased business value. Just like how important an engine for a car, automation is one of the core pillars of DevOps. Normally, DevOps adoption roadmap is defined with the combination of well-structured automation along with process and cultural shift.

GitHub provides a very flexible and extensible automation framework - actions. ?? Confused ! GitHub actions are defined as the CI/CD platform to automate build, test and deployment pipeline. Is it only for CICD ? NO. Actions support the event driven programming and respond to various events from internal and external sources. External event handling supported through Webhook.

Sometimes, workflow and actions are used interchangeably. In simple terms, a workflow consists of event triggers and actions to execute. You will be able to define a workflow with external actions and inline actions, as shown below.

    steps:
	      # Checks-out your repository  - external action
	      - uses: actions/checkout@v3

          # inline action
          - run: |
               gh api graphql -f query='...........        

In this article, we will be using actions to denote the workflow defined under 'Actions' tab in GitHub. Let us look into some of the main concepts associated with the action

No alt text provided for this image

Events

Internal and external events trigger the execution of the action/workflow. As shown in above figure, there are many internal events as part of each of the operations in GitHub platform. GitHub allow you to handle the events in granular levels. Each of the event have activity types associated with them to define the type of activity against it.

For example, 'issues' event supports many activity types such as opened, edited, deleted, pinned, closed, etc. Based on the automation requirement, one can associate the action to a specific activity itself. For example, when an issue opened or edited, the following code snippet will get triggered.

on:
  issues:
    types: [opened, edited]        

If you want further control on event handling, you will be able to define the criteria using the event trigger attributes like if: ${{github.event.issue.<attr> == 'expected val' }} or using context values (context.repo.owner). Refer Events details for further information about the activity types associated with different event sources.

Sometimes, we want to trigger the automation script from an external system/tool. External events will be handled through the Webhook and linked to the workflow using webhook events. Refer the Webhook events for more details.

GitHub Platform Data

Most of the time, the automation script require data from the underlying platform like the repository details, commit data, project boards, issues, etc. GitHub provides different options to query the required data - GitHub GraphQL, API and CLI. These integration options not only support the data extraction to actions, it also supports the integration with external tools/systems.

Runners

Runners are the machines that execute the actions. GitHub offers hosted virtual machines to run workflows/actions. One can use the standard hosted runners provided by GitHub or opt for the Large runners (Beta). Large runners supports high end VMs with more RAM and CPU capacity. Self-hosted runners are systems that you deploy and manage to execute the GitHub actions. Self-hosted runners offer more control on the hardware, OS and tools.

CI/CD

Actions and workflows are mainly used for automating the continuous integration and continuous delivery/deployment pipelines. Actions supports the deployment of various kind of applications based on different technologies including .NET, Java, Angular, etc. It also supports various deployment platforms like on-premises data centre, cloud based deployment to Azure/GCP/AWS, private cloud deployments, etc.

Marketplace

GitHub Marketplace is the place where you will be able to discover and purchase new actions, apps and stacks. Apart from the GitHub provided actions, there are around 14k+ actions available from community - either free or paid. Based on our project requirement, one can plan to integrate the actions from community. Apps are another automation or extensibility feature of GitHub. Stack is a bundle, which offers the quick deployment of a repository along with workflows and other settings.

Custom Action

You will be able to author custom actions and in-line actions using JavaScript, Shell command or Docker containers. I have a simple action - Azure Compliance Checker, published in marketplace ??. This action is based on shell commands only. JavaScript based custom action development is widely adopted and faster than the Docker container actions. Docker container actions brings the benefit of authoring the action using any of the docker supported technologies like Python.

Conclusion

Actions provide a flexible and scalable platform for automation across the DevOps implementation. GitHub provides GitHub Apps to address the automation requirements to handle persistent data. Actions provide the platform centric automation, whereas GitHub Apps provide more extensibility features. For example, using GitHub Apps, you will be able to define a complete test case management module or new dashboard experience for GitHub.

要查看或添加评论,请登录

Ambily KK的更多文章

  • Why GitHub Actions?

    Why GitHub Actions?

    GitHub Actions, the extensible scalable automation framework from GitHub, have many differences compared to the other…

  • GitHub: Actions OpenID Connect (OIDC)

    GitHub: Actions OpenID Connect (OIDC)

    OpenID Connect enable the actions or workflows to get short lived tokens from cloud providers. This eliminate the need…

  • GitHub Administration: Notify Security setting changes

    GitHub Administration: Notify Security setting changes

    GitHub enables the Shift Left Security paradigm using GitHub Advanced Security (GHAS) features. Main features of GHAS…

  • Azure: Resource Analysis

    Azure: Resource Analysis

    Recently, one of my friend asked about the Azure resource visualization and management. As an Azure Administrator, he…

  • GitHub: Project Management

    GitHub: Project Management

    GitHub is one of the main DevSecOps platform with lot of developer friendly features. GitHub was used for a long time…

    2 条评论
  • GitHub GraphQL

    GitHub GraphQL

    GraphQL is an open-source data query language for APIs. GraphQL is one of the widely adopted query language by modern…

  • GitHub: Deployment Management

    GitHub: Deployment Management

    GitHub is one of the leading DevOps platforms to orchestrate end-to-end DevOps implementation. GitHub's actions and…

  • GitHub Custom actions: Reusable modules

    GitHub Custom actions: Reusable modules

    GitHub actions are playing a major role in DevOps adoption across many organizations. GitHub provides set of actions to…

  • POV: Enterprise DevOps Transformation

    POV: Enterprise DevOps Transformation

    DevOps is one of the Core practices followed in modern application development. Many organizations started the DevOps…

  • Cloud Migration: Oracle Database

    Cloud Migration: Oracle Database

    I have started my journey to expand my cloud knowledge with other cloud platforms. Based on my understanding, if you…

    2 条评论

社区洞察

其他会员也浏览了