Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

This repository contains the source code and Packer configuration files to create an image, for either Hyper-V or Azure, that contains an instance of a Jenkins build agent on a Windows operating system

License

Notifications You must be signed in to change notification settings

Calvinverse/resource.build.agent.windows

Repository files navigation

resource.build.agent.windows

This repository contains the code used to build a base Windows build agent on a Hyper-V VM hard disk. The current process will use the Windows Server 2016 Core base image, i.e. without UI, on to create a Jenkins build agent with the swarm plugin.

Image

Contents

The current process will use the Windows 2016 Core base image and ammending it using a Chef cookbook which installs the Java Development Kit, Jenkins, Jolokia and the build tools for .NET and Javascript builds.

Configuration

  • The GIT install. The version of which is determined by the default['git']['version'] attribute in the default.rb attributes file in the cookbook.
  • The OpenJDK Java development kit which is requried to run Jenkins. The version of which is determined by the version of the java cookbook in the metadata.rb file.
  • The Jenkins swarm slave JAR file. The version of which is determined by the default['jenkins']['version'] attribute in the default.rb attributes file in the cookbook.
  • The Jolokia JAR file which is used to collect metrics from Jenkins. The version of which is determined by the default['jolokia']['version'] attribute in the default.rb attributes file in the cookbook.
  • The latest .NET build tools.
  • The Node, NPM and Yarn tools. The versions of which are determined by the default['nodesjs']['version'], default['npm']['version'] and default['yarn']['version'] attributes in the default.rb attributes file in the cookbook.
  • The NuGet command line. The version of which is determined by the default['nuget']['version'] attribute in the default.rb attributes file in the cookbook.

Provisioning

During provisioning the standard steps are taken. In addition the Jenkins agent workspace directory permissions are reset as those are lost during the sysprep.

Logs

Logs are collected via the Filebeat application which will normally write the logs to disk. If the Consul-Template service has been provided with the appropriate credentials then it will generate additional configuration for the syslog service that allows the logs to be pushed to a RabbitMQ exchange. The vhost the log messages are pushed to is determined by the Consul Key-Value key at config/services/queue/logs/file/vhost. The are pushed to the MQTT endpoint for that vhost which should redirect to the appropriate queues.

Metrics

Metrics are collected through different means.

  • Metrics for Consul are collected by Consul sending StatsD metrics to Telegraf.
  • Metrics for Unbound are collected by Telegraf pulling the metrics.
  • System metrics, e.g. CPU, disk, network and memory usage, are collected by Telegraf.
  • Metrics for Jenkins and the JVM via Jolokia and Telegraf.

Build, test and release

The build process follows the standard procedure for building Calvinverse images.

Hyper-V

For building Hyper-V images use the following command line

msbuild entrypoint.msbuild /t:build /P:ShouldCreateHypervImage=true /P:RepositoryArchive=PATH_TO_ARTIFACTLOCATION

where PATH_TO_ARTIFACTLOCATION is the full path to the directory where the base image artifact file is stored.

In order to run the smoke tests on the generated image run the following command line

msbuild entrypoint.msbuild /t:test /P:ShouldCreateHypervImage=true

Deploy

TBD

About

This repository contains the source code and Packer configuration files to create an image, for either Hyper-V or Azure, that contains an instance of a Jenkins build agent on a Windows operating system

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published