Skip to content

Add support for Windows 2019 #694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ci-windows-1803.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ 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` }}"
Expand All @@ -20,7 +19,7 @@ builders:
image_description: Travis CI Windows 1803 Core (for containers)
account_file: "{{ user `gce_account_file` }}"
project_id: "{{ user `gce_project_id` }}"
source_image: "{{ user `gce_image_family` }}"
source_image_family: windows-1803-core-for-containers
zone: us-central1-a
image_name: "{{ user `image_name` }}"
machine_type: n1-standard-4
Expand Down
91 changes: 91 additions & 0 deletions ci-windows-2019.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
description: Travis CI Windows 2019 (for containers) build env template
variables:
gce_account_file: "{{ env `GCE_ACCOUNT_FILE` }}"
gce_project_id: "{{ env `GCE_PROJECT_ID` }}"
image_name: travis-ci-windows-2019-containers-{{ timestamp }}-<%= git_desc %>
dist_name: 2019-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 2019 (for containers)
account_file: "{{ user `gce_account_file` }}"
project_id: "{{ user `gce_project_id` }}"
source_image_family: windows-2019-for-containers
zone: us-central1-a
image_name: "{{ user `image_name` }}"
machine_type: n1-standard-4
disk_size: 70
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-2019
- 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-2019-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
4 changes: 4 additions & 0 deletions cookbooks/travis_ci_windows_2019/.rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--color
--format documentation
--require support
--order rand
4 changes: 4 additions & 0 deletions cookbooks/travis_ci_windows_2019/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
travis_ci_windows_2019 Cookbook
========================

A wrapper cookbook for the Windows 2019 CI image.
70 changes: 70 additions & 0 deletions cookbooks/travis_ci_windows_2019/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# frozen_string_literal: true

override['travis_java']['default_version'] = ''
override['travis_java']['alternate_versions'] = []

override['travis_phpenv']['prerequisite_recipes'] = []
override['travis_phpbuild']['prerequisite_recipes'] = []

override['travis_perlbrew']['perls'] = []
override['travis_perlbrew']['modules'] = []
override['travis_perlbrew']['prerequisite_packages'] = []

gimme_versions = %w[
1.7.4
]

override['travis_build_environment']['gimme']['versions'] = gimme_versions
override['travis_build_environment']['gimme']['default_version'] = gimme_versions.max

override['travis_build_environment']['pythons'] = []
override['travis_build_environment']['python_aliases'] = {}
override['travis_build_environment']['pip']['packages'] = {}
override['travis_build_environment']['system_python']['pythons'] = []

override['travis_build_environment']['nodejs_default'] = ''
override['travis_build_environment']['nodejs_versions'] = []
override['travis_build_environment']['nodejs_aliases'] = {}
override['travis_build_environment']['nodejs_default_modules'] = []

override['travis_system_info']['commands_file'] = \
'/var/tmp/onion-system-info-commands.yml'

rubies = %w[
2.2.7
2.4.1
]

override['travis_build_environment']['default_ruby'] = rubies.max
override['travis_build_environment']['rubies'] = rubies
override['travis_build_environment']['php_versions'] = []
override['travis_build_environment']['php_aliases'] = {}
override['travis_build_environment']['otp_releases'] = []
override['travis_build_environment']['elixir_versions'] = []
override['travis_build_environment']['default_elixir_version'] = ''
override['travis_build_environment']['hhvm_enabled'] = false
override['travis_build_environment']['update_hostname'] = false
override['travis_build_environment']['use_tmpfs_for_builds'] = false
override['travis_build_environment']['install_gometalinter_tools'] = false
override['travis_build_environment']['mercurial_install_type'] = 'pip'
override['travis_build_environment']['mercurial_version'] = '4.2.2~trusty1'

override['travis_packer_templates']['job_board']['stack'] = 'onion'
override['travis_packer_templates']['job_board']['features'] = %w[
basic
disabled-ipv6
docker
docker-compose
go-toolchain
perl_interpreter
perlbrew
python_interpreter
ruby_interpreter
]
override['travis_packer_templates']['job_board']['languages'] = %w[
__windows_1803__
bash
minimal
sh
shell
]
20 changes: 20 additions & 0 deletions cookbooks/travis_ci_windows_2019/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

name 'travis_ci_windows_2019'
maintainer 'Travis CI GmbH'
maintainer_email '[email protected]'
license 'MIT'
description 'Installs/Configures travis_ci_windows_2019'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
source_url 'https://github.com/travis-ci/packer-templates'
issues_url 'https://github.com/travis-ci/packer-templates/issues'

# TODO: wat
## depends 'travis_build_environment'
## depends 'travis_docker'
## depends 'travis_java'
## depends 'travis_packer_templates'
## depends 'travis_perlbrew'
## depends 'travis_postgresql'
## depends 'travis_system_info'
27 changes: 27 additions & 0 deletions cookbooks/travis_ci_windows_2019/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

# Cookbook Name:: travis_ci_windows_2019
# Recipe:: default
#
# Copyright 2017, Travis CI GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

directory 'c:\\travis'
20 changes: 20 additions & 0 deletions packer-assets/windows-server-2019-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
7zip.install
cmake.install --installargs 'ADD_CMAKE_TO_PATH=System'
curl
git.install
gnuwin32-make.portable
hashdeep
jq
llvm
mingw
rsync
ruby
wget
winscp
visualstudio2017buildtools --package-parameters "--quiet --wait --norestart --locale en-US --allWorkloads --includeRecommended --includeOptional --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.ATLMFC"
visualstudio2017-workload-netcorebuildtools
visualstudio2017-workload-vctools
visualstudio2017-workload-webbuildtools
windows-sdk-10-version-1903-all
vcredist2017
wsl
Empty file.