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 export CYPRESS_FAIL_FAST_ENABLED?=false
46 ARVADOS_DIRECTORY?=$(shell env -C $(WORKSPACE) git rev-parse --show-toplevel)
54 .PHONY: help clean* yarn-install test build packages packages-with-version integration-tests-in-docker
58 @echo >&2 "There is no default make target here. Did you mean 'make test'?"
60 @echo >&2 "More info:"
61 @echo >&2 " Installing --> http://doc.arvados.org/install"
62 @echo >&2 " Developing/contributing --> https://dev.arvados.org"
63 @echo >&2 " Project home --> https://arvados.org"
68 rm -f $(WORKSPACE)/*.deb
71 rm -f $(WORKSPACE)/*.rpm
74 rm -rf $(WORKSPACE)/node_modules
76 clean: clean-rpm clean-deb clean-node-modules
78 arvados-server-install: check-arvados-directory
79 cd $(ARVADOS_DIRECTORY)
82 echo GOPATH is $(GOPATH)
83 GOFLAGS=-buildvcs=false go install
85 ls -l $(GOPATH)/bin/arvados-server
86 $(GOPATH)/bin/arvados-server install -type test
91 unit-tests: yarn-install
94 integration-tests: yarn-install check-arvados-directory
95 yarn run cypress install
96 ifeq ($(SPECFILE), ALL)
97 $(WORKSPACE)/tools/run-integration-tests.sh $(INTERACTIVE) -a $(ARVADOS_DIRECTORY)
99 $(WORKSPACE)/tools/run-integration-tests.sh $(INTERACTIVE) -a $(ARVADOS_DIRECTORY) -- --spec $(SPECFILE)
102 integration-tests-in-docker: workbench2-build-image check-arvados-directory
103 docker run $(TI) --rm \
104 --env ARVADOS_DIRECTORY=/usr/src/arvados \
105 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
106 -v $(WORKSPACE):/usr/src/arvados/services/workbench2 \
107 -v $(ARVADOS_DIRECTORY):/usr/src/arvados \
108 -w /usr/src/arvados/services/workbench2 \
110 make arvados-server-install integration-tests SPECFILE=$(SPECFILE)
112 unit-tests-in-docker: workbench2-build-image check-arvados-directory
113 docker run $(TI) --rm \
114 --env ARVADOS_DIRECTORY=/usr/src/arvados \
115 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
116 -v $(WORKSPACE):/usr/src/arvados/services/workbench2 \
117 -v $(ARVADOS_DIRECTORY):/usr/src/arvados \
118 -w /usr/src/arvados/services/workbench2 \
120 make arvados-server-install unit-tests
122 tests-in-docker: workbench2-build-image check-arvados-directory
123 docker run $(TI) --rm \
124 --env ARVADOS_DIRECTORY=/usr/src/arvados \
125 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
127 -v $(WORKSPACE):/usr/src/arvados/services/workbench2 \
128 -v$(ARVADOS_DIRECTORY):/usr/src/arvados \
129 -w /usr/src/arvados/services/workbench2 \
133 test: unit-tests integration-tests
136 VERSION=$(VERSION) BUILD_NUMBER=$(BUILD_NUMBER) GIT_COMMIT=$(GIT_COMMIT) yarn build
144 --iteration "$(ITERATION)" \
145 --vendor="The Arvados Authors" \
146 --maintainer="$(MAINTAINER)" \
147 --url="https://arvados.org" \
148 --license="GNU Affero General Public License, version 3.0" \
149 --description="$(DESCRIPTION)" \
150 --config-files="etc/arvados/$(APP_NAME)/workbench2.example.json" \
151 $(WORKSPACE)/build/=$(DEST_DIR) \
152 etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$(APP_NAME)/workbench2.example.json
160 --iteration "$(ITERATION)" \
161 --vendor="The Arvados Authors" \
162 --maintainer="$(MAINTAINER)" \
163 --url="https://arvados.org" \
164 --license="GNU Affero General Public License, version 3.0" \
165 --description="$(DESCRIPTION)" \
166 --config-files="etc/arvados/$(APP_NAME)/workbench2.example.json" \
167 $(WORKSPACE)/build/=$(DEST_DIR) \
168 etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$(APP_NAME)/workbench2.example.json
170 copy: $(DEB_FILE) $(RPM_FILE)
171 for target in $(TARGETS); do \
172 mkdir -p "packages/$$target" && \
174 centos*|rocky*) cp -p "$(RPM_FILE)" "packages/$$target" ;; \
175 debian*|ubuntu*) cp -p "$(DEB_FILE)" "packages/$$target" ;; \
176 *) echo "Unknown copy target $$target"; exit 1 ;; \
179 rm -f "$(DEB_FILE)" "$(RPM_FILE)"
181 # use FPM to create DEB and RPM
184 check-arvados-directory:
185 @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
186 @if ! test -d "${ARVADOS_DIRECTORY}"; then echo "the environment variable ARVADOS_DIRECTORY does not point at a directory"; exit 1; fi
188 packages-in-docker: check-arvados-directory workbench2-build-image
189 docker run -t --rm --env ci="true" \
190 --env ARVADOS_DIRECTORY=/tmp/arvados \
191 --env APP_NAME=${APP_NAME} \
192 --env VERSION="${VERSION}" \
193 --env ITERATION=${ITERATION} \
194 --env TARGETS="${TARGETS}" \
195 --env MAINTAINER="${MAINTAINER}" \
196 --env DESCRIPTION="${DESCRIPTION}" \
197 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
198 -w "/tmp/workbench2" \
199 -v ${WORKSPACE}:/tmp/workbench2 \
200 -v ${ARVADOS_DIRECTORY}:/tmp/arvados \
201 workbench2-build:latest \
202 sh -c 'git config --global --add safe.directory /tmp/workbench2 && make packages'
204 workbench2-build-image:
205 docker inspect workbench2-build &> /dev/null || \
206 docker build -t workbench2-build -f docker/Dockerfile ${ARVADOS_DIRECTORY}