Skip to content

Commit

Permalink
chore: allow empty EFFECTIVE_VERSION if set to empty value
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobmoellerdev committed Nov 13, 2024
1 parent 7b690ea commit bda10d4
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 17 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,14 @@ jobs:
- name: CTF
run: |
cd components/${{ matrix.component }}
ARGS="PATH=$PATH:$(go env GOPATH)/bin CTF_TYPE=${{ env.CTF_TYPE }}"
if [ -n "${{ inputs.effective-version }}" ]; then
ARGS="$ARGS EFFECTIVE_VERSION=${{ inputs.effective-version }}"
fi
if [ -n "${{ env.PLATFORMS }}" ]; then
ARGS="$ARGS PLATFORMS=${{ env.PLATFORMS }}"
fi
if [ -n "${{ env.IMAGE_PLATFORMS }}" ]; then
ARGS="$ARGS IMAGE_PLATFORMS=${{ env.IMAGE_PLATFORMS }}"
fi
$ARGS make ctf descriptor describe
PATH=$PATH:$(go env GOPATH)/bin \
CTF_TYPE=${{ env.CTF_TYPE }} \
EFFECTIVE_VERSION=${{ inputs.effective-version }} \
PLATFORMS="${{ env.PLATFORMS }}" \
IMAGE_PLATFORMS="${{ env.IMAGE_PLATFORMS }}" \
make \
ctf descriptor describe
- name: Upload CTF
uses: actions/upload-artifact@v4
with:
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ REPO_ROOT := $(shell dirname $(realpath $(l
GITHUBORG ?= open-component-model
OCMREPO ?= ghcr.io/$(GITHUBORG)/ocm
VERSION := $(shell go run api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
COMMIT = $(shell git rev-parse HEAD)
# if EFFECTIVE_VERSION is not set, set it to VERSION+HEAD
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
ifeq ($(EFFECTIVE_VERSION),)
EFFECTIVE_VERSION := $(VERSION)+$(shell git rev-parse HEAD)
endif
GIT_TREE_STATE := $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty)
COMMIT := $(shell git rev-parse --verify HEAD)

Expand Down
6 changes: 5 additions & 1 deletion components/demoplugin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ CTF_TYPE ?= directory
REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../..
VERSION = $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
COMMIT = $(shell git rev-parse HEAD)
EFFECTIVE_VERSION ?= $(VERSION)+$(COMMIT)
# if EFFECTIVE_VERSION is not set, set it to VERSION+COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
ifeq ($(EFFECTIVE_VERSION),)
EFFECTIVE_VERSION := $(VERSION)+$(COMMIT)
endif
GIT_TREE_STATE := $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty)

CMDSRCS=$(shell find $(REPO_ROOT)/cmds/$(NAME) -type f)
Expand Down
6 changes: 5 additions & 1 deletion components/ecrplugin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ CTF_TYPE ?= directory
REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../..
VERSION = $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
COMMIT = $(shell git rev-parse HEAD)
EFFECTIVE_VERSION ?= $(VERSION)+$(COMMIT)
# if EFFECTIVE_VERSION is not set, set it to VERSION+COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
ifeq ($(EFFECTIVE_VERSION),)
EFFECTIVE_VERSION := $(VERSION)+$(COMMIT)
endif
GIT_TREE_STATE := $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty)

CMDSRCS=$(shell find $(REPO_ROOT)/cmds/$(NAME) -type f)
Expand Down
6 changes: 5 additions & 1 deletion components/helmdemo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ HELMINSTCOMP = $(PROVIDER)/toi/installers/helminstaller
REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../..
VERSION = $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
COMMIT = $(shell git rev-parse HEAD)
EFFECTIVE_VERSION ?= $(VERSION)-$(COMMIT)
# if EFFECTIVE_VERSION is not set, set it to VERSION-COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
ifeq ($(EFFECTIVE_VERSION),)
EFFECTIVE_VERSION := $(VERSION)-$(COMMIT)
endif
HELMINSTVERSION ?= $(VERSION)

CREDS ?=
Expand Down
6 changes: 5 additions & 1 deletion components/helminstaller/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ CTF_TYPE ?= directory
REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../..
VERSION := $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
COMMIT := $(shell git rev-parse --verify HEAD)
EFFECTIVE_VERSION ?= $(VERSION)-$(COMMIT)
# if EFFECTIVE_VERSION is not set, set it to VERSION-COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
ifeq ($(EFFECTIVE_VERSION),)
EFFECTIVE_VERSION := $(VERSION)-$(COMMIT)
endif
GIT_TREE_STATE := $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty)
PLATFORM := $(shell go env GOOS)/$(shell go env GOARCH)
CACHE_DIR := $(shell go env GOCACHE)
Expand Down
6 changes: 5 additions & 1 deletion components/ocmcli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ REPO_ROOT := $(dir $(realpath $(lastword $(
GIT_TREE_STATE = $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty)
VERSION = $(shell go run ../../api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
COMMIT = $(shell git rev-parse HEAD)
EFFECTIVE_VERSION ?= $(VERSION)+$(COMMIT)
# if EFFECTIVE_VERSION is not set, set it to VERSION+COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
ifeq ($(EFFECTIVE_VERSION),)
EFFECTIVE_VERSION := $(VERSION)+$(COMMIT)
endif
PLATFORM_OS := $(shell go env GOOS)
PLATFORM_ARCH := $(shell go env GOARCH)

Expand Down
6 changes: 5 additions & 1 deletion components/subchartsdemo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ REPO_ROOT := $(shell dirname $(realpath $(la
GIT_TREE_STATE = $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty)
VERSION = $(shell go run $(REPO_ROOT)/api/version/generate/release_generate.go print-rc-version $(CANDIDATE))
COMMIT = $(shell git rev-parse HEAD)
EFFECTIVE_VERSION ?= $(VERSION)-$(COMMIT)
# if EFFECTIVE_VERSION is not set, set it to VERSION-COMMIT
# this is not the same as '?=' because it will also set the value if EFFECTIVE_VERSION is set to an empty string
ifeq ($(EFFECTIVE_VERSION),)
EFFECTIVE_VERSION := $(VERSION)-$(COMMIT)
endif
HELMINSTVERSION ?= $(VERSION)

CREDS ?=
Expand Down

0 comments on commit bda10d4

Please sign in to comment.