Skip to content

Instantly share code, notes, and snippets.

Ilya Finkelshteyn IlyaFinkelshteyn

Block or report user

Report or block IlyaFinkelshteyn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View do-not-rebuild-same-commit.ps1
# $env:API_KEY should be defined as a secure variable
$headers = @{
"Authorization" = "$env:API_KEY"
"Content-type" = "application/json"
}
$apiURL = "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG"
$history = Invoke-RestMethod -Uri "$apiURL/history?recordsNumber=5" -Headers $headers -Method Get
@IlyaFinkelshteyn
IlyaFinkelshteyn / EnvironmentSettingJson.ps1
Created Jan 5, 2019
Howto store and update environment setting in JSON to track changes.
View EnvironmentSettingJson.ps1
$token = '<API_TOKEN>'
$sourceEnvironmentName = '<SOURCE_ENVIRONMENT_NAME>'
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
# get source environment ID
$sourceEnvironmentId = ((Invoke-RestMethod -Uri "https://ci.appveyor.com/api/environments" -Headers $headers -Method Get) | where {$_.name -eq $sourceEnvironmentName}).deploymentEnvironmentId
View BulkCancelDeleteQueuedBuilds.ps1
$env:API_TOKEN="<replace>" # https://ci.appveyor.com/api-keys
$env:APPVEYOR_ACCOUNT_NAME="<replace>" # from AppVeyor URL (after "project/")
$env:APPVEYOR_PROJECT_SLUG="<replace>" # from AppVeyor URL (after account name)
$env:recordsNumber = 20
$headers = @{
"Authorization" = "Bearer $env:API_TOKEN"
"Content-type" = "application/json"
}
View UpdateProjectSlug.ps1
$env:API_URL = "https://ci.appveyor.com/api" # replace for AppVeyor Enterprise
$env:API_TOKEN = "<replace>" # from https://ci.appveyor.com/api-keys
$env:APPVEYOR_ACCOUNT_NAME = "<replace>" # from AppVeyor project URL
$env:APPVEYOR_PROJECT_SLUG_OLD = "<replace>" # from AppVeyor project URL
$env:APPVEYOR_PROJECT_SLUG_NEW = "<replace>" # Desired slug
$headers = @{
"Authorization" = "Bearer $env:API_TOKEN"
"Content-type" = "application/json"
}
View UpdateEnvironmentsPermissions.ps1
$token = '<replace>'
$roles = @("role1", "role2")
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
function UpdateSingleRolePermission ($roleName, $environmentId, $permission) {
$setting = Invoke-RestMethod -Uri "https://ci.appveyor.com/api/environments/$environmentId/settings" -Headers $headers -Method Get
View AllowViewPermission.ps1
$env:API_TOKEN = "<replace>" # from https://ci.appveyor.com/api-token
$env:APPVEYOR_ACCOUNT_NAME = "<replace>" # from AppVeyor project URL
$env:APPVEYOR_PROJECT_SLUG = "<replace>" # from AppVeyor project URL
$env:ROLE_NAME = "<replace>" # role to update permissions
$API_URL = "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/settings"
$headers = @{
"Authorization" = "Bearer $env:API_TOKEN"
"Content-type" = "application/json"
View UpdateAzureVmSize.ps1
$apiUrl = "https://ci.appveyor.com/api" # replace with AppVeyor Enterprise URL if needed
$token = "<your_API_token>" # from https://ci.appveyor.com/api-token" or similar AppVeyor Enterprise URL
$buildEnvironmentId = "your_build_environment_id" # you can get it from build environment URL
$newVmSize = "<VM_Size_not_listed_in_AppVeyor_UI>" # https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
View StartBuildWaitForLogEntries.ps1
$token="<Your_api_token>"
$accountName="<Your_account>"
$projectSlug="<Your_project_slug>"
$toFind = @("foo", "bar")
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
View increment-version-only-master.yml
#WARNING: this may work unpredictable with parallel build of the same project (parallel jobs in matrix are fine)
#Note $separator variable. If "-" can be used earlier in build version, replace it to something unique
version: 0.1.{build}
environment:
API_TOKEN:
secure: SlDEDtAKuvsy+VErEuc/4DxdhPeKu2WRqvYzEh/fiH4=
for:
View UpdateVariableValue.ps1
$API_TOKEN = "<replace>" # from https://ci.appveyor.com/api-token
$APPVEYOR_ACCOUNT_NAME = "<replace>" # from AppVeyor project URL
$APPVEYOR_PROJECT_SLUG = "<replace>" # from AppVeyor project URL
$VAR_NAME = "<replace>" # name of variable to update
$VAR_NEW_VALUE = "<replace>" # new variable value
$API_URL = "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/settings/environment-variables"
$ENCRYPT_URL = "https://ci.appveyor.com/api/account/encrypt"
$headers = @{
You can’t perform that action at this time.