-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jeremy T. Bouse <[email protected]>
- Loading branch information
Showing
17 changed files
with
737 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
# | ||
# This is a shim installed automatically by the build-harness | ||
# https://github.com/cloudposse/build-harness | ||
# | ||
|
||
# templates/Makefile.build-harness includes this Makefile | ||
# and this Makefile includes templates/Makefile.build-harness | ||
# to support different modes of invocation. Use a guard variable | ||
# to prevent infinite recursive includes | ||
ifeq ($(BUILD_HARNESS_TEMPLATES_MAKEFILE_GUARD),) | ||
BUILD_HARNESS_TEMPLATES_MAKEFILE_GUARD := included | ||
|
||
export SHELL = /bin/bash | ||
export PWD = $(shell pwd) | ||
export BUILD_HARNESS_ORG ?= ugns | ||
export BUILD_HARNESS_PROJECT ?= build-harness | ||
export BUILD_HARNESS_DOCKER_IMAGE ?= $(BUILD_HARNESS_ORG)/$(BUILD_HARNESS_PROJECT) | ||
export BUILD_HARNESS_BRANCH ?= main | ||
export BUILD_HARNESS_CLONE_URL ?= https://github.com/$(BUILD_HARNESS_ORG)/$(BUILD_HARNESS_PROJECT).git | ||
|
||
# Resolves BUILD_HARNESS_PATH to BUILD_HARNESS_PATH_LOCAL when BUILD_HARNESS_PATH does not exist | ||
BUILD_HARNESS_PATH ?= $(shell until [ -d "$(BUILD_HARNESS_PROJECT)" ] || [ "`pwd`" == '/' ]; do cd ..; done; pwd)/$(BUILD_HARNESS_PROJECT) | ||
BUILD_HARNESS_PATH_LOCAL := $(PWD)/$(BUILD_HARNESS_PROJECT) | ||
export BUILD_HARNESS_PATH := $(or $(wildcard $(BUILD_HARNESS_PATH)),$(BUILD_HARNESS_PATH_LOCAL)) | ||
# 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 | ||
# With the ":=" syntax, it stores the current value of BUILD_HARNESS_PATH, so this has to come after that has been set with ":=" | ||
export BUILD_HARNESS_DOCKER_SHA_TAG_CMD := git -C "$(BUILD_HARNESS_PATH)" log -n 1 --format=sha-%h 2>/dev/null || echo latest | ||
|
||
# Toggles the auto-init feature | ||
BUILD_HARNESS_AUTO_INIT ?= false | ||
|
||
# Macro to clone/install BUILD_HARNESS_PROJECT | ||
define harness_install | ||
curl --retry 5 --fail --silent --retry-delay 1 \ | ||
https://raw.githubusercontent.com/$(BUILD_HARNESS_ORG)/$(BUILD_HARNESS_PROJECT)/$(BUILD_HARNESS_BRANCH)/bin/install.sh | \ | ||
bash -s "$(BUILD_HARNESS_ORG)" "$(BUILD_HARNESS_PROJECT)" "$(BUILD_HARNESS_BRANCH)" | ||
endef | ||
|
||
# Macro to auto-init the BUILD_HARNESS_PROJECT with the `include` directive | ||
# Tests if BUILD_HARNESS_PROJECT does not yet exist, or if it does exist but the | ||
# checkout does not match BUILD_HARNESS_BRANCH | ||
define harness_auto_init | ||
if [[ \ | ||
-f "/build-harness/Makefile" || -f "/$(BUILD_HARNESS_PROJECT)/Makefile" \ | ||
]]; then \ | ||
echo "[.build-harness]: In $(BUILD_HARNESS_PROJECT) docker container, skipping auto-init" ;\ | ||
elif grep -q docker /proc/1/cgroup 2>/dev/null; then \ | ||
echo "[.build-harness]: In unknown docker container, skipping auto-init" ;\ | ||
elif [[ \ | ||
"$(BUILD_HARNESS_PATH)" != "$(BUILD_HARNESS_PATH_LOCAL)" && \ | ||
-f "$(BUILD_HARNESS_PATH)/Makefile" \ | ||
]]; then \ | ||
echo "[.build-harness]: Using external $(BUILD_HARNESS_PATH), skipping auto-init" ;\ | ||
elif [[ \ | ||
"$(BUILD_HARNESS_PATH)" == "$(BUILD_HARNESS_PATH_LOCAL)" && \ | ||
-f "$(BUILD_HARNESS_PATH)/Makefile" && \ | ||
"$$(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)" \ | ||
]]; then \ | ||
echo "[.build-harness]: Clone of $(BUILD_HARNESS_PROJECT) is up-to-date, skipping auto-init" ;\ | ||
else \ | ||
$(harness_install) ;\ | ||
fi | ||
endef | ||
|
||
-include $(if $(findstring true,$(BUILD_HARNESS_AUTO_INIT)),$(shell $(harness_auto_init) >&2)) $(BUILD_HARNESS_PATH)/Makefile | ||
|
||
.PHONY : init | ||
## Init build-harness | ||
init:: | ||
@ $(harness_install) | ||
|
||
.PHONY : clean | ||
## Clean build-harness | ||
clean:: | ||
@ if [ -d "$(BUILD_HARNESS_PATH)" ]; then \ | ||
if [ -d build-harness ] && [ $$(stat -f -c %i "$(BUILD_HARNESS_PATH)") == $$(stat -f -c %i build-harness) ]; then \ | ||
rm -rf build-harness; \ | ||
else \ | ||
echo Not removing build harness from "$(BUILD_HARNESS_PATH)" because it appears to be shared.; \ | ||
echo If you are sure you want to delete it, run: ; \ | ||
echo ' rm -rf "$(BUILD_HARNESS_PATH)"'; \ | ||
fi; \ | ||
fi | ||
|
||
.PHONY: build-harness/shell builder build-harness/shell/pull builder/pull builder/build | ||
|
||
build-harness/shell/pull builder/pull builder/build: BUILD_HARNESS_DOCKER_SHA_TAG ?= $(shell $(BUILD_HARNESS_DOCKER_SHA_TAG_CMD)) | ||
build-harness/shell/pull builder/pull: | ||
docker pull $(BUILD_HARNESS_DOCKER_IMAGE):$(BUILD_HARNESS_DOCKER_SHA_TAG) | ||
@[[ "$(BUILD_HARNESS_DOCKER_SHA_TAG)" == "latest" ]] || docker pull $(BUILD_HARNESS_DOCKER_IMAGE):latest | ||
|
||
builder/build: export DOCKER_IMAGE_NAME = $(BUILD_HARNESS_DOCKER_IMAGE):$(BUILD_HARNESS_DOCKER_SHA_TAG) | ||
builder/build: | ||
@$(MAKE) --no-print-directory docker/build | ||
|
||
DEFAULT_DOCKER_ENVS := AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN TERM AWS_PROFILE AWS_REGION \ | ||
AWS_DEFAULT_PROFILE AWS_DEFAULT_REGION | ||
EXTRA_DOCKER_ENVS ?= AWS_CONFIG_FILE AWS_SHARED_CREDENTIALS_FILE | ||
DOCKER_ENVS ?= $(DEFAULT_DOCKER_ENVS) $(EXTRA_DOCKER_ENVS) | ||
|
||
## Start a shell inside of the `build-harness` docker container with `make build-harness/shell` or `make builder` | ||
## Run `make` targets inside the build-harness shell by setting `TARGETS` or `TARGET`, e.g. | ||
## make builder TARGETS="github/init readme" | ||
build-harness/shell builder tester: MOUNT_HOME ?= $(shell [ -d "$$HOME" ] && printf -- "-e HOME -v \"%s\":\"%s\"" "$$HOME" "$$HOME") | ||
build-harness/shell builder tester: TARGETS ?= $(TARGET) | ||
build-harness/shell builder tester: ARGS := $(if $(TARGETS),$(TARGETS),-l || true) | ||
build-harness/shell builder tester: ENTRYPOINT := $(if $(TARGETS),/usr/bin/make,/bin/bash) | ||
build-harness/shell builder pr/pre-commit: RUNNER_DOCKER_TAG ?= $(shell $(BUILD_HARNESS_DOCKER_SHA_TAG_CMD)) | ||
build-harness/shell builder pr/pre-commit: RUNNER_DOCKER_IMAGE ?= $(BUILD_HARNESS_DOCKER_IMAGE) | ||
build-harness/shell builder: build-harness/runner | ||
@exit 0 | ||
|
||
.PHONY: build-harness/shell-slim builder-slim pr/auto-format pr/auto-format/host pr/readme pr/readme/host pr/pre-commit tf14-upgrade | ||
|
||
build-harness/shell-slim builder-slim pr/auto-format pr/readme tf14-upgrade: RUNNER_DOCKER_IMAGE ?= $(BUILD_HARNESS_DOCKER_IMAGE) | ||
|
||
build-harness/shell-slim builder-slim tf14-upgrade pr/auto-format pr/readme: RUNNER_DOCKER_SHA_TAG ?= $(shell $(BUILD_HARNESS_DOCKER_SHA_TAG_CMD)) | ||
build-harness/shell-slim builder-slim tf14-upgrade pr/auto-format pr/readme: RUNNER_DOCKER_TAG ?= \ | ||
$(shell docker inspect --type=image $(RUNNER_DOCKER_IMAGE):$(RUNNER_DOCKER_SHA_TAG) >/dev/null 2>&1 && \ | ||
echo "$(RUNNER_DOCKER_SHA_TAG) " || echo "slim-$(RUNNER_DOCKER_SHA_TAG)") | ||
|
||
build-harness/shell-slim builder-slim: TARGETS ?= $(TARGET) | ||
build-harness/shell-slim builder-slim: ARGS := $(if $(TARGETS),$(TARGETS),-l || true) | ||
build-harness/shell-slim builder-slim: ENTRYPOINT := $(if $(TARGETS),/usr/bin/make,/bin/bash) | ||
build-harness/shell-slim builder-slim: build-harness/runner | ||
|
||
pr/auto-format pr/readme pr/pre-commit tf14-upgrade : ENTRYPOINT := /usr/bin/make | ||
|
||
pr/auto-format pr/auto-format/host: ARGS := terraform/fmt readme | ||
pr/readme pr/readme/host: ARGS := readme/deps readme | ||
pr/auto-format pr/readme: build-harness/runner | ||
pr/auto-format/host pr/readme/host: | ||
$(MAKE) $(ARGS) | ||
|
||
pr/pre-commit: ARGS := pre-commit/run | ||
pr/pre-commit: build-harness/runner | ||
|
||
tf14-upgrade: export TERRAFORM_FORCE_README := true | ||
tf14-upgrade: ARGS := github/init terraform/v14-rewrite | ||
tf14-upgrade: build-harness/runner | ||
|
||
.PHONY: tester tester/pull | ||
|
||
tester tester/pull: TEST_HARNESS_DOCKER_IMAGE ?= cloudposse/test-harness | ||
tester tester/pull: TEST_HARNESS_DOCKER_TAG ?= latest | ||
tester: RUNNER_DOCKER_IMAGE ?= $(TEST_HARNESS_DOCKER_IMAGE) | ||
tester: RUNNER_DOCKER_TAG ?= $(TEST_HARNESS_DOCKER_TAG) | ||
tester: build-harness/runner | ||
|
||
tester/pull: | ||
docker pull $(TEST_HARNESS_DOCKER_IMAGE):$(TEST_HARNESS_DOCKER_TAG) | ||
|
||
|
||
.PHONY: build-harness/runner | ||
|
||
build-harness/runner: | ||
$(info Starting $(RUNNER_DOCKER_IMAGE):$(RUNNER_DOCKER_TAG)) | ||
docker run --name build-harness \ | ||
--rm -it \ | ||
-e PACKAGES_PREFER_HOST=true \ | ||
$(addprefix -e ,$(DOCKER_ENVS)) \ | ||
$(MOUNT_HOME) \ | ||
-v $(CURDIR):/opt \ | ||
--workdir /opt \ | ||
--entrypoint $(ENTRYPOINT) \ | ||
$(RUNNER_DOCKER_IMAGE):$(RUNNER_DOCKER_TAG) $(ARGS) | ||
|
||
.PHONY: reset-owner | ||
reset-owner: | ||
@if [[ -n $$(find . -xdev -user 0 -print) ]]; then \ | ||
printf "\n* To reset ownership on files, run:\n sudo find . -xdev -user 0 -exec chown $$USER {} \;\n\n" ; \ | ||
else \ | ||
printf "\n* No root-owned files found\n\n" ; \ | ||
fi | ||
|
||
endif |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Use this file to define individuals or teams that are responsible for code in a repository. | ||
# Read more: <https://help.github.com/articles/about-codeowners/> | ||
# | ||
# Order is important: the last matching pattern has the highest precedence | ||
|
||
# These owners will be the default owners for everything | ||
* @ugns/engineering @ugns/contributors | ||
|
||
# Cloud Posse must review any changes to Makefiles | ||
**/Makefile @ugns/engineering | ||
**/Makefile.* @ugns/engineering | ||
|
||
# Cloud Posse must review any changes to GitHub actions | ||
.github/* @ugns/engineering | ||
|
||
# Cloud Posse must review any changes to standard context definition, | ||
# but some changes can be rubber-stamped. | ||
**/*.tf @ugns/engineering @ugns/contributors @ugns/approvers | ||
README.yaml @ugns/engineering @ugns/contributors @ugns/approvers | ||
README.md @ugns/engineering @ugns/contributors @ugns/approvers | ||
docs/*.md @ugns/engineering @ugns/contributors @ugns/approvers | ||
|
||
# Cloud Posse Admins must review all changes to CODEOWNERS or the mergify configuration | ||
.github/mergify.yml @ugns/admins | ||
.github/CODEOWNERS @ugns/admins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: 'bug' | ||
assignees: '' | ||
|
||
--- | ||
|
||
Found a bug? Maybe our [Slack Community](https://slack.cloudposse.com) can help. | ||
|
||
[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com) | ||
|
||
## Describe the Bug | ||
A clear and concise description of what the bug is. | ||
|
||
## Expected Behavior | ||
A clear and concise description of what you expected to happen. | ||
|
||
## Steps to Reproduce | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Run '....' | ||
3. Enter '....' | ||
4. See error | ||
|
||
## Screenshots | ||
If applicable, add screenshots or logs to help explain your problem. | ||
|
||
## Environment (please complete the following information): | ||
|
||
Anything that will help us triage the bug will help. Here are some ideas: | ||
- OS: [e.g. Linux, OSX, WSL, etc] | ||
- Version [e.g. 10.15] | ||
|
||
## Additional Context | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
blank_issues_enabled: false | ||
|
||
contact_links: | ||
|
||
- name: Community Slack Team | ||
url: https://cloudposse.com/slack/ | ||
about: |- | ||
Please ask and answer questions here. | ||
- name: Office Hours | ||
url: https://cloudposse.com/office-hours/ | ||
about: |- | ||
Join us every Wednesday for FREE Office Hours (lunch & learn). | ||
- name: DevOps Accelerator Program | ||
url: https://cloudposse.com/accelerate/ | ||
about: |- | ||
Own your infrastructure in record time. We build it. You drive it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: Feature Request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: 'feature request' | ||
assignees: '' | ||
|
||
--- | ||
|
||
Have a question? Please checkout our [Slack Community](https://slack.cloudposse.com) or visit our [Slack Archive](https://archive.sweetops.com/). | ||
|
||
[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com) | ||
|
||
## Describe the Feature | ||
|
||
A clear and concise description of what the bug is. | ||
|
||
## Expected Behavior | ||
|
||
A clear and concise description of what you expected to happen. | ||
|
||
## Use Case | ||
|
||
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. | ||
|
||
## Describe Ideal Solution | ||
|
||
A clear and concise description of what you want to happen. If you don't know, that's okay. | ||
|
||
## Alternatives Considered | ||
|
||
Explain what alternative solutions or features you've considered. | ||
|
||
## Additional Context | ||
|
||
Add any other context or screenshots about the feature request here. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## what | ||
* Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?) | ||
* Use bullet points to be concise and to the point. | ||
|
||
## why | ||
* Provide the justifications for the changes (e.g. business case). | ||
* Describe why these changes were made (e.g. why do these commits fix the problem?) | ||
* Use bullet points to be concise and to the point. | ||
|
||
## references | ||
* Link to any supporting github issues or helpful documentation to add some context (e.g. stackoverflow). | ||
* Use `closes #123`, if this PR closes a GitHub issue `#123` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name-template: 'v$RESOLVED_VERSION' | ||
tag-template: '$RESOLVED_VERSION' | ||
version-template: '$MAJOR.$MINOR.$PATCH' | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'major' | ||
minor: | ||
labels: | ||
- 'minor' | ||
- 'enhancement' | ||
patch: | ||
labels: | ||
- 'auto-update' | ||
- 'patch' | ||
- 'fix' | ||
- 'bugfix' | ||
- 'bug' | ||
- 'hotfix' | ||
- 'no-release' | ||
default: 'minor' | ||
|
||
categories: | ||
- title: '🚀 Enhancements' | ||
labels: | ||
- 'enhancement' | ||
- 'patch' | ||
- title: '🐛 Bug Fixes' | ||
labels: | ||
- 'fix' | ||
- 'bugfix' | ||
- 'bug' | ||
- 'hotfix' | ||
- title: '🤖 Automatic Updates' | ||
labels: | ||
- 'auto-update' | ||
|
||
change-template: | | ||
<details> | ||
<summary>$TITLE @$AUTHOR (#$NUMBER)</summary> | ||
$BODY | ||
</details> | ||
template: | | ||
$CHANGES | ||
replacers: | ||
# Remove irrelevant information from Renovate bot | ||
- search: '/(?<=---\s)\s*^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm' | ||
replace: '' | ||
# Remove Renovate bot banner image | ||
- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm' | ||
replace: '' |
Oops, something went wrong.