Coder Social home page Coder Social logo

gusztavvargadr / packer Goto Github PK

View Code? Open in Web Editor NEW
442.0 442.0 62.0 1.93 MB

Packer templates for building Windows and Ubuntu images

Home Page: https://app.vagrantup.com/gusztavvargadr

License: The Unlicense

Ruby 16.50% PowerShell 8.69% Batchfile 0.29% C# 3.67% Shell 5.26% HCL 65.59%
packer ubuntu windows

packer's People

Contributors

derrix060 avatar gusztavvargadr avatar rasa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packer's Issues

Document build usage

  • Requirements
  • Running builds
  • Custom configuration
    • Hyper-V switch
    • Generic PF vars
  • Publishing
  • Reference AZP builds

Update Visual Studio 2017 version

  • Include latest updates
  • Include desktop development components
  • Double check VS17 with .net 3.5.
  • Fix docs for VS contents (proper component names)

no access to files under shared folders with virtualbox 5.1.16

First, thanks for maintaining those boxes.

While the Vagrantfile below works properly with virtualbox 5.1.14, it fails with 5.1.16 with

==> windows: Get-Content : Cannot find path 'C:\vagrant\Vagrantfile' because it does not exist.
==> windows: At C:\tmp\vagrant-shell.ps1:1 char:1
==> windows: + Get-Content c:\vagrant\Vagrantfile
==> windows: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==> windows:     + CategoryInfo          : ObjectNotFound: (C:\vagrant\Vagrantfile:String) [Get-Content], ItemNotFoundException
==> windows:     + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
# -*- mode: ruby -*-
# vi: set ft=ruby :

# http://stackoverflow.com/questions/23926945/specify-headless-or-gui-from-command-line
def gui_enabled?
  !ENV.fetch('GUI', '').empty?
end

Vagrant.configure(2) do |config|
  config.vm.define "windows" do |machine|
    machine.vm.box = "gusztavvargadr/w16s"
    machine.vm.box_url = machine.vm.box
    machine.vm.provider 'virtualbox' do |v|
      v.gui = gui_enabled?
      v.memory = 1024  # Windows is greedy
      v.cpus = 1
    end
    machine.ssh.shell = "powershell"
  end
  config.vm.define "windows" do |machine|
    machine.vm.provision :shell, :inline => "ls c:\\vagrant"
    machine.vm.provision :shell, :inline => "Get-Content c:\\vagrant\\Vagrantfile"
  end
end

$ vboxmanage --version
5.1.16r113841
$ vagrant --version
Vagrant 1.9.2
$ uname -a
Linux ubuntu 4.4.0-64-generic #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 x86_64 x86_64
$ cat /etc/os-release | grep PRETTY
PRETTY_NAME="Ubuntu 16.04.2 LTS"

Refactor build chaining

  • Add support for Hyper-V (Packer 1.1.1)
  • Image naming (core vs base)
  • Add intermediate .NET images
  • Deprecate least used configurations, keep:
    • w10e
    • w10e-dc
    • w10e-vs17c
    • w16s
    • w16s-dc
    • w16s-vs17c
    • w16s-iis
    • w16s-sql
  • Fix Chef cleanup
  • Update docs

Chef client uninstall is incomlete

Double check that Chef client uninstall is complete before invoking Sysprep, consider adding sleep before and after.

  • Windows 10
  • Windows 2012 R2

Update core OS versions

https://support.microsoft.com/en-us/help/4018124

  • Windows 10 new iso for version 1703
    • w10e
      • Hyper-V
      • VirtualBox
  • Windows Server 2016 with latest patches
    • w16s
      • Hyper-V
      • VirtualBox
    • w16s-iis
      • Hyper-V
      • VirtualBox
    • w16s-sql14d
      • Hyper-V
      • VirtualBox
    • w16s-vs10p
      • Hyper-V
      • VirtualBox
    • w16s-vs15c
      • Hyper-V
      • VirtualBox
    • w16s-vs15p
      • Hyper-V
      • VirtualBox
    • w16s-vs17c
      • Hyper-V
      • VirtualBox
    • w16s-vs17p
      • Hyper-V
      • VirtualBox

