forked from pawelgrzeda/packer-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci-windows-1803.yml
92 lines (92 loc) · 3.71 KB
/
ci-windows-1803.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
---
description: Travis CI Windows 1803 Core (for containers) build env template
variables:
gce_account_file: "{{ env `GCE_ACCOUNT_FILE` }}"
gce_project_id: "{{ env `GCE_PROJECT_ID` }}"
gce_image_family: "windows-1803-core-for-containers"
image_name: travis-ci-windows-1803-containers-{{ timestamp }}-<%= git_desc %>
dist_name: 1803-containers
travis_cookbooks_branch: "{{ env `TRAVIS_COOKBOOKS_BRANCH` }}"
travis_cookbooks_edge_branch: master
travis_cookbooks_sha: "{{ env `TRAVIS_COOKBOOKS_SHA` }}"
travis_uid: "{{ env `TRAVIS_UID` }}"
builders:
- type: googlecompute
name: googlecompute
communicator: winrm
winrm_username: travis
winrm_use_ssl: true
winrm_insecure: true
image_description: Travis CI Windows 1803 Core (for containers)
account_file: "{{ user `gce_account_file` }}"
project_id: "{{ user `gce_project_id` }}"
source_image_family: "{{ user `gce_image_family` }}"
zone: us-central1-a
image_name: "{{ user `image_name` }}"
machine_type: n1-standard-4
disk_size: 100
metadata:
windows-startup-script-cmd: "winrm quickconfig -quiet & net user /add travis & net localgroup administrators travis /add & winrm set winrm/config/service/auth @{Basic=\"true\"} & powershell -Command \"& {Set-ExecutionPolicy AllSigned -Force}\""
tags:
- ci
- windows
- windows-1803
- travis-ci-packer-templates
state_timeout: 10m
provisioners:
- type: file
source: tmp/git-meta
destination: c:/windows/temp/
- type: file
source: packer-assets/windows-server-1803-packages.txt
destination: c:/windows/temp/packages.txt
- type: file
source: packer-scripts/Run-BashScript.ps1
destination: c:/windows/temp/Run-BashScript.ps1
- type: powershell
scripts:
- packer-scripts/Bootstrap-Windows.ps1
environment_vars:
- "JOB_BOARD_REGISTER_FILE=c:/travis-job-board-register.yml"
- "SYSTEM_INFO_JSON=c:/travis_system_info.json"
- type: powershell
scripts:
- packer-scripts/packer-env-dump
- packer-scripts/clone-travis-cookbooks
environment_vars:
- CHEF_TMP=/c/windows/temp/chef-stuff
- GIT_META_DIR=/c/windows/temp/git-meta
- PACKER_ENV_DIR=/c/.packer-env
- TRAVIS_COOKBOOKS_BRANCH={{ user `travis_cookbooks_branch` }}
- TRAVIS_COOKBOOKS_SHA={{ user `travis_cookbooks_sha` }}
execute_command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. {{.Vars}}; & c:/windows/temp/Run-BashScript.ps1 -bashscript '{{.Path}}'; exit $LastExitCode }"
- type: powershell
scripts:
# TODO: write job board data via chef
- packer-scripts/create-windows-job-board-data
- packer-scripts/create-image-metadata-tarball
environment_vars:
- "IMAGE_METADATA_TARBALL=/c/windows/temp/image-metadata-{{ user `image_name` }}.tar.bz2"
- JOB_BOARD_REGISTER_FILE=/c/travis-job-board-register.yml
- JOB_BOARD_IMAGE_DIST={{ user `dist_name` }}
- PACKER_ENV_DIR=/c/.packer-env
- SYSTEM_INFO_JSON=/c/travis_system_info.json
- TMPDIR=/c/windows/temp
- NODE_ATTRIBUTES_YML=/c/.node-attributes.yml
- RSPEC_JSON_DIR=/c/Users/travis
- DPKG_MANIFEST_JSON=/c/.dpkg-manifest.json
- BIN_LIB_CHECKSUMS=/c/.bin-lib.SHA256SUMS
execute_command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. {{.Vars}}; & c:/windows/temp/Run-BashScript.ps1 -bashscript '{{.Path}}'; exit $LastExitCode }"
- type: file
source: "c:/windows/temp/image-metadata-{{ user `image_name` }}.tar.bz2"
destination: tmp/image-metadata-{{ user `image_name` }}.tar.bz2
direction: download
post-processors:
-
- type: shell-local
script: bin/job-board-register
environment_vars:
- IMAGE_NAME={{ user `image_name` }}
-
- type: shell-local
script: bin/write-latest-image-name