-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
139 lines (108 loc) · 5.82 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#
# Copyright Broker QE authors.
# License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
#
ROOT_DIR = $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
MVN_DEFAULT_CMD = mvn -T 1.5C --no-transfer-progress --update-snapshots
MVN_TEST_CMD = ${MVN_DEFAULT_CMD} -Dfailsafe.rerunFailingTestsCount=3 failsafe:integration-test
WGET_CMD = wget -nv -c
ARTEMIS_VERSION ?= 2.38.0
OPERATOR_VERSION ?= main
OPERATOR_ROOT_DIR = ${ROOT_DIR}/operator-suite
STANDALONE_ROOT_DIR = ${ROOT_DIR}/standalone-suite
STANDALONE_ARTEMIS_DIR = ${STANDALONE_ROOT_DIR}/artemis
STANDALONE_ARTEMIS_INSTALL_DIR = ${STANDALONE_ARTEMIS_DIR}/artemis_install
STANDALONE_ARTEMIS_DEFAULT_CFG_DIR = ${STANDALONE_ARTEMIS_DIR}/artemis_default_cfg
STANDALONE_INSTANCE_NAME = artemis-instance
STANDALONE_USER = admin
STANDALONE_PASSWORD = admin
STANDALONE_CONTAINER_ARTEMIS_INSTANCE_DIR = /var/lib/artemis-instance
STANDALONE_CONTAINER_ARTEMIS_INSTANCE_ETC_DIR = ${STANDALONE_CONTAINER_ARTEMIS_INSTANCE_DIR}/etc
# Container variables
ARCH = amd64 ppc64le s390x
VERSION ?= latest
REGISTRY ?= quay.io
# messaging
NAMESPACE ?= rhmessagingqe
IMAGE_NAME ="${REGISTRY}/${NAMESPACE}/claire:${VERSION}"
ifndef ARTEMIS_INSTALL_ZIP
$(eval ARTEMIS_INSTALL_ZIP := https://dlcdn.apache.org/activemq/activemq-artemis/${ARTEMIS_VERSION}/apache-artemis-${ARTEMIS_VERSION}-bin.zip)
endif
ifndef ARTEMIS_INSTALL_ZIP_SECONDARY
$(eval ARTEMIS_INSTALL_ZIP_SECONDARY := https://archive.apache.org/dist/activemq/activemq-artemis/${ARTEMIS_VERSION}/apache-artemis-${ARTEMIS_VERSION}-bin.zip)
endif
ifdef TESTS
$(eval MVN_TESTS_PARAM := -Dit.test="${TESTS}")
endif
ifdef TEST_GROUPS
$(eval MVN_GROUPS_PARAM := -Dgroups="${TEST_GROUPS}")
endif
clean: clean_maven standalone_clean operator_clean
clean_maven:
${MVN_DEFAULT_CMD} --no-transfer-progress versions:revert clean
build: standalone_prepare operator_prepare build_maven
build_maven:
${MVN_DEFAULT_CMD} versions:update-property -DallowDowngrade=true -Dproperty=artemiscloud-crd.version -DnewVersion=[${OPERATOR_VERSION}]
${MVN_DEFAULT_CMD} -DskipTests install
checkstyle:
${MVN_DEFAULT_CMD} checkstyle:check
display_mvn_property_updates:
${MVN_DEFAULT_CMD} versions:display-property-updates
### Standalone targets
standalone_clean:
rm -rf ${STANDALONE_ARTEMIS_DIR}
standalone_prepare: standalone_prepare_dirs standalone_download_zip standalone_generate_artemis_default_cfg
standalone_build_java:
${MVN_DEFAULT_CMD} --projects :standalone-suite install -DskipTests
standalone_build: standalone_prepare standalone_build_java
standalone_test_smoke:
${MVN_TEST_CMD} --projects :standalone-suite -Dgroups="smoke"
standalone_test:
${MVN_TEST_CMD} --projects :standalone-suite ${MVN_TESTS_PARAM} ${MVN_GROUPS_PARAM}
standalone_prepare_dirs:
mkdir -p ${STANDALONE_ARTEMIS_INSTALL_DIR}
standalone_download_zip:
${WGET_CMD} ${ARTEMIS_INSTALL_ZIP} -P /tmp/ || ${WGET_CMD} ${ARTEMIS_INSTALL_ZIP_SECONDARY} -P /tmp/
$(eval ARTEMIS_FILE := /tmp/$(shell basename ${ARTEMIS_INSTALL_ZIP}))
cp -f ${ARTEMIS_FILE} ${STANDALONE_ARTEMIS_DIR}/artemis.zip
rm -rf ${STANDALONE_ARTEMIS_INSTALL_DIR}/*
unzip -q -o ${STANDALONE_ARTEMIS_DIR}/artemis.zip -d ${STANDALONE_ARTEMIS_INSTALL_DIR}
mv ${STANDALONE_ARTEMIS_INSTALL_DIR}/*/* ${STANDALONE_ARTEMIS_INSTALL_DIR}
rm -rf ${STANDALONE_ARTEMIS_INSTALL_DIR}/examples
find ${STANDALONE_ARTEMIS_INSTALL_DIR} -maxdepth 1 -type d -name apache-artemis-* -exec rmdir \{\} \;
standalone_generate_artemis_default_cfg:
# create default instance
${STANDALONE_ARTEMIS_INSTALL_DIR}/bin/artemis create --force --name ${STANDALONE_INSTANCE_NAME} \
--user ${STANDALONE_USER} --password ${STANDALONE_PASSWORD} \
--require-login ${STANDALONE_ARTEMIS_DEFAULT_CFG_DIR}
# update artemis command with correct container instance path
sed -i.bak -re "s#^(ARTEMIS_INSTANCE_ETC=)(.*)#\1'${STANDALONE_CONTAINER_ARTEMIS_INSTANCE_ETC_DIR}'#" \
${STANDALONE_ARTEMIS_DEFAULT_CFG_DIR}/bin/artemis
### Operator targets
operator_clean:
rm -rf ${OPERATOR_ROOT_DIR}/artemis
operator_prepare_dirs:
mkdir -p ${OPERATOR_ROOT_DIR}/artemis
operator_prepare: operator_prepare_dirs
operator_build_java:
${MVN_DEFAULT_CMD} versions:update-property -DallowDowngrade=true -Dproperty=artemiscloud-crd.version -DnewVersion=[${OPERATOR_VERSION}]
${MVN_DEFAULT_CMD} --projects :operator-suite install -DskipTests
operator_build: operator_prepare operator_build_java
operator_test_smoke:
${MVN_DEFAULT_CMD} test --projects :operator-suite -Dgroups="smoke"
operator_test:
${MVN_TEST_CMD} --projects :operator-suite ${MVN_TESTS_PARAM} ${MVN_GROUPS_PARAM}
build_container:
sudo podman run --privileged --rm docker.io/tonistiigi/binfmt --install all
echo "Creating a new manifest: ${IMAGE_NAME}"
podman manifest rm ${IMAGE_NAME} || true
podman manifest create ${IMAGE_NAME}
@for arch in ${ARCH} ; do \
echo "Building a new docker image: ${IMAGE_NAME}, arch: $${arch}" ;\
podman build --arch=$${arch} -t ${IMAGE_NAME}.$${arch} --build-arg ARCH=$${arch} --build-arg VERSION=${VERSION} . ;\
podman push ${IMAGE_NAME}.$${arch} ;\
podman manifest add ${IMAGE_NAME} ${IMAGE_NAME}.$${arch} ;\
done
echo "Pushing a new manifest: ${IMAGE_NAME}"
podman manifest push ${IMAGE_NAME} docker://${IMAGE_NAME}
.PHONY: clean