0% found this document useful (0 votes)
645 views21 pages

Unit V Building Devops Pipelines Using Azure Notes

Devops unit 5 notes

Uploaded by

nagalakshmi30599
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
645 views21 pages

Unit V Building Devops Pipelines Using Azure Notes

Devops unit 5 notes

Uploaded by

nagalakshmi30599
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

20ITV73 DevOps

UNIT V BUILDING DEVOPS PIPELINES USING AZURE

Create Github Account, Create Repository, Create Azure Organization, Create a new pipeline, Build a sample
code, Modify azure-pipelines. yaml file.

Contents
1. Create Github Account ------------------------------------------------------------------------------------------------------------ 1
2. Create Repository ------------------------------------------------------------------------------------------------------------------ 3
3. Create Azure Organization ------------------------------------------------------------------------------------------------------- 5
4. Create a new pipeline ------------------------------------------------------------------------------------------------------------- 6
5. Build a sample code --------------------------------------------------------------------------------------------------------------- 8
6. Modify azure-pipelines. yaml file--------------------------------------------------------------------------------------------- 11
2 MARKS:---------------------------------------------------------------------------------------------------------------------------------- 14

1. Create Github Account

Creating a GitHub account is a straightforward process. Here’s a step-by-step guide to help you set up
your GitHub account:

1. Visit the GitHub Website

1. Open your web browser.


2. Go to the GitHub website.

2. Sign Up for an Account

1. On the GitHub homepage, click the "Sign up" button in the upper right corner of the page.

3. Enter Your Information

1. Email Address:
o Enter a valid email address you want to use for your GitHub account.
2. Password:
o Choose a strong password. GitHub will show you the strength of your password as you type.
3. Username:
o Pick a unique username that will be your GitHub handle. This username will be part of your
GitHub profile URL.
4. Verification:
o GitHub may ask you to complete a CAPTCHA to prove you're not a robot.

4. Choose a Plan

1. Free Plan:
1
o The free plan provides unlimited public repositories and up to 3 private repositories with
limited features.
2. Paid Plans:
o If you need more private repositories or additional features, you can choose from the paid
plans.
3. Click "Continue":
o After choosing a plan, click the "Continue" button.

5. Configure Your Account

1. Personalization:
o GitHub will offer to customize your experience with some optional settings. You can fill these
out or skip them by clicking "Skip this step".
2. Email Preferences:
o Set your email preferences for notifications and updates from GitHub.

6. Verify Your Email Address

1. Check Your Email:


o GitHub will send a verification email to the address you provided.
2. Open the Email:
o Find the email from GitHub and click the verification link to confirm your email address.

7. Complete Your Profile

1. Sign In:
o After verifying your email, sign in to GitHub with your new credentials.
2. Complete Your Profile:
o You can now set up your GitHub profile by adding a profile picture, bio, and other details.

8. Explore GitHub

1. Create a Repository:
o Once logged in, you can create a new repository by clicking the "New" button on the
repositories page.
2. Install Git:
o To start using Git with GitHub, install Git on your local machine if you haven't already. You can
download it from git-scm.com.
3. Configure Git:
o Configure Git with your GitHub credentials using the following commands in your terminal:

bash

git config --global user.name "Your Name"


git config --global user.email "your-email@example.com"

2
2. Create Repository

Creating a repository on GitHub allows you to start organizing and managing your projects. Here’s a
step-by-step guide on how to create a repository on GitHub:

1. Log In to GitHub

1. Visit the GitHub website: GitHub.


2. Sign in: Click on the "Sign in" button in the upper right corner and enter your username/email and
password.

2. Create a New Repository

1. Navigate to the Repositories Page:


o After logging in, click on your profile picture or the "Your repositories" link in the upper-right
corner of the page.
2. Start a New Repository:
o On the repositories page, click the "New" button. This button is typically located on the right
side of the page.

3. Configure Your Repository

