From 23e5df838aec9699142185c06a84a44d3ec924a8 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 16:12:17 +0200 Subject: [PATCH 01/32] Adding initial powershell script for cleanup on CI server --- src/ci/scripts/cleanup.ps | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/ci/scripts/cleanup.ps diff --git a/src/ci/scripts/cleanup.ps b/src/ci/scripts/cleanup.ps new file mode 100644 index 000000000..00d37aefa --- /dev/null +++ b/src/ci/scripts/cleanup.ps @@ -0,0 +1,11 @@ +<# + Powershell script for cleaning up remaining processes on the CI servers +#> + +$list = dir +foreach ($item in $list) { + $fn = $item.name + "_.txt" + get-itemproperty $item | format-list +} +Get-Process | sort -Descending CPU +Get-Process iexplo* From dd409b1dd77b8e2f7fad20f88426aabbff746826 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 16:27:32 +0200 Subject: [PATCH 02/32] Changing ps script extension --- src/ci/scripts/{cleanup.ps => cleanup.ps1} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/ci/scripts/{cleanup.ps => cleanup.ps1} (100%) diff --git a/src/ci/scripts/cleanup.ps b/src/ci/scripts/cleanup.ps1 similarity index 100% rename from src/ci/scripts/cleanup.ps rename to src/ci/scripts/cleanup.ps1 From 428ca6a100c24c7dc26a0ff7108d7a46e411aba4 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 17:19:47 +0200 Subject: [PATCH 03/32] Trying some ps features --- src/ci/scripts/cleanup.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 00d37aefa..2289ffa9f 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -7,5 +7,4 @@ foreach ($item in $list) { $fn = $item.name + "_.txt" get-itemproperty $item | format-list } -Get-Process | sort -Descending CPU -Get-Process iexplo* +Get-Process -IncludeUserName -FileVersionInfo | sort -Descending CPU From a178b96e5424fb2ee4faecaad0fdbab50a602bda Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 17:31:26 +0200 Subject: [PATCH 04/32] PS tests --- src/ci/scripts/cleanup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 2289ffa9f..542b93c80 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -7,4 +7,4 @@ foreach ($item in $list) { $fn = $item.name + "_.txt" get-itemproperty $item | format-list } -Get-Process -IncludeUserName -FileVersionInfo | sort -Descending CPU +Get-Process -IncludeUserName From a02f98c6e26c996e23a667d4e0cbab57def04c84 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 17:43:23 +0200 Subject: [PATCH 05/32] Additional test --- src/ci/scripts/cleanup.ps1 | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 542b93c80..6f32e9f03 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -2,9 +2,20 @@ Powershell script for cleaning up remaining processes on the CI servers #> -$list = dir -foreach ($item in $list) { - $fn = $item.name + "_.txt" - get-itemproperty $item | format-list +Get-Process + +$processes = Get-WmiObject Win32_Process -Filter "name = 'java.exe'" +foreach($proc in $processes) +{ + if($proc.CommandLine.Contains("selenium-server.jar")) + { + Write-Host "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." + Stop-Process -F $proc.ProcessId + } else + { + Write-Host "skipping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." + } } -Get-Process -IncludeUserName +Get-Process firefox | Stop-Process +Get-Process chrome | Stop-Process +Get-Process iexplore | Stop-Process From 085eadd929cda2964d54239422bb953d5e8da39f Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 17:51:51 +0200 Subject: [PATCH 06/32] Another test --- src/ci/scripts/cleanup.ps1 | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 6f32e9f03..01d60d1d7 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -2,7 +2,25 @@ Powershell script for cleaning up remaining processes on the CI servers #> -Get-Process +Get-Process | Get-Member +Get-Process | Select-Object name,fileversion,productversion,company + +$View = @( + @{l='Handles';e={$_.HandleCount}}, + @{l='NPM(K)';e={ (Get-Process -Id $_.ProcessId).NonpagedSystemMemorySize/1KB -as [int]}}, + @{l='PM(K)';e={ $_.PrivatePageCount/1KB -as [int]}}, + @{l='WS(K)';e={ $_.WorkingSetSize/1KB -as [int]}}, + @{l='VM(M)';e={ $_.VirtualSize/1mB -as [int]}}, + @{l='CPU(s)';e={ (Get-Process -Id $_.ProcessId).CPU -as [int]}}, + @{l='Id';e={ $_.ProcessId}}, + 'UserName' + @{l='ProcessName';e={ $_.ProcessName}} +) +Get-WmiObject Win32_Process | % { $_ | + Add-Member -MemberType ScriptProperty -Name UserName -Value { + '{0}\{1}' -f $this.GetOwner().Domain,$this.GetOwner().User + } -Force -PassThru +} $processes = Get-WmiObject Win32_Process -Filter "name = 'java.exe'" foreach($proc in $processes) @@ -16,6 +34,6 @@ foreach($proc in $processes) Write-Host "skipping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." } } -Get-Process firefox | Stop-Process -Get-Process chrome | Stop-Process -Get-Process iexplore | Stop-Process +Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process +Get-Process chrome -ErrorAction SilentlyContinue | Stop-Process +Get-Process iexplore -ErrorAction SilentlyContinue | Stop-Process From 8dbfed5d471a7c1cce9afd9bc8a509897e4af4e5 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 18:42:12 +0200 Subject: [PATCH 07/32] Additional tests --- src/ci/scripts/cleanup.ps1 | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 01d60d1d7..91e534e81 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -2,8 +2,10 @@ Powershell script for cleaning up remaining processes on the CI servers #> +$currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name +Write-Output "$currentUser" + Get-Process | Get-Member -Get-Process | Select-Object name,fileversion,productversion,company $View = @( @{l='Handles';e={$_.HandleCount}}, @@ -22,7 +24,9 @@ Get-WmiObject Win32_Process | % { $_ | } -Force -PassThru } -$processes = Get-WmiObject Win32_Process -Filter "name = 'java.exe'" + + +$processes = Get-WmiObject Win32_Process -Filter "name = 'java.exe'" | Where-Object {$_.GetOwner().User -eq $currentUser } foreach($proc in $processes) { if($proc.CommandLine.Contains("selenium-server.jar")) @@ -34,6 +38,14 @@ foreach($proc in $processes) Write-Host "skipping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." } } -Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process -Get-Process chrome -ErrorAction SilentlyContinue | Stop-Process -Get-Process iexplore -ErrorAction SilentlyContinue | Stop-Process + +Write-Output "Filter: name = '$procName'" +foreach ($procName in ['firefox.exe','ieplore.exe','chrome.exe']) +{ + $processes = Get-WmiObject Win32_Process -Filter "name = '$procName'" | Where-Object {$_.GetOwner().User -eq $currentUser } + foreach($proc in $processes) + { + Write-Host "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." + Stop-Process -F $proc.ProcessId + } +} From 1398d4115f8a27dc5d6e10e77a4c2d516ae90730 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 18:46:19 +0200 Subject: [PATCH 08/32] Additional tests --- src/ci/scripts/cleanup.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 91e534e81..31b9e21d2 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -40,7 +40,8 @@ foreach($proc in $processes) } Write-Output "Filter: name = '$procName'" -foreach ($procName in ['firefox.exe','ieplore.exe','chrome.exe']) +$browsers = "firefox.exe","iexplore.exe","chrome.exe" +foreach ($procName in $browsers) { $processes = Get-WmiObject Win32_Process -Filter "name = '$procName'" | Where-Object {$_.GetOwner().User -eq $currentUser } foreach($proc in $processes) From c8c68468e105fd5aa8e3082ae8831ad8f382e639 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 18:49:38 +0200 Subject: [PATCH 09/32] Additinal tests --- src/ci/scripts/cleanup.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 31b9e21d2..6ffd69465 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -3,7 +3,9 @@ #> $currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name -Write-Output "$currentUser" +Write-Output "User: $currentUser" +$currentUser = "$env:UserDomain\$env:UserName" +Write-Output "User2: $currentUser" Get-Process | Get-Member From d0adf96a83da1db8700c0ef248934ff689f473ce Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 20:14:00 +0200 Subject: [PATCH 10/32] Additional script modifications --- src/ci/scripts/cleanup.bat | 4 +++ src/ci/scripts/cleanup.ps1 | 53 +++++++++++++++++++++----------------- 2 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 src/ci/scripts/cleanup.bat diff --git a/src/ci/scripts/cleanup.bat b/src/ci/scripts/cleanup.bat new file mode 100644 index 000000000..2e74bf777 --- /dev/null +++ b/src/ci/scripts/cleanup.bat @@ -0,0 +1,4 @@ +@echo off +SET runpath=%~dp0 + +PowerShell.exe -NonInteractive -ExecutionPolicy bypass -File %runpath%src\ci\scripts\cleanup.ps1 %* diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 6ffd69465..cb3361fb8 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -1,30 +1,36 @@ <# - Powershell script for cleaning up remaining processes on the CI servers + Powershell script for cleaning up remaining browser and selenium server processes on the CI servers #> +param ( + [switch]$Verbose = $False, + [String[]]$Browsers = @("firefox.exe","iexplore.exe","chrome.exe") +) + $currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name Write-Output "User: $currentUser" -$currentUser = "$env:UserDomain\$env:UserName" -Write-Output "User2: $currentUser" -Get-Process | Get-Member - -$View = @( - @{l='Handles';e={$_.HandleCount}}, - @{l='NPM(K)';e={ (Get-Process -Id $_.ProcessId).NonpagedSystemMemorySize/1KB -as [int]}}, - @{l='PM(K)';e={ $_.PrivatePageCount/1KB -as [int]}}, - @{l='WS(K)';e={ $_.WorkingSetSize/1KB -as [int]}}, - @{l='VM(M)';e={ $_.VirtualSize/1mB -as [int]}}, - @{l='CPU(s)';e={ (Get-Process -Id $_.ProcessId).CPU -as [int]}}, - @{l='Id';e={ $_.ProcessId}}, - 'UserName' - @{l='ProcessName';e={ $_.ProcessName}} -) -Get-WmiObject Win32_Process | % { $_ | - Add-Member -MemberType ScriptProperty -Name UserName -Value { - '{0}\{1}' -f $this.GetOwner().Domain,$this.GetOwner().User - } -Force -PassThru -} +if ($Verbose) +{ + Get-Process | Get-Member + + $View = @( + @{l='Handles';e={$_.HandleCount}}, + @{l='NPM(K)';e={ (Get-Process -Id $_.ProcessId).NonpagedSystemMemorySize/1KB -as [int]}}, + @{l='PM(K)';e={ $_.PrivatePageCount/1KB -as [int]}}, + @{l='WS(K)';e={ $_.WorkingSetSize/1KB -as [int]}}, + @{l='VM(M)';e={ $_.VirtualSize/1mB -as [int]}}, + @{l='CPU(s)';e={ (Get-Process -Id $_.ProcessId).CPU -as [int]}}, + @{l='Id';e={ $_.ProcessId}}, + 'UserName' + @{l='ProcessName';e={ $_.ProcessName}} + ) + Get-WmiObject Win32_Process | % { $_ | + Add-Member -MemberType ScriptProperty -Name UserName -Value { + '{0}\{1}' -f $this.GetOwner().Domain,$this.GetOwner().User + } -Force -PassThru + } +} @@ -41,10 +47,9 @@ foreach($proc in $processes) } } -Write-Output "Filter: name = '$procName'" -$browsers = "firefox.exe","iexplore.exe","chrome.exe" -foreach ($procName in $browsers) +foreach ($procName in $Browsers) { + Write-Output "Filter: name = '$procName'" $processes = Get-WmiObject Win32_Process -Filter "name = '$procName'" | Where-Object {$_.GetOwner().User -eq $currentUser } foreach($proc in $processes) { From e7d055fa957648a62ad6a1c100b8f262dc68abd5 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 20:17:24 +0200 Subject: [PATCH 11/32] Fixing path --- src/ci/scripts/cleanup.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/scripts/cleanup.bat b/src/ci/scripts/cleanup.bat index 2e74bf777..fdb09df72 100644 --- a/src/ci/scripts/cleanup.bat +++ b/src/ci/scripts/cleanup.bat @@ -1,4 +1,4 @@ @echo off SET runpath=%~dp0 -PowerShell.exe -NonInteractive -ExecutionPolicy bypass -File %runpath%src\ci\scripts\cleanup.ps1 %* +PowerShell.exe -NonInteractive -ExecutionPolicy bypass -File %runpath%cleanup.ps1 %* From 6639ff3fda1122fa7cfa696fb71a5dea4ea60f15 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 20:45:03 +0200 Subject: [PATCH 12/32] Additional tests --- src/ci/scripts/cleanup.ps1 | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index cb3361fb8..46515855c 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -5,6 +5,7 @@ param ( [switch]$Verbose = $False, [String[]]$Browsers = @("firefox.exe","iexplore.exe","chrome.exe") + [String[]]$SeleniumProcesses = @("mshta.exe","java.exe") ) $currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name @@ -32,19 +33,20 @@ if ($Verbose) } } - - -$processes = Get-WmiObject Win32_Process -Filter "name = 'java.exe'" | Where-Object {$_.GetOwner().User -eq $currentUser } -foreach($proc in $processes) +foreach ($procName in $seleniumProcesses) { - if($proc.CommandLine.Contains("selenium-server.jar")) - { - Write-Host "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." - Stop-Process -F $proc.ProcessId - } else - { - Write-Host "skipping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." - } + $processes = Get-WmiObject Win32_Process -Filter "name = '$procName'" | Where-Object {$_.GetOwner().User -eq $currentUser } + foreach($proc in $processes) + { + if($proc.CommandLine.Contains("selenium-server")) + { + Write-Host "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." + Stop-Process -F $proc.ProcessId + } else + { + Write-Host "skipping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." + } + } } foreach ($procName in $Browsers) From 6d634f8fe3d84899fce4a6eb87dbd3ad1f543552 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 20:46:57 +0200 Subject: [PATCH 13/32] Fix --- src/ci/scripts/cleanup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 46515855c..0055940ec 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -4,7 +4,7 @@ param ( [switch]$Verbose = $False, - [String[]]$Browsers = @("firefox.exe","iexplore.exe","chrome.exe") + [String[]]$Browsers = @("firefox.exe","iexplore.exe","chrome.exe"), [String[]]$SeleniumProcesses = @("mshta.exe","java.exe") ) From 12cfcc3248c21279ebebaf3b3e2e5fec120f28bc Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 20:56:33 +0200 Subject: [PATCH 14/32] Fixes --- src/ci/scripts/cleanup.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 0055940ec..668905182 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -35,7 +35,13 @@ if ($Verbose) foreach ($procName in $seleniumProcesses) { + Write-Output "Filter: name = '$procName'" $processes = Get-WmiObject Win32_Process -Filter "name = '$procName'" | Where-Object {$_.GetOwner().User -eq $currentUser } + $processes2 = Get-WmiObject Win32_Process -Filter "name = '$procName'" + if ($Verbose) { + Write-Output "Processes $processes" + Write-Output "Processes2 $processes2" + } foreach($proc in $processes) { if($proc.CommandLine.Contains("selenium-server")) From e2bb56feeb8765c8a527badd0846f7f11936fdd4 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 21:02:29 +0200 Subject: [PATCH 15/32] Fix --- src/ci/scripts/cleanup.ps1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 668905182..1055a375f 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -1,6 +1,6 @@ -<# - Powershell script for cleaning up remaining browser and selenium server processes on the CI servers -#> +# +# Powershell script for cleaning up remaining browser and selenium server processes on the CI servers +# param ( [switch]$Verbose = $False, @@ -8,7 +8,8 @@ param ( [String[]]$SeleniumProcesses = @("mshta.exe","java.exe") ) -$currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name +# $currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name +$currentUser = $env:UserName Write-Output "User: $currentUser" if ($Verbose) From cc6420e6126e307ce9a97695a00029aef85a96ff Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 21:06:59 +0200 Subject: [PATCH 16/32] Fix --- src/ci/scripts/cleanup.ps1 | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 1055a375f..90228c659 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -37,22 +37,14 @@ if ($Verbose) foreach ($procName in $seleniumProcesses) { Write-Output "Filter: name = '$procName'" - $processes = Get-WmiObject Win32_Process -Filter "name = '$procName'" | Where-Object {$_.GetOwner().User -eq $currentUser } - $processes2 = Get-WmiObject Win32_Process -Filter "name = '$procName'" + $processes = Get-WmiObject Win32_Process -Filter "name = '$procName'" | Where-Object {$_.GetOwner().User -eq $currentUser } | Where-Object {$_.CommandLine -match "selenium-server"} if ($Verbose) { Write-Output "Processes $processes" - Write-Output "Processes2 $processes2" } foreach($proc in $processes) { - if($proc.CommandLine.Contains("selenium-server")) - { - Write-Host "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." - Stop-Process -F $proc.ProcessId - } else - { - Write-Host "skipping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." - } + Write-Host "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." + Stop-Process -F $proc.ProcessId } } From 4b5959c3cb9102b83e169a31b1adfec1ea84a4f8 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 21:14:09 +0200 Subject: [PATCH 17/32] Fixed output --- src/ci/scripts/cleanup.ps1 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 90228c659..24178697e 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -36,25 +36,26 @@ if ($Verbose) foreach ($procName in $seleniumProcesses) { - Write-Output "Filter: name = '$procName'" $processes = Get-WmiObject Win32_Process -Filter "name = '$procName'" | Where-Object {$_.GetOwner().User -eq $currentUser } | Where-Object {$_.CommandLine -match "selenium-server"} if ($Verbose) { - Write-Output "Processes $processes" + Write-Output "Filter: name = '$procName'" } foreach($proc in $processes) { - Write-Host "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." + Write-Output "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." Stop-Process -F $proc.ProcessId } } foreach ($procName in $Browsers) { - Write-Output "Filter: name = '$procName'" $processes = Get-WmiObject Win32_Process -Filter "name = '$procName'" | Where-Object {$_.GetOwner().User -eq $currentUser } + if ($Verbose) { + Write-Output "Filter: name = '$procName'" + } foreach($proc in $processes) { - Write-Host "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." + Write-Output "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..." Stop-Process -F $proc.ProcessId } } From 90529e1ab7aa59a31bd6984f2369c5075777ef20 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 30 Apr 2017 21:44:02 +0200 Subject: [PATCH 18/32] Adding license and documentation --- src/ci/scripts/cleanup.ps1 | 39 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/ci/scripts/cleanup.ps1 b/src/ci/scripts/cleanup.ps1 index 24178697e..fd709ed63 100644 --- a/src/ci/scripts/cleanup.ps1 +++ b/src/ci/scripts/cleanup.ps1 @@ -1,6 +1,41 @@ # -# Powershell script for cleaning up remaining browser and selenium server processes on the CI servers +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at # +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# +# Powershell script for cleaning up remaining browser and selenium server processes on the CI servers +# +# Author: Martin Stockhammer +# Date : 2017-04-30 +# +# Descriptions: +# Stopps processes related to the selenium checks, if they were not stopped by the selenium server, because +# the job was aborted. +# The script cannot determine, which of the processes are started by the current job, so if there are +# parallel jobs running on this server that start processes with the same name and user, these +# will be stopped too. +# +# Per default the script will stop "firefox.exe","iexplore.exe","chrome.exe" +# and the processes "java.exe","mshta.exe" if their commandline arguments contain "selenium-server" +# +# Parameters: +# -Verbose : If set, more output will be printed +# -Browsers proc1,proc2 : The list of executables that define the browser processes, that are started by selenium +# -SeleniumProcesses : The list of processes with the string "selenium-server" in the commandline arguments param ( [switch]$Verbose = $False, @@ -34,7 +69,7 @@ if ($Verbose) } } -foreach ($procName in $seleniumProcesses) +foreach ($procName in $SeleniumProcesses) { $processes = Get-WmiObject Win32_Process -Filter "name = '$procName'" | Where-Object {$_.GetOwner().User -eq $currentUser } | Where-Object {$_.CommandLine -match "selenium-server"} if ($Verbose) { From c6f5732af80a2888fbbac2a2af7916e018b1a345 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 17:56:30 +0200 Subject: [PATCH 19/32] Sync with current master --- archiva-cli/pom.xml | 2 +- archiva-docs/pom.xml | 2 +- .../apt/adminguide/configuration-files.apt.vm | 4 +- .../apt/adminguide/customising-security.apt | 56 +---- .../redback-runtime-configuration.apt | 4 +- .../src/site/apt/adminguide/repositories.apt | 193 ++++++++++-------- .../src/site/apt/release-notes.apt.vm | 19 +- archiva-docs/src/site/resources/css/site.css | 9 + archiva-jetty/pom.xml | 2 +- .../archiva-base/archiva-checksum/pom.xml | 2 +- .../archiva-base/archiva-common/pom.xml | 2 +- .../archiva-configuration/pom.xml | 4 +- .../DefaultArchivaConfiguration.java | 107 +++++++++- .../src/main/mdo/configuration.mdo | 62 +++++- .../archiva/configuration/default-archiva.xml | 14 +- .../ArchivaConfigurationTest.java | 1 - .../archiva-consumer-api/pom.xml | 2 +- .../archiva-consumer-archetype/pom.xml | 2 +- .../archiva-core-consumers/pom.xml | 2 +- .../archiva-lucene-consumers/pom.xml | 2 +- .../archiva-metadata-consumer/pom.xml | 2 +- .../archiva-signature-consumers/pom.xml | 2 +- .../archiva-base/archiva-consumers/pom.xml | 2 +- .../archiva-base/archiva-converter/pom.xml | 2 +- .../archiva-base/archiva-filelock/pom.xml | 2 +- .../archiva-base/archiva-indexer/pom.xml | 2 +- .../archiva-maven2-metadata/pom.xml | 2 +- .../archiva-base/archiva-maven2-model/pom.xml | 2 +- .../archiva-base/archiva-mock/pom.xml | 2 +- .../archiva-base/archiva-model/pom.xml | 2 +- .../archiva-plexus-bridge/pom.xml | 2 +- .../archiva-base/archiva-policies/pom.xml | 2 +- .../archiva-base/archiva-proxy-api/pom.xml | 2 +- .../archiva-base/archiva-proxy-common/pom.xml | 2 +- .../archiva-base/archiva-proxy/pom.xml | 2 +- .../archiva-repository-admin-api/pom.xml | 2 +- .../admin/model/beans/RemoteRepository.java | 29 ++- .../archiva-repository-admin-default/pom.xml | 2 +- .../remote/DefaultRemoteRepositoryAdmin.java | 17 +- .../archiva-repository-admin/pom.xml | 2 +- .../archiva-repository-layer/pom.xml | 2 +- .../archiva-repository-scanner/pom.xml | 2 +- .../archiva-security-common/pom.xml | 2 +- .../archiva-base/archiva-test-utils/pom.xml | 2 +- .../archiva-base/archiva-transaction/pom.xml | 2 +- .../archiva-base/archiva-xml-tools/pom.xml | 2 +- archiva-modules/archiva-base/pom.xml | 2 +- .../archiva-karaf/archiva-features/pom.xml | 2 +- archiva-modules/archiva-karaf/pom.xml | 2 +- .../archiva-scheduler-api/pom.xml | 2 +- .../archiva-scheduler-indexing/pom.xml | 2 +- .../archiva-scheduler-repository-api/pom.xml | 2 +- .../archiva-scheduler-repository/pom.xml | 2 +- archiva-modules/archiva-scheduler/pom.xml | 2 +- .../archiva-rest/archiva-rest-api/pom.xml | 2 +- .../archiva-rest-services/pom.xml | 2 +- .../DefaultRemoteRepositoriesService.java | 184 ++++++++--------- .../RemoteRepositoriesServiceTest.java | 52 +++++ .../archiva-web/archiva-rest/pom.xml | 2 +- .../archiva-web/archiva-rss/pom.xml | 2 +- .../archiva-web/archiva-security/pom.xml | 2 +- .../archiva-web/archiva-test-mocks/pom.xml | 2 +- .../archiva-web/archiva-web-common/pom.xml | 2 +- .../apache/archiva/i18n/default.properties | 10 +- .../archiva-web/archiva-webapp-test/pom.xml | 2 +- .../archiva-web/archiva-webapp/pom.xml | 2 +- .../admin/repository/maven2/repositories.js | 7 +- .../src/main/webapp/js/archiva/main.js | 22 +- .../js/templates/archiva/repositories.html | 14 ++ .../archiva-web/archiva-webdav/pom.xml | 2 +- archiva-modules/archiva-web/pom.xml | 2 +- .../metadata/metadata-model-maven2/pom.xml | 2 +- .../metadata/metadata-model/pom.xml | 2 +- .../metadata/metadata-repository-api/pom.xml | 2 +- archiva-modules/metadata/pom.xml | 2 +- .../metadata/test-repository/pom.xml | 2 +- archiva-modules/plugins/audit/pom.xml | 2 +- .../plugins/generic-metadata-support/pom.xml | 2 +- .../plugins/maven2-repository/pom.xml | 2 +- .../plugins/metadata-store-cassandra/pom.xml | 2 +- .../plugins/metadata-store-file/pom.xml | 2 +- .../plugins/metadata-store-jcr/pom.xml | 2 +- archiva-modules/plugins/pom.xml | 2 +- .../plugins/problem-reports/pom.xml | 2 +- .../plugins/repository-statistics/pom.xml | 2 +- .../plugins/stage-repository-merge/pom.xml | 2 +- archiva-modules/pom.xml | 4 +- pom.xml | 6 +- src/ci/scripts/cleanup.bat | 17 ++ 89 files changed, 623 insertions(+), 346 deletions(-) diff --git a/archiva-cli/pom.xml b/archiva-cli/pom.xml index 3f2a3f76e..24b1cc836 100644 --- a/archiva-cli/pom.xml +++ b/archiva-cli/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT 4.0.0 archiva-cli diff --git a/archiva-docs/pom.xml b/archiva-docs/pom.xml index d9df8025d..0780098ca 100644 --- a/archiva-docs/pom.xml +++ b/archiva-docs/pom.xml @@ -21,7 +21,7 @@ org.apache.archiva archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT 4.0.0 archiva-docs diff --git a/archiva-docs/src/site/apt/adminguide/configuration-files.apt.vm b/archiva-docs/src/site/apt/adminguide/configuration-files.apt.vm index 7b7fe8e55..22f17dc16 100644 --- a/archiva-docs/src/site/apt/adminguide/configuration-files.apt.vm +++ b/archiva-docs/src/site/apt/adminguide/configuration-files.apt.vm @@ -31,7 +31,9 @@ Configuration Files of Apache Archiva * <<>> - this is the primary Archiva configuration file - * <<>> - this configures the security as described in the {{{./security.html} security configuration documentation}} + * <<>> - This file, if it exists, is only read once to populate the + Redback Runtime Configuration properties (see {{{./redback-runtime-configuration.html#Runtime_Properties}Redback Runtime Configuration}}, + stored in <<>>. The file will be ignored after this. This section will focus on the <<>> file. diff --git a/archiva-docs/src/site/apt/adminguide/customising-security.apt b/archiva-docs/src/site/apt/adminguide/customising-security.apt index d42c2275c..797b2f309 100644 --- a/archiva-docs/src/site/apt/adminguide/customising-security.apt +++ b/archiva-docs/src/site/apt/adminguide/customising-security.apt @@ -27,66 +27,24 @@ Archiva Security Configuration - Security properties and password rules can be configured in the - <<>> file, which by default is searched for in: + Security properties and password rules are configured now in the Redback Runtime Configuration + properties (see {{{./redback-runtime-configuration.html#Runtime_properties}Redback Runtime Configuration}}). - * <<<~/.m2/security.properties>>> - - * <<>> in the Archiva installation + The Redback Runtime Configuration properties are stored in <<>>. + The former <<>> file, if it exists, is only used once for populating the + Runtime Configuration settings. After that, this file will be ignored. [] - (In the above list, <<<~>>> is the home directory of the user who is running - Archiva.) ~~TODO: Link to plexus-redback documentation when available - Following are some of the properties you can modify. For a complete list, - consult the default properties file in Redback's svn repo: + These are the default properties. The file can be found in in Redback's svn repo: {{{http://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk/redback-configuration/src/main/resources/org/apache/archiva/redback/config-defaults.properties} config-defaults.properties}} -+-----+ -# Security Policies -# ----------------- -#security.policy.password.encoder= -security.policy.password.previous.count=6 -security.policy.password.expiration.days=90 -security.policy.password.expiration.enabled=true -security.policy.allowed.login.attempt=3 +%{snippet|ignoreDownloadError=true|url=https://raw.githubusercontent.com/apache/archiva-redback-core/master/redback-configuration/src/main/resources/org/apache/archiva/redback/config-defaults.properties} -# Password Rules -# -------------- -security.policy.password.rule.alphanumeric.enabled=false -security.policy.password.rule.alphacount.enabled=true -security.policy.password.rule.alphacount.minimum=1 -security.policy.password.rule.characterlength.enabled=true -security.policy.password.rule.characterlength.minimum=1 -security.policy.password.rule.characterlength.maximum=8 -security.policy.password.rule.musthave.enabled=true -security.policy.password.rule.numericalcount.enabled=true -security.policy.password.rule.numericalcount.minimum=1 -security.policy.password.rule.reuse.enabled=true -security.policy.password.rule.nowhitespace.enabled=true - -# Cross Site Request Forgery (CSRF) Prevention -# -------------------------------------------- -# Enable/Disable CSRF filtering. -# Possible values: true, false -rest.csrffilter.enabled=true -# Base URL used to verify the origin headers of the requests. If not set or empty -# it tries to determine the base url automatically -rest.baseUrl= -# What to do, if the request contains no Origin or Referer header. -# If true, requests without Origin or Referer Header are denied, otherwise accepted. -# Possible values: true, false -rest.csrffilter.absentorigin.deny=true -# Enable/Disable the token validation only. -# If true, the validation of the CSRF tokens will be disabled. -# Possible values: true, false -rest.csrffilter.disableTokenValidation=false -+-----+ - <> If installed standalone, Archiva's list of configuration files is configurable, and can be found in: <<>> diff --git a/archiva-docs/src/site/apt/adminguide/redback-runtime-configuration.apt b/archiva-docs/src/site/apt/adminguide/redback-runtime-configuration.apt index 143589a34..7e000aa7e 100644 --- a/archiva-docs/src/site/apt/adminguide/redback-runtime-configuration.apt +++ b/archiva-docs/src/site/apt/adminguide/redback-runtime-configuration.apt @@ -29,7 +29,7 @@ Apache Archiva Redback Runtime Configuration * Apache Redback User Manager/RbacManager Implementations - Since 1.4-M4, you can choose to switch dynamically + You can choose to switch dynamically * User Manager Implementations (from Database and/or LDAP). @@ -49,7 +49,7 @@ Apache Archiva Redback Runtime Configuration * LDAP Group-Roles mapping - Since 1.4-M4, you can map dynamically LDAP Group to Archiva Roles + You can map dynamically LDAP Group to Archiva Roles [../images/ldap-group-roles-mapping.png] diff --git a/archiva-docs/src/site/apt/adminguide/repositories.apt b/archiva-docs/src/site/apt/adminguide/repositories.apt index 850b30a3d..7ec7753af 100644 --- a/archiva-docs/src/site/apt/adminguide/repositories.apt +++ b/archiva-docs/src/site/apt/adminguide/repositories.apt @@ -42,56 +42,58 @@ Understanding Repository Configuration of Apache Archiva Managed repository fields: - * <> - the id of the repository. This must be unique. - - * <> - the name of the repository. - - * <> - the location of the repository. If the path specified does not - exist, Archiva will create the missing directories. - - * <> - the location of the index files generated by Archiva. If - no location is specified, then the index directory (named <<<.indexer>>>) - will be created at the root of the repository directory. - This directory contains the packaged/bundled index which is consumed by different consumers of the index such as M2Eclipse. - - * <> - the repository layout (maven 2 or maven 1) - - * <> - the - {{{http://quartz-scheduler.org/api/2.1.5/org/quartz/CronTrigger.html}cron schedule}} when - repository scanning will be executed. - - * <> - the first option for repository purge. - Archiva will check how old the artifact is and if it is older than the set - number of days in this field, then the artifact will be deleted respecting - the retention count of course. In order to disable the purge by - number of days old and set Archiva to purge by retention count, just set the - repository purge field to 0. The maximum number of days which can be set - here is 1000. See the Repository Purge section below for more details. -~~ above was:the retention count (see #7) of course no idea what is was linkeed to - - * <> - the second option for repository - purge. When running the repository purge, Archiva will retain only the - number of artifacts set for this field for a specific snapshot version. See - the Repository Purge section below for more details. - - * <> - specifies whether there are released artifacts in the - repository. - - * <> - specifies whether released - artifacts that are already existing in the repository can be overwritten. - Note that this only take effects for non-snapshot deployments. - - * <> - specifies whether there are snapshot artifacts in the - repository. - - * <> - specifies whether the repository can be scanned, meaning it is - a local repository which can be indexed, browsed, purged, etc. - - * <> - specifies whether to remove those snapshot - artifacts which already has release versions of it in the repository during - repository purge. - - * << Skip Packed Index creation >> - avoid creation of compressed index for IDE usage. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The identifier of the repository. This must be unique. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The name of the repository. This is the display name. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The location of the repository. If the path specified does not +| | exist, Archiva will create the missing directories. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The location of the index files generated by Archiva. If +| | no location is specified, then the index directory (named <<<.indexer>>>) +| | will be created at the root of the repository directory. +| | This directory contains the packaged/bundled index which is consumed by different +| | consumers of the index such as M2Eclipse. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The repository layout (maven 2 or maven 1) +*----------------------+----------------------------------------------------------------------------------+ +| <> | The +| | {{{http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html}cron schedule}} +| | when repository scanning will be executed. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The first option for repository purge. +| | Archiva will check how old the artifact is and if it is older than the set +| | number of days in this field, then the artifact will be deleted respecting +| | the retention count of course. In order to disable the purge by +| | number of days old and set Archiva to purge by retention count, just set the +| | repository purge field to 0. The maximum number of days which can be set +| | here is 1000. See the Repository Purge section below for more details. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The second option for repository purge. When running the repository purge, +| | Archiva will retain only the number of artifacts set for this field for a +| | specific snapshot version. See the Repository Purge section below for more details. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Additional information about the repository. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Specifies whether there are released artifacts in the repository. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Specifies whether there are snapshot artifacts in the repository. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Specifies whether released artifacts that are already existing in the +| | repository can be overwritten. Note that this only take effects for non-snapshot +| | deployments. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Specifies whether the repository can be scanned, meaning it is a local repository +| | which should be indexed, purged, etc. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Specifies whether to remove those snapshot artifacts which already has +| | release versions of it in the repository during repository purge. +*----------------------+----------------------------------------------------------------------------------+ +| <>| Automatic creation of a stage repository for this local repository. +*----------------------+----------------------------------------------------------------------------------+ +|<< Skip Packed Index Creation>> | Avoid creation of compressed index for IDE usage. +*----------------------+----------------------------------------------------------------------------------+ [] @@ -119,46 +121,57 @@ http://[URL TO ARCHIVA]/repository/[REPOSITORY ID] (e.g. http://localhost:8080/r Remote repository fields: - * <> - the id of the remote repository. - - * <> - the name of the remote repository. - - * <> - the url of the remote repository. It is also possible to use a - 'file://' url to proxy a local repository. Be careful that if this local - repository is a managed repository of archiva which has some proxies - connectors, those ones won't be triggered. - - * <> - the username (if authentication is needed) to be used to access - the repository. - - * <> - the password (if authentication is needed) to be used to access - the repository. - - * <> - the layout (maven 2 or maven 1) of the remote repository. - - * <> - to activate downloading remote index to - add available remote artifacts in search queries. - - * <> - path of the remote index - directory. - - * <> - cron expression for downloading remote index (default - weekly on sunday) - - * <> - path to store index directory, default will be - $\{appserver.base\}/data/remotes/$\{repositoryId\}/.indexer - - * <> - read time out for downloading - remote index files (default 300) - - * <> - proxy to use for - downloading remote index files. - - * <> - will download remote index on Archiva startup. - - * <> - key/value pairs to add to url when querying remote repository. - - * <> - key/value pairs to add as http headers when querying remote repository. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The identifier of the remote repository. | +*----------------------+----------------------------------------------------------------------------------+ +| <> | The name of the remote repository. | +*----------------------+----------------------------------------------------------------------------------+ +| <> | The url of the remote repository. It is also possible to use a +| | 'file://' url to proxy a local repository. Be careful that if this local +| | repository is a managed repository of archiva which has some proxies +| | connectors, those ones won't be triggered. | +*----------------------+----------------------------------------------------------------------------------+ +| <> | The username (if authentication is needed) to be used to access +| | the repository. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The password (if authentication is needed) to be used to access +| | the repository. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The time in seconds after which a download from the remote repository is stopped. +*----------------------+----------------------------------------------------------------------------------+ +| <> | The layout (maven 2 or maven 1) of the remote repository. +*----------------------+----------------------------------------------------------------------------------+ +| <> | To activate downloading remote index to +| | add available remote artifacts in search queries. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Can be relative to Url - path of the remote index +| | directory. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Cron expression for downloading remote index (default +| | weekly on sunday) +*----------------------+----------------------------------------------------------------------------------+ +| <> | Path to store index directory, default will be +| | $\{appserver.base\}/data/remotes/$\{repositoryId\}/.indexer +*----------------------+----------------------------------------------------------------------------------+ +| <> | Time in seconds, after which download of remote index files will be +| | stopped (default 300). +*----------------------+----------------------------------------------------------------------------------+ +| <> | Proxy to use for downloading remote index files. +*----------------------+----------------------------------------------------------------------------------+ +| <> | If selected, the remote index will be downloaded on Archiva +| | startup. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Can be used to store additional information about the repository. +*----------------------+----------------------------------------------------------------------------------+ +| <> | If set, the connection to the remote repository is checked by validating the +| | existence of the given file / artifact. Some repositories do not allow to browse +| | the base directory and the standard check may fail. The path is relative to the +| | repository Url. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Key/Value pairs to add to url when querying remote repository. +*----------------------+----------------------------------------------------------------------------------+ +| <> | Key/Value pairs to add as http headers when querying remote repository. +*----------------------+----------------------------------------------------------------------------------+ [] diff --git a/archiva-docs/src/site/apt/release-notes.apt.vm b/archiva-docs/src/site/apt/release-notes.apt.vm index e89f9a432..c650c146a 100644 --- a/archiva-docs/src/site/apt/release-notes.apt.vm +++ b/archiva-docs/src/site/apt/release-notes.apt.vm @@ -48,11 +48,16 @@ Release Notes for Archiva ${project.version} and Referer header of the HTTP requests and adding an validation token to the Header. This prevents requests from malicious sites if they are open in the same browser. If you use the REST services from other clients you may change the behaviour with the new - configuration properties for the redback security (rest.csrffilter.*, rest.baseUrl) + configuration properties for the redback security (<<>>, <<>>). For more information see {{{./adminguide/customising-security.html}Archiva Security Configuration}} and - the {{{/redback/integration/rest.html}Redback REST documentation }} + the {{{/redback/integration/rest.html}Redback REST documentation }}. - * Archiva uses redback for authentication and authorization in version ${redback.version} + <> If your archiva installation is behind a reverse proxy or load balancer, it may be possible + that the Archiva Web UI does not load after the upgrade. If this is the case you may access the WebUI + via localhost or edit archiva.xml manually. In the "Redback Runtime Configuration" properties you have to + enter the base URLs of your archiva installation to the <<>> field. + + * Archiva uses redback for authentication and authorization in version 2.6 * Release Notes @@ -76,7 +81,7 @@ Release Notes for Archiva ${project.version} * Adding origin header validation checks for REST requests - ** Bugs fixed +** Bugs fixed * [MRM-1859] - Error upon viewing 'Artifacts' tab when browsing an artifact @@ -91,9 +96,13 @@ Release Notes for Archiva ${project.version} * [MRM-1926] - Invalid checksum files in Archiva repository after download from remote repository * [MRM-1928] - Bad redirect URL when using Archiva through HTTP reverse proxy + + * [MRM-1933] - No message body writer has been found for class org.apache.archiva.rest.services.ArchivaRestError + + * [MRM-1940] - Slashes appended to remote repo url - ** Task +** Task diff --git a/archiva-docs/src/site/resources/css/site.css b/archiva-docs/src/site/resources/css/site.css index 0a3ebda64..11f870b91 100755 --- a/archiva-docs/src/site/resources/css/site.css +++ b/archiva-docs/src/site/resources/css/site.css @@ -70,6 +70,15 @@ pre.commandline { color: gray; } +img { + border-style: solid ; + border-width: 1px; + border-color: #ddd; + padding: 5px; + margin-top: 10px; + border-radius: 5px; +} + pre.commandline .input { color: #55f; } diff --git a/archiva-jetty/pom.xml b/archiva-jetty/pom.xml index cebbe4ca5..e88f8e7fc 100644 --- a/archiva-jetty/pom.xml +++ b/archiva-jetty/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT archiva-jetty pom diff --git a/archiva-modules/archiva-base/archiva-checksum/pom.xml b/archiva-modules/archiva-base/archiva-checksum/pom.xml index 9c9b8e2be..280af2a85 100644 --- a/archiva-modules/archiva-base/archiva-checksum/pom.xml +++ b/archiva-modules/archiva-base/archiva-checksum/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT archiva-checksum bundle diff --git a/archiva-modules/archiva-base/archiva-common/pom.xml b/archiva-modules/archiva-base/archiva-common/pom.xml index 661400e5d..da59826b4 100644 --- a/archiva-modules/archiva-base/archiva-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-common/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT 4.0.0 archiva-common diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml index df5a1f2de..64c189a25 100644 --- a/archiva-modules/archiva-base/archiva-configuration/pom.xml +++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT 4.0.0 archiva-configuration @@ -169,7 +169,7 @@ - 1.4.1 + 1.4.2 src/main/mdo/configuration.mdo diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java index f37171afa..44f25212b 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java @@ -162,6 +162,9 @@ public class DefaultArchivaConfiguration private static final String KEY = "org.apache.archiva"; + // Section used for default only configuration + private static final String KEY_DEFAULT_ONLY = "org.apache.archiva_default"; + @Override public Configuration getConfiguration() { @@ -183,6 +186,11 @@ public class DefaultArchivaConfiguration return configuration; } + private boolean hasConfigVersionChanged(Configuration current, Registry defaultOnlyConfiguration) { + return current==null || current.getVersion()==null || + !current.getVersion().trim().equals(defaultOnlyConfiguration.getString("version","").trim()); + } + @SuppressWarnings("unchecked") private Configuration load() { @@ -200,6 +208,7 @@ public class DefaultArchivaConfiguration Configuration config = new ConfigurationRegistryReader().read( subset ); + config.getRepositoryGroups(); config.getRepositoryGroupsAsMap(); if ( !config.getRepositories().isEmpty() ) @@ -363,9 +372,63 @@ public class DefaultArchivaConfiguration } } + + return config; } + /* + * Updates the checkpath list for repositories. + * + * We are replacing existing ones and adding new ones. This allows to update the list with new releases. + * + * We are also updating existing remote repositories, if they exist already. + * + * This update method should only be called, if the config version changes to avoid overwriting + * user repository settings all the time. + */ + private void updateCheckPathDefaults(Configuration config, Registry defaultConfiguration) { + List existingCheckPathList = config.getArchivaDefaultConfiguration().getDefaultCheckPaths(); + HashMap existingCheckPaths = new HashMap<>(); + HashMap newCheckPaths = new HashMap<>(); + for (RepositoryCheckPath path : config.getArchivaDefaultConfiguration().getDefaultCheckPaths()) { + existingCheckPaths.put(path.getUrl(), path); + } + List defaultCheckPathsSubsets = defaultConfiguration.getSubsetList("archivaDefaultConfiguration.defaultCheckPaths.defaultCheckPath" ); + for ( Iterator i = defaultCheckPathsSubsets.iterator(); i.hasNext(); ) + { + RepositoryCheckPath v = readRepositoryCheckPath( (Registry) i.next() ); + if (existingCheckPaths.containsKey(v.getUrl())) { + existingCheckPathList.remove(existingCheckPaths.get(v.getUrl())); + } + existingCheckPathList.add(v); + newCheckPaths.put(v.getUrl(), v); + } + // Remote repositories update + for (RemoteRepositoryConfiguration remoteRepositoryConfiguration : config.getRemoteRepositories()) { + String url = remoteRepositoryConfiguration.getUrl().toLowerCase(); + if (newCheckPaths.containsKey(url)) { + String currentPath = remoteRepositoryConfiguration.getCheckPath(); + String newPath = newCheckPaths.get(url).getPath(); + log.info("Updating connection check path for repository {}, from '{}' to '{}'.", remoteRepositoryConfiguration.getId(), + currentPath, newPath); + remoteRepositoryConfiguration.setCheckPath(newPath); + } + } + } + + private RepositoryCheckPath readRepositoryCheckPath( Registry registry ) + { + RepositoryCheckPath value = new RepositoryCheckPath(); + + String url = registry.getString( "url", value.getUrl() ); + + value.setUrl( url ); + String path = registry.getString( "path", value.getPath() ); + value.setPath( path ); + return value; + } + private Policy findPolicy( String policyId ) { if ( MapUtils.isEmpty( prePolicies ) ) @@ -439,6 +502,25 @@ public class DefaultArchivaConfiguration return registry.getSubset( KEY ); } + /* + * Reads the default only configuration into a special prefix. This allows to check for changes + * of the default configuration. + */ + private Registry readDefaultOnlyConfiguration() + { + registry.removeSubset(KEY_DEFAULT_ONLY); + try + { + registry.addConfigurationFromResource( "org/apache/archiva/configuration/default-archiva.xml", KEY_DEFAULT_ONLY); + } + catch ( RegistryException e ) + { + throw new ConfigurationRuntimeException( + "Fatal error: Unable to find the built-in default configuration and load it into the registry", e ); + } + return registry.getSubset(KEY_DEFAULT_ONLY); + } + @SuppressWarnings("unchecked") @Override public synchronized void save( Configuration configuration ) @@ -527,6 +609,9 @@ public class DefaultArchivaConfiguration section.removeSubset( "repositoryScanning.invalidContentConsumers" ); } } + if (configuration.getArchivaRuntimeConfiguration()!=null) { + section.removeSubset("archivaRuntimeConfiguration.defaultCheckPaths"); + } new ConfigurationRegistryWriter().write( configuration, section ); section.save(); @@ -736,7 +821,7 @@ public class DefaultArchivaConfiguration } /** - * upgrade from 1.3 + * Handle upgrade to newer version */ private void handleUpgradeConfiguration() throws RegistryException, IndeterminateConfigurationException @@ -781,8 +866,24 @@ public class DefaultArchivaConfiguration knowContentConsumers.add( "duplicate-artifacts" ); configuration.getRepositoryScanning().setKnownContentConsumers( knowContentConsumers ); } - // save ?? - //save( configuration ); + + Registry defaultOnlyConfiguration = readDefaultOnlyConfiguration(); + // Currently we check only for configuration version change, not certain version numbers. + if (hasConfigVersionChanged(configuration, defaultOnlyConfiguration)) { + updateCheckPathDefaults(configuration, defaultOnlyConfiguration); + String newVersion = defaultOnlyConfiguration.getString("version"); + if (newVersion==null) { + throw new IndeterminateConfigurationException("The default configuration has no version information!"); + } + configuration.setVersion(newVersion); + try { + save(configuration); + } catch (IndeterminateConfigurationException e) { + log.error("Error occured during configuration update to new version: {}", e.getMessage()); + } catch (RegistryException e) { + log.error("Error occured during configuration update to new version: {}", e.getMessage()); + } + } } @Override diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index fc5169ff2..494af1204 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -197,6 +197,15 @@ The list of ProxyConnectorRuleConfigurations. + + archivaDefaultConfiguration + 1.4.2+ + + ArchivaDefaultConfiguration + 1 + + Archiva default settings. + @@ -597,12 +606,18 @@ extraHeaders 1.4.0+ Map - Additionnal http headers to add to url when requesting remote repositories. + Additional http headers to add to url when requesting remote repositories. String * + + checkPath + 1.4.2+ + String + The path to check the repository availability (relative to the repository URL). Some repositories do not allow browsing, so a certain artifact must be checked. + @@ -877,6 +892,30 @@ + + RepositoryCheckPath + 1.4.2+ + + + url + 1.4.2+ + String + true + + The URL for which this path should be used + + + + path + 1.4.2+ + String + true + + The path to use for checking the repository connection. + + + + diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml index cc4442230..e620e9ff6 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-rest - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT archiva-rest-services bundle diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java index 5a7948719..59358dddf 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java @@ -38,11 +38,14 @@ import org.apache.maven.wagon.proxy.ProxyInfo; import org.apache.maven.wagon.repository.Repository; import org.springframework.stereotype.Service; +import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.ws.rs.core.Response; import java.net.URL; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @author Olivier Lamy @@ -51,8 +54,7 @@ import java.util.List; @Service( "remoteRepositoriesService#rest" ) public class DefaultRemoteRepositoriesService extends AbstractRestService - implements RemoteRepositoriesService -{ + implements RemoteRepositoriesService { @Inject private RemoteRepositoryAdmin remoteRepositoryAdmin; @@ -67,32 +69,26 @@ public class DefaultRemoteRepositoriesService int checkReadTimeout = 10000; int checkTimeout = 9000; + @Override public List getRemoteRepositories() - throws ArchivaRestServiceException - { - try - { + throws ArchivaRestServiceException { + try { List remoteRepositories = remoteRepositoryAdmin.getRemoteRepositories(); return remoteRepositories == null ? Collections.emptyList() : remoteRepositories; - } - catch ( RepositoryAdminException e ) - { - log.error( e.getMessage(), e ); - throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); + } catch (RepositoryAdminException e) { + log.error(e.getMessage(), e); + throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e); } } @Override - public RemoteRepository getRemoteRepository( String repositoryId ) - throws ArchivaRestServiceException - { + public RemoteRepository getRemoteRepository(String repositoryId) + throws ArchivaRestServiceException { List remoteRepositories = getRemoteRepositories(); - for ( RemoteRepository repository : remoteRepositories ) - { - if ( StringUtils.equals( repositoryId, repository.getId() ) ) - { + for (RemoteRepository repository : remoteRepositories) { + if (StringUtils.equals(repositoryId, repository.getId())) { return repository; } } @@ -100,121 +96,106 @@ public class DefaultRemoteRepositoriesService } @Override - public Boolean deleteRemoteRepository( String repositoryId ) - throws ArchivaRestServiceException - { - try - { - return remoteRepositoryAdmin.deleteRemoteRepository( repositoryId, getAuditInformation() ); - } - catch ( RepositoryAdminException e ) - { - log.error( e.getMessage(), e ); - throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); + public Boolean deleteRemoteRepository(String repositoryId) + throws ArchivaRestServiceException { + try { + return remoteRepositoryAdmin.deleteRemoteRepository(repositoryId, getAuditInformation()); + } catch (RepositoryAdminException e) { + log.error(e.getMessage(), e); + throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e); } } @Override - public Boolean addRemoteRepository( RemoteRepository remoteRepository ) - throws ArchivaRestServiceException - { - try - { - return remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getAuditInformation() ); - } - catch ( RepositoryAdminException e ) - { - log.error( e.getMessage(), e ); - throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); + public Boolean addRemoteRepository(RemoteRepository remoteRepository) + throws ArchivaRestServiceException { + try { + return remoteRepositoryAdmin.addRemoteRepository(remoteRepository, getAuditInformation()); + } catch (RepositoryAdminException e) { + log.error(e.getMessage(), e); + throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e); } } @Override - public Boolean updateRemoteRepository( RemoteRepository remoteRepository ) - throws ArchivaRestServiceException - { - try - { - return remoteRepositoryAdmin.updateRemoteRepository( remoteRepository, getAuditInformation() ); - } - catch ( RepositoryAdminException e ) - { - log.error( e.getMessage(), e ); - throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); + public Boolean updateRemoteRepository(RemoteRepository remoteRepository) + throws ArchivaRestServiceException { + try { + return remoteRepositoryAdmin.updateRemoteRepository(remoteRepository, getAuditInformation()); + } catch (RepositoryAdminException e) { + log.error(e.getMessage(), e); + throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e); } } @Override - public Boolean checkRemoteConnectivity( String repositoryId ) - throws ArchivaRestServiceException - { - try - { - RemoteRepository remoteRepository = remoteRepositoryAdmin.getRemoteRepository( repositoryId ); - if ( remoteRepository == null ) - { - log.warn( "ignore scheduleDownloadRemote for repo with id {} as not exists", repositoryId ); + public Boolean checkRemoteConnectivity(String repositoryId) + throws ArchivaRestServiceException { + try { + RemoteRepository remoteRepository = remoteRepositoryAdmin.getRemoteRepository(repositoryId); + if (remoteRepository == null) { + log.warn("ignore scheduleDownloadRemote for repo with id {} as not exists", repositoryId); return Boolean.FALSE; } NetworkProxy networkProxy = null; - if ( StringUtils.isNotBlank( remoteRepository.getRemoteDownloadNetworkProxyId() ) ) - { - networkProxy = networkProxyAdmin.getNetworkProxy( remoteRepository.getRemoteDownloadNetworkProxyId() ); - if ( networkProxy == null ) - { + if (StringUtils.isNotBlank(remoteRepository.getRemoteDownloadNetworkProxyId())) { + networkProxy = networkProxyAdmin.getNetworkProxy(remoteRepository.getRemoteDownloadNetworkProxyId()); + if (networkProxy == null) { log.warn( - "your remote repository is configured to download remote index trought a proxy we cannot find id:{}", - remoteRepository.getRemoteDownloadNetworkProxyId() ); + "your remote repository is configured to download remote index trought a proxy we cannot find id:{}", + remoteRepository.getRemoteDownloadNetworkProxyId()); } } - String wagonProtocol = new URL( remoteRepository.getUrl() ).getProtocol(); + String wagonProtocol = new URL(remoteRepository.getUrl()).getProtocol(); final Wagon wagon = - wagonFactory.getWagon( new WagonFactoryRequest( wagonProtocol, remoteRepository.getExtraHeaders() ) // - .networkProxy( networkProxy ) ); + wagonFactory.getWagon(new WagonFactoryRequest(wagonProtocol, remoteRepository.getExtraHeaders()) // + .networkProxy(networkProxy)); // hardcoded value as it's a check of the remote repo connectivity - wagon.setReadTimeout( checkReadTimeout ); - wagon.setTimeout( checkTimeout ); + wagon.setReadTimeout(checkReadTimeout); + wagon.setTimeout(checkTimeout); - if ( wagon instanceof AbstractHttpClientWagon ) - { + if (wagon instanceof AbstractHttpClientWagon) { HttpMethodConfiguration httpMethodConfiguration = new HttpMethodConfiguration() // - .setUsePreemptive( true ) // - .setReadTimeout( checkReadTimeout ); - HttpConfiguration httpConfiguration = new HttpConfiguration().setGet( httpMethodConfiguration ); - AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration ); + .setUsePreemptive(true) // + .setReadTimeout(checkReadTimeout); + HttpConfiguration httpConfiguration = new HttpConfiguration().setGet(httpMethodConfiguration); + AbstractHttpClientWagon.class.cast(wagon).setHttpConfiguration(httpConfiguration); } - + ProxyInfo proxyInfo = null; - if ( networkProxy != null ) - { + if (networkProxy != null) { proxyInfo = new ProxyInfo(); - proxyInfo.setType( networkProxy.getProtocol() ); - proxyInfo.setHost( networkProxy.getHost() ); - proxyInfo.setPort( networkProxy.getPort() ); - proxyInfo.setUserName( networkProxy.getUsername() ); - proxyInfo.setPassword( networkProxy.getPassword() ); - } + proxyInfo.setType(networkProxy.getProtocol()); + proxyInfo.setHost(networkProxy.getHost()); + proxyInfo.setPort(networkProxy.getPort()); + proxyInfo.setUserName(networkProxy.getUsername()); + proxyInfo.setPassword(networkProxy.getPassword()); + } + String url = StringUtils.stripEnd(remoteRepository.getUrl(), "/"); + wagon.connect(new Repository(remoteRepository.getId(), url), proxyInfo); - wagon.connect( new Repository( remoteRepository.getId(), remoteRepository.getUrl() ), proxyInfo ); - - // we only check connectivity as remote repo can be empty - // MRM-1909: Wagon implementation appends a slash already - wagon.getFileList( "" ); + // MRM-1933, there are certain servers that do not allow browsing + if (!(StringUtils.isEmpty(remoteRepository.getCheckPath()) || + "/".equals(remoteRepository.getCheckPath()))) { + return wagon.resourceExists(remoteRepository.getCheckPath()); + } else { + // we only check connectivity as remote repo can be empty + // MRM-1909: Wagon implementation appends a slash already + wagon.getFileList(""); + } return Boolean.TRUE; - } - catch ( TransferFailedException e ) - { - log.info( "TransferFailedException :{}", e.getMessage() ); + } catch (TransferFailedException e) { + log.info("TransferFailedException :{}", e.getMessage()); + return Boolean.FALSE; + } catch (Exception e) { + // This service returns either true or false, Exception cannot be handled by the clients + log.debug("Exception occured on connectivity test.", e); + log.info("Connection exception: {}", e.getMessage()); return Boolean.FALSE; - } - catch ( Exception e ) - { - throw new ArchivaRestServiceException( e.getMessage(), - Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); } } @@ -234,4 +215,5 @@ public class DefaultRemoteRepositoriesService public void setCheckTimeout(int checkTimeout) { this.checkTimeout = checkTimeout; } + } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java index 3d284e452..d3d667283 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java @@ -161,10 +161,62 @@ public class RemoteRepositoriesServiceTest } + /* + * Check maven repository + */ + @Test + public void checkRemoteConnectivity2() + throws Exception { + RemoteRepositoriesService service = getRemoteRepositoriesService(); + + WebClient.client(service).header("Authorization", authorizationHeader); + + int initialSize = service.getRemoteRepositories().size(); + + service.addRemoteRepository(getRemoteMavenRepository()); + + assertTrue(service.checkRemoteConnectivity("id-maven1")); + + } + + + /* + * Check oracle repository that allows not browsing (MRM-1933) + */ + @Test + public void checkRemoteConnectivity3() + throws Exception { + RemoteRepositoriesService service = getRemoteRepositoriesService(); + + WebClient.client(service).header("Authorization", authorizationHeader); + WebClient.client(service).accept("application/json"); + + int initialSize = service.getRemoteRepositories().size(); + + service.addRemoteRepository(getRemoteOracleRepository()); + + assertTrue(service.checkRemoteConnectivity("id-oracle")); + + } + RemoteRepository getRemoteRepository() { return new RemoteRepository( "id-new", "new one", "http://foo.com", "default", "foo", "foopassword", 120, "cool repo" ); } + + RemoteRepository getRemoteMavenRepository() + { + return new RemoteRepository( "id-maven1", "Maven1", "http://repo.maven.apache.org/maven2", "default", "foo", "foopassword", 120, + "cool repo3" ); + } + + + RemoteRepository getRemoteOracleRepository() + { + return new RemoteRepository( "id-oracle", "Oracle", "http://download.oracle.com/maven", "default", "foo", "foopassword", 120, + "cool repo4" ); + } + } diff --git a/archiva-modules/archiva-web/archiva-rest/pom.xml b/archiva-modules/archiva-web/archiva-rest/pom.xml index 821ff19fc..7a80c0145 100644 --- a/archiva-modules/archiva-web/archiva-rest/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-web - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT archiva-rest Archiva Web :: REST support diff --git a/archiva-modules/archiva-web/archiva-rss/pom.xml b/archiva-modules/archiva-web/archiva-rss/pom.xml index ed1e17d6c..78f20e333 100644 --- a/archiva-modules/archiva-web/archiva-rss/pom.xml +++ b/archiva-modules/archiva-web/archiva-rss/pom.xml @@ -22,7 +22,7 @@ archiva-web org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT 4.0.0 archiva-rss diff --git a/archiva-modules/archiva-web/archiva-security/pom.xml b/archiva-modules/archiva-web/archiva-security/pom.xml index 66aa53b72..14fccff7c 100644 --- a/archiva-modules/archiva-web/archiva-security/pom.xml +++ b/archiva-modules/archiva-web/archiva-security/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-web - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT 4.0.0 archiva-security diff --git a/archiva-modules/archiva-web/archiva-test-mocks/pom.xml b/archiva-modules/archiva-web/archiva-test-mocks/pom.xml index f751fcc2a..1f97a6911 100644 --- a/archiva-modules/archiva-web/archiva-test-mocks/pom.xml +++ b/archiva-modules/archiva-web/archiva-test-mocks/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-web - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT archiva-test-mocks diff --git a/archiva-modules/archiva-web/archiva-web-common/pom.xml b/archiva-modules/archiva-web/archiva-web-common/pom.xml index 6d9c94c15..beeaa3e6a 100644 --- a/archiva-modules/archiva-web/archiva-web-common/pom.xml +++ b/archiva-modules/archiva-web/archiva-web-common/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-web - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT archiva-web-common diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index e8013c5b3..122db4f3d 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -172,8 +172,9 @@ remoterepository.download.remote.full=Full download ? remoterepository.download.remote.scheduled=Download Remote Index of repository {0} scheduled. remoterepository.delete.confirm=Are you sure to delete Remote Repository {0} ? remoterepository.deleted=Remote repository {0}\u00c2\u00a0deleted. -remoteRepository.extraParametersEntries=Additionnal url parameters -remoteRepository.extraHeadersEntries=Additionnal Http Headers +remoteRepository.extraParametersEntries=Additional url parameters +remoteRepository.extraHeadersEntries=Additional Http Headers +remoteRepository.checkPath=Connection Check Path remoteRepository.timeout.help.title=Download Timeout remoteRepository.timeout.help.content=Timeout in secondes for downloading files from remote repository. remoteRepository.userName.help.title=Username @@ -197,6 +198,11 @@ remoteRepository.extraParametersEntries.help.content=Key/Value pair you want to remoteRepository.extraHeadersEntries.help.title=Extra HTTP Headers remoteRepository.extraHeadersEntries.help.content=Key/Value pair HTTP headers you want to add when asking the remote repository. remoterepository.remotecheck=Remote Check +remoteRepository.checkPath.help.title=Connection Check Path +remoteRepository.checkPath.help.content=Path relative to the repository URL that is used to check the connection to the \ + remote repository. Some repositories may not allow to browse the root directory. So if this path is set, the repository is \ + considered online if the resources exists. + diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml index cd01dc44f..ecff6b481 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-web - 2.2.2-SNAPSHOT + 2.2.3-SNAPSHOT archiva-webapp-test pom diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 135c5ad41..7ae0c6548 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-web - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT archiva-webapp war diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js index 3a6cb5ff3..abfb373b3 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js @@ -692,7 +692,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { RemoteRepository=function(id,name,layout,indexDirectory,url,userName,password,timeout,downloadRemoteIndex,remoteIndexUrl, remoteDownloadNetworkProxyId,cronExpression,remoteDownloadTimeout,downloadRemoteIndexOnStartup, - description,extraParametersEntries,extraHeadersEntries){ + description,extraParametersEntries,extraHeadersEntries,checkPath){ var self=this; @@ -774,6 +774,9 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { self.modified(true); }); + this.checkPath=ko.observable(checkPath); + this.checkPath.subscribe(function(newValue){self.modified(true)}); + this.modified=ko.observable(false); } @@ -799,7 +802,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { return new RemoteRepository(data.id,data.name,data.layout,data.indexDirectory,data.url,data.userName,data.password, data.timeout,data.downloadRemoteIndex,data.remoteIndexUrl,data.remoteDownloadNetworkProxyId, data.cronExpression,data.remoteDownloadTimeout,data.downloadRemoteIndexOnStartup,data.description, - extraParametersEntries,extraHeadersEntries); + extraParametersEntries,extraHeadersEntries,data.checkPath); } mapRemoteRepositories=function(data){ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index 4085d4438..c047c2da8 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -861,17 +861,19 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa }; addValidationTokenHeader=function(user) { - if (user.validationToken) { - $.log("Adding validation token "+user.validationToken); - $.ajaxSetup({ - beforeSend: function (xhr) { - xhr.setRequestHeader('X-XSRF-TOKEN', user.validationToken); - } - }); - } else { - $.log("No validation token in user object "+user.username+", "+user.validationToken); + if(user) { + if (user.validationToken) { + $.log("Adding validation token "+user.validationToken); + $.ajaxSetup({ + beforeSend: function (xhr) { + xhr.setRequestHeader('X-XSRF-TOKEN', user.validationToken); + } + }); + } else { + $.log("No validation token in user object "+user.username+", "+user.validationToken); + } } - } + }; startArchivaApplication=function(){ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html index 3d16cf84f..c23158e95 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html @@ -733,6 +733,20 @@ +
+ + +
+ + + + +
+
+
${$.i18n.prop('remoteRepository.extraParametersEntries')} diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml index 6e7bf6f8d..e3962231e 100644 --- a/archiva-modules/archiva-web/archiva-webdav/pom.xml +++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-web - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT archiva-webdav diff --git a/archiva-modules/archiva-web/pom.xml b/archiva-modules/archiva-web/pom.xml index 99535ff93..8f9099e47 100644 --- a/archiva-modules/archiva-web/pom.xml +++ b/archiva-modules/archiva-web/pom.xml @@ -19,7 +19,7 @@ org.apache.archiva archiva-modules - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT archiva-web diff --git a/archiva-modules/metadata/metadata-model-maven2/pom.xml b/archiva-modules/metadata/metadata-model-maven2/pom.xml index 654230a9a..b9451f523 100644 --- a/archiva-modules/metadata/metadata-model-maven2/pom.xml +++ b/archiva-modules/metadata/metadata-model-maven2/pom.xml @@ -22,7 +22,7 @@ metadata org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT metadata-model-maven2 bundle diff --git a/archiva-modules/metadata/metadata-model/pom.xml b/archiva-modules/metadata/metadata-model/pom.xml index fc04c4efa..b67476284 100644 --- a/archiva-modules/metadata/metadata-model/pom.xml +++ b/archiva-modules/metadata/metadata-model/pom.xml @@ -22,7 +22,7 @@ metadata org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT metadata-model bundle diff --git a/archiva-modules/metadata/metadata-repository-api/pom.xml b/archiva-modules/metadata/metadata-repository-api/pom.xml index 0b6c062c1..49974a055 100644 --- a/archiva-modules/metadata/metadata-repository-api/pom.xml +++ b/archiva-modules/metadata/metadata-repository-api/pom.xml @@ -22,7 +22,7 @@ metadata org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT metadata-repository-api bundle diff --git a/archiva-modules/metadata/pom.xml b/archiva-modules/metadata/pom.xml index 29e144b58..d15dc4669 100644 --- a/archiva-modules/metadata/pom.xml +++ b/archiva-modules/metadata/pom.xml @@ -22,7 +22,7 @@ archiva-modules org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT metadata Archiva :: Metadata diff --git a/archiva-modules/metadata/test-repository/pom.xml b/archiva-modules/metadata/test-repository/pom.xml index 5bdecb71c..78ef855d8 100644 --- a/archiva-modules/metadata/test-repository/pom.xml +++ b/archiva-modules/metadata/test-repository/pom.xml @@ -22,7 +22,7 @@ metadata org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT test-repository Archiva Metadata :: Repository for Testing diff --git a/archiva-modules/plugins/audit/pom.xml b/archiva-modules/plugins/audit/pom.xml index 68b6c7461..d7d5a58c3 100644 --- a/archiva-modules/plugins/audit/pom.xml +++ b/archiva-modules/plugins/audit/pom.xml @@ -22,7 +22,7 @@ plugins org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT audit bundle diff --git a/archiva-modules/plugins/generic-metadata-support/pom.xml b/archiva-modules/plugins/generic-metadata-support/pom.xml index 8b247aaa5..3a6054c72 100644 --- a/archiva-modules/plugins/generic-metadata-support/pom.xml +++ b/archiva-modules/plugins/generic-metadata-support/pom.xml @@ -22,7 +22,7 @@ plugins org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT generic-metadata-support bundle diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index eeadf463d..8065fd931 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva plugins - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT maven2-repository bundle diff --git a/archiva-modules/plugins/metadata-store-cassandra/pom.xml b/archiva-modules/plugins/metadata-store-cassandra/pom.xml index 0fed09618..73334590d 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/pom.xml +++ b/archiva-modules/plugins/metadata-store-cassandra/pom.xml @@ -23,7 +23,7 @@ plugins org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT metadata-store-cassandra bundle diff --git a/archiva-modules/plugins/metadata-store-file/pom.xml b/archiva-modules/plugins/metadata-store-file/pom.xml index 3b23e9c7b..9ac964d07 100644 --- a/archiva-modules/plugins/metadata-store-file/pom.xml +++ b/archiva-modules/plugins/metadata-store-file/pom.xml @@ -22,7 +22,7 @@ plugins org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT metadata-store-file bundle diff --git a/archiva-modules/plugins/metadata-store-jcr/pom.xml b/archiva-modules/plugins/metadata-store-jcr/pom.xml index 9f38f6ae0..f47643652 100644 --- a/archiva-modules/plugins/metadata-store-jcr/pom.xml +++ b/archiva-modules/plugins/metadata-store-jcr/pom.xml @@ -23,7 +23,7 @@ plugins org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT metadata-store-jcr bundle diff --git a/archiva-modules/plugins/pom.xml b/archiva-modules/plugins/pom.xml index 73407577b..837dba98d 100644 --- a/archiva-modules/plugins/pom.xml +++ b/archiva-modules/plugins/pom.xml @@ -22,7 +22,7 @@ archiva-modules org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT plugins Archiva :: Core Plugins diff --git a/archiva-modules/plugins/problem-reports/pom.xml b/archiva-modules/plugins/problem-reports/pom.xml index d11a1ba12..989344e66 100644 --- a/archiva-modules/plugins/problem-reports/pom.xml +++ b/archiva-modules/plugins/problem-reports/pom.xml @@ -22,7 +22,7 @@ plugins org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT problem-reports bundle diff --git a/archiva-modules/plugins/repository-statistics/pom.xml b/archiva-modules/plugins/repository-statistics/pom.xml index 3be6caee5..dc2f40c6d 100644 --- a/archiva-modules/plugins/repository-statistics/pom.xml +++ b/archiva-modules/plugins/repository-statistics/pom.xml @@ -22,7 +22,7 @@ plugins org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT repository-statistics bundle diff --git a/archiva-modules/plugins/stage-repository-merge/pom.xml b/archiva-modules/plugins/stage-repository-merge/pom.xml index 8686e2b2d..3b099e72c 100644 --- a/archiva-modules/plugins/stage-repository-merge/pom.xml +++ b/archiva-modules/plugins/stage-repository-merge/pom.xml @@ -22,7 +22,7 @@ plugins org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT org.apache.archiva stage-repository-merge diff --git a/archiva-modules/pom.xml b/archiva-modules/pom.xml index ecf5809a2..a16b3eba2 100644 --- a/archiva-modules/pom.xml +++ b/archiva-modules/pom.xml @@ -21,7 +21,7 @@ archiva org.apache.archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT 4.0.0 archiva-modules @@ -98,7 +98,7 @@ false true - 1.5 + 1.7 http://java.sun.com/j2se/1.5.0/docs/api http://commons.apache.org/collections/apidocs-COLLECTIONS_3_0/ diff --git a/pom.xml b/pom.xml index 554c35e73..8063b4820 100644 --- a/pom.xml +++ b/pom.xml @@ -23,11 +23,11 @@ org.apache.archiva archiva-parent - 18-SNAPSHOT + 18 archiva - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT pom Apache Archiva @@ -61,7 +61,7 @@ 2.1 5.1.1 2.9 - 2.6-SNAPSHOT + 2.6 2.2 2.1 2.4 diff --git a/src/ci/scripts/cleanup.bat b/src/ci/scripts/cleanup.bat index fdb09df72..bcfdd2a2a 100644 --- a/src/ci/scripts/cleanup.bat +++ b/src/ci/scripts/cleanup.bat @@ -1,4 +1,21 @@ @echo off +REM Licensed to the Apache Software Foundation (ASF) under one +REM or more contributor license agreements. See the NOTICE file +REM distributed with this work for additional information +REM regarding copyright ownership. The ASF licenses this file +REM to you under the Apache License, Version 2.0 (the +REM "License"); you may not use this file except in compliance +REM with the License. You may obtain a copy of the License at +REM +REM http://www.apache.org/licenses/LICENSE-2.0 +REM +REM Unless required by applicable law or agreed to in writing, +REM software distributed under the License is distributed on an +REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +REM KIND, either express or implied. See the License for the +REM specific language governing permissions and limitations +REM under the License. + SET runpath=%~dp0 PowerShell.exe -NonInteractive -ExecutionPolicy bypass -File %runpath%cleanup.ps1 %* From 49c5ab8962630e33dade28c7adb384e4983cabeb Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 18:20:18 +0200 Subject: [PATCH 20/32] First test --- src/ci/scripts/updateSeleniumDrivers.ps1 | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/ci/scripts/updateSeleniumDrivers.ps1 diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 new file mode 100644 index 000000000..98dc123a9 --- /dev/null +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -0,0 +1,39 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# +# Powershell script updating Selenium drivers on ci server +# +# Author: Martin Stockhammer +# Date : 2017-04-30 +# +# Description: + + +$url = "http://selenium-release.storage.googleapis.com/2.53/IEDriverServer_x64_2.53.1.zip" +$downloadFile = "C:\jenkins\tools\iedriver\2.53.1\win64\IEDriverServer_x64_2.53.1.zip" +$downloadDir = Split-Path $downloadFile -Parent + +if(!(Test-Path -Path $downloadDir )){ + New-Item -ItemType directory -Path $downloadFile + +} +if !(Test-Path -Path $downloadFile )){ + Invoke-WebRequest -Uri $url -OutFile $downloadFile +} + From a81e31ddd75d20095c83f7f06a292b72c7701243 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 18:22:13 +0200 Subject: [PATCH 21/32] Fixing script --- src/ci/scripts/updateSeleniumDrivers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 index 98dc123a9..f5e9b20c7 100644 --- a/src/ci/scripts/updateSeleniumDrivers.ps1 +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -33,7 +33,7 @@ if(!(Test-Path -Path $downloadDir )){ New-Item -ItemType directory -Path $downloadFile } -if !(Test-Path -Path $downloadFile )){ +if (!(Test-Path -Path $downloadFile )){ Invoke-WebRequest -Uri $url -OutFile $downloadFile } From 6ff7f00992037377b23fcba0506e780d00221524 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 20:32:54 +0200 Subject: [PATCH 22/32] Test --- src/ci/scripts/updateSeleniumDrivers.ps1 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 index f5e9b20c7..81e986cbb 100644 --- a/src/ci/scripts/updateSeleniumDrivers.ps1 +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -20,10 +20,18 @@ # Powershell script updating Selenium drivers on ci server # # Author: Martin Stockhammer -# Date : 2017-04-30 +# Date : 2017-05-14 # # Description: +$psVersion = $PSVersionTable.PSVersion + +Write-Output "PS-Version: $psVersion" + +param ( + [switch]$Verbose = $False, + [switch]$Force = $False +) $url = "http://selenium-release.storage.googleapis.com/2.53/IEDriverServer_x64_2.53.1.zip" $downloadFile = "C:\jenkins\tools\iedriver\2.53.1\win64\IEDriverServer_x64_2.53.1.zip" @@ -33,7 +41,8 @@ if(!(Test-Path -Path $downloadDir )){ New-Item -ItemType directory -Path $downloadFile } -if (!(Test-Path -Path $downloadFile )){ +if ($Force -Or !(Test-Path -Path $downloadFile )){ Invoke-WebRequest -Uri $url -OutFile $downloadFile + Expand-Archive $downloadFile -DestinationPath $downloadDir } From ec6cb02afc2552a81871f7f02ece7dad30432cd0 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 20:37:22 +0200 Subject: [PATCH 23/32] Test --- src/ci/scripts/updateSeleniumDrivers.ps1 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 index 81e986cbb..9e5047dc9 100644 --- a/src/ci/scripts/updateSeleniumDrivers.ps1 +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -24,15 +24,17 @@ # # Description: -$psVersion = $PSVersionTable.PSVersion - -Write-Output "PS-Version: $psVersion" - param ( [switch]$Verbose = $False, [switch]$Force = $False ) +$psVersion = $PSVersionTable.PSVersion + +Write-Output "PS-Version: $psVersion" + + + $url = "http://selenium-release.storage.googleapis.com/2.53/IEDriverServer_x64_2.53.1.zip" $downloadFile = "C:\jenkins\tools\iedriver\2.53.1\win64\IEDriverServer_x64_2.53.1.zip" $downloadDir = Split-Path $downloadFile -Parent @@ -43,6 +45,6 @@ if(!(Test-Path -Path $downloadDir )){ } if ($Force -Or !(Test-Path -Path $downloadFile )){ Invoke-WebRequest -Uri $url -OutFile $downloadFile - Expand-Archive $downloadFile -DestinationPath $downloadDir + [System.IO.Compression.ZipFile]::ExtractToDirectory($downloadFile, $downloadDir) } From a28e1363adfd597ceb1466fe6a732af8f700b325 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 20:43:47 +0200 Subject: [PATCH 24/32] Test --- src/ci/scripts/updateSeleniumDrivers.ps1 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 index 9e5047dc9..79752ba73 100644 --- a/src/ci/scripts/updateSeleniumDrivers.ps1 +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -43,8 +43,17 @@ if(!(Test-Path -Path $downloadDir )){ New-Item -ItemType directory -Path $downloadFile } -if ($Force -Or !(Test-Path -Path $downloadFile )){ - Invoke-WebRequest -Uri $url -OutFile $downloadFile - [System.IO.Compression.ZipFile]::ExtractToDirectory($downloadFile, $downloadDir) +if ($Force -And (Test-Path -Path $downloadFile ) ) { + Remove-Item $downloadFile +} + +if ($Force -Or !(Test-Path -Path $downloadFile )){ + Invoke-WebRequest -Uri $url -OutFile $downloadFile + + $shell = New-Object -ComObject shell.application + $zip = $shell.NameSpace($downloadFile) + foreach ($item in $zip.items()) { + $shell.Namespace($downloadDir).CopyHere($item) + } } From 7d0d6fcf56121fa89904d3122d2a5fac7c4f949c Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 20:57:11 +0200 Subject: [PATCH 25/32] Test --- src/ci/scripts/updateSeleniumDrivers.ps1 | 50 +++++++++++++++--------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 index 79752ba73..a711d5e9f 100644 --- a/src/ci/scripts/updateSeleniumDrivers.ps1 +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -33,27 +33,39 @@ $psVersion = $PSVersionTable.PSVersion Write-Output "PS-Version: $psVersion" - - -$url = "http://selenium-release.storage.googleapis.com/2.53/IEDriverServer_x64_2.53.1.zip" -$downloadFile = "C:\jenkins\tools\iedriver\2.53.1\win64\IEDriverServer_x64_2.53.1.zip" -$downloadDir = Split-Path $downloadFile -Parent - -if(!(Test-Path -Path $downloadDir )){ - New-Item -ItemType directory -Path $downloadFile - -} -if ($Force -And (Test-Path -Path $downloadFile ) ) { - Remove-Item $downloadFile +$urls = @{ + "iedriver\2.53.1\win64\DriverServer.zip"="http://selenium-release.storage.googleapis.com/2.53/IEDriverServer_x64_2.53.1.zip" + "iedriver\2.53.1\win32\DriverServer.zip"="http://selenium-release.storage.googleapis.com/2.53/IEDriverServer_Win32_2.53.1.zip" + "iedriver\3.4.0\win64\DriverServer.zip"="http://selenium-release.storage.googleapis.com/3.4/IEDriverServer_x64_3.4.0.zip" + "iedriver\3.4.0\win32\DriverServer.zip"="http://selenium-release.storage.googleapis.com/3.4/IEDriverServer_Win32_3.4.0.zip" + "chromedriver\2.29\win32\DriverServer.zip"="https://chromedriver.storage.googleapis.com/2.29/chromedriver_win32.zip" + "geckodriver\0.16.1\win32\DriverServer.zip"="https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-win32.zip" + "geckodriver\0.16.1\win64\DriverServer.zip"="https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-win64.zip" } -if ($Force -Or !(Test-Path -Path $downloadFile )){ - Invoke-WebRequest -Uri $url -OutFile $downloadFile +foreach ($h in $urls.GetEnumerator()) { + $url = $h.Value + $downloadFile = "C:\jenkins\tools\$($h.Name)" + $downloadDir = Split-Path $downloadFile -Parent + + if(!(Test-Path -Path $downloadDir )){ + New-Item -ItemType directory -Path $downloadFile - $shell = New-Object -ComObject shell.application - $zip = $shell.NameSpace($downloadFile) - foreach ($item in $zip.items()) { - $shell.Namespace($downloadDir).CopyHere($item) } -} + if ($Force -And (Test-Path -Path $downloadFile ) ) { + Remove-Item $downloadFile + } + if ($Force -Or !(Test-Path -Path $downloadFile )){ + Invoke-WebRequest -Uri $url -OutFile $downloadFile + + $shell = New-Object -ComObject shell.application + $zip = $shell.NameSpace($downloadFile) + foreach ($item in $zip.items()) { + $shell.Namespace($downloadDir).CopyHere($item) + } + + Write-Output "Driver $($h.Value)" + Get-ChildItem -Path $downloadDir + } +} \ No newline at end of file From c54e39dba633d426ed71a02ec6c866cc4442c72a Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 21:07:16 +0200 Subject: [PATCH 26/32] Test --- src/ci/scripts/updateSeleniumDrivers.ps1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 index a711d5e9f..f96d5fb6f 100644 --- a/src/ci/scripts/updateSeleniumDrivers.ps1 +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -38,22 +38,23 @@ $urls = @{ "iedriver\2.53.1\win32\DriverServer.zip"="http://selenium-release.storage.googleapis.com/2.53/IEDriverServer_Win32_2.53.1.zip" "iedriver\3.4.0\win64\DriverServer.zip"="http://selenium-release.storage.googleapis.com/3.4/IEDriverServer_x64_3.4.0.zip" "iedriver\3.4.0\win32\DriverServer.zip"="http://selenium-release.storage.googleapis.com/3.4/IEDriverServer_Win32_3.4.0.zip" - "chromedriver\2.29\win32\DriverServer.zip"="https://chromedriver.storage.googleapis.com/2.29/chromedriver_win32.zip" - "geckodriver\0.16.1\win32\DriverServer.zip"="https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-win32.zip" - "geckodriver\0.16.1\win64\DriverServer.zip"="https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-win64.zip" + "chromedriver\2.29\win32\DriverServer.zip"="http://chromedriver.storage.googleapis.com/2.29/chromedriver_win32.zip" + "geckodriver\0.16.1\win32\DriverServer.zip"="http://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-win32.zip" + "geckodriver\0.16.1\win64\DriverServer.zip"="http://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0.16.1-win64.zip" } foreach ($h in $urls.GetEnumerator()) { $url = $h.Value + Write-Output "Driver $url" $downloadFile = "C:\jenkins\tools\$($h.Name)" $downloadDir = Split-Path $downloadFile -Parent + if ($Force -And (Test-Path -Path $downloadFile ) ) { + Remove-Item $downloadDir\* -recurse + } + if(!(Test-Path -Path $downloadDir )){ New-Item -ItemType directory -Path $downloadFile - - } - if ($Force -And (Test-Path -Path $downloadFile ) ) { - Remove-Item $downloadFile } if ($Force -Or !(Test-Path -Path $downloadFile )){ @@ -65,7 +66,6 @@ foreach ($h in $urls.GetEnumerator()) { $shell.Namespace($downloadDir).CopyHere($item) } - Write-Output "Driver $($h.Value)" Get-ChildItem -Path $downloadDir } } \ No newline at end of file From 73bef5cf08ff9ba67555c8bb8ab0a58d3c407cf8 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 21:14:36 +0200 Subject: [PATCH 27/32] Test --- src/ci/scripts/updateSeleniumDrivers.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 index f96d5fb6f..a4380224d 100644 --- a/src/ci/scripts/updateSeleniumDrivers.ps1 +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -32,6 +32,7 @@ param ( $psVersion = $PSVersionTable.PSVersion Write-Output "PS-Version: $psVersion" +Write-Output "Verbose: $Verbose, Force: $Force" $urls = @{ "iedriver\2.53.1\win64\DriverServer.zip"="http://selenium-release.storage.googleapis.com/2.53/IEDriverServer_x64_2.53.1.zip" @@ -49,8 +50,8 @@ foreach ($h in $urls.GetEnumerator()) { $downloadFile = "C:\jenkins\tools\$($h.Name)" $downloadDir = Split-Path $downloadFile -Parent - if ($Force -And (Test-Path -Path $downloadFile ) ) { - Remove-Item $downloadDir\* -recurse + if ($Force -And (Test-Path -Path $downloadDir ) ) { + Get-ChildItem -Path $downloadDir -Recurse | Remove-Item -force -recurse } if(!(Test-Path -Path $downloadDir )){ From 912c8adf57298b81f2fab79925cbc4da6f4101f1 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 21:30:15 +0200 Subject: [PATCH 28/32] Test --- src/ci/scripts/updateSeleniumDrivers.ps1 | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 index a4380224d..896bca047 100644 --- a/src/ci/scripts/updateSeleniumDrivers.ps1 +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -23,6 +23,13 @@ # Date : 2017-05-14 # # Description: +# This script checks, if the selenium drivers are available on the system and downloads +# and extracts them, if they do not exist. +# +# Parameter: +# -Verbose: Print additional output +# -Force: Remove the existing drivers and download/extract them again + param ( [switch]$Verbose = $False, @@ -30,9 +37,12 @@ param ( ) $psVersion = $PSVersionTable.PSVersion +$baseDir = "F:\jenkins\tools" -Write-Output "PS-Version: $psVersion" -Write-Output "Verbose: $Verbose, Force: $Force" +if ($Verbose) { + Write-Output "PS-Version: $psVersion" + Write-Output "Verbose: $Verbose, Force: $Force" +} $urls = @{ "iedriver\2.53.1\win64\DriverServer.zip"="http://selenium-release.storage.googleapis.com/2.53/IEDriverServer_x64_2.53.1.zip" @@ -46,8 +56,8 @@ $urls = @{ foreach ($h in $urls.GetEnumerator()) { $url = $h.Value - Write-Output "Driver $url" - $downloadFile = "C:\jenkins\tools\$($h.Name)" + Write-Output "Downloading Driver $url" + $downloadFile = "$($baseDir)\$($h.Name)" $downloadDir = Split-Path $downloadFile -Parent if ($Force -And (Test-Path -Path $downloadDir ) ) { @@ -66,7 +76,8 @@ foreach ($h in $urls.GetEnumerator()) { foreach ($item in $zip.items()) { $shell.Namespace($downloadDir).CopyHere($item) } - - Get-ChildItem -Path $downloadDir + if ($Verbose) { + Get-ChildItem -Path $downloadDir + } } } \ No newline at end of file From 8068da8c9eab2b3aec639a5ba14eb174baf047ca Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 21:36:39 +0200 Subject: [PATCH 29/32] Test --- pom.xml | 2 +- src/ci/scripts/updateSeleniumDrivers.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8063b4820..ffa5cafe9 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-parent - 18 + 19-SNAPSHOT archiva diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 index 896bca047..090fc47c8 100644 --- a/src/ci/scripts/updateSeleniumDrivers.ps1 +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -65,7 +65,7 @@ foreach ($h in $urls.GetEnumerator()) { } if(!(Test-Path -Path $downloadDir )){ - New-Item -ItemType directory -Path $downloadFile + New-Item -ItemType directory -Path $downloadDir } if ($Force -Or !(Test-Path -Path $downloadFile )){ From ff4a0a097c9e3488f8d9cfa5e86470ba3f786338 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 14 May 2017 21:39:24 +0200 Subject: [PATCH 30/32] Test --- archiva-modules/archiva-web/archiva-webapp-test/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml index ecff6b481..21070f8e5 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-web - 2.2.3-SNAPSHOT + 2.2.4-SNAPSHOT archiva-webapp-test pom From e7d742c23c951af46f156f88f172545f2a458548 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Mon, 15 May 2017 21:16:42 +0200 Subject: [PATCH 31/32] Code cleanup --- src/ci/scripts/updateSeleniumDrivers.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/scripts/updateSeleniumDrivers.ps1 b/src/ci/scripts/updateSeleniumDrivers.ps1 index 090fc47c8..888637b42 100644 --- a/src/ci/scripts/updateSeleniumDrivers.ps1 +++ b/src/ci/scripts/updateSeleniumDrivers.ps1 @@ -56,7 +56,6 @@ $urls = @{ foreach ($h in $urls.GetEnumerator()) { $url = $h.Value - Write-Output "Downloading Driver $url" $downloadFile = "$($baseDir)\$($h.Name)" $downloadDir = Split-Path $downloadFile -Parent @@ -69,6 +68,7 @@ foreach ($h in $urls.GetEnumerator()) { } if ($Force -Or !(Test-Path -Path $downloadFile )){ + Write-Output "Downloading Driver $url" Invoke-WebRequest -Uri $url -OutFile $downloadFile $shell = New-Object -ComObject shell.application From 34537981480019ac4741913a7cd2666bf6700e3b Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Mon, 15 May 2017 21:17:35 +0200 Subject: [PATCH 32/32] Changing redback dependency to SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ffa5cafe9..3cd2c8b4e 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 2.1 5.1.1 2.9 - 2.6 + 2.7-SNAPSHOT 2.2 2.1 2.4