Global YAML is a configuration in appveyor.yml format which is injected into all projects under the account. It can be edited on Account → Global YAML page.
Some of the use cases for global configuration:
Actions defined in global config are merged with actions defined in project config with global actions going first, for example:
Global YAML:
init:
- appveyor version
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
Project appveyor.yml
:
init:
- ps: $env:appveyor_build_worker_image
Resulting config:
init:
- appveyor version
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- ps: $env:appveyor_build_worker_image
String values defined in project config overrides values defined in global config, for example:
Global YAML:
dotnet_csproj:
file: '**\*.*proj'
Project appveyor.yml
:
dotnet_csproj:
file: '**\*.csproj'
Resulting config:
dotnet_csproj:
file: '**\*.csproj'
Boolean value set to true
in global config always overrides the value defined on project level to true
, for example:
Global YAML:
shallow_clone: true
Project appveyor.yml
:
shallow_clone: false # if the setting is omitted it defaults to "false"
Resulting config:
shallow_clone: true
The following sections can be configured in Global YAML:
shallow_clone: true
- enables shallow clone (one commit only, via SCM API) for all projects.
clone_depth: <number>
- cloning depth for all projects.
clone_script
- custom repository cloning script overriding built-in cloning method for all projects, for example:
clone_script:
- ps: |
if(-not $env:appveyor_pull_request_number) {
git clone --depth=1 -q -c filter.lfs.smudge= -c filter.lfs.required=false --branch=$env:appveyor_repo_branch git@github.com:$env:appveyor_repo_name.git $env:appveyor_build_folder
git checkout -qf $env:appveyor_repo_commit
git lfs pull
} else {
git clone --depth=1 -q -c filter.lfs.smudge= -c filter.lfs.required=false git@github.com:$env:appveyor_repo_name.git $env:appveyor_build_folder
git fetch -q origin +refs/pull/$env:appveyor_pull_request_number/merge:
git checkout -qf FETCH_HEAD
git lfs pull
}
init
- scripts to run on build start before repository cloning.
install
- scripts to run after repository is cloned.
hosts
- /etc/hosts
records common for all projects.
cache
- build cache records applied to all projects.
nuget
- enable project/account NuGet feeds for all projects; modify publish behavior:
nuget:
project_feed: true
account_feed: true
disable_publish_on_pr: true
environment
- configure environment variables common for all projects. Environment variable with the same name defined on project level overrides the one defined in global configuration. secure
variables are supported too. For example, the following global YAML enables RDP access to build VM in case of build failure for all projects:
environment:
APPVEYOR_RDP_PASSWORD:
secure: encrypted-password==
on_failure:
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
The following sections can be defined in Global YAML that will be applied to all projects.
AssemblyInfo.*
patching:
assembly_info:
patch: true
file: AssemblyInfo.*
assembly_version: "2.2.{build}"
assembly_file_version: "{version}"
assembly_informational_version: "{version}"
.NET Core *.*proj
files patching:
dotnet_csproj:
patch: true
file: '**\*.csproj'
version: '{version}'
version_prefix: '{version}'
package_version: '{version}'
assembly_version: '{version}'
file_version: '{version}'
informational_version: '{version}'
build_script
- custom scripts to run on build phase.
before_build
- scripts to run before build phase.
before_package
- scripts to run on built-in artifacts packaging phase.
after_build
- scripts to run after build phase.
Global build phase configuration has no effect if build phase on project level is explicitly disabled with
build: off
.
test_script
- custom scripts to run on test phase.
before_test
- scripts to run before test phase.
after_test
- scripts to run after test phase.
Global test phase configuration has no effect if test phase on project level is explicitly disabled with
test: off
.
artifacts
- define the list of common artifacts that will be collected for all projects. It’s safe to provide nonexistent path here as the build won’t fail if artifact with specified path criteria was not found, for example:
artifacts:
- path: Logs\*.txt
deploy
- deployment providers to run on all projects. Providers defined in Global YAML are inserted before the ones defined on project level.
deploy_script
- custom scripts to run on deploy phase.
before_deploy
- scripts to run before deploy phase.
after_deploy
- scripts to run after deploy phase.
Global deploy phase configuration has no effect if deploy phase on project level is explicitly disabled with
deploy: off
.
notifications
- global build notifications for all projects, for example:
notifications:
- provider: Slack
incoming_webhook:
secure: AAABBB+CCC+DDD==
channel: '#ci'
on_build_failure: true
on_success
- scripts to run on successful builds of all projects.
on_failure
- scripts to run on failed builds of all projects, e.g. enable RDP/SSH access to the worker, or push crash dumps to artifacts.
on_finish
- scripts to run on both successful and failed builds of all projects.