1. Repository Name:
o Name: Enter a name for your repository. The name must be unique within your account or
organization.
2. Description (Optional):
o Description: Provide a brief description of what your repository is about. This is optional but
recommended.
3. Visibility:
o Public: The repository is visible to everyone on the internet.
o Private: The repository is visible only to you and people you explicitly share it with.
4. Initialize This Repository with (Optional):
o README file: A README file provides information about your project. You can initialize your
repository with a README file by checking this box.
o .gitignore: Choose a .gitignore template to specify files and directories to ignore. You can
select a template that matches your project’s language or framework.
o License: Add a license to specify the terms under which your code can be used by others.
GitHub offers various common licenses to choose from.
5. Add a .gitignore Template (Optional):
o If you selected .gitignore, choose a template relevant to your project type from the
dropdown menu.
6. Choose a License (Optional):
o If you want to add a license, select one from the dropdown menu. GitHub offers several
options such as MIT, GPL, Apache, etc.

4. Create the Repository

1. Create Repository:
o After filling in the details, click the "Create repository" button at the bottom of the page.

3
5. Add Files to Your Repository

Once the repository is created, you can start adding files to it. You have several options for adding
files:

1. Directly Upload Files:


o Go to the repository page, click "Add file", and select "Upload files". Drag and drop files or
select files from your computer.
2. Clone the Repository:
o Clone the repository to your local machine using Git:

bash

git clone https://github.com/username/repository-name.git

o Navigate into your repository folder:

bash

cd repository-name

o Add and commit your files:

bash

git add.
git commit -m "Initial commit"
git push origin main

3. Create Files on GitHub:


o Go to the repository page, click "Add file", and select "Create new file". Enter the file name
and content, then commit the new file.

6. Manage Your Repository

Once your repository is set up, you can manage it by:

 Creating branches to work on different features or fixes.


 Opening pull requests to review and merge changes.
 Collaborating with others by adding collaborators or teams.
 Reviewing issues and discussions related to your project.

4
3. Create Azure Organization

Creating an Azure organization involves setting up an Azure Active Directory (Azure AD) tenant,
which serves as the foundational directory service for managing users, groups, and applications in
your Azure environment. Here’s a step-by-step guide to creating an Azure organization:

1. Sign In to Azure Portal

1. Visit the Azure Portal:


o Go to Azure Portal.
2. Sign In:
o Enter your Microsoft account credentials. If you don’t have an account, you’ll need to create
one. You can sign up for a free Azure account if you don’t have one.

2. Create a New Azure AD Tenant

1. Navigate to Azure Active Directory:


o In the left-hand menu of the Azure Portal, click on "Azure Active Directory". If you don’t see
it, you can search for it in the search bar at the top of the portal.
2. Create a New Directory:
o Click on "Create a tenant" in the Azure Active Directory blade.
3. Choose the Directory Type:
o Select "Azure Active Directory" to create a standard Azure AD tenant.
4. Fill in the Directory Details:
o Organization Name: Enter the name of your organization.
o Initial Domain Name: This will be the initial domain for your directory. You can choose a
default domain or create a custom domain later.
o Country or Region: Select the country or region where your organization is based.
5. Click "Review + create":
o Review the information you’ve entered, and then click the "Create" button.

3. Verify and Configure Your New Azure AD Tenant

1. Switch to the New Directory:


o After the tenant is created, you can switch to it by clicking on your profile icon in the upper
right corner of the Azure Portal and selecting "Switch directory". Choose the newly created
directory from the list.
2. Configure Your Directory:
o Add Custom Domains: If you have a custom domain, you can add it by going to "Custom
domain names" in the Azure Active Directory blade.
o Add Users: You can add users by navigating to "Users" and then "New user".
o Set Up Groups: Organize users into groups by going to "Groups" and creating new groups as
needed.
o Assign Roles and Permissions: Assign roles and permissions to users and groups to manage
access to resources.

4. Additional Configurations

1. Configure Applications:
o You can register and configure applications in Azure AD by going to "App registrations". This
is where you manage application access and settings.
2. Set Up Multi-Factor Authentication (MFA):
o For enhanced security, configure MFA by going to "Security" > "Multi-Factor Authentication".
5
3. Set Up Conditional Access Policies:
o Implement conditional access policies to control how and when users can access resources by
navigating to "Security" > "Conditional Access".

5. Access Azure Resources

1. Create and Manage Azure Resources:


