Skip to content

Commit

Permalink
Install tools with aqua
Browse files Browse the repository at this point in the history
Signed-off-by: Daichi Sakaue <[email protected]>
  • Loading branch information
yokaze committed Oct 10, 2024
1 parent 5c23e7d commit cd08158
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
14 changes: 14 additions & 0 deletions .github/actions/aqua/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Setup tools"
description: "Setup tools with aqua"
inputs:
github_token:
description: "GitHub Token"
required: true
runs:
using: composite
steps:
- uses: aquaproj/aqua-installer@6ce1f8848ec8e61f14d57bd5d7597057a6dd187c # v3.0.1
with:
aqua_version: v2.25.1
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
with:
path: cache
key: cache-files-go-${{ hashFiles('go.mod') }}-${{ hashFiles('Makefile') }}
- uses: ./.github/actions/aqua
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup tools
run: make setup
- name: Run code check
Expand Down
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ JQ_VERSION := 1.7.1
KIND_VERSION := 0.22.0
KUBECTL_VERSION := 1.29.3
KUSTOMIZE_VERSION := 5.3.0
YQ_VERSION := 4.43.1

# Test tools
CUSTOMCHECKER := $(TOOLS_DIR)/custom-checker
Expand All @@ -18,7 +17,6 @@ KIND := $(TOOLS_DIR)/kind
KUBECTL := $(TOOLS_DIR)/kubectl
KUSTOMIZE := $(TOOLS_DIR)/kustomize
STATICCHECK := $(TOOLS_DIR)/staticcheck
YQ := $(TOOLS_DIR)/yq

.PHONY: all
all: help
Expand All @@ -30,7 +28,12 @@ help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

.PHONY: setup
setup: $(CUSTOMCHECKER) $(HELM_BINARY) $(KIND) $(JQ) $(KUBECTL) $(KUSTOMIZE) $(STATICCHECK) $(YQ) ## Install necessary tools
setup: $(CUSTOMCHECKER) $(HELM_BINARY) $(KIND) $(JQ) $(KUBECTL) $(KUSTOMIZE) $(STATICCHECK) ## Install necessary tools
if ! which aqua; then \
echo 'setup needs aqua.'; \
exit 1; \
fi
aqua install -l
$(HELM) repo add cilium https://helm.cilium.io/
$(HELM) repo update cilium

Expand Down Expand Up @@ -63,10 +66,6 @@ $(KUSTOMIZE):
$(STATICCHECK):
GOBIN=$(TOOLS_DIR) go install honnef.co/go/tools/cmd/staticcheck@latest

$(YQ):
mkdir -p $(TOOLS_DIR)
wget -qO $@ https://github.com/mikefarah/yq/releases/download/v$(YQ_VERSION)/yq_linux_amd64
chmod +x $@

.PHONY: clean
clean:
Expand Down
13 changes: 13 additions & 0 deletions aqua.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
# aqua - Declarative CLI Version Manager
# https://aquaproj.github.io/
# checksum:
# enabled: true
# require_checksum: true
# supported_envs:
# - all
registries:
- type: standard
ref: v4.231.0 # renovate: depName=aquaproj/aqua-registry
packages:
- name: mikefarah/[email protected]
7 changes: 3 additions & 4 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ HELM := $(TOOLS_DIR)/helm --repository-cache $(CACHE_DIR)/helm/repository --repo
KIND := $(TOOLS_DIR)/kind
KUBECTL := $(TOOLS_DIR)/kubectl
KUSTOMIZE := $(TOOLS_DIR)/kustomize
YQ := $(TOOLS_DIR)/yq

##@ Basic

Expand Down Expand Up @@ -38,9 +37,9 @@ start:

run-test-pod-%:
cat testdata/template/ubuntu.yaml | \
$(YQ) '.metadata.name = "$*"' | \
$(YQ) '.spec.selector.matchLabels = {"test": "$*"}' | \
$(YQ) '.spec.template.metadata.labels = {"test": "$*"}' | \
yq '.metadata.name = "$*"' | \
yq '.spec.selector.matchLabels = {"test": "$*"}' | \
yq '.spec.template.metadata.labels = {"test": "$*"}' | \
$(KUBECTL) apply -f -

.PHONY: install-test-pod
Expand Down

0 comments on commit cd08158

Please sign in to comment.