GithubHelp home page GithubHelp logo

pawanbahuguna / circleci-server-windows-image-builder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brianoh1979/circleci-server-windows-image-builder

0.0 0.0 0.0 40 KB

This is an example of how to build a new Windows VM image to be used with CircleCI Server.

Shell 15.78% PowerShell 84.07% Batchfile 0.15%

circleci-server-windows-image-builder's Introduction

Example Packer Config For building Windows On CircleCI

This folder contains everything you will need to build a Windows image, with the CircleCI dsc resources, on CircleCI. For more information on setting up VM service, which includes specifying your new Windows image for your users, see our VM Service guide.

Building a Windows Image to use with machine Executor

The following steps will guide you through building a Windows AMI, which you can then specify in the VM Service settings for your installation of CircleCI Server, letting users of your installation run their builds in a Windows environment.

Please note Windows images are built on CircleCI, so we suggest you run through this process once your installation is up and running. Alternatively you can use any other CircleCI account – including on our managed Cloud service – to generate the image:

  1. Create a new repository under your GitHub or GitHub Enterprise account.

  2. Copy the contents of this repo into your new repo.

  3. Open up your installation of CircleCI Server and connect your new repo by clicking Follow Project from the Add Projects page. Once you set up the project, the first build will get triggered automatically. It will fail because the AWS credentials are not configured yet — feel free to cancel the first build that gets created automatically.

  4. Next, add your aws keys as env vars to the build in the CircleCI using:

  • AWS_ACCESS_KEY_ID
  • AWS_DEFAULT_REGION
  • AWS_SECRET_ACCESS_KEY

Note: You will have to create a context, then add it to the config.yaml file (workflows section)

workflows:
build_all_images:
  jobs:
    - windows_visualstudio_aws:
        context: ami-builder
  1. Update the owner in windows/visual-studio/packer.yaml if you configured the keys under a different account to the once your Circleci Server installation is under. If you get any errors around not being able to find a default VPC, you will need to specify a vpc_id and subnet_id in this file.

  2. Click Rerun Workflow from the job details page to rerun the Windows image buider

  3. Your will find your new Windows AMI ID at the end of the summarize results step in the job output

What the packer job in this build does

  • Sets up winrm.
  • Adds scripts for removing winrm when we are ready to clean up.
  • Copies over ImageHelpers and CircleDSCResources to the powershell module path.
  • Runs some configuration to get the machine ready to use DSC and clean up some defaults that are not helpful.
  • Runs DSC and restarts the machine a few times to let it continue through the configuration process.
  • Runs Pester tests to validate that the image is configured correctly. These tests are designed to ensure that all of the software is actually callable not just “installed”.
  • Reenables Windows Defender and runs the virus scanner.
  • Disables Windows Defender to improve performance.
  • Copies: test results, the choco logs, and the software.md (a list of everything we install and test for the presence of) off of the host.
  • Installs the SSH server and enables the cleanup script that runs on shutdown (check out the aws packer scripts for exactly how that works).
  • Creates a Windows AMI.

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.