o Use your Azure AD tenant to manage access to various Azure resources. Navigate to "All
services" in the Azure Portal to create and manage services like Virtual Machines, Databases,
and Storage.
2. Monitor and Maintain:
o Regularly monitor your Azure environment and maintain it by reviewing usage, managing
security settings, and performing regular audits.

4. Create a new pipeline

Creating a new pipeline in Azure DevOps allows you to automate the build, test, and deployment
processes for your application. Azure DevOps Pipelines support Continuous Integration (CI) and
Continuous Deployment (CD). Here’s a detailed guide on how to create a new pipeline:

1. Sign In to Azure DevOps

1. Visit Azure DevOps:


o Go to Azure DevOps Services or Azure DevOps Server.
2. Sign In:
o Enter your Microsoft account credentials to sign in. If you don’t have an Azure DevOps
account, you’ll need to create one.

2. Navigate to Your Azure DevOps Project

1. Select a Project:
o From the Azure DevOps homepage, select the project where you want to create the pipeline.
If you don’t have a project, you can create one by clicking "New Project" and following the
prompts.

3. Create a New Pipeline

1. Open Pipelines:
o In the left-hand menu, click on "Pipelines".
2. Create Pipeline:
o Click the "New Pipeline" button.

4. Configure the Pipeline

1. Select a Repository:
o Choose the source for your code. You can select from various options such as:
 Azure Repos Git: If your code is stored in Azure Repos.
 GitHub: If your code is stored in GitHub.
 Bitbucket Cloud: If your code is stored in Bitbucket.
 GitLab: If your code is stored in GitLab.
 Other Git: For other Git repositories.
 Import a repository: If you need to import from another service.

6
o Authenticate and authorize access if necessary.
2. Configure Pipeline YAML:
o Starter Pipeline: You can start with a basic YAML pipeline template or use an existing YAML
file.
o Existing YAML File: If you have a YAML file ready, you can select it from your repository. This
file defines your pipeline's steps and configuration.
3. Use Classic Editor (Optional):
o If you prefer a graphical interface, click on "Use the classic editor" instead of configuring the
YAML file. This will guide you through a UI-based configuration.

5. Define Pipeline Steps

1. Edit YAML File:


o If using YAML, edit the pipeline YAML file to define your build and release steps. Below is a
simple example of a YAML pipeline:

yaml

trigger:
branches:
include:
- main

pool:
vmImage: 'ubuntu-latest'

steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '5.x'
installationPath: $(Agent.ToolsDirectory)/dotnet

- script: dotnet build --configuration Release


displayName: 'Build project'

- script: dotnet test


displayName: 'Run tests'

2. Save and Run:


o Save the YAML file and run the pipeline. Azure DevOps will automatically trigger the pipeline
based on the defined triggers.

6. Configure Pipeline Settings

1. Add Environment Variables:


o Navigate to "Variables" to add environment variables or secrets required for your pipeline.
2. Set Up Triggers:
o Configure triggers to automatically run the pipeline on specific events such as code commits,
pull requests, or scheduled intervals.
3. Configure Agent Pools:
o Ensure your pipeline uses the correct agent pool by navigating to "Agent Pools" and selecting
or configuring the appropriate agents.

7
7. Monitor Pipeline Execution

1. Pipeline Runs:
o Monitor the execution of your pipeline from the "Pipelines" section. You can view logs, status,
and details of each run.
2. Review Results:
o Review build and deployment results, including any errors or warnings. Analyze logs and
metrics to ensure everything runs smoothly.

5. Build a sample code

Building a sample code typically involves writing a small application or script to demonstrate a
particular concept, technology, or framework. For simplicity, I'll provide a basic example of a sample
code using a popular language, Python, to illustrate fundamental programming concepts.

Sample Code: Simple Python Calculator

This Python script will create a simple command-line calculator that can perform basic arithmetic
operations: addition, subtraction, multiplication, and division.

1. Sample Code

# Simple Calculator

def add(x, y):

"""Add two numbers."""

return x + y

def subtract(x, y):

"""Subtract two numbers."""

return x - y

def multiply(x, y):

"""Multiply two numbers."""

return x * y

def divide(x, y):

"""Divide two numbers. Handles division by zero."""

if y == 0:

8
return "Error! Division by zero."

return x / y

def main():