Release new version

  • Remove deprecated configurations.
    • windows2012r2se-vs2015c
    • windows2012r2se-vs2015p
  • Deprecate current configurations
    • Collect download counts 25-2-2017
      • windows10ee 400
      • windows10ee-vs2015c 296
      • windows10ee-vs2015p 149
      • windows10ee-vs2010p 11
      • windows10ee-vs2010p-vs2015p 16
      • windows10ee-sql2014de 71
      • windows10ee-sql2014de-vs2015p 18
      • windows10ee-sql2014de-vs2010p-vs2015p 250
      • windows10ee-sql2014de-vs2015c 34
      • windows10ee-sql2014de-vs2010p 5
      • windows2012r2se 374
      • windows2012r2se-sql2014de 247
      • windows2012r2se-iis 220
      • windows2012r2se-sql2014de-iis 682
    • Collect download counts 25-2-2017 28-4-2017
      • windows10ee-vs2015c 296 368
      • windows2012r2se 374 456
      • windows2012r2se-sql2014de 247 344
      • windows2012r2se-iis 220 257
      • windows2012r2se-sql2014de-iis 682 958
  • Add new configurations
    • w10e
      • Build
      • Package
      • Test
      • Upload
      • Release
      • Download
    • w10e-sql14d
      • Build
      • Package
      • Test
      • Upload
      • Release
      • Download
    • w10e-sql14d-vs15c
      • Build
      • Package
      • Test
      • Upload
      • Release
      • Download
    • w10e-sql14d-vs10p-vs15p
      • Build
      • Package
      • Test
      • Upload
      • Release
      • Download
    • w16s
      • Build
      • Package
      • Test
      • Upload
      • Release
      • Download
    • w16s-iis
      • Build
      • Package
      • Test
      • Upload
      • Release
      • Download
    • w16s-sql14d
      • Build
      • Package
      • Test
      • Upload
      • Release
      • Download
    • w16s-sql14d-vs15c
      • Build
      • Package
      • Test
      • Upload
      • Release
      • Download
    • w16s-sql14d-vs10p-vs15p
      • Build
      • Package
      • Test
      • Upload
      • Release
      • Download
  • Update documentations
    • Make evaluation versions explicit
    • Update release notes in Atlas

Implement publishing to Atlas

https://www.vagrantup.com/docs/vagrant-cloud/vagrant-cloud-migration.html

  • Publish according to current version (only stable)
    • GitVersion
  • Repack used deprecated versions with message
  • Check for generating documentation and release notes
  • Rebuild / Repackage for changes
  • Build parent config if missing
  • Restore all params to json (be able to run packer standalone)
  • Build / package separation to remove from template? (displayname / technical name / pass as argument to scripts / chef)
  • Vagrant only for package step if needed
  • Update iso sources
  • Review external sources for other approaches
    • Review and refactor current scripts
    • Review all issues, vagrant included
  • Document sysprep and add helpers to run again
  • Make sure Windows Updates installs all updates (MS as well)
  • Test built box locally before publishing
  • Save packer metadata to artifacts
  • Simplify provider setups (reduce duplication by "profiles")
  • Environment variables to pass params to scripts
  • SQL only only on w16
  • Add reference to sample vagrant repos

Update Visual Studio components

  • Community
    • Generate unattended configuration from latest version
    • Review selected options
  • Professional
    • Generate unattended configuration from latest version
    • Review selected options
  • Check for prerequisites
    • .NET Framework
    • IIS
  • With and without SQL Server
  • Get rid of Windows 2012-based configurations

Error building w16s-virtualbox-core

When running .\ci.ps1 build w16s-virtualbox-core I get the error -

