forked from Marklogic-retired/marklogic-data-hub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
78 lines (71 loc) · 2.71 KB
/
appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
version: 1.0.{build}
branches:
only:
- master
image: WMF 5
environment:
ML_USER:
secure: nioOZ/YaPcyFoqN9bVZHMllinShpPT+lG1uyi78H23c=
ML_PASSWORD:
secure: LaFtKimqM2zAtGUkciP5RA==
ML_VERSION: 8.0-5.8
install:
- ps: >-
function HttpPost($cookieContainer, $url, $postData) {
$uri = New-Object "System.Uri" "$url"
$webrequest = [System.Net.HTTPWebRequest]::Create($uri)
$webrequest.CookieContainer = $cookieContainer
$webrequest.ContentType = "application/x-www-form-urlencoded"
$webrequest.Method = "POST"
$encoding = New-Object System.Text.ASCIIEncoding
$bytes = $encoding.GetBytes($postData)
$webrequest.ContentLength = $bytes.Length
$newStream = $webrequest.GetRequestStream()
$newStream.Write($bytes, 0, $bytes.Length)
$response = $webrequest.GetResponse().GetResponseStream()
$sr = New-Object System.IO.StreamReader($response)
$respTxt = $sr.ReadToEnd()
$sr.Close()
$response.Dispose()
return $respTxt
}
function downloadFile($cookieContainer, $url, $targetFile) {
$cookie = $cookieContainer.GetCookies("https://developer.marklogic.com")[0]
$cookieTxt = $cookie.NAME + "=" + $cookie.Value
$wc = New-Object System.Net.WebClient
$wc.Headers.Add([System.Net.HttpRequestHeader]::Cookie, $cookieTxt)
$wc.DownloadFile($url, $targetFile)
}
$cookieContainer = New-Object System.Net.CookieContainer
$email = $env:ML_USER
$password = $env:ML_PASSWORD
$loginData = "email=$email&password=$password"
# Login
$url = "https://developer.marklogic.com/login"
$response = HttpPost $cookieContainer $url $loginData
# Get Download url
$ver = $env:ML_VERSION
$fname = "MarkLogic-$ver-amd64.msi"
$url = "https://developer.marklogic.com/get-download-url"
$postData = "download=/download/binaries/8.0/$fname"
$response = HttpPost $cookieContainer $url $postData
$json = $response | ConvertFrom-Json
$downloadLink = $json.path
$downloadLink = "https://developer.marklogic.com$downloadLink"
# Download File
downloadFile $cookieContainer $downloadLink "$PSScriptRoot\$fname"
msiexec /i "$PSScriptRoot\$fname" /quiet /qn /norestart /log install.log
Start-Sleep -s 90
cat .\install.log
Start-Service -displayname "MarkLogic"
HttpPost $cookieContainer "http://localhost:8001/admin/v1/init" ""
Start-Sleep -s 10
$postData = "admin-username=admin&admin-password=admin&realm=public"
HttpPost $cookieContainer "http://localhost:8001/admin/v1/instance-admin" $postData
Start-Sleep -s 10
build: off
test_script:
- ps: >-
c:
cd \projects\marklogic-data-hub
.\gradlew.bat test