print("Welcome to the Simple Calculator!")

while True:

# Get user input

operation = input("Choose operation (add, subtract, multiply, divide) or 'exit' to quit: ").strip().lower()

if operation == 'exit':

print("Exiting the calculator. Goodbye!")

break

if operation not in ['add', 'subtract', 'multiply', 'divide']:

print("Invalid operation. Please choose from add, subtract, multiply, divide.")

continue

try:

num1 = float(input("Enter first number: "))

num2 = float(input("Enter second number: "))

except ValueError:

print("Invalid input. Please enter numerical values.")

continue

# Perform calculation based on the chosen operation

if operation == 'add':

print(f"Result: {add(num1, num2)}")

elif operation == 'subtract':

9
print(f"Result: {subtract(num1, num2)}")

elif operation == 'multiply':

print(f"Result: {multiply(num1, num2)}")

elif operation == 'divide':

print(f"Result: {divide(num1, num2)}")

if __name__ == "__main__":

main()

2. Explanation

1. Functions: The code defines four functions (add, subtract, multiply, divide) that perform
basic arithmetic operations.
o add: Returns the sum of two numbers.
o subtract: Returns the difference between two numbers.
o multiply: Returns the product of two numbers.
o divide: Returns the quotient of two numbers and handles division by zero.
2. main Function: This is the main function where the program starts.
o It presents a menu to the user to choose an operation or exit.
o It takes user input for the operation and numbers.
o Based on the operation chosen, it calls the appropriate function and prints the result.
o It handles invalid operations and non-numerical inputs gracefully.
3. Error Handling: The script includes basic error handling for division by zero and non-
numeric input.
4. Loop: The while loop allows the user to perform multiple calculations until they choose to
exit.

3. Running the Code

To run the code, save it in a file named calculator.py, and execute it using Python:

bash

python calculator.py

You’ll interact with the command line to perform calculations using the provided operations.

10
6. Modify azure-pipelines. yaml file

Modifying an azure-pipelines.yml file allows you to customize and enhance your Azure DevOps
pipeline configurations. Below is a basic guide on how to modify a YAML pipeline file to achieve
different tasks, such as adding steps, setting variables, or integrating testing and deployment.

Sample azure-pipelines.yml File

Here's a simple YAML pipeline file for a .NET application that includes stages for building, testing,
and deploying. I'll show you how to modify it for various needs.

yaml

trigger:
branches:
include:
- main

pool:
vmImage: 'ubuntu-latest'

variables:
buildConfiguration: 'Release'

steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '6.x'
installationPath: $(Agent.ToolsDirectory)/dotnet

- script: dotnet build --configuration $(buildConfiguration)


displayName: 'Build project'

- script: dotnet test --configuration $(buildConfiguration)


displayName: 'Run tests'

- task: CopyFiles@2
inputs:
contents: '**/*.dll'
targetFolder: '$(Build.ArtifactStagingDirectory)'
displayName: 'Copy files to: $(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
displayName: 'Publish Artifacts'

How to Modify azure-pipelines.yml

1. Change the Trigger Branch

To change which branches trigger the pipeline, modify the trigger section:

yaml

trigger:
branches:

11
include:
- main
- development

2. Add or Modify Variables

To add or change variables, update the variables section:

yaml

variables:
buildConfiguration: 'Release'
outputDirectory: '$(Build.ArtifactStagingDirectory)/output'

3. Add New Steps

To add a new step, such as running a script or a task, append it to the steps section:

yaml

- script: echo "Deploying application"


displayName: 'Echo Deploy Message'

4. Update .NET SDK Version

To use a different .NET SDK version, modify the UseDotNet task:

yaml

- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '7.x'
installationPath: $(Agent.ToolsDirectory)/dotnet

5. Add a Deployment Stage

To add a deployment stage, you can define a new stage and include deployment tasks:

yaml

stages:
- stage: Build
jobs:
- job: Build
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '6.x'
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'Build project'
- script: dotnet test --configuration $(buildConfiguration)
displayName: 'Run tests'

- stage: Deploy
jobs:
- job: Deploy
steps:

