1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 # Use bash, and run all lines in each recipe as one shell command
10 APP_NAME?=arvados-workbench2
12 # Cypress test file that can be passed to the integration-test target
15 # VERSION uses all the above to produce X.Y.Z.timestamp
16 # something in the lines of 1.2.0.20180612145021, this will be the package version
17 # it can be overwritten when invoking make as in make packages VERSION=1.2.0
18 VERSION?=$(shell ./version-at-commit.sh HEAD)
19 # We don't use BUILD_NUMBER at the moment, but it needs to be defined
21 GIT_COMMIT?=$(shell git rev-parse --short HEAD)
23 # ITERATION is the package iteration, intended for manual change if anything non-code related
24 # changes in the package. (i.e. example config files externally added
27 TARGETS?=rocky8 debian11 debian12 ubuntu2004 ubuntu2204
29 DESCRIPTION=Arvados Workbench2 - Arvados is a free and open source platform for big data science.
30 MAINTAINER=Arvados Package Maintainers <packaging@arvados.org>
32 # DEST_DIR will have the build package copied.
33 DEST_DIR=/var/www/$(APP_NAME)/workbench2/
36 DEB_FILE=$(APP_NAME)_$(VERSION)-$(ITERATION)_amd64.deb
39 RPM_FILE=$(APP_NAME)-$(VERSION)-$(ITERATION).x86_64.rpm
41 GOPATH=$(shell go env GOPATH)
42 export WORKSPACE?=$(shell pwd)
44 ARVADOS_DIRECTORY?=$(shell env -C $(WORKSPACE) git rev-parse --show-toplevel)
52 .PHONY: help clean* yarn-install test build packages packages-with-version integration-tests-in-docker
56 @echo >&2 "There is no default make target here. Did you mean 'make test'?"
58 @echo >&2 "More info:"
59 @echo >&2 " Installing --> http://doc.arvados.org/install"
60 @echo >&2 " Developing/contributing --> https://dev.arvados.org"
61 @echo >&2 " Project home --> https://arvados.org"
66 rm -f $(WORKSPACE)/*.deb
69 rm -f $(WORKSPACE)/*.rpm
72 rm -rf $(WORKSPACE)/node_modules
74 clean: clean-rpm clean-deb clean-node-modules
76 arvados-server-install: check-arvados-directory
77 cd $(ARVADOS_DIRECTORY)
80 echo GOPATH is $(GOPATH)
81 GOFLAGS=-buildvcs=false go install
83 ls -l $(GOPATH)/bin/arvados-server
84 $(GOPATH)/bin/arvados-server install -type test
89 unit-tests: yarn-install
92 integration-tests: yarn-install check-arvados-directory
93 yarn run cypress install
94 ifeq ($(SPECFILE), ALL)
95 $(WORKSPACE)/tools/run-integration-tests.sh -a $(ARVADOS_DIRECTORY)
97 $(WORKSPACE)/tools/run-integration-tests.sh -a $(ARVADOS_DIRECTORY) -- --spec $(SPECFILE)
100 integration-tests-in-docker: workbench2-build-image check-arvados-directory
101 docker run $(TI) --rm \
102 --env ARVADOS_DIRECTORY=/usr/src/arvados \
103 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
104 -v $(WORKSPACE):/usr/src/arvados/services/workbench2 \
105 -v $(ARVADOS_DIRECTORY):/usr/src/arvados \
106 -w /usr/src/arvados/services/workbench2 \
108 make arvados-server-install integration-tests SPECFILE=$(SPECFILE)
110 unit-tests-in-docker: workbench2-build-image check-arvados-directory
111 docker run $(TI) --rm \
112 --env ARVADOS_DIRECTORY=/usr/src/arvados \
113 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
114 -v $(WORKSPACE):/usr/src/arvados/services/workbench2 \
115 -v $(ARVADOS_DIRECTORY):/usr/src/arvados \
116 -w /usr/src/arvados/services/workbench2 \
118 make arvados-server-install unit-tests
120 tests-in-docker: workbench2-build-image check-arvados-directory
121 docker run $(TI) --rm \
122 --env ARVADOS_DIRECTORY=/usr/src/arvados \
123 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
125 -v $(WORKSPACE):/usr/src/arvados/services/workbench2 \
126 -v$(ARVADOS_DIRECTORY):/usr/src/arvados \
127 -w /usr/src/arvados/services/workbench2 \
131 test: unit-tests integration-tests
134 VERSION=$(VERSION) BUILD_NUMBER=$(BUILD_NUMBER) GIT_COMMIT=$(GIT_COMMIT) yarn build
142 --iteration "$(ITERATION)" \
143 --vendor="The Arvados Authors" \
144 --maintainer="$(MAINTAINER)" \
145 --url="https://arvados.org" \
146 --license="GNU Affero General Public License, version 3.0" \
147 --description="$(DESCRIPTION)" \
148 --config-files="etc/arvados/$(APP_NAME)/workbench2.example.json" \
149 $(WORKSPACE)/build/=$(DEST_DIR) \
150 etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$(APP_NAME)/workbench2.example.json
158 --iteration "$(ITERATION)" \
159 --vendor="The Arvados Authors" \
160 --maintainer="$(MAINTAINER)" \
161 --url="https://arvados.org" \
162 --license="GNU Affero General Public License, version 3.0" \
163 --description="$(DESCRIPTION)" \
164 --config-files="etc/arvados/$(APP_NAME)/workbench2.example.json" \
165 $(WORKSPACE)/build/=$(DEST_DIR) \
166 etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$(APP_NAME)/workbench2.example.json
168 copy: $(DEB_FILE) $(RPM_FILE)
169 for target in $(TARGETS); do \
170 mkdir -p "packages/$$target" && \
172 centos*|rocky*) cp -p "$(RPM_FILE)" "packages/$$target" ;; \
173 debian*|ubuntu*) cp -p "$(DEB_FILE)" "packages/$$target" ;; \
174 *) echo "Unknown copy target $$target"; exit 1 ;; \
177 rm -f "$(DEB_FILE)" "$(RPM_FILE)"
179 # use FPM to create DEB and RPM
182 check-arvados-directory:
183 @if test "${ARVADOS_DIRECTORY}" == "unset"; then echo "the environment variable ARVADOS_DIRECTORY must be set to the path of an arvados git checkout"; exit 1; fi
184 @if ! test -d "${ARVADOS_DIRECTORY}"; then echo "the environment variable ARVADOS_DIRECTORY does not point at a directory"; exit 1; fi
186 packages-in-docker: check-arvados-directory workbench2-build-image
187 docker run -t --rm --env ci="true" \
188 --env ARVADOS_DIRECTORY=/tmp/arvados \
189 --env APP_NAME=${APP_NAME} \
190 --env VERSION="${VERSION}" \
191 --env ITERATION=${ITERATION} \
192 --env TARGETS="${TARGETS}" \
193 --env MAINTAINER="${MAINTAINER}" \
194 --env DESCRIPTION="${DESCRIPTION}" \
195 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
196 -w "/tmp/workbench2" \
197 -v ${WORKSPACE}:/tmp/workbench2 \
198 -v ${ARVADOS_DIRECTORY}:/tmp/arvados \
199 workbench2-build:latest \
200 sh -c 'git config --global --add safe.directory /tmp/workbench2 && make packages'
202 workbench2-build-image:
203 docker inspect workbench2-build &> /dev/null || \
204 docker build -t workbench2-build -f docker/Dockerfile ${ARVADOS_DIRECTORY}