Skip to content

Commit

Permalink
Update and sync with Open Liberty Operator
Browse files Browse the repository at this point in the history
  • Loading branch information
arturdzm committed Mar 7, 2022
1 parent b92f087 commit 42d470e
Show file tree
Hide file tree
Showing 39 changed files with 4,741 additions and 1,158 deletions.
65 changes: 48 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ OPERATOR_SDK_RELEASE_VERSION ?= v1.6.4
VERSION ?= 0.8.0

OPERATOR_IMAGE ?= cp.stg.icr.io/websphere-liberty-operator
OPERATOR_IMAGE_TAG ?= daily

# Type of release. Can be "daily", "releases", or a release tag.
RELEASE_TARGET := $(or ${RELEASE_TARGET}, ${TRAVIS_TAG}, daily)

PUBLISH_REGISTRY=docker.io

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=preview,fast,stable)
# - use environment variables to overwrite this value (e.g export CHANNELS="preview,fast,stable")
CHANNELS ?= v1
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif
Expand All @@ -24,11 +29,18 @@ endif
# To re-generate a bundle for any other default channel without changing the default setup, you can:
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
DEFAULT_CHANNEL ?= v1
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

CREATEDAT ?= AUTO

ifeq ($(CREATEDAT), AUTO)
CREATEDAT := $(shell date +%y-%m-%dT%TZ)
endif

# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
# This variable is used to construct full image tags for bundle and catalog images.
#
Expand Down Expand Up @@ -98,9 +110,6 @@ build: generate fmt vet ## Build manager binary.
run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go

docker-login:
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"

docker-build: test ## Build docker image with the manager.
docker build -t ${IMG} .

Expand Down Expand Up @@ -158,11 +167,13 @@ rm -rf $$TMP_DIR ;\
endef

.PHONY: bundle
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
bundle: manifests setup kustomize ## Generate bundle manifests and metadata, then validate generated files.
sed -i.bak "s,IMAGE,${IMG},g;s,CREATEDAT,${CREATEDAT},g" config/manifests/patches/csvAnnotations.yaml
operator-sdk generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
./scripts/csv_description_update.sh update_csv
mv config/manifests/patches/csvAnnotations.yaml.bak config/manifests/patches/csvAnnotations.yaml
operator-sdk bundle validate ./bundle

.PHONY: bundle-build
Expand Down Expand Up @@ -226,19 +237,39 @@ setup-minikube:
unit-test: ## Run unit tests
go test -v -mod=vendor -tags=unit github.com/WASdev/websphere-liberty-operator/...

build-image: ## Build operator Docker image and tag with "${OPERATOR_IMAGE}:${OPERATOR_IMAGE_TAG}"
docker build -t ${OPERATOR_IMAGE}:${OPERATOR_IMAGE_TAG} .

build-multiarch-image: ## Build operator image
./scripts/build-releases.sh -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" --image "${OPERATOR_IMAGE}"

push-multiarch-image: ## Push operator image
./scripts/build-releases.sh --push -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" --image "${OPERATOR_IMAGE}"
docker-login:
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"

build-manifest: setup-manifest
./scripts/build-manifest.sh -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" --image "${OPERATOR_IMAGE}"
./scripts/build-manifest.sh --image "${PUBLISH_REGISTRY}/${OPERATOR_IMAGE}" --target "${RELEASE_TARGET}"

minikube-test-e2e:
./scripts/e2e-minikube.sh --test-tag "${TRAVIS_BUILD_NUMBER}"

test-e2e:
./scripts/e2e.sh -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" \
--cluster-url "${CLUSTER_URL}" --cluster-token "${CLUSTER_TOKEN}" \
--registry-name default-route --registry-namespace openshift-image-registry
./scripts/e2e-release.sh --registry-name default-route --registry-namespace openshift-image-registry \
--test-tag "${TRAVIS_BUILD_NUMBER}" --target "${RELEASE_TARGET}"

build-releases:
./scripts/build-releases.sh --image "${PUBLISH_REGISTRY}/${OPERATOR_IMAGE}" --target "${RELEASE_TARGET}"

bundle-releases:
./scripts/bundle-releases.sh --image "${PUBLISH_REGISTRY}/${OPERATOR_IMAGE}" --target "${RELEASE_TARGET}"

install-podman:
./scripts/installers/install-podman.sh

install-opm:
./scripts/installers/install-opm.sh

bundle-build-podman:
podman build -f bundle.Dockerfile -t "${BUNDLE_IMG}"

bundle-push-podman:
podman push --format=docker "${BUNDLE_IMG}"

build-catalog:
opm index add --bundles "${BUNDLE_IMG}" --tag "${CATALOG_IMG}"

push-catalog: docker-login
podman push --format=docker "${CATALOG_IMG}"
Loading

0 comments on commit 42d470e

Please sign in to comment.