12
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'specific'
project: '$(System.TeamProjectId)'
pipeline: '1'
buildVersionToDownload: 'latest'
downloadType: 'single'
artifactName: 'drop'
- task: AzureWebApp@1
inputs:
azureSubscription: 'your-service-connection'
appName: 'your-app-name'
package: '$(Pipeline.Workspace)/drop/**/*.zip'

6. Configure Notifications

To set up notifications for the pipeline’s success or failure, use the following YAML:

yaml

notifications:
- event: success
recipients:
- email@example.com
subject: Pipeline Succeeded
body: The pipeline has completed successfully.
- event: failure
recipients:
- email@example.com
subject: Pipeline Failed
body: The pipeline has failed. Please check the logs for details.

Additional Tips

 Test Changes: After modifying the YAML file, commit and push the changes to your repository. Azure
DevOps will automatically trigger the pipeline if it’s configured to do so.
 Validate YAML Syntax: Ensure your YAML file is correctly formatted. You can use online YAML
validators or the Azure DevOps pipeline editor to validate syntax.
 Use Templates: For complex pipelines, consider using YAML templates to modularize your pipeline
configuration.

This guide provides a starting point for modifying your Azure Pipelines YAML file to suit your
project’s needs. Adjust the pipeline configuration based on your specific requirements and
environments.

13
2 MARKS:

1. How do you create a new repository on GitHub and what are the options available
during initialization?

Answer:

1. Sign In: Log in to GitHub.


2. Navigate: Click "New repository" from your profile or dashboard.
3. Enter Details: Provide a repository name, description, and choose visibility (public/private).
4. Initialize: Optionally initialize with a README, .gitignore, or license.
5. Create: Click "Create repository".

2. Explain how to set up a basic Azure DevOps pipeline for a Java project using
Maven.

Answer:

1. Create Pipeline: Go to "Pipelines" > "New Pipeline".


2. Connect Repository: Link to your repository.
3. YAML Configuration:

yaml

trigger:
branches:
include:
- main

pool:
vmImage: 'ubuntu-latest'

steps:
- task: Maven@3
inputs:
mavenVersionOption: 'Default'
goals: 'clean install'
displayName: 'Build with Maven'

4. Save and Run: Save the YAML file and commit it.

3. How can you configure a pipeline in Azure DevOps to deploy an application to


Azure Web App?

Answer:

1. Update YAML:

yaml

14
stages:
- stage: Build
jobs:
- job: Build
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '6.x'

- script: dotnet build --configuration Release


displayName: 'Build project'

- stage: Deploy
jobs:
- job: Deploy
steps:
- task: AzureWebApp@1
inputs:
azureSubscription: 'your-service-connection'
appName: 'your-app-name'
package: '$(Pipeline.Workspace)/drop/**/*.zip'
displayName: 'Deploy to Azure Web App'

2. Commit Changes: Save and commit the YAML file.

4. Describe how to add and use environment variables in an Azure DevOps pipeline
YAML file.

Answer:

1. Define Variables:

yaml

variables:
buildConfiguration: 'Release'
outputDirectory: '$(Build.ArtifactStagingDirectory)/output'

2. Use Variables:

yaml

steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'Build project'

- task: CopyFiles@2
inputs:
contents: '**/*.dll'
targetFolder: '$(outputDirectory)'
displayName: 'Copy files'

3. Save and Commit: Save the YAML file and commit it.

15
5. How can you create a GitHub repository using the GitHub CLI?

Answer:

1. Install GitHub CLI: Ensure you have GitHub CLI installed.


2. Run Command: Use gh repo create <repo-name> to create a new repository.
3. Follow Prompts: Follow CLI prompts to set repository details.

6. What is the purpose of the trigger section in an Azure DevOps YAML pipeline
file?

Answer: The trigger section defines which branches or paths will automatically start the pipeline
when changes are detected.

7. How can you include a deployment step in an Azure DevOps pipeline YAML file to
deploy to an Azure Kubernetes Service (AKS)?

Answer:

1. Update YAML:

yaml

stages:
- stage: Deploy
jobs:
- job: Deploy
steps:
- task: AzureCLI@2
inputs:
azureSubscription: 'your-service-connection'
scriptType: 'bash'
scriptPath: 'deploy.sh'
arguments: '-f deployment.yaml'
displayName: 'Deploy to AKS'

