Skip to content

Commit

Permalink
Update validate codeowners, install auto-readme (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuru authored Feb 10, 2022
1 parent 31e880c commit 8054ccb
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 32 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v2
- name: Lint Code Base
uses: docker://github/super-linter:v3
uses: github/super-linter/slim@v4
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_NATURAL_LANGUAGE: false
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/validate-codeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
steps:
- name: "Checkout source code at current commit"
uses: actions/checkout@v2
- uses: mszostok/codeowners-validator@v0.5.0
- uses: mszostok/codeowners-validator@v0.6.0
if: github.event.pull_request.head.repo.full_name == github.repository
name: "Full check of CODEOWNERS"
with:
Expand All @@ -18,7 +18,7 @@ jobs:
checks: "syntax,owners,duppatterns"
# GitHub access token is required only if the `owners` check is enabled
github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
- uses: mszostok/codeowners-validator@v0.5.0
- uses: mszostok/codeowners-validator@v0.6.0
if: github.event.pull_request.head.repo.full_name != github.repository
name: "Syntax check of CODEOWNERS"
with:
Expand Down
22 changes: 11 additions & 11 deletions Makefile.helpers
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ red = $(shell echo -e '\x1b[33;31m$1\x1b[0m')

# Ensures that a variable is defined and non-empty
define assert-set
@$(if $($(1)),,$(error $(1) not defined in $(@)))
@$(if $($(1)),,$(error $(1) not defined in $(@)))
endef

# Ensures that a variable is undefined
define assert-unset
@$(if $($1),$(error $(1) should not be defined in $(@)),)
@$(if $($1),$(error $(1) should not be defined in $(@)),)
endef

test/assert-set:
Expand Down Expand Up @@ -54,15 +54,15 @@ help/short:

# Generate help output from MAKEFILE_LIST
help/generate:
@awk '/^[a-zA-Z\_0-9%:\\\/-]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = $$1; \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
gsub("\\\\", "", helpCommand); \
gsub(":+$$", "", helpCommand); \
printf " \x1b[32;01m%-35s\x1b[0m %s\n", helpCommand, helpMessage; \
} \
@awk '/^[-a-zA-Z_0-9%:\\\.\/]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = $$1; \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
gsub("\\\\", "", helpCommand); \
gsub(":+$$", "", helpCommand); \
printf " \x1b[32;01m%-35s\x1b[0m %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST) | sort -u
@printf "\n"
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ At the top of your `Makefile` add, the following...
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
```

This will download a `Makefile` called `.build-harness` and include it at run-time. We recommend adding the `.build-harness` file to your `.gitignore`.
This will download a `Makefile` called `.build-harness` and include it at run time. We recommend adding the `.build-harness` file to your `.gitignore`.

This automatically exposes many new targets that you can leverage throughout your build & CI/CD process.

Expand Down Expand Up @@ -168,6 +168,8 @@ Available targets:
docker/image/push Push $TARGET_DOCKER_REGISTRY/$IMAGE_NAME:$TARGET_VERSION
docker/login Login into docker hub
docs/copyright-add Add copyright headers to source code
docs/targets.md Update `docs/targets.md` from `make help`
docs/terraform.md Update `docs/terraform.md` from `terraform-docs`
geodesic/deploy Run a Jenkins Job to Deploy $(APP) with $(CANONICAL_TAG)
git/aliases-update Update git aliases
git/export Export git vars
Expand Down Expand Up @@ -242,8 +244,8 @@ Available targets:
template/build Create $OUT file by building it from $IN template file
template/deps Install dependencies
terraform/bump-tf-12-min-version Rewrite versions.tf to bump modules with minimum core version of '0.12.x' to '>= 0.12.26'
terraform/get-modules Ensure all modules can be fetched
terraform/get-plugins Ensure all plugins can be fetched
terraform/get-modules (Obsolete) Ensure all modules can be fetched
terraform/get-plugins (Obsolete) Ensure all plugins can be fetched
terraform/install Install terraform
terraform/lint Lint check Terraform
terraform/loosen-constraints and convert "~>" constraints to ">=".
Expand Down Expand Up @@ -403,7 +405,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

## Copyrights

Copyright © 2016-2021 [Cloud Posse, LLC](https://cloudposse.com)
Copyright © 2016-2022 [Cloud Posse, LLC](https://cloudposse.com)



Expand Down
2 changes: 1 addition & 1 deletion README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ usage: |-
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
```
This will download a `Makefile` called `.build-harness` and include it at run-time. We recommend adding the `.build-harness` file to your `.gitignore`.
This will download a `Makefile` called `.build-harness` and include it at run time. We recommend adding the `.build-harness` file to your `.gitignore`.
This automatically exposes many new targets that you can leverage throughout your build & CI/CD process.
Expand Down
6 changes: 4 additions & 2 deletions docs/targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Available targets:
docker/image/push Push $TARGET_DOCKER_REGISTRY/$IMAGE_NAME:$TARGET_VERSION
docker/login Login into docker hub
docs/copyright-add Add copyright headers to source code
docs/targets.md Update `docs/targets.md` from `make help`
docs/terraform.md Update `docs/terraform.md` from `terraform-docs`
geodesic/deploy Run a Jenkins Job to Deploy $(APP) with $(CANONICAL_TAG)
git/aliases-update Update git aliases
git/export Export git vars
Expand Down Expand Up @@ -117,8 +119,8 @@ Available targets:
template/build Create $OUT file by building it from $IN template file
template/deps Install dependencies
terraform/bump-tf-12-min-version Rewrite versions.tf to bump modules with minimum core version of '0.12.x' to '>= 0.12.26'
terraform/get-modules Ensure all modules can be fetched
terraform/get-plugins Ensure all plugins can be fetched
terraform/get-modules (Obsolete) Ensure all modules can be fetched
terraform/get-plugins (Obsolete) Ensure all plugins can be fetched
terraform/install Install terraform
terraform/lint Lint check Terraform
terraform/loosen-constraints and convert "~>" constraints to ">=".
Expand Down
1 change: 1 addition & 0 deletions modules/github/Makefile.init
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ GITHUB_TEMPLATES = \
GITHUB_TERRAFORM_TEMPLATES = .github/workflows/chatops.yml \
.github/workflows/auto-context.yml \
.github/workflows/auto-format.yml \
.github/workflows/auto-readme.yml \
.github/mergify.yml \
.github/renovate.json

Expand Down
6 changes: 3 additions & 3 deletions modules/terraform/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ terraform/install:
)
$(TERRAFORM) version

## Ensure all plugins can be fetched
## (Obsolete) Ensure all plugins can be fetched
terraform/get-plugins:
@$echo terraform -get-plugins no longer supported
@echo terraform -get-plugins no longer supported

## Ensure all modules can be fetched
## (Obsolete) Ensure all modules can be fetched
terraform/get-modules:
@$(TERRAFORM) init -get -backend=false -input=false >/dev/null

Expand Down
16 changes: 8 additions & 8 deletions templates/Makefile.build-harness
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ init::
.PHONY : clean
## Clean build-harness
clean::
if [ -d "$(BUILD_HARNESS_PATH)" ]; then \
if [ -d build-harness ] && [ $$(stat -f %i "$(BUILD_HARNESS_PATH)") == $$(stat -f %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; \
@if [ -d "$(BUILD_HARNESS_PATH)" ]; then \
if [ -d build-harness ] && [ $$(ls -di "$(BUILD_HARNESS_PATH)" | cut -f 1 -d' ') == $$(ls -di build-harness | cut -f 1 -d' ') ]; 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
Expand Down

0 comments on commit 8054ccb

Please sign in to comment.