> ========================================
> packer-build
> ========================================
> Executing task: packer-build
> w16s-virtualbox-core: Version
> w16s-virtualbox-core: Restore
> w16s-virtualbox-core: Build
> w16s-virtualbox-core: Packer build template.json
> Executing: "packer" build template.json
> virtualbox-iso output will be in this color.
> 
> ==> virtualbox-iso: Downloading or copying ISO
>     virtualbox-iso: Downloading or copying: http://care.dlservice.microsoft.com/dl/download/1/4/9/149D5452-9B29-4274-B6B3-5361DBDA30BC/14393.0.161119-1705.RS1_REFRESH_SERVER_EVAL_X64FRE_EN-US.ISO
> ==> virtualbox-iso: Creating floppy disk...
>     virtualbox-iso: Copying files flatly from floppy_files
>     virtualbox-iso: Copying directory: builders/virtualbox-iso/floppy
>     virtualbox-iso: Adding file: builders\virtualbox-iso\floppy\Autounattend.ps1
>     virtualbox-iso: Adding file: builders\virtualbox-iso\floppy\Autounattend.xml
>     virtualbox-iso: Adding file: builders\virtualbox-iso\floppy\shutdown.cmd
>     virtualbox-iso: Done copying files from floppy_files
>     virtualbox-iso: Collecting paths from floppy_dirs
>     virtualbox-iso: Resulting paths from floppy_dirs : []
>     virtualbox-iso: Done copying paths from floppy_dirs
> ==> virtualbox-iso: Creating virtual machine...
> ==> virtualbox-iso: Creating hard drive...
> ==> virtualbox-iso: Attaching floppy disk...
> ==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 4313)
> ==> virtualbox-iso: Executing custom VBoxManage commands...
>     virtualbox-iso: Executing: modifyvm gusztavvargadr-w16s-virtualbox-core-0.7.0-1508946327 --memory 4096
>     virtualbox-iso: Executing: modifyvm gusztavvargadr-w16s-virtualbox-core-0.7.0-1508946327 --cpus 2
> ==> virtualbox-iso: Starting the virtual machine...
>     virtualbox-iso: The VM will be run headless, without a GUI. If you want to
>     virtualbox-iso: view the screen of the VM, connect via VRDP without a password to
>     virtualbox-iso: rdp://127.0.0.1:5964
> ==> virtualbox-iso: Waiting 1m0s for boot...
> ==> virtualbox-iso: Typing the boot command...
> ==> virtualbox-iso: Waiting for WinRM to become available...
>     virtualbox-iso: #< CLIXML
>     virtualbox-iso: WinRM connected.
>     virtualbox-iso: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
> ==> virtualbox-iso: Connected to WinRM!
> ==> virtualbox-iso: Uploading VirtualBox version info (5.1.28)
> ==> virtualbox-iso: Unregistering and deleting virtual machine...
> ==> virtualbox-iso: Deleting output directory...
> Build 'virtualbox-iso' errored: Error uploading VirtualBox version: Error uploading file to $env:TEMP\winrmcp-940d6b53-c5f6-43aa-6e66-dcc32cd8e61f.tmp: upload operation returned code=16001
> 
> ==> Some builds didn't complete successfully and had errors:
> --> virtualbox-iso: Error uploading VirtualBox version: Error uploading file to $env:TEMP\winrmcp-940d6b53-c5f6-43aa-6e66-dcc32cd8e61f.tmp: upload operation returned code=16001
> 
> ==> Builds finished but no artifacts were created.
> An error occurred when executing task 'packer-build'.
> Error: System.Exception: Process exited with code 1.
>    at Submission#0.PackerTemplate_Packer(PackerTemplate template, String arguments)
>    at Submission#0.PackerTemplate_Build(PackerTemplate template)
>    at Submission#0.PackerTemplates_ForEach(String template, Action`1 action, Boolean recursive)
>    at Submission#0.<.ctor>b__35()
>    at Cake.Core.ActionTask.Execute(ICakeContext context)
>    at Cake.Core.DefaultExecutionStrategy.Execute(CakeTask task, ICakeContext context)
>    at Cake.Core.CakeEngine.ExecuteTask(ICakeContext context, IExecutionStrategy strategy, Stopwatch stopWatch, CakeTask task, CakeReport report)
>    at Cake.Core.CakeEngine.RunTarget(ICakeContext context, IExecutionStrategy strategy, String target)
>    at Cake.Scripting.BuildScriptHost.RunTarget(String target)
>    at Submission#0..ctor(Session session, Object& submissionResult)
>    at Submission#0.<Factory>(Session session)
>    at Roslyn.Scripting.CommonScriptEngine.Execute[T](String code, String path, DiagnosticBag diagnostics, Session session, Boolean isInteractive)
>    at Roslyn.Scripting.Session.Execute(String code)
>    at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
>    at Cake.Commands.BuildCommand.Execute(CakeOptions options)
>    at Cake.CakeApplication.Run(CakeOptions options)
>    at Cake.Program.Main()

