Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e34c619

Browse files
author
Matt Calhoun
committed
repo bootstrapping
1 parent 5aeb37e commit e34c619

File tree

13 files changed

+513
-0
lines changed

13 files changed

+513
-0
lines changed

.build-harness

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
#
2+
# This is a shim installed automatically by the build-harness
3+
# https://github.com/cloudposse/build-harness
4+
#
5+
6+
# templates/Makefile.build-harness includes this Makefile
7+
# and this Makefile includes templates/Makefile.build-harness
8+
# to support different modes of invocation. Use a guard variable
9+
# to prevent infinite recursive includes
10+
ifeq ($(BUILD_HARNESS_TEMPLATES_MAKEFILE_GUARD),)
11+
BUILD_HARNESS_TEMPLATES_MAKEFILE_GUARD := included
12+
13+
export SHELL = /bin/bash
14+
export PWD = $(shell pwd)
15+
export BUILD_HARNESS_ORG ?= cloudposse
16+
export BUILD_HARNESS_PROJECT ?= build-harness
17+
export BUILD_HARNESS_DOCKER_IMAGE ?= $(BUILD_HARNESS_ORG)/$(BUILD_HARNESS_PROJECT)
18+
export BUILD_HARNESS_BRANCH ?= master
19+
export BUILD_HARNESS_CLONE_URL ?= https://github.com/$(BUILD_HARNESS_ORG)/$(BUILD_HARNESS_PROJECT).git
20+
21+
# Resolves BUILD_HARNESS_PATH to BUILD_HARNESS_PATH_LOCAL when BUILD_HARNESS_PATH does not exist
22+
BUILD_HARNESS_PATH ?= $(shell until [ -d "$(BUILD_HARNESS_PROJECT)" ] || [ "`pwd`" == '/' ]; do cd ..; done; pwd)/$(BUILD_HARNESS_PROJECT)
23+
BUILD_HARNESS_PATH_LOCAL := $(PWD)/$(BUILD_HARNESS_PROJECT)
24+
export BUILD_HARNESS_PATH := $(or $(wildcard $(BUILD_HARNESS_PATH)),$(BUILD_HARNESS_PATH_LOCAL))
25+
# It is kind of expensive to figure out the Docker SHA tag, so we just define the command here, and only call it when needed
26+
# With the ":=" syntax, it stores the current value of BUILD_HARNESS_PATH, so this has to come after that has been set with ":="
27+
export BUILD_HARNESS_DOCKER_SHA_TAG_CMD := git -C "$(BUILD_HARNESS_PATH)" log -n 1 --format=sha-%h 2>/dev/null || echo latest
28+
29+
# Toggles the auto-init feature
30+
BUILD_HARNESS_AUTO_INIT ?= false
31+
32+
# Macro to clone/install BUILD_HARNESS_PROJECT
33+
define harness_install
34+
curl --retry 5 --fail --silent --retry-delay 1 \
35+
https://raw.githubusercontent.com/$(BUILD_HARNESS_ORG)/$(BUILD_HARNESS_PROJECT)/$(BUILD_HARNESS_BRANCH)/bin/install.sh | \
36+
bash -s "$(BUILD_HARNESS_ORG)" "$(BUILD_HARNESS_PROJECT)" "$(BUILD_HARNESS_BRANCH)"
37+
endef
38+
39+
# Macro to auto-init the BUILD_HARNESS_PROJECT with the `include` directive
40+
# Tests if BUILD_HARNESS_PROJECT does not yet exist, or if it does exist but the
41+
# checkout does not match BUILD_HARNESS_BRANCH
42+
define harness_auto_init
43+
if [[ \
44+
-f "/build-harness/Makefile" || -f "/$(BUILD_HARNESS_PROJECT)/Makefile" \
45+
]]; then \
46+
echo "[.build-harness]: In $(BUILD_HARNESS_PROJECT) docker container, skipping auto-init" ;\
47+
elif grep -q docker /proc/1/cgroup 2>/dev/null; then \
48+
echo "[.build-harness]: In unknown docker container, skipping auto-init" ;\
49+
elif [[ \
50+
"$(BUILD_HARNESS_PATH)" != "$(BUILD_HARNESS_PATH_LOCAL)" && \
51+
-f "$(BUILD_HARNESS_PATH)/Makefile" \
52+
]]; then \
53+
echo "[.build-harness]: Using external $(BUILD_HARNESS_PATH), skipping auto-init" ;\
54+
elif [[ \
55+
"$(BUILD_HARNESS_PATH)" == "$(BUILD_HARNESS_PATH_LOCAL)" && \
56+
-f "$(BUILD_HARNESS_PATH)/Makefile" && \
57+
"$$(git -C '$(BUILD_HARNESS_PATH_LOCAL)' ls-remote '$(BUILD_HARNESS_CLONE_URL)' '$(BUILD_HARNESS_BRANCH)' | cut -f1)" == "$$(git -C '$(BUILD_HARNESS_PATH_LOCAL)' rev-parse HEAD)" \
58+
]]; then \
59+
echo "[.build-harness]: Clone of $(BUILD_HARNESS_PROJECT) is up-to-date, skipping auto-init" ;\
60+
else \
61+
$(harness_install) ;\
62+
fi
63+
endef
64+
65+
-include $(if $(findstring true,$(BUILD_HARNESS_AUTO_INIT)),$(shell $(harness_auto_init) >&2)) $(BUILD_HARNESS_PATH)/Makefile
66+
67+
.PHONY : init
68+
## Init build-harness
69+
init::
70+
@ $(harness_install)
71+
72+
.PHONY : clean
73+
## Clean build-harness
74+
clean::
75+
@if [ -d "$(BUILD_HARNESS_PATH)" ]; then \
76+
if [ -d build-harness ] && [ "$(BUILD_HARNESS_PATH)" -ef build-harness ]; then \
77+
echo rm -rf build-harness; \
78+
rm -rf build-harness; \
79+
else \
80+
echo Not removing build harness from "$(BUILD_HARNESS_PATH)" because it appears to be shared.; \
81+
echo If you are sure you want to delete it, run: ; \
82+
echo ' rm -rf "$(BUILD_HARNESS_PATH)"'; \
83+
fi; \
84+
fi
85+
86+
.PHONY: safe-directory
87+
88+
# Workaround for https://github.com/actions/checkout/issues/766
89+
safe-directory:
90+
[[ -n "$$GITHUB_WORKSPACE" ]] && git config --global --add safe.directory "$$GITHUB_WORKSPACE" || git config --global --add safe.directory '*'
91+
92+
.PHONY: build-harness/shell builder build-harness/shell/pull builder/pull builder/build builder-slim/build
93+
94+
build-harness/shell/pull builder/pull builder/build builder-slim/build: BUILD_HARNESS_DOCKER_SHA_TAG ?= $(shell $(BUILD_HARNESS_DOCKER_SHA_TAG_CMD))
95+
build-harness/shell/pull builder/pull:
96+
docker pull $(BUILD_HARNESS_DOCKER_IMAGE):$(BUILD_HARNESS_DOCKER_SHA_TAG)
97+
@[[ "$(BUILD_HARNESS_DOCKER_SHA_TAG)" == "latest" ]] || docker pull $(BUILD_HARNESS_DOCKER_IMAGE):latest
98+
99+
builder/build: export DOCKER_IMAGE_NAME = $(BUILD_HARNESS_DOCKER_IMAGE):$(BUILD_HARNESS_DOCKER_SHA_TAG)
100+
builder/build:
101+
@$(MAKE) --no-print-directory docker/build
102+
103+
builder-slim/build: export DOCKER_IMAGE_NAME = $(BUILD_HARNESS_DOCKER_IMAGE):slim-$(BUILD_HARNESS_DOCKER_SHA_TAG)
104+
builder-slim/build: export DOCKER_FILE := Dockerfile.slim
105+
builder-slim/build:
106+
@$(MAKE) --no-print-directory docker/build
107+
108+
DEFAULT_DOCKER_ENVS := AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN TERM AWS_PROFILE AWS_REGION \
109+
AWS_DEFAULT_PROFILE AWS_DEFAULT_REGION
110+
EXTRA_DOCKER_ENVS ?= AWS_CONFIG_FILE AWS_SHARED_CREDENTIALS_FILE
111+
DOCKER_ENVS ?= $(DEFAULT_DOCKER_ENVS) $(EXTRA_DOCKER_ENVS)
112+
113+
## Start a shell inside of the `build-harness` docker container with `make build-harness/shell` or `make builder`
114+
## Run `make` targets inside the build-harness shell by setting `TARGETS` or `TARGET`, e.g.
115+
## make builder TARGETS="github/init readme"
116+
build-harness/shell builder tester: MOUNT_HOME ?= $(shell [ -d "$$HOME" ] && printf -- "-e HOME -v \"%s\":\"%s\"" "$$HOME" "$$HOME")
117+
build-harness/shell builder tester: TARGETS ?= $(TARGET)
118+
build-harness/shell builder tester: ARGS := $(if $(TARGETS),$(TARGETS),-l || true)
119+
build-harness/shell builder tester: ENTRYPOINT := $(if $(TARGETS),/usr/bin/make,/bin/bash)
120+
build-harness/shell builder pr/pre-commit pr/readme pr/github-update: RUNNER_DOCKER_TAG ?= $(shell $(BUILD_HARNESS_DOCKER_SHA_TAG_CMD))
121+
build-harness/shell builder pr/pre-commit pr/readme pr/github-update: RUNNER_DOCKER_IMAGE ?= $(BUILD_HARNESS_DOCKER_IMAGE)
122+
build-harness/shell builder: build-harness/runner
123+
@exit 0
124+
125+
.PHONY: build-harness/shell-slim builder-slim pr/auto-format pr/auto-format/host pr/readme pr/readme/host pr/pre-commit pr/github-update pr/github-update/host tf14-upgrade
126+
127+
build-harness/shell-slim builder-slim pr/auto-format pr/readme tf14-upgrade: RUNNER_DOCKER_IMAGE ?= $(BUILD_HARNESS_DOCKER_IMAGE)
128+
129+
build-harness/shell-slim builder-slim tf14-upgrade pr/auto-format pr/readme: RUNNER_DOCKER_SHA_TAG ?= $(shell $(BUILD_HARNESS_DOCKER_SHA_TAG_CMD))
130+
build-harness/shell-slim builder-slim tf14-upgrade pr/auto-format pr/readme: RUNNER_DOCKER_TAG ?= \
131+
$(shell docker inspect --type=image $(RUNNER_DOCKER_IMAGE):$(RUNNER_DOCKER_SHA_TAG) >/dev/null 2>&1 && \
132+
echo "$(RUNNER_DOCKER_SHA_TAG) " || echo "slim-$(RUNNER_DOCKER_SHA_TAG)")
133+
134+
build-harness/shell-slim builder-slim: TARGETS ?= $(TARGET)
135+
build-harness/shell-slim builder-slim: ARGS := $(if $(TARGETS),$(TARGETS),-l || true)
136+
build-harness/shell-slim builder-slim: ENTRYPOINT := $(if $(TARGETS),/usr/bin/make,/bin/bash)
137+
build-harness/shell-slim builder-slim: build-harness/runner
138+
139+
pr/auto-format pr/readme pr/pre-commit pr/github-update tf14-upgrade : ENTRYPOINT := /usr/bin/make
140+
141+
pr/auto-format pr/auto-format/host: ARGS := github/update terraform/fmt readme
142+
pr/readme pr/readme/host: ARGS := readme/deps readme
143+
pr/github-update pr/github-update/host: ARGS := github/update
144+
pr/auto-format pr/readme pr/github-update: build-harness/runner
145+
pr/auto-format/host pr/readme/host pr/github-update/host: safe-directory
146+
$(MAKE) $(ARGS)
147+
148+
pr/pre-commit: ARGS := pre-commit/run
149+
pr/pre-commit: build-harness/runner
150+
151+
tf14-upgrade: export TERRAFORM_FORCE_README := true
152+
tf14-upgrade: ARGS := github/init terraform/v14-rewrite
153+
tf14-upgrade: build-harness/runner
154+
155+
.PHONY: tester tester/pull
156+
157+
tester tester/pull: TEST_HARNESS_DOCKER_IMAGE ?= cloudposse/test-harness
158+
tester tester/pull: TEST_HARNESS_DOCKER_TAG ?= latest
159+
tester: RUNNER_DOCKER_IMAGE ?= $(TEST_HARNESS_DOCKER_IMAGE)
160+
tester: RUNNER_DOCKER_TAG ?= $(TEST_HARNESS_DOCKER_TAG)
161+
tester: build-harness/runner
162+
163+
tester/pull:
164+
docker pull $(TEST_HARNESS_DOCKER_IMAGE):$(TEST_HARNESS_DOCKER_TAG)
165+
166+
167+
.PHONY: build-harness/runner
168+
169+
build-harness/runner:
170+
$(info Starting $(RUNNER_DOCKER_IMAGE):$(RUNNER_DOCKER_TAG))
171+
docker run --name build-harness \
172+
--rm -it \
173+
-e PACKAGES_PREFER_HOST=true \
174+
$(addprefix -e ,$(DOCKER_ENVS)) \
175+
$(MOUNT_HOME) \
176+
-v $(CURDIR):/host \
177+
--workdir /host \
178+
--entrypoint $(ENTRYPOINT) \
179+
$(RUNNER_DOCKER_IMAGE):$(RUNNER_DOCKER_TAG) $(ARGS)
180+
181+
.PHONY: reset-owner
182+
reset-owner:
183+
@if [[ -n $$(find . -xdev -user 0 -print) ]]; then \
184+
printf "\n* To reset ownership on files, run:\n sudo find . -xdev -user 0 -exec chown $$USER {} \;\n\n" ; \
185+
else \
186+
printf "\n* No root-owned files found\n\n" ; \
187+
fi
188+
189+
endif

