forked from appveyor/build-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
122 lines (112 loc) · 3.98 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# This YAML instructs Appveyor to build images of different OSes on different Clouds
image: ubuntu
environment:
matrix:
- TEMPLATE: ws2019
CLOUD: Azure
- TEMPLATE: vs2019
CLOUD: Azure
- TEMPLATE: ubuntu1804
CLOUD: Azure
- TEMPLATE: ubuntu1604
CLOUD: Azure
- TEMPLATE: ws2019
CLOUD: GCE
- TEMPLATE: vs2019
CLOUD: GCE
- TEMPLATE: ubuntu1804
CLOUD: GCE
- TEMPLATE: ubuntu1604
CLOUD: GCE
- TEMPLATE: ubuntu1804
CLOUD: AWS
- TEMPLATE: ubuntu1604
CLOUD: AWS
init:
- appveyor version
- sh: echo $APPVEYOR_BUILD_WORKER_IMAGE
- sh: echo $APPVEYOR_BUILD_WORKER_CLOUD
- sh: |
should_exit=false
if [[ "$SKIP_TEMPLATE" =~ $TEMPLATE ]]; then
appveyor AddMessage "Skipped due to SKIP_TEMPLATE='$SKIP_TEMPLATE'" -Category Information
should_exit=true
fi
if [[ "$SKIP_CLOUD" =~ $CLOUD ]]; then
appveyor AddMessage "Skipped due to SKIP_CLOUD='$SKIP_CLOUD'" -Category Information
should_exit=true
fi
if [[ "$should_exit" = true ]]; then
appveyor exit
fi
- sh: |
# get latest docker container if Version not provided
if [ -z "${BUILD_CONTAINER_BUILD_VERSION}" ]; then
export BUILD_CONTAINER_BUILD_VERSION=latest
fi
- sh: |
#init azure cli
az login --service-principal -u ${azure_client_id} -p ${azure_client_secret} --tenant ${azure_tenant_id} &> /dev/null
az account set --subscription ${azure_subscription_id}
sleep 5
build_script:
- sh: |
CONTAINER_ENVS=( )
CONTAINER_SECURE_ENVS=( )
- sh: |
# prepare variables for different Clouds
case "${CLOUD}" in
Azure )
builders=azure-arm
build_agent_mode=Azure
CONTAINER_ENVS+=( "azure_location=${azure_location}" )
CONTAINER_ENVS+=( "azure_resource_group_name=${azure_resource_group_name}" )
CONTAINER_ENVS+=( "azure_storage_account=${azure_storage_account}" )
CONTAINER_SECURE_ENVS+=( "azure_client_id=${azure_client_id}" )
CONTAINER_SECURE_ENVS+=( "azure_client_secret=${azure_client_secret}" )
CONTAINER_SECURE_ENVS+=( "azure_subscription_id=${azure_subscription_id}" )
;;
GCE )
builders=googlecompute
build_agent_mode=GCE
CONTAINER_ENVS+=( "gce_zone=${gce_zone}" )
CONTAINER_ENVS+=( "gce_project=${gce_project}" )
CONTAINER_SECURE_ENVS+=( "gce_account_file=${gce_account_file}" )
;;
AWS )
builders=amazon-ebs
build_agent_mode=AmazonEC2
CONTAINER_SECURE_ENVS+=( "aws_access_key=${aws_access_key}" )
CONTAINER_SECURE_ENVS+=( "aws_secret_key=${aws_secret_key}" )
CONTAINER_SECURE_ENVS+=( "aws_region=${aws_region}" )
CONTAINER_SECURE_ENVS+=( "aws_security_group_id=${aws_security_group_id}" )
CONTAINER_SECURE_ENVS+=( "aws_subnet_id=${aws_subnet_id}" )
;;
esac
- sh: |
if [[ -n ${slackhook_url} ]]; then
CONTAINER_SECURE_ENVS+=( slackhook_url=${slackhook_url} )
fi
- sh: |
# start baking image in West US region
az container create -g test-westus \
--name bake-${CLOUD,,}-${TEMPLATE}-image \
--image appveyor/build-images:${BUILD_CONTAINER_BUILD_VERSION} \
--cpu 1 --memory 2 --restart-policy Never \
--azure-file-volume-account-name ${packer_logs_storage_account_name} \
--azure-file-volume-account-key ${packer_logs_storage_account_key} \
--azure-file-volume-share-name packer-logs \
--azure-file-volume-mount-path /mnt/packer-logs \
--environment-variables \
"${CONTAINER_ENVS[@]}" \
install_user=${install_user} \
install_password=${install_password} \
build_agent_mode=${build_agent_mode} \
APPVEYOR_BUILD_AGENT_VERSION=${APPVEYOR_BUILD_AGENT_VERSION} \
"packer_custom_args=${packer_custom_args}" \
builders=${builders} \
TEMPLATE=${TEMPLATE} \
--secure-environment-variables \
"${CONTAINER_SECURE_ENVS[@]}" \
appveyor_password=${appveyor_password}
test: off