Skip to content

Commit

Permalink
migrate tp build-harness
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWoolfenden committed Jan 20, 2019
1 parent 204db8b commit 44b2e4c
Show file tree
Hide file tree
Showing 17 changed files with 388 additions and 87 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Compiled files
*.tfstate
*.tfstate.backup

# Module directory
.terraform
.idea
*.iml
.build-harness
build-harness
*.ini

*~HEAD
*backup
# Cache objects
packer_cache/

Expand Down
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ repos:
rev: v4.0.1
hooks:
- id: ansible-lint
- repo: https://github.com/prettier/prettier
rev: 1.15.3
hooks:
- id: prettier
- repo: git://github.com/igorshubovych/markdownlint-cli
rev: v0.13.0
hooks:
Expand Down
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#Makefile
SHELL := /bin/bash

AWS_DEFAULT_REGION ?= "eu-west-1"
PACKFILE ?= "base.json"
ENVIRONMENT ?= "management-<account-number>"
PACKFILE ?= "packfiles/RedHat/base-aws.json"
ENVIRONMENT ?= "environment/personal-jgw.json"

# List of targets the `readme` target should call before generating the readme
export README_DEPS ?= docs/targets.md docs/terraform.md

.PHONY: base
-include $(shell curl -sSL -o .build-harness "https://raw.githubusercontent.com/JamesWoolfenden/build-harness/master/templates/Makefile.build-harness"; echo .build-harness)

base:
sh ./build.sh -p ${PACKFILE} -e ${ENVIRONMENT}
## Lint terraform code
lint:
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate
5 changes: 5 additions & 0 deletions PSScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# PSScriptAnalyzerSettings.psd1
@{
Severity=@('Error','Warning')
ExcludeRules=@('PSUseShouldProcessForStateChangingFunctions')
}
129 changes: 128 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
# Packer: By Example
<!-- This file was automatically generated by the `packer-by-example`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->

