diff --git a/.github/auto-label.yml b/.github/auto-label.yml index c7b151ca..b7f6236b 100644 --- a/.github/auto-label.yml +++ b/.github/auto-label.yml @@ -8,6 +8,7 @@ modules/docker: modules/docker/** modules/docs: modules/docs/** modules/geodesic: modules/geodesic/** modules/git: modules/git/** +modules/github-automated-workflow: modules/github-automated-workflow/** modules/github: modules/github/** modules/gitleaks: modules/gitleaks/** modules/go: modules/go/** diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 00000000..ed9361fa --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,23 @@ +name: docker +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] + +jobs: + update: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v1 + - name: docker/build-and-push + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + repository: ${{ github.repository }} + registry: registry-1.docker.io + tag_with_ref: true + tag_with_sha: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 26b90114..00000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: go -go: - - 1.9.x - -addons: - apt: - packages: - - git - - make - - curl - -services: -- docker - -install: -- make docker/login -- make go/deps-build -- make go/deps-dev -- make readme/deps - -script: -- make bash/lint -- make make/lint -- make terraform/install -- make docker/build - -after_success: -- make travis/docker-tag-and-push diff --git a/Dockerfile b/Dockerfile index eef01964..c9093835 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,8 @@ ENV INSTALL_PATH /usr/local/bin WORKDIR /build-harness -RUN make -s template/deps aws/install +RUN make -s bash/lint make/lint +RUN make -s template/deps aws/install terraform/install go/deps-build go/deps-dev readme/deps ENTRYPOINT ["/usr/bin/make"] diff --git a/README.md b/README.md index de7a999d..1b40e0dd 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,22 @@ - +# Build Harness [![Build Status](https://github.com/cloudposse/build-harness/workflows/docker/badge.svg?branch=master)](https://github.com/cloudposse/build-harness/actions?query=workflow%3Adocker) [![Latest Release](https://img.shields.io/github/release/cloudposse/build-harness.svg)](https://github.com/cloudposse/build-harness/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com) [![Discourse Forum](https://img.shields.io/discourse/https/ask.sweetops.com/posts.svg)](https://ask.sweetops.com/) + +[![README Header][readme_header_img]][readme_header_link] +[![Cloud Posse][logo]](https://cpco.io/homepage) + -[![README Header][readme_header_img]][readme_header_link] - -[![Cloud Posse][logo]](https://cpco.io/homepage) - -# Build Harness [![Build Status](https://travis-ci.org/cloudposse/build-harness.svg?branch=master)](https://travis-ci.org/cloudposse/build-harness) [![Latest Release](https://img.shields.io/github/release/cloudposse/build-harness.svg)](https://github.com/cloudposse/build-harness/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com) [![Discourse Forum](https://img.shields.io/discourse/https/ask.sweetops.com/posts.svg)](https://ask.sweetops.com/) - +--> This `build-harness` is a collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more. It's designed to work with CI/CD systems such as GitHub Actions, Codefresh, Travis CI, CircleCI and Jenkins. @@ -51,7 +33,7 @@ It's designed to work with CI/CD systems such as GitHub Actions, Codefresh, Trav --- -This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps. +This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps. [][share_email] [][share_googleplus] [][share_facebook] @@ -104,9 +86,9 @@ Run `make help` for a list of available targets. The `build-harness` is compatible with [GitHub Actions](https://github.com/features/actions). -Here's an example of running `make readme/lint` +Here's an example of running `make readme/lint` -``` +```yaml name: build-harness/readme/lint on: [pull_request] jobs: @@ -139,8 +121,9 @@ Here are some real world examples: + ## Makefile Targets -``` +```text Available targets: aws/install Install aws cli bundle @@ -254,28 +237,34 @@ Available targets: slack/notify/deploy Send notification to slack using "deploy" template 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/install Install terraform terraform/lint Lint check Terraform - terraform/upgrade-modules Upgrade all terraform module sources + terraform/loosen-constraints and convert "~>" constraints to ">=". + terraform/rewrite-required-providers Rewrite versions.tf to update existing configuration to add an explicit source attribute for each provider + terraform/upgrade-modules This target has not been upgraded to handle registry format terraform/validate Basic terraform sanity check travis/docker-login Login into docker hub travis/docker-tag-and-push Tag & Push according Travis environment variables ``` + + ## Extending `build-harness` with targets from another repo It is possible to extend the `build-harness` with targets and entire modules of your own, without having to fork or modify `build-harness` itself. This might be useful if, for example, you wanted to maintain some tooling that was specific to your environment that didn't have enough general applicability to be part of the main project. This makes it so you don't necessarily need to fork `build-harness` itself - you can place a repo defined by the environment variable `BUILD_HARNESS_EXTENSIONS_PATH` (a filesystem peer of `build-harness` named `build-harness-extensions` by default) and populate it with tools in the same `Makefile` within `module` structure as `build-harness` has. Modules will be combined and available with a unified `make` command. + -## Share the Love +## Share the Love -Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/build-harness)! (it helps us **a lot**) +Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/build-harness)! (it helps us **a lot**) Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =) @@ -292,14 +281,14 @@ Check out these related projects. ## References -For additional context, refer to some of these links. +For additional context, refer to some of these links. - [Wikipedia - Test Harness](https://en.wikipedia.org/wiki/Test_harness) - The `build-harness` is similar in concept to a "Test Harness" ## Help -**Got a question?** We got answers. +**Got a question?** We got answers. File a GitHub [issue](https://github.com/cloudposse/build-harness/issues), send us an [email][email] or join our [Slack Community][slack]. @@ -308,7 +297,7 @@ File a GitHub [issue](https://github.com/cloudposse/build-harness/issues), send ## DevOps Accelerator for Startups -We are a [**DevOps Accelerator**][commercial_support]. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us. +We are a [**DevOps Accelerator**][commercial_support]. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us. [![Learn More](https://img.shields.io/badge/learn%20more-success.svg?style=for-the-badge)][commercial_support] @@ -337,11 +326,11 @@ Participate in our [Discourse Forums][discourse]. Here you'll find answers to co ## Newsletter -Sign up for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover. +Sign up for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover. ## Office Hours -[Join us every Wednesday via Zoom][office_hours] for our weekly "Lunch & Learn" sessions. It's **FREE** for everyone! +[Join us every Wednesday via Zoom][office_hours] for our weekly "Lunch & Learn" sessions. It's **FREE** for everyone! [![zoom](https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png")][office_hours] @@ -375,28 +364,30 @@ Copyright © 2016-2020 [Cloud Posse, LLC](https://cloudposse.com) -## License +## License -[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +[![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. +```text +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. +``` @@ -418,7 +409,7 @@ This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? P We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We ❤️ [Open Source Software][we_love_open_source]. -We offer [paid support][commercial_support] on all of our projects. +We offer [paid support][commercial_support] on all of our projects. Check out [our other projects][github], [follow us on twitter][twitter], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation. @@ -426,8 +417,10 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply ### Contributors -| [![Erik Osterman][osterman_avatar]][osterman_homepage]
[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]
[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]
[Andriy Knysh][aknysh_homepage] | [![Sarkis][sarkis_avatar]][sarkis_homepage]
[Sarkis][sarkis_homepage] | [![Alexander Babai][alebabai_avatar]][alebabai_homepage]
[Alexander Babai][alebabai_homepage] | [![Jon Boulle][jonboulle_avatar]][jonboulle_homepage]
[Jon Boulle][jonboulle_homepage] | -|---|---|---|---|---|---| + +| [![Erik Osterman][osterman_avatar]][osterman_homepage]
[Erik Osterman][osterman_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]
[Igor Rodionov][goruha_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]
[Andriy Knysh][aknysh_homepage] | [![Sarkis][sarkis_avatar]][sarkis_homepage]
[Sarkis][sarkis_homepage] | [![Alexander Babai][alebabai_avatar]][alebabai_homepage]
[Alexander Babai][alebabai_homepage] | [![Jon Boulle][jonboulle_avatar]][jonboulle_homepage]
[Jon Boulle][jonboulle_homepage] | [![Marcin Brański][3h4x_avatar]][3h4x_homepage]
[Marcin Brański][3h4x_homepage] | +|---|---|---|---|---|---|---| + [osterman_homepage]: https://github.com/osterman [osterman_avatar]: https://img.cloudposse.com/150x150/https://github.com/osterman.png @@ -441,6 +434,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply [alebabai_avatar]: https://img.cloudposse.com/150x150/https://github.com/alebabai.png [jonboulle_homepage]: https://github.com/jonboulle [jonboulle_avatar]: https://img.cloudposse.com/150x150/https://github.com/jonboulle.png + [3h4x_homepage]: https://github.com/3h4x + [3h4x_avatar]: https://img.cloudposse.com/150x150/https://github.com/3h4x.png [![README Footer][readme_footer_img]][readme_footer_link] [![Beacon][beacon]][website] diff --git a/README.yaml b/README.yaml index 90d0b5d8..14200cac 100644 --- a/README.yaml +++ b/README.yaml @@ -25,8 +25,8 @@ github_repo: cloudposse/build-harness # Badges to display badges: - name: "Build Status" - image: "https://travis-ci.org/cloudposse/build-harness.svg?branch=master" - url: "https://travis-ci.org/cloudposse/build-harness" + image: "https://github.com/cloudposse/build-harness/workflows/docker/badge.svg?branch=master" + url: "https://github.com/cloudposse/build-harness/actions?query=workflow%3Adocker" - name: "Latest Release" image: "https://img.shields.io/github/release/cloudposse/build-harness.svg" url: "https://github.com/cloudposse/build-harness/releases/latest" diff --git a/docs/targets.md b/docs/targets.md index c8e32d33..ffa0b810 100644 --- a/docs/targets.md +++ b/docs/targets.md @@ -1,5 +1,6 @@ + ## Makefile Targets -``` +```text Available targets: aws/install Install aws cli bundle @@ -113,13 +114,17 @@ Available targets: slack/notify/deploy Send notification to slack using "deploy" template 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/install Install terraform terraform/lint Lint check Terraform - terraform/upgrade-modules Upgrade all terraform module sources + terraform/loosen-constraints and convert "~>" constraints to ">=". + terraform/rewrite-required-providers Rewrite versions.tf to update existing configuration to add an explicit source attribute for each provider + terraform/upgrade-modules This target has not been upgraded to handle registry format terraform/validate Basic terraform sanity check travis/docker-login Login into docker hub travis/docker-tag-and-push Tag & Push according Travis environment variables ``` + diff --git a/modules/make/Makefile b/modules/make/Makefile index b598cdbd..b5779aaa 100644 --- a/modules/make/Makefile +++ b/modules/make/Makefile @@ -3,6 +3,9 @@ make/lint: @LINT=true \ find . -type f -name '*Makefile*' \ -type f '!' -name '*.example' \ - -type f '!' -path './vendor/*' -exec \ - /bin/sh -c 'echo "==> {}">/dev/stderr; make --include-dir=modules/ --just-print --dry-run --recon --no-print-directory --quiet --silent -f {}' \; > /dev/null - @$(SELF) bash/lint + -type f '!' -path './modules/packages/*' \ + -type f '!' -path './vendor/*' \ + -type f '!' -path './templates/Makefile.build-harness' \ + -type f '!' -path './Makefile' \ + -exec \ + /bin/sh -c 'echo "==> {}">/dev/stderr; make --file=modules/packages/Makefile --include-dir=modules/ --just-print --dry-run --recon --no-print-directory --quiet --silent -f {}' \; > /dev/null diff --git a/modules/terraform/Makefile b/modules/terraform/Makefile index 83eaa379..c1209465 100644 --- a/modules/terraform/Makefile +++ b/modules/terraform/Makefile @@ -1,6 +1,6 @@ TMP ?= /tmp TERRAFORM ?= $(BUILD_HARNESS_PATH)/vendor/terraform -TERRAFORM_VERSION ?= 0.11.11 +TERRAFORM_VERSION ?= 0.12.26 TERRAFORM_URL ?= https://releases.hashicorp.com/terraform/$(TERRAFORM_VERSION)/terraform_$(TERRAFORM_VERSION)_$(OS)_$(BUILD_HARNESS_ARCH).zip ## Install terraform