This presentation provides an introduction to GitHub Actions and the core concepts of GitHub Actions. Then dives into details about how you can use GitHub Actions for Azure to deploy your workloads to Azure Cloud Platform.
Using GitHub Actions to Deploy your Workloads to Azure
1. Using GitHub Actions to Deploy Your
Workloads to Azure
Kasun Kodagoda
Technical Lead | 99X Technology
https://kasunkodagoda.com
♥
2. I am, Kasun Kodagoda
• In ♥ with Azure & Azure DevOps
• Active Blogger – https://kasunkodagoda.com
• Open Source Contributor - https://github.com/kasunkv
• Technical Lead
I Work For,
• Established in 2004
• Headquartered in Sri Lanka with offices in
Europe and Australia
• Providing high quality, high value Software
Product Engineering + R&D services
3. Agenda
• Basics of GitHub Actions
• Core Concepts
• GitHub Actions for Azure
• Demo
4. What are GitHub Actions
• Made up of individual tasks called Actions
• Collection of actions performs a certain
activity
• This collection is called a workflow
These Workflows helps you automate your software
development activities in the same place where you store
your source code
6. Action
• Smallest building block of a workflow
• Individual task that performs a specific
activity in a workflow
• Two Types of Actions
• JavaScript Actions
- Hosted on a public repository
• Docker Actions
- Hosted on a public docker registry
7. Artifacts
• Output of a workflow
• Can include,
• A set of files (e.g. files of a web app)
• Test results
• Log files
• Screenshots etc.
• Can be shared with other jobs or be
deployed
8. Event
• Activity that can trigger a workflow run
• An event can have multiple activity types
• Could be any GitHub event
• push
• pull_request
• create
• delete
• issue_comment
• created
• edited
• deleted
https://help.github.com/en/actions/reference/events-that-trigger-workflows
9. Job
• Set of steps that gets executed on the
same runner.
• In a single workflow, there can be multiple
jobs
• Can have dependencies between jobs in a
workflow file
- job_1
- job_2
- job_3
job_2 can depend on job_1. job_3 can depend on jod_2
10. Job Strategy
• Creates a build matrix for the jobs
• Define different variations of the
environment
• Run the job on build matrix at the same
time.
strategy:
matrix:
node: [6, 8, 10]
steps:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
11. Workflow
• Configurable automated process
• Contained in the repository
• In .github/workflows directory
• Made up of one or more jobs
• Triggered by an event or a schedule
• Described in a YAML file
• Must contain at least one job
12. Workflow Run
• Instance of a workflow
• Runs when the trigger event occurs
• E.g. pull_request, push
• You can see;
• Execution logs
• Status and results
• Artifacts
13. Runners
• GitHub hosted virtual environments that
run workflows
• All 3 major OS platforms are supported
• Windows
- Runs Windows Server 2019
- windows-latest or windows-2019
• Linux
- Runs Ubuntu 16.04 and 18.04
- ubuntu-latest or ubuntu-18.04 and ubuntu-16.04
• MacOS
- Runs MacOS Catalina 10.15
- macos-latest or macos-10.15
14. Runners – ctd.
• Two types of runners available
• GitHub Hosted
• Automatically updated
• Managed and maintained by GitHub
• Clean instance for every job execution
• Free minutes/rates will be applied depending on the plan
• Self-Hosted
• Local or any cloud infrastructure you own
• You pay for your own infrastructure
• You can customize with hardware, software & tools you want
• No need to have a clean instance for each job execution
• No rates are applied, free to you.
• You need to maintain your environments
15. Runners – ctd.
• Linux and Windows VMs are hosted in
Azure
• Standard_DS2_v2 sku
• Based on the Azure Pipelines Agent
• MacOS VMs are hosted in MacStadium
https://help.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners
16. Usage Limits
• Job Execution Time
• GitHub Hosted – 6 hrs
• Self-Hosted – Unlimited
• Workflow Run Time
• GitHub Hosted, Self-Hosted – 72 hrs
• Job Queue Time
• GitHub Hosted – Not Applicable
• Self-Hosted – 24 hrs
• Job Matrix
• GitHub Hosted, Self Hosted – Max. 256 Jobs per
workflow
17. Usage Limits – ctd.
• API Requests
• 1000 Requests per Hour
• Across all actions for a single repository
• Both GitHub Hosted and Self-Hosted.
• Concurrent Jobs
Plan Total Concurrent Jobs Max. Concurrent macOS Jobs
Free 20 5
Pro 40 5
Team 60 5
Enterprise 180 50
18. GitHub Marketplace
• Central location to find GitHub Actions
• Created by official organizations and the
community
• Accessible through the workflow editor
20. GitHub Actions for Azure
• Set of actions to access Azure Services
• Azure cloud resources
• Azure Pipelines builds and releases
• Deploy workloads to Azure cloud from
workflows
• Some of the widely used Azure services
are accessible
• More on the way
21. Connecting to Azure
• Azure Login
• azure/login
• Authenticate to Azure using a service principle
• Azure CLI
• azure/cli
• Configures the runner with the latest or specified version
of the Azure CLI
• Run Azure CLI scripts to manage Azure Resources
22. Azure Web Apps
• Azure Web App
• azure/webapps-deploy
• Deploy your web site artifacts to Azure Web Apps
• Azure Web App for Containers
• azure/webapps-container-deploy
• Deploy your web app, packaged as a container to Azure
Web Apps.
• Azure App Service Settings
• azure/appservice-settings
• Configure App Settings and Connection string on Azure
App Service .
23. Azure Function Apps
• Azure Functions
• azure/functions-action
• Deploy your serverless code to an Azure Function App
• Azure Functions for Containers
• azure/functions-container-action
• Deploy your custom container image to Azure Functions
App.
24. Azure Kubernetes Services
• Kubectl Tools Installer
• azure/setup-kubectl
• Installs specific version of kubectl on the runner
• AKS Set Context
• azure/aks-set-context
• Set the Kubernetes cluster context on AKS
• Kubernetes Deploy
• azure/k8s-deploy
• Deploy manifests to the Kubernetes cluster
25. Azure Kubernetes Services – ctd.
• Setup Help
• azure/setup-helm
• Installs specific version of Helm on the runner
• Kubernetes Create Secret
• azure/k8s-create-secret
• Create secret on Kubernetes cluster
• More Actions…
• https://github.com/Azure/actions#deploy-to-
kubernetes
26. Azure Databases
• Azure SQL Databse
• azure/sql-action
• Deploy DACPAC and SQL Scripts to Azure SQL Database
• Uses a connection string to authenticate
• Azure MySQL Database
• azure/mysql-action
• Deploy MySQL databases using SQL Scripts
• Uses a connection string to authenticate
27. Few More…
• Azure Pipelines
• azure/pipelines
• Trigger Azure Pipeline run as part of the workflow
• Docker Login
• azure/docker-login
• Push containers to Docker Hub or Azure Container
Registry
• Get Secret from Azure Key Vault
• azure/get-keyvault-secret
• Fetch one or more Key Vault secrets.
https://github.com/Azure/actions