Skip to content

Commit

Permalink
Merge pull request #190 from lorengordon/tfdocs-install
Browse files Browse the repository at this point in the history
Extracts terraform-docs from archive retrieved from github release
  • Loading branch information
lorengordon authored May 4, 2021
2 parents 6fc5828 + bd8781b commit 35a009d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.12.1
current_version = 0.12.2
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

### 0.12.2

**Released**: 2021.05.03

**Commit Delta**: [Change from 0.12.1 release](https://github.com/plus3it/tardigrade-ci/compare/0.12.1..0.12.2)

**Summary**:

* Provides a macro "stream_github_release" that supports piping a GitHub Release
artifact to another tool (like `tar`). The target "stream/gh-release/%" is
deprecated in favor of this macro, to avoid an unnecessary recursive `$(MAKE)`.
* Updates the `terraform-docs/install` target to extract the binary from the
tar.gz archive hosted by GitHub Releases, as the binary is no longer available
as a separate artifact.

### 0.12.1

**Released**: 2021.05.3
Expand All @@ -12,13 +27,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

**Summary**:

* Remove the "--user" option from the "python -m pip install" commands.
* Remove the "--user" option from the "python -m pip install" commands.

### 0.12.0

**Released**: 2021.04.23

**Commit Delta**: [Change from 0.12.0 release](https://github.com/plus3it/tardigrade-ci/compare/0.11.0..0.12.0)
**Commit Delta**: [Change from 0.11.0 release](https://github.com/plus3it/tardigrade-ci/compare/0.11.0..0.12.0)

**Summary**:

Expand Down
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ parse_github_download_url = $(CURL) $(GITHUB_AUTHORIZATION) https://api.github.c
# $(call download_github_release,file,owner,repo,version,asset select query)
download_github_release = $(CURL) $(GITHUB_AUTHORIZATION) -o $(1) $(shell $(call parse_github_download_url,$(2),$(3),$(4),$(5)))

# Macro to stream a github binary release
# $(call stream_github_release,owner,repo,version,asset select query)
stream_github_release = $(CURL) $(GITHUB_AUTHORIZATION) $(shell $(call parse_github_download_url,$(1),$(2),$(3),$(4)))

# Macro to download a hashicorp archive release
# $(call download_hashicorp_release,file,app,version)
download_hashicorp_release = $(CURL) -o $(1) https://releases.hashicorp.com/$(2)/$(3)/$(2)_$(3)_$(OS)_$(ARCH).zip
Expand All @@ -87,6 +91,7 @@ install/gh-release/%:
@ echo "[$@]: Completed successfully!"

stream/gh-release/%: guard/env/OWNER guard/env/REPO guard/env/VERSION guard/env/QUERY
$(warning WARNING: The target stream/gh-release is deprecated and will be removed in a future version. Use the macro "stream_github_release" instead.)
$(CURL) $(GITHUB_AUTHORIZATION) $(shell $(call parse_github_download_url,$(OWNER),$(REPO),$(VERSION),$(QUERY)))

zip/install:
Expand All @@ -106,27 +111,29 @@ terraform/install: | $(BIN_DIR) guard/program/jq

terraform-docs/install: TFDOCS_VERSION ?= latest
terraform-docs/install: | $(BIN_DIR) guard/program/jq
@ $(MAKE) install/gh-release/$(@D) FILENAME="$(BIN_DIR)/$(@D)" OWNER=segmentio REPO=$(@D) VERSION=$(TFDOCS_VERSION) QUERY='.name | endswith("$(OS)-$(ARCH)")'
@ echo "[$@]: Installing $(@D)..."
$(call stream_github_release,$(@D),$(@D),$(TFDOCS_VERSION),.name | endswith("$(OS)-$(ARCH).tar.gz")) | tar -C "$(BIN_DIR)" -xzv --wildcards --no-anchored $(@D)
$(@D) --version
@ echo "[$@]: Completed successfully!"

jq/install: JQ_VERSION ?= latest
jq/install: | $(BIN_DIR)
@ $(MAKE) install/gh-release/$(@D) FILENAME="$(BIN_DIR)/$(@D)" OWNER=stedolan REPO=$(@D) VERSION=$(JQ_VERSION) QUERY='.name | endswith("$(OS)64")'

shellcheck/install: SHELLCHECK_VERSION ?= latest
shellcheck/install: $(BIN_DIR) guard/program/xz
$(MAKE) -s stream/gh-release/$(@D) OWNER=koalaman REPO=shellcheck VERSION=$(SHELLCHECK_VERSION) QUERY='.name | endswith("$(OS).x86_64.tar.xz")' | tar -xJv
mv $(@D)-*/$(@D) $(BIN_DIR)
rm -rf $(@D)-*
@ echo "[$@]: Installing $(@D)..."
$(call stream_github_release,koalaman,$(@D),$(SHELLCHECK_VERSION),.name | endswith("$(OS).x86_64.tar.xz")) | tar -C "$(BIN_DIR)" -xJv --wildcards --no-anchored --strip-components=1 $(@D)
$(@D) --version
@ echo "[$@]: Completed successfully!"

# For editorconfig-checker, the tar file consists of a single file,
# ./bin/ec-linux-amd64.
ec/install: EC_BASE_NAME := ec-$(OS)-$(ARCH)
ec/install: EC_VERSION ?= latest
ec/install:
@ echo "[$@]: Installing $(@D)..."
$(MAKE) -s stream/gh-release/$(@D) OWNER=editorconfig-checker REPO=editorconfig-checker VERSION=$(EC_VERSION) QUERY='.name | endswith("$(EC_BASE_NAME).tar.gz")' | tar -C "$(BIN_DIR)" --strip-components=1 -xzvf -
ln -sf "$(BIN_DIR)/$(EC_BASE_NAME)" "$(BIN_DIR)/$(@D)"
$(call stream_github_release,editorconfig-checker,editorconfig-checker,$(EC_VERSION),.name | endswith("$(EC_BASE_NAME).tar.gz")) | tar -C "$(BIN_DIR)" -xzv --wildcards --no-anchored --transform='s/$(EC_BASE_NAME)/ec/' --strip-components=1 $(EC_BASE_NAME)
$(@D) --version
@ echo "[$@]: Completed successfully!"

Expand Down

0 comments on commit 35a009d

Please sign in to comment.