@@ -4,34 +4,38 @@ SHELL = /bin/bash
44# This value must be updated to the release tag of the most recent release, a change that must
55# occur in the release commit. IMAGE_VERSION will be removed once each subproject that uses this
66# version is moved to a separate repo and release process.
7- export IMAGE_VERSION = v1.31 .0
7+ export IMAGE_VERSION = v0.0 .0
88# Build-time variables to inject into binaries
9- # export SIMPLE_VERSION = $(shell (test "$(shell git describe --tags)" = "$(shell git describe --tags --abbrev=0)" && echo $(shell git describe --tags)) || echo $(shell git describe --tags --abbrev=0)+git)
10- # export GIT_VERSION = $(shell git describe --dirty --tags --always)
11- # export GIT_COMMIT = $(shell git rev-parse HEAD)
9+ export SIMPLE_VERSION = $(shell (test "$(shell git describe --tags) " = "$(shell git describe --tags --abbrev=0) " && echo $(shell git describe --tags) ) || echo $(shell git describe --tags --abbrev=0) +git)
10+ export GIT_VERSION = $(shell git describe --dirty --tags --always)
11+ export GIT_COMMIT = $(shell git rev-parse HEAD)
1212export K8S_VERSION = 1.26.0
1313
1414# Build settings
1515export TOOLS_DIR = tools/bin
1616export SCRIPTS_DIR = tools/scripts
1717REPO = $(shell go list -m)
18- BUILD_DIR = build
19- GO_ASMFLAGS = -asmflags "all=-trimpath=$(shell dirname $(PWD ) ) "
20- GO_GCFLAGS = -gcflags "all=-trimpath=$(shell dirname $(PWD ) ) "
21- GO_BUILD_ARGS = \
22- $(GO_GCFLAGS ) $(GO_ASMFLAGS ) \
23- -ldflags " \
18+ BUILD_DIR = .
19+ export GO_BUILD_ASMFLAGS = all=-trimpath=$(shell dirname $(PWD ) )
20+ export GO_BUILD_GCFLAGS = all=-trimpath=$(shell dirname $(PWD ) )
21+ export GO_BUILD_LDFLAGS = \
2422 -X '$(REPO ) /internal/version.Version=$(SIMPLE_VERSION ) ' \
2523 -X '$(REPO ) /internal/version.GitVersion=$(GIT_VERSION ) ' \
2624 -X '$(REPO ) /internal/version.GitCommit=$(GIT_COMMIT ) ' \
2725 -X '$(REPO ) /internal/version.KubernetesVersion=v$(K8S_VERSION ) ' \
2826 -X '$(REPO ) /internal/version.ImageVersion=$(IMAGE_VERSION ) ' \
29- " \
27+ \
28+
29+ GO_BUILD_ARGS = \
30+ -gcflags "$(GO_BUILD_GCFLAGS ) " -asmflags "$(GO_BUILD_ASMFLAGS ) " -ldflags "$(GO_BUILD_LDFLAGS ) "
3031
3132export GO111MODULE = on
3233export CGO_ENABLED = 0
3334export PATH := $(PWD ) /$(BUILD_DIR ) :$(PWD ) /$(TOOLS_DIR ) :$(PATH )
3435
36+ export IMAGE_REPO = quay.io/operator-framework/ansible-operator-plugins
37+ export IMAGE_TAG = dev
38+
3539# #@ Development
3640
3741.PHONY : generate
@@ -79,12 +83,7 @@ build/ansible-operator:
7983# Convenience wrapper for building all remotely hosted images.
8084.PHONY : image-build
8185IMAGE_TARGET_LIST = ansible-operator
82- image-build : $(foreach i,$(IMAGE_TARGET_LIST ) ,image/$(i ) ) # # Build all images.
83-
84- # Convenience wrapper for building dependency base images.
85- .PHONY : image-build-base
86- IMAGE_BASE_TARGET_LIST = ansible-operator
87- image-build-base : $(foreach i,$(IMAGE_BASE_TARGET_LIST ) ,image-base/$(i ) ) # # Build all images.
86+ image-build : build $(foreach i,$(IMAGE_TARGET_LIST ) ,image/$(i ) ) # # Build all images.
8887
8988# Build an image.
9089BUILD_IMAGE_REPO = quay.io/operator-framework
@@ -94,11 +93,7 @@ DOCKER_PROGRESS = --progress plain
9493endif
9594image/% : export DOCKER_CLI_EXPERIMENTAL = enabled
9695image/% :
97- docker buildx build $(DOCKER_PROGRESS ) -t $(BUILD_IMAGE_REPO ) /$* :dev -f ./images/$* /Dockerfile --load .
98-
99- image-base/% : export DOCKER_CLI_EXPERIMENTAL = enabled
100- image-base/% :
101- docker buildx build $(DOCKER_PROGRESS ) -t $(BUILD_IMAGE_REPO ) /$* -base:dev -f ./images/$* /base.Dockerfile --load images/$*
96+ docker buildx build $(DOCKER_PROGRESS ) -t $(BUILD_IMAGE_REPO ) /$* -plugins:dev -f ./images/$* /Dockerfile --load . --no-cache
10297# #@ Release
10398
10499# # TODO: Add release targets here
@@ -169,6 +164,22 @@ test-e2e-ansible-molecule:: install dev-install image/ansible-operator ## Run mo
169164 go run ./hack/generate/samples/molecule/generate.go
170165 ./hack/tests/e2e-ansible-molecule.sh
171166
167+ # # Location to install dependencies to
168+ LOCALBIN ?= $(shell pwd) /bin
169+ $(LOCALBIN ) :
170+ mkdir -p $(LOCALBIN )
171+
172+ GORELEASER := $(abspath $(LOCALBIN ) /goreleaser)
173+ GORELEASER_VERSION ?= v1.16.2
174+ goreleaser : $(LOCALBIN ) # # Build a local copy of goreleaser
175+ GOBIN=$(LOCALBIN ) go install github.com/goreleaser/goreleaser@$(GORELEASER_VERSION )
176+
177+ export ENABLE_RELEASE_PIPELINE ?= false
178+ export GORELEASER_ARGS ?= --snapshot --clean --timeout=60m
179+ release : IMAGE_TAG = $(GIT_VERSION )
180+ release : goreleaser # # Runs goreleaser. By default, this will run only as a snapshot and will not publish any artifacts unless it is run with different arguments. To override the arguments, run with "GORELEASER_ARGS=...". When run as a github action from a tag, this target will publish a full release.
181+ $(GORELEASER ) $(GORELEASER_ARGS )
182+
172183.DEFAULT_GOAL := help
173184.PHONY : help
174185help : # # Show this help screen.
0 commit comments