[![Slalom][logo]](https://slalom.com)

# packer-by-example [![Build Status](https://travis-ci.org/JamesWoolfenden/packer-by-example.svg?branch=master)](https://travis-ci.org/JamesWoolfenden/packer-by-example) [![Latest Release](https://img.shields.io/github/release/JamesWoolfenden/packer-by-example.svg)](https://github.com/JamesWoolfenden/packer-by-example/releases/latest)

Packer-by-example is a collection of Scripts, Ansible, Makefiles and Packer files to building images in the Public Cloud.
It's designed to work with CI/CD systems such as Travis CI, CircleCI and Jenkins, or even at your console.

---

This project uses the "build-harness" a bit modified version of the project ["SweetOps"](https://cpco.io/sweetops) from Cloudposse. Sweet indeed.

It's 100% Open Source and licensed under the [APACHE2](LICENSE).

## Introduction

## Usage

some usage info...

## Quick Start

Here's how to get started...
1. `git clone https://github.com/jameswoolfenden/packer-by-example.git` to pull down the repository
2. `make init` to initialize the [`packer-by-example`](https://github.com/jameswoolfenden/packer-by-example/)

This Repository contains a number of examples for using Packer, with different OS and CloudPlatforms.

Expand All @@ -10,3 +35,105 @@ Instructions for each Cloud provider are here:

There are several different OS examples, Windows and Linux, and different versions of each.
The "packfiles" have examples of using basic features of scipts or Ansible to configure your images, aw well versioning the AMI's.
## Makefile Targets
```
Available targets:
help/all:
Display help for all targets
help/short:
This help short screen
help:
Help screen
lint Lint terraform code
```




## Help

**Got a question?**

File a GitHub [issue](https://github.com/JamesWoolfenden/packer-by-example/issues).


## Slack Community

You can join the Cloudposse community [Open Source Community][slack] on Slack.

## Contributing

### Bug Reports & Feature Requests

Please use the [issue tracker](https://github.com/JamesWoolfenden/packer-by-example/issues) to report any bugs or file feature requests.



## Copyrights

Copyright © 2019-2019 [Slalom, LLC](https://slalom.com)






## License

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

See [LICENSE](LICENSE) for full details.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.












### Contributors

| [![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]<br/>[James Woolfenden][jameswoolfenden_homepage] |
|---|

[jameswoolfenden_homepage]: https://github.com/jameswoolfenden
[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150



[logo]: docs/slalom-logo.png
[website]: https://slalom.com
[github]: https://github.com/jameswoolfenden
[slack]: https://cpco.io/slack
[linkedin]: https://www.linkedin.com/company/slalom-consulting/
[twitter]: https://twitter.com/Slalom

[share_twitter]: https://twitter.com/intent/tweet/?text=packer-by-example&url=https://github.com/JamesWoolfenden/packer-by-example
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=packer-by-example&url=https://github.com/JamesWoolfenden/packer-by-example
[share_reddit]: https://reddit.com/submit/?url=https://github.com/JamesWoolfenden/packer-by-example
[share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/JamesWoolfenden/packer-by-example
[share_googleplus]: https://plus.google.com/share?url=https://github.com/JamesWoolfenden/packer-by-example
[share_email]: mailto:?subject=packer-by-example&body=https://github.com/JamesWoolfenden/packer-by-example
57 changes: 57 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name: packer-by-example

# Logo for this project
#logo: docs/slalom-logo.png

# License of this project
license: 'APACHE2'

# Copyrights
copyrights:
- name: 'Slalom, LLC'
url: 'https://slalom.com'
year: '2019'

# Canonical GitHub repo
github_repo: JamesWoolfenden/packer-by-example

# Badges to display
badges:
- name: 'Build Status'
image: 'https://travis-ci.org/JamesWoolfenden/build-harness.svg?branch=master'
url: 'https://travis-ci.org/JamesWoolfenden/build-harness'
- name: 'Latest Release'
image: 'https://img.shields.io/github/release/JamesWoolfenden/build-harness.svg'
url: 'https://github.com/JamesWoolfenden/build-harness/releases/latest'

# Short description of this project
description: |-
Packer-by-example is a collection of Scripts, Ansible, Makefiles and Packer files to building images in the Public Cloud.
It's designed to work with CI/CD systems such as Travis CI, CircleCI and Jenkins, or even at your console.
# Introduction to the project
introduction: |-
# This is an introduction.
# How to use this project
usage: |-
some usage info...
# How to get started quickly
quickstart: |-
Here's how to get started...
1. `git clone https://github.com/jameswoolfenden/build-harness.git` to pull down the repository
2. `make init` to initialize the [`build-harness`](https://github.com/jameswoolfenden/build-harness/)
# Other files to include in this README from the project folder
include:
- 'docs/instructions.md'
- 'docs/targets.md'

# Contributors to this project
contributors:
- name: 'James Woolfenden'
github: 'jameswoolfenden'
54 changes: 27 additions & 27 deletions AWS.MD → docs/AWS.MD
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# AWS amis

These examples target the customisation of existing AWS Amis, usually from AWS or from trusted sources such as Canonicals AWS account. You can find the details of an AMI from the command line

## AWS Set-up

You will need to set-up and configured your AWS:

```cli
aws configure
```

When you run packer its is assumed that the following Environment variables are set:

```cli
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
```

You can run

```bash
./build.sh -packfile ./packfiles/redhat/base-aws.json -environment
```

Additionally in the root you will find the script **iam_assum_role**, this allows you to assume an aws role to build your AMI's.
# AWS amis

These examples target the customisation of existing AWS Amis, usually from AWS or from trusted sources such as Canonicals AWS account. You can find the details of an AMI from the command line

## AWS Set-up

You will need to set-up and configured your AWS:

```cli
aws configure
```

When you run packer its is assumed that the following Environment variables are set:

```cli
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
```

You can run

```bash
./build.sh -packfile ./packfiles/redhat/base-aws.json -environment
```

Additionally in the root you will find the script **iam_assum_role**, this allows you to assume an aws role to build your AMI's.
16 changes: 8 additions & 8 deletions AZURE.MD → docs/AZURE.MD
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Azure Images

## Azure Set-up

You can run

```bash
./build.sh -packfile ./packfiles/redhat/base-azure.json -environment
# Azure Images

## Azure Set-up

You can run

```bash
./build.sh -packfile ./packfiles/redhat/base-azure.json -environment
```
Loading

0 comments on commit 44b2e4c

Please sign in to comment.