Skip to content

Commit

Permalink
Update to latest AU script
Browse files Browse the repository at this point in the history
  • Loading branch information
bdukes committed Feb 2, 2019
1 parent cb8824a commit 07ee27c
Showing 1 changed file with 44 additions and 9 deletions.
53 changes: 44 additions & 9 deletions au/update_all.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,52 @@ param([string[]] $Name, [string] $ForcedPackages, [string] $Root = $PSScriptRoot
if (Test-Path $PSScriptRoot/update_vars.ps1) { . $PSScriptRoot/update_vars.ps1 }

$Options = [ordered]@{
WhatIf = $au_WhatIf #Whatif all packages
Force = $false #Force all packages
Timeout = 100 #Connection timeout in seconds
UpdateTimeout = 1200 #Update timeout in seconds
Threads = 10 #Number of background jobs to use
Push = $Env:au_Push -eq 'true' #Push to chocolatey
PushAll = $true #Allow to push multiple packages at once
PluginPath = '' #Path to user plugins
IgnoreOn = @( #Error message parts to set the package ignore status
'Could not create SSL/TLS secure channel'
'Could not establish trust relationship'
'The operation has timed out'
'Internal Server Error'
'Service Temporarily Unavailable'
)
RepeatOn = @( #Error message parts on which to repeat package updater
'Could not create SSL/TLS secure channel' # https://github.com/chocolatey/chocolatey-coreteampackages/issues/718
'Could not establish trust relationship' # -||-
'Unable to connect'
'The remote name could not be resolved'
'Choco pack failed with exit code 1' # https://github.com/chocolatey/chocolatey-coreteampackages/issues/721
'The operation has timed out'
'Internal Server Error'
'An exception occurred during a WebClient request'
'remote session failed with an unexpected state'
)
#RepeatSleep = 250 #How much to sleep between repeats in seconds, by default 0
#RepeatCount = 2 #How many times to repeat on errors, by default 1

#NoCheckChocoVersion = $true #Turn on this switch for all packages

Report = @{
Type = 'markdown' #Report type: markdown or text
Path = "$PSScriptRoot\..\Update-AUPackages.md" #Path where to save the report
Params= @{ #Report parameters:
Github_UserRepo = $Env:github_user_repo # Markdown: shows user info in upper right corner
NoAppVeyor = $false # Markdown: do not show AppVeyor build shield
UserMessage = "[History](#update-history)" # Markdown, Text: Custom user message to show
UserMessage = "[Ignored](#ignored) | [History](#update-history) | [Force Test](https://gist.github.com/$Env:gist_id_test) | [Releases](https://github.com/$Env:github_user_repo/tags)" # Markdown, Text: Custom user message to show
NoIcons = $false # Markdown: don't show icon
IconSize = 32 # Markdown: icon size
Title = '' # Markdown, Text: TItle of the report, by default 'Update-AUPackages'
}
}

History = @{
Lines = 30 #Number of lines to show
Lines = 120 #Number of lines to show
Github_UserRepo = $Env:github_user_repo #User repo to be link to commits
Path = "$PSScriptRoot\..\Update-History.md" #Path where to save history
}
Expand All @@ -37,18 +62,24 @@ $Options = [ordered]@{
}

Git = @{
#User = '' #Git username, leave empty if github api key is used
User = '' #Git username, leave empty if github api key is used
Password = $Env:github_api_key #Password if username is not empty, otherwise api key
}

GitReleases = @{
ApiToken = $Env:github_api_key #Your github api key
ReleaseType = 'package' #Either 1 release per date, or 1 release per package
}

RunInfo = @{
Exclude = 'password', 'apikey' #Option keys which contain those words will be removed
Exclude = 'password', 'apikey', 'apitoken' #Option keys which contain those words will be removed
Path = "$PSScriptRoot\..\update_info.xml" #Path where to save the run info
}

Mail = if ($Env:mail_user) {
@{
To = $Env:mail_user
From = $Env:mail_from
Server = $Env:mail_server
UserName = $Env:mail_user
Password = $Env:mail_pass
Expand All @@ -63,16 +94,20 @@ $Options = [ordered]@{
ForcedPackages = $ForcedPackages -split ' '
BeforeEach = {
param($PackageName, $Options )
$p = $Options.ForcedPackages | ? { $_ -match "^${PackageName}(?:\:(.+))*$" }

$pattern = "^${PackageName}(?:\\(?<stream>[^:]+))?(?:\:(?<version>.+))?$"
$p = $Options.ForcedPackages | ? { $_ -match $pattern }
if (!$p) { return }

$global:au_Force = $true
$global:au_Version = ($p -split ':')[1]
$global:au_Force = $true
$global:au_IncludeStream = $Matches['stream']
$global:au_Version = $Matches['version']
}
}

if ($ForcedPackages) { Write-Host "FORCED PACKAGES: $ForcedPackages" }
$global:au_Root = "$Root\..\automatic" #Path to the AU packages
$global:au_Root = "$Root\..\automatic" #Path to the AU packages
$global:au_GalleryUrl = '' #URL to package gallery, leave empty for Chocolatey Gallery
$global:info = updateall -Name $Name -Options $Options

#if ($global:info.error_count.total) { throw 'Errors during update' }
if ($global:info.error_count.total) { throw 'Errors during update' }

0 comments on commit 07ee27c

Please sign in to comment.