From 6e189e7b8deb626bd357e3e33b675c1058318804 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sun, 7 Jun 2020 09:55:57 -0700 Subject: [PATCH] Use github actions to build and push (#213) * Use github actions to build and push * Update readme * rename to docker * rename to docker * update descriptions * build-and-push * Update readme * more renaming * Update .github/workflows/build-and-push.yml Co-authored-by: Andriy Knysh Co-authored-by: Andriy Knysh --- .github/workflows/build-and-push.yml | 23 +++++++++++++++++++++++ .travis.yml | 28 ---------------------------- Dockerfile | 3 ++- README.md | 10 +++++----- README.yaml | 4 ++-- docs/targets.md | 8 ++++---- modules/make/Makefile | 9 ++++++--- modules/terraform/Makefile | 2 +- 8 files changed, 43 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/build-and-push.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 00000000..d90db95d --- /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: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: "Checkout source code at current commit" + uses: actions/checkout@v2 + - name: "Build and push docker image to DockerHub" + 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..d36625e1 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ [![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/) +# 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/) This `build-harness` is a collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more. @@ -185,13 +185,13 @@ Available targets: geodesic/deploy Run a Jenkins Job to Deploy $(APP) with $(CANONICAL_TAG) git/aliases-update Update git aliases git/export Export git vars - git/submodules-update Update submodules github/download-private-release Download release from github github/download-public-release Download release from github github/latest-release Fetch the latest release tag from the GitHub API github/push-artifacts Push all release artifacts to GitHub (Required: `GITHUB_TOKEN`) gitleaks/install Install gitleaks gitleaks/scan Scan current repository + git/submodules-update Update submodules go/build Build binary go/build-all Build binary for all platforms go/clean Clean compiled binary @@ -220,6 +220,7 @@ Available targets: helm/delete/failed Delete all failed releases in a `NAMESPACE` subject to `FILTER` helm/delete/namespace Delete all releases in a `NAMEPSACE` as well as the namespace helm/delete/namespace/empty Delete `NAMESPACE` if there are no releases in it + helmfile/install Install helmfile helm/install Install helm helm/repo/add Add $REPO_NAME from $REPO_ENDPOINT helm/repo/add-current Add helm remote dev repos @@ -232,17 +233,16 @@ Available targets: helm/repo/update Update repo info helm/serve/index Build index for serve helm charts helm/toolbox/upsert Install or upgrade helm tiller - helmfile/install Install helmfile help Help screen help/all Display help for all targets help/short This help short screen jenkins/run-job-with-tag Run a Jenkins Job with $(TAG) make/lint Lint all makefiles packages/delete Delete packages - packages/install Install packages packages/install/% Install package (e.g. helm, helmfile, kubectl) - packages/reinstall Reinstall packages + packages/install Install packages packages/reinstall/% Reinstall package (e.g. helm, helmfile, kubectl) + packages/reinstall Reinstall packages packages/uninstall/% Uninstall package (e.g. helm, helmfile, kubectl) readme Alias for readme/build readme/build Create README.md by building it from README.yaml 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..acce5cae 100644 --- a/docs/targets.md +++ b/docs/targets.md @@ -44,13 +44,13 @@ Available targets: geodesic/deploy Run a Jenkins Job to Deploy $(APP) with $(CANONICAL_TAG) git/aliases-update Update git aliases git/export Export git vars - git/submodules-update Update submodules github/download-private-release Download release from github github/download-public-release Download release from github github/latest-release Fetch the latest release tag from the GitHub API github/push-artifacts Push all release artifacts to GitHub (Required: `GITHUB_TOKEN`) gitleaks/install Install gitleaks gitleaks/scan Scan current repository + git/submodules-update Update submodules go/build Build binary go/build-all Build binary for all platforms go/clean Clean compiled binary @@ -79,6 +79,7 @@ Available targets: helm/delete/failed Delete all failed releases in a `NAMESPACE` subject to `FILTER` helm/delete/namespace Delete all releases in a `NAMEPSACE` as well as the namespace helm/delete/namespace/empty Delete `NAMESPACE` if there are no releases in it + helmfile/install Install helmfile helm/install Install helm helm/repo/add Add $REPO_NAME from $REPO_ENDPOINT helm/repo/add-current Add helm remote dev repos @@ -91,17 +92,16 @@ Available targets: helm/repo/update Update repo info helm/serve/index Build index for serve helm charts helm/toolbox/upsert Install or upgrade helm tiller - helmfile/install Install helmfile help Help screen help/all Display help for all targets help/short This help short screen jenkins/run-job-with-tag Run a Jenkins Job with $(TAG) make/lint Lint all makefiles packages/delete Delete packages - packages/install Install packages packages/install/% Install package (e.g. helm, helmfile, kubectl) - packages/reinstall Reinstall packages + packages/install Install packages packages/reinstall/% Reinstall package (e.g. helm, helmfile, kubectl) + packages/reinstall Reinstall packages packages/uninstall/% Uninstall package (e.g. helm, helmfile, kubectl) readme Alias for readme/build readme/build Create README.md by building it from README.yaml 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