-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathazure-pipelines.yml
44 lines (42 loc) · 1.25 KB
/
azure-pipelines.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
jobs:
- job: Windows
pool:
vmImage: 'windows-2019'
steps:
- pwsh: docker build -t pomelofoundation/mysql-windows:8-ltsc2019 .
displayName: Build Image
- pwsh: |
docker run `
-d `
--name "mysql" `
-e "MYSQL_ROOT_PASSWORD=test" `
-p "3306:3306" `
pomelofoundation/mysql-windows:8-ltsc2019
$started=$false
For ($i=0; $i -le 240; $i++) {
$status = (docker container inspect mysql --format '{{ .State.Status }}')
if ($status -eq "exited") {
break
}
docker exec mysql mysqladmin -h localhost -P 3306 -u root -ptest status
if ($LastExitCode -eq 0) {
$started=$true
break
}
Start-Sleep 1
}
docker logs mysql
if (!$started) {
Write-Error "mysql container failed to start in 240 seconds"
exit 1
}
errorActionPreference: continue
displayName: Test Image
- task: Docker@2
displayName: Push Image
inputs:
containerRegistry: DockerHub
repository: pomelofoundation/mysql-windows
command: push
tags: 8-ltsc2019
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranchName'], 'master') )