The virtual machine is deleted (had a quick look to see where I can use --no-destroy-on-error but not found it) so I can't get to the logs to see what happened. The machine had booted up, installed updates and started configuring.

Deprecate old configurations

  • w12r2
  • w16s vs with sql
  • w10e
  • Download counts

Consider releasing new patch version with deprecation notice. See old numbers at #35.

Extract common parts of builds

Reuse artifacts from previous builds by chaining them and defining only the differences.

  • Windows
    • 10
    • 2012 R2
  • Visual Studio
    • 2010
    • 2015
    • Discontinue Windows Server-based images
  • boot, install, shutdown - core windows install basic configuration - scripts and recipes

Error when build box

When trying to run -

.\ci.ps1 build w16s-vs17p-virtualbox-base

I first got the error -
Error: C:/Code/Devops/packer/src/core/cake/template.cake(61,3): error CS1501: No overload for method 'DeleteDirectory' takes 1 arguments

I fixed the by modifying line 62 in template.cake to add a second parameter -
DeleteDirectory(template.GetBuildDirectory(), true);

I then get the error -

========================================
packer-build
========================================
Executing task: packer-build
w16s-vs17p-virtualbox-base: Version
w16s-vs17p-virtualbox-base: Restore
w16s-vs17p-virtualbox-base: Build
w16s-vs17p-virtualbox-base: Packer build template.json
virtualbox-ovf output will be in this color.

1 error(s) occurred:

* source_path is required
An error occurred when executing task 'packer-build'.
Error: Process exited with code 1.

SSL Err no 54

Hi, I have a problem, my download progress are 7.5Gb whem throw error SSL, do you help me please.

vagrant init gusztavvargadr/w16s-sql14d-vs15c; vagrant up --provider virtualbox
`Vagrantfile` already exists in this directory. Remove it before
running `vagrant init`.
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'gusztavvargadr/w16s-sql14d-vs15c' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'gusztavvargadr/w16s-sql14d-vs15c'
    default: URL: https://atlas.hashicorp.com/gusztavvargadr/w16s-sql14d-vs15c
==> default: Adding box 'gusztavvargadr/w16s-sql14d-vs15c' (v0.4.0) for provider: virtualbox                              default: Downloading: https://atlas.hashicorp.com/gusztavvargadr/boxes/w16s-sql14d-vs15c/versions/0.4.0/providers/virtualbox.box
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try again.
SSL read: error:00000000:lib(0):func(0):reason(0), errno 54

Mac Sierra
iMac (21.5-inch, Late 2013)
Processor 2.7Hz Core i5 8GB DDR3

Improve build automation

  • Convert existing configurations
  • Cake
  • Script name to CI
  • Copy all relevant resources / templates to build dir
    • Handle image dependencies (ovf) based on naming convention
  • guest additions per provider
  • bat renames to cmd
  • Double check for box naming
    • w instead of windows?
    • d instead of de for SQL
    • numbers excluding 20 prefix
    • check if evaluation is needed in name

Clean up shutdown configuration

  • Extract common parts to common scripts to define only differences for configurations
  • Dobule check for uninstalling as much as possible
    • Keep chef, check for skip install everywhere
  • Version-specific recipes for Windows as for other components

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.