-
Notifications
You must be signed in to change notification settings - Fork 70
/
appveyor-container.yml
47 lines (40 loc) · 1.63 KB
/
appveyor-container.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
# This YAML instruct Appveyor to build and publish Docker container
image: ubuntu
init:
- echo SKIP_TEMPLATE=${SKIP_TEMPLATE}
- echo SKIP_CLOUD=${SKIP_CLOUD}
build_script:
- ps: |
# packer requires add_ssh_known_hosts.ps1
$AddhostsScriptPath = [io.path]::combine($env:APPVEYOR_BUILD_FOLDER, "scripts", "Ubuntu", "add_ssh_known_hosts.ps1")
$AddhostsScriptUrl = 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enterprise/add_ssh_known_hosts.ps1'
(New-Object Net.WebClient).DownloadFile($AddhostsScriptUrl, $AddhostsScriptPath)
if (-Not(Test-Path -Path $AddhostsScriptPath)) {
echo "[ERROR] There is no add_ssh_known_hosts.ps1 file. Aborting build."
exit 10
}
- docker build -t appveyor/build-images:${APPVEYOR_BUILD_VERSION} .
deploy_script:
# publish image
- docker login -u ${DOCKER_USER} -p ${DOCKER_PWD}
- docker push appveyor/build-images:${APPVEYOR_BUILD_VERSION}
on_success:
- ps: |
$token = $env:APPVEYOR_TOKEN
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
$body = @{
accountName="appveyor"
projectSlug="build-images"
branch=$env:APPVEYOR_REPO_BRANCH
environmentVariables = @{
BUILD_CONTAINER_JOB_ID=$env:APPVEYOR_JOB_ID
BUILD_CONTAINER_BUILD_VERSION=$env:APPVEYOR_BUILD_VERSION
SKIP_TEMPLATE=$env:SKIP_TEMPLATE
SKIP_CLOUD=$env:SKIP_CLOUD
}
}
$body = $body | ConvertTo-Json
Invoke-RestMethod -Uri 'https://ci.appveyor.com/api/builds' -Headers $headers -Body $body -Method POST