Skip to content

Commit d4839f3

Browse files
committed
update Makefiles as per suggested, remove image wrapper scripts
1 parent 9030482 commit d4839f3

11 files changed

+27
-200
lines changed

.travis.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
os: linux
22
dist: xenial
33

4-
# Install python3 and utilities dependencies
5-
addons:
6-
apt:
7-
packages:
8-
- "python3"
9-
- "python3-pip"
10-
11-
# Python 3.6 is the default Python when language: python.
12-
# But when not language: python, Python 3 can not be used by default.
13-
# There is pip (/usr/bin/pip), but not pip3.
14-
# Because of it the global env is required.
15-
env:
16-
global:
17-
- PATH=/opt/python/3.6.7/bin:$PATH
18-
194
language: go
205
go:
216
- 1.15.x
@@ -93,7 +78,11 @@ jobs:
9378
- stage: test
9479
name: ansible e2e
9580
<<: *test
81+
env:
82+
# Required to set python3 as the default python interpreter.
83+
- PATH=/opt/python/3.6.7/bin:${PATH}
9684
before_script:
85+
- sudo apt-get install python3 python3-pip
9786
- pip3 install --upgrade setuptools pip
9887
- pip install --user ansible~=2.9.13
9988
script:

Makefile

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,22 @@ clean: ## Cleanup build artifacts and tool binaries.
4949

5050
##@ Build
5151

52-
.PHONY: build
53-
build: build/operator-sdk build/ansible-operator build/helm-operator ## Build operator-sdk, ansible-operator, and helm-operator.
54-
5552
.PHONY: install
56-
GOBIN ?= $(shell go env GOPATH)/bin
57-
install: ## Install operator-sdk, ansible-operator, and helm-operator in $GOBIN
53+
install: ## Install operator-sdk, ansible-operator, and helm-operator.
5854
go install $(GO_BUILD_ARGS) ./cmd/{operator-sdk,ansible-operator,helm-operator}
5955

60-
# Build operator-sdk project binaries
56+
.PHONY: build
57+
build: ## Build operator-sdk, ansible-operator, and helm-operator.
58+
@mkdir -p $(BUILD_DIR)
59+
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR) ./cmd/{operator-sdk,ansible-operator,helm-operator}
60+
61+
# Build scorecard binaries.
62+
.PHONY: build/scorecard-test build/scorecard-test-kuttl build/custom-scorecard-tests
6163
build/scorecard-test build/scorecard-test-kuttl build/custom-scorecard-tests:
62-
go build $(GO_GCFLAGS) $(GO_ASMFLAGS) -o $@ ./images/$(@F)
63-
build/%:
64-
go build $(GO_BUILD_ARGS) -o $@ ./cmd/$*
64+
go build $(GO_GCFLAGS) $(GO_ASMFLAGS) -o $(BUILD_DIR)/$(@F) ./images/$(@F)
65+
.PHONY: build/operator-sdk build/ansible-operator build/helm-operator
66+
build/operator-sdk build/ansible-operator build/helm-operator:
67+
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR)/$(@F) ./cmd/$(@F)
6568

6669
##@ Dev images
6770

@@ -73,8 +76,9 @@ image-build: $(foreach i,$(IMAGE_TARGET_LIST),image/$(i)) ## Build all images.
7376
# Build an image.
7477
IMAGE_REPO ?= quay.io/operator-framework
7578
image/%: build/%
76-
rm -rf build/_image && mkdir -p build/_image && mv build/$* build/_image
79+
rm -rf build/_image && mkdir -p build/_image && cp build/$* build/_image
7780
docker build -t $(IMAGE_REPO)/$*:dev -f ./images/$*/Dockerfile build/_image
81+
@rm -rf build/_image
7882

7983
##@ Test
8084

@@ -115,9 +119,7 @@ test-e2e-setup: build
115119
$(SCRIPTS_DIR)/fetch kind 0.9.0
116120
$(SCRIPTS_DIR)/fetch envtest 0.6.3
117121
$(SCRIPTS_DIR)/fetch kubectl $(K8S_VERSION) # Install kubectl AFTER envtest because envtest includes its own kubectl binary
118-
ifeq (,$(findstring $(KIND_CLUSTER),$(shell $(TOOLS_DIR)/kind get clusters -q)))
119-
$(TOOLS_DIR)/kind create cluster --image="kindest/node:v$(K8S_VERSION)" --name $(KIND_CLUSTER)
120-
endif
122+
[[ "`$(TOOLS_DIR)/kind get clusters`" =~ "$(KIND_CLUSTER)" ]] || $(TOOLS_DIR)/kind create cluster --image="kindest/node:v$(K8S_VERSION)" --name $(KIND_CLUSTER)
121123

122124
.PHONY: test-e2e-teardown
123125
test-e2e-teardown:
@@ -126,7 +128,7 @@ test-e2e-teardown:
126128
rm -f $(KUBECONFIG)
127129

128130
# Double colon rules allow repeated rule declarations.
129-
# Repeated rules are exectured in the order they appear.
131+
# Repeated rules are executed in the order they appear.
130132
$(e2e_targets):: test-e2e-setup image/scorecard-test
131133

132134
test-e2e:: $(e2e_tests) ## Run e2e tests

hack/image/ansible/Dockerfile

Lines changed: 0 additions & 44 deletions
This file was deleted.

hack/image/build-ansible-image.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

hack/image/build-custom-scorecard-tests-image.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

hack/image/build-helm-image.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

hack/image/build-scorecard-test-image.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

hack/image/build-scorecard-test-kuttl-image.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

hack/image/build-sdk-image.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

images/operator-sdk/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
22

3-
ENV CGO_ENABLED=0
4-
53
RUN microdnf install -y golang make which
64

75
ARG BIN=operator-sdk

release/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1+
## This Makefile should only be called from the project root ##
2+
13
# Needed for glob expansion.
24
SHELL = /bin/bash
35
.SHELLFLAGS = -O extglob -c
46

5-
GIT_VERSION = $(shell git describe --dirty --always --tags)
67
ifneq ($(DRY_RUN),)
7-
SNAPSHOT_FLAGS = --snapshot --skip-publish --rm-dist
88
TAG ?= $(GIT_VERSION)
99
endif
1010

11+
# Ensure that this Makefile is run from the project root (always contains the 'cmd/' directory).
12+
ifeq (,$(wildcard cmd))
13+
$(error "This Makefile must be invoked from the operator-sdk project root")
14+
endif
15+
1116
.PHONY: all
1217
all: release
1318

0 commit comments

Comments
 (0)