2. Commit Changes: Save and commit the YAML file.

8. Describe how to use GitHub Actions to automate a workflow for a Node.js project.

Answer:

1. Create Workflow File: In your GitHub repository, create a file in .github/workflows/.


2. Add YAML Configuration:

yaml

name: Node.js CI

on:
16
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- run: npm test
env:
CI: true

3. Commit: Save and push the file.

9. How do you configure a pipeline to use a specific version of Python in Azure


DevOps?

Answer:

1. Update YAML:

yaml

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'

2. Commit: Save and commit the YAML file.

10. Explain how to integrate a GitHub repository with Azure Pipelines.

Answer:

1. Create Pipeline: Go to Azure DevOps and select "Pipelines" > "New Pipeline".
2. Select GitHub: Choose GitHub as the source and authenticate if necessary.
3. Configure: Follow the setup steps to configure pipeline settings and YAML file.

11. What is the purpose of the pool section in an Azure DevOps pipeline YAML file?

Answer: The pool section specifies the type of agent or virtual machine that will be used to run the
pipeline jobs.

17
12. How do you configure continuous integration (CI) for a Python project using
Azure DevOps?

Answer:

1. Create Pipeline: Go to Azure DevOps and create a new pipeline.


2. YAML Configuration:

yaml

trigger:
branches:
include:
- main

pool:
vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'

- script: pip install -r requirements.txt


displayName: 'Install dependencies'

- script: pytest
displayName: 'Run tests'

3. Commit: Save and commit the YAML file.

13. How can you define a custom Docker image for a job in an Azure DevOps
pipeline?

Answer:

1. Update YAML:

yaml

pool:
vmImage: 'ubuntu-latest'
container: 'my-custom-image:latest'

2. Commit: Save and commit the YAML file.

14. Describe the process for setting up a GitHub Actions workflow to automatically
deploy a website to GitHub Pages.

Answer:

1. Create Workflow File: Add a file in .github/workflows/ in your repository.


2. Add YAML Configuration:
18
yaml

name: Deploy to GitHub Pages

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- run: npm run build
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build

3. Commit: Save and push the file.

15. How can you set up an Azure DevOps pipeline to automatically trigger on pull
requests?

Answer:

1. Update YAML:

yaml

trigger:
branches:
exclude:
- '*'

pr:
branches:
include:
- main

2. Commit: Save and commit the YAML file.

16. What is the purpose of the steps section in an Azure DevOps YAML pipeline file?

Answer: The steps section defines a sequence of tasks or scripts to be executed in the pipeline job.

19
17. How can you configure a pipeline in Azure DevOps to use a self-hosted agent
pool?

Answer:

1. Update YAML:

yaml

pool:
name: 'MySelfHostedAgentPool'

2. Commit: Save and commit the YAML file.

18. Describe how to add a manual approval step before deployment in an Azure
DevOps pipeline.

Answer:

1. Update YAML:

yaml

stages:
- stage: Deploy
jobs:
- job: Deploy
steps:
- task: AzureWebApp@1
inputs:
azureSubscription: 'your-service-connection'
appName: 'your-app-name'
package: '$(Pipeline.Workspace)/drop/**/*.zip'
displayName: 'Deploy to Azure Web App'

- stage: Approval
dependsOn: Deploy
jobs:
- job: Approval
steps:
- script: echo "Manual Approval Needed"
displayName: 'Manual Approval'

2. Commit: Save and commit the YAML file.

19. How do you configure a GitHub Actions workflow to run on a schedule?

Answer:

1. Create Workflow File: Add a file in .github/workflows/.


2. Add YAML Configuration:

20
yaml

name: Scheduled Workflow

on:
schedule:
- cron: '0 0 * * *'

jobs:
run:
runs-on: ubuntu-latest
steps:
- run: echo "Running scheduled job"

3. Commit: Save and push the file.

20. Explain how to use a .gitignore file in a GitHub repository.

Answer:

1. Create .gitignore File: Add a .gitignore file in the root of your repository.
2. Add Patterns: Specify patterns for files and directories to be excluded from version control.

gitignore

node_modules/
*.log
.env

3. Commit: Save and commit the .gitignore file to your repository.

21

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy