This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Output 'Understand how $PreferenceVariable controls verbose output' | |
# prints current value of $verbosepreference | |
Write-Host "VerbosePreference is set to: $VerbosePreference" | |
# understanding how $VerbosePreference controls the verbose output | |
# case 1: set to bypass verbose stream | |
$VerbosePreference = "SilentlyContinue" | |
Write-Host "VerbosePreference is set to: $VerbosePreference" | |
Write-Verbose -message "This line will not be shown" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample pipeline code to demonstrate scheduling using cron syntax | |
pool: | |
name: 'Hosted Ubuntu 1604' | |
schedules: | |
- cron: "0 * * * *" | |
displayName: "hourly build" | |
branches: | |
include: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schedules: | |
- cron: string # cron syntax defining a schedule | |
displayName: string # friendly name given to a specific schedule | |
branches: | |
# include is calculated first followed by exclude | |
# there is no implicit include | |
include: [ string ] # which branches the schedule applies to | |
exclude: [ string ] # which branches to exclude from the schedule | |
always: boolean # whether to always run the pipeline or only if there have been source code changes since the last run. The default is false. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-PersonDetails { | |
Begin { | |
Write-Verbose "In Begin Block: Get-PersonDetails" | |
[hashtable] $PersonDetails = @{} | |
} | |
Process{ | |
Write-Verbose "In Process Block: Get-PersonDetails" | |
$PersonDetails = @{Keith=29; Eddy=24; Kevin=23; Kate=15} | |
} | |
End{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-PersonDetails { | |
Begin { | |
Write-Verbose "In Begin Block: Get-PersonDetails" | |
$PersonName = @() | |
$PersonAge = @() | |
} | |
Process{ | |
Write-Verbose "In Process Block: Get-PersonDetails" | |
$PersonName = "Keith", "Eddy", "Kevin", "Kate" | |
$PersonAge = 29, 34, 23, 15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-PersonDetails { | |
Begin { | |
Write-Verbose "In Begin Block: Get-PersonDetails" | |
$PersonName = @() | |
$PersonAge = @() | |
} | |
Process{ | |
Write-Verbose "In Process Block: Get-PersonDetails" | |
$PersonName = "Keith", "Eddy", "Kevin", "Kate" | |
$PersonAge = 29, 34, 23, 15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-Sum { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[int] $Number1, | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[int] $Number2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is inline code | |
env | sort |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# code trimmed for brevity from azure-pipelines.yml | |
... | |
steps: # 'Steps' section is to be used inside 'job' section. | |
- task: Bash@3 | |
inputs: | |
targetType: 'inline' | |
script: 'env | sort' | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import fileinput | |
# Read in each ref that the user is trying to update | |
for line in fileinput.input(): | |
print "pre-receive: Trying to push ref: %s" % line | |
sys.exit(0) |