Skip to content

Instantly share code, notes, and snippets.

View IlyaFinkelshteyn's full-sized avatar

Ilya Finkelshteyn IlyaFinkelshteyn

  • Azure App Service
  • Seattle WA
View GitHub Profile
$env:AzureDeploymentUsername = "<deployment_credentials_username>"
$env:AzureDeploymentPassword = "deployment_credentials_password"
$env:AzureWebsiteName = "<your_site_name>"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $env:AzureDeploymentUsername,$env:AzureDeploymentPassword)))
$apiUrl = "https://$env:AzureWebsiteName.scm.azurewebsites.net/api/command"
$body = @{
command="npm install"
dir="site"
@IlyaFinkelshteyn
IlyaFinkelshteyn / remoteyaml.yml
Last active March 16, 2017 02:13
remoteyaml.yml
version: 1.0.{build}
image: Visual Studio 2017
build: off
test: off
before_build:
- dotnet --info
- dotnet restore Source/PrismLibrary_Core.sln
- dotnet restore Source/PrismLibrary_Xamarin.sln
- nuget restore Source/PrismLibrary_Win10.sln
- nuget restore Source/PrismLibrary_Wpf.sln
version: 1.22.{build}
environment:
API_TOKEN:
secure: YIuqOcciVmoaQJhMWRoknEDuDMTUJ+oMnHCXQmBlgv4=
init:
- ps: |
$headers = @{
"Authorization" = "Bearer $env:API_TOKEN"
$token = "<your_api_token>"
$accountName="<your_account_name>"
$projectSlug="<ypur_project_slug>"
$filePath = "<your_source_config_in_yaml>"
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "plain/text"
}
#1 Upload unzipped script or executable
$AzureDeploymentUsername = "<your_deployment_username>"
$AzureDeploymentPassword = "<your_deployment_password>"
$AzureWebsiteName = "<your_website_name>"
$JobName = "<your_webjob_name>"
$inFile = "<your_executable_or_script_relative_path>" # unzipped job file like .cmd, .exe, .js, etc. For example .\test.cmd
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $AzureDeploymentUsername,$AzureDeploymentPassword)))
$apiBaseUrl = "https://$AzureWebsiteName.scm.azurewebsites.net/api"
function duplicateSetting()
{
var token = "<API_TOKEN>";
var headers = {
"Authorization": "Bearer " + token,
"Content-type": "application/json"
};
// create new project
var body = {
$token = $env:API_TOKEN #should be defined as a secure variable
$headers = @{
"Authorization" = "Bearer $token"
"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=2" -Headers $headers -Method Get
$gh_user = "<github_user>"
$gh_repo = "<github_repo>"
$sha = "<your_sha>"
$av_account = $gh_user # not always true
$av_project_slug = $gh_repo # not always true
$av_api_token = "<your_appveyor_api_token>"
# not officially supported way to get branch
# add authorization header for private repo
$resp = Invoke-WebRequest -Uri "https://github.com/$gh_user/$gh_repo/commit/$sha"
Write-Host "Installing DynamoDb..." -ForegroundColor Cyan -NoNewline
mkdir C:\DynamoDb
$dnynamoDbPath = "C:\DynamoDb"
$zipPath = "$($env:TEMP)\dynamodb_local_latest.zip"
(New-Object Net.WebClient).DownloadFile('https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip', $zipPath)
7z x $zipPath -y -o"$dnynamoDbPath" | Out-Null
del $zipPath
#http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
cd $dnynamoDbPath
# assumes that stash_url, stash_name and stash_password environment variables
# has been added to the build configuration (as a secure variables)
$stash_repo = $env:APPVEYOR_REPO_NAME.Split("/")[0]
$stash_slug = $env:APPVEYOR_REPO_NAME.Split("/")[1]
$headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($env:stash_name):$($env:stash_password)"))}
$changes = Invoke-RestMethod -Uri "$env:stash_url/rest/api/1.0/projects/$stash_repo/repos/$stash_slug/commits/$env:APPVEYOR_REPO_COMMIT/changes" -Headers $headers -Method Get
$changes.values | ForEach-Object {write-host $_.path.components}