.github/CODEOWNERS

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this file to define individuals or teams that are responsible for code in a repository.
2+
# Read more: <https://help.github.com/articles/about-codeowners/>
3+
#
4+
# Order is important: the last matching pattern has the highest precedence
5+
6+
# These owners will be the default owners for everything
7+
* @cloudposse/engineering @cloudposse/contributors
8+
9+
# Cloud Posse must review any changes to Makefiles
10+
**/Makefile @cloudposse/engineering
11+
**/Makefile.* @cloudposse/engineering
12+
13+
# Cloud Posse must review any changes to GitHub actions
14+
.github/* @cloudposse/engineering
15+
16+
# Cloud Posse must review any changes to standard context definition,
17+
# but some changes can be rubber-stamped.
18+
**/*.tf @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
19+
README.yaml @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
20+
README.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
21+
docs/*.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
22+
23+
# Cloud Posse Admins must review all changes to CODEOWNERS or the mergify configuration
24+
.github/mergify.yml @cloudposse/admins
25+
.github/CODEOWNERS @cloudposse/admins
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
Found a bug? Maybe our [Slack Community](https://slack.cloudposse.com) can help.
11+
12+
[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
13+
14+
## Describe the Bug
15+
A clear and concise description of what the bug is.
16+
17+
## Expected Behavior
18+
A clear and concise description of what you expected to happen.
19+
20+
## Steps to Reproduce
21+
Steps to reproduce the behavior:
22+
1. Go to '...'
23+
2. Run '....'
24+
3. Enter '....'
25+
4. See error
26+
27+
## Screenshots
28+
If applicable, add screenshots or logs to help explain your problem.
29+
30+
## Environment (please complete the following information):
31+
32+
Anything that will help us triage the bug will help. Here are some ideas:
33+
- OS: [e.g. Linux, OSX, WSL, etc]
34+
- Version [e.g. 10.15]
35+
36+
## Additional Context
37+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
blank_issues_enabled: false
2+
3+
contact_links:
4+
5+
- name: Community Slack Team
6+
url: https://cloudposse.com/slack/
7+
about: |-
8+
Please ask and answer questions here.
9+
10+
- name: Office Hours
11+
url: https://cloudposse.com/office-hours/
12+
about: |-
13+
Join us every Wednesday for FREE Office Hours (lunch & learn).
14+
15+
- name: DevOps Accelerator Program
16+
url: https://cloudposse.com/accelerate/
17+
about: |-
18+
Own your infrastructure in record time. We build it. You drive it.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: 'feature request'
6+
assignees: ''
7+
8+
---
9+
10+
Have a question? Please checkout our [Slack Community](https://slack.cloudposse.com) or visit our [Slack Archive](https://archive.sweetops.com/).
11+
12+
[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
13+
14+
## Describe the Feature
15+
16+
A clear and concise description of what the bug is.
17+
18+
## Expected Behavior
19+
20+
A clear and concise description of what you expected to happen.
21+
22+
## Use Case
23+
24+
Is your feature request related to a problem/challenge you are trying to solve? Please provide some additional context of why this feature or capability will be valuable.
25+
26+
## Describe Ideal Solution
27+
28+
A clear and concise description of what you want to happen. If you don't know, that's okay.
29+
30+
## Alternatives Considered
31+
32+
Explain what alternative solutions or features you've considered.
33+
34+
## Additional Context
35+
36+
Add any other context or screenshots about the feature request here.

.github/ISSUE_TEMPLATE/question.md

Whitespace-only changes.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## what
2+
* Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
3+
* Use bullet points to be concise and to the point.
4+
5+
## why
6+
* Provide the justifications for the changes (e.g. business case).
7+
* Describe why these changes were made (e.g. why do these commits fix the problem?)
8+
* Use bullet points to be concise and to the point.
9+
10+
## references
11+
* Link to any supporting github issues or helpful documentation to add some context (e.g. stackoverflow).
12+
* Use `closes #123`, if this PR closes a GitHub issue `#123`
13+

.github/auto-release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: '$RESOLVED_VERSION'
3+
version-template: '$MAJOR.$MINOR.$PATCH'
4+
version-resolver:
5+
major:
6+
labels:
7+
- 'major'
8+
minor:
9+
labels:
10+
- 'minor'
11+
- 'enhancement'
12+
patch:
13+
labels:
14+
- 'auto-update'
15+
- 'patch'
16+
- 'fix'
17+
- 'bugfix'
18+
- 'bug'
19+
- 'hotfix'
20+
default: 'minor'
21+
22+
categories:
23+
- title: '🚀 Enhancements'
24+
labels:
25+
- 'enhancement'
26+
- 'patch'
27+
- title: '🐛 Bug Fixes'
28+
labels:
29+
- 'fix'
30+
- 'bugfix'
31+
- 'bug'
32+
- 'hotfix'
33+
- title: '🤖 Automatic Updates'
34+
labels:
35+
- 'auto-update'
36+
37+
change-template: |
38+
<details>
39+
<summary>$TITLE @$AUTHOR (#$NUMBER)</summary>
40+
41+
$BODY
42+
</details>
43+
44+
template: |
45+
$CHANGES
46+
47+
replacers:
48+
# Remove irrelevant information from Renovate bot
49+
- search: '/(?<=---\s)\s*^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
50+
replace: ''
51+
# Remove Renovate bot banner image
52+
- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm'
53+
replace: ''

0 commit comments

Comments
 (0)