diff --git a/Jenkinsfile b/Jenkinsfile index 798de36..1d81163 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,10 @@ pipeline { agent {label 'physix_agent'} + environment { + // GRAFFY_OWNCLOUD_JENKINS_PWD's value has been obtained from https://cloud.ipr.univ-rennes1.fr as an app password and is defined in gitlab as a CI secret variable, + // then this app password has been declared to jenkins's credentials as a secret text with the name graffy-cloudipr-for-jenkinsipr + GRAFFY_OWNCLOUD_JENKINS_PWD = credentials('graffy-cloudipr-for-jenkinsipr') + } stages { stage('Initial setup...') { steps { @@ -21,13 +26,16 @@ pipeline { // // sh '/bin/bash ./src/CI/CI.bash -d ci_venv' // } // } - // stage('Releasing package...') { - // steps { - // echo 'Releasing package...' - // // sh 'rm -rf $HOME/www/*' - // // sh 'cp -a ./src/doc/build/html/* $HOME/www/' - // } - // } + stage('Releasing package...') { + steps { + echo 'Releasing package...' + sh './scripts/release_lipase_package.bash' + //sh 'python -c "import owncloud; oc = owncloud.Client(''https://cloud.ipr.univ-rennes1.fr''); oc.login(''graffy'',''$OWNCLOUD_GITLABUR1_PWD''); oc.put_file(''downloads/%installer_file_name%', r'%installer_file_path%')"' + // sh 'make FIJI_ROOT_PATH=$(pwd)/Fiji.app package' + // sh 'rm -rf $HOME/www/*' + // sh 'cp -a ./src/doc/build/html/* $HOME/www/' + } + } stage('Cleaning up...') { steps { echo 'Cleaning artifacts...' diff --git a/Makefile b/Makefile index cdbb338..d9831a5 100644 --- a/Makefile +++ b/Makefile @@ -4,15 +4,19 @@ FIJI_EXE_PATH=$(FIJI_ROOT_PATH)/ImageJ-linux64 # RAW_IMAGES_ROOT_PATH:='/opt/ipr/cluster/work.global/graffy/jenkins-store/lipase/raw-images' RAW_IMAGES_ROOT_PATH:=$(shell echo ~/work/lipase/raw-images) LIB_SRC_FILES=$(shell find ./src/lipase -name "*.py") +LIPASE_VERSION=1.00 + +BUILD_ROOT_PATH=$(shell pwd)/build +PACKAGE_FILE_PATH=$(shell pwd)/lipase-$(LIPASE_VERSION).zip .PHONY: all -all: test0001 +all: test -$(FIJI_ROOT_PATH)/jars/Lib/fr.univ-rennes1.ip.lipase.lib.jar: $(LIB_SRC_FILES) +$(BUILD_ROOT_PATH)/jars/Lib/fr.univ-rennes1.ipr.lipase.lib.jar: $(LIB_SRC_FILES) pushd ./src; \ - mkdir -p $(FIJI_ROOT_PATH)/jars/Lib ; \ + mkdir -p $(BUILD_ROOT_PATH)/jars/Lib ; \ find ./lipase -name "*.py" > /tmp/files.txt ; \ - jar cvf $(FIJI_ROOT_PATH)/jars/Lib/fr.univ-rennes1.ip.lipase.lib.jar @/tmp/files.txt ; \ + jar cvf $(BUILD_ROOT_PATH)/jars/Lib/fr.univ-rennes1.ipr.lipase.lib.jar @/tmp/files.txt ; \ popd .PHONY: install_ij_opencv @@ -56,16 +60,17 @@ install_ij_opencv: $(FIJI_ROOT_PATH)/ImageJ-linux64 --update update; \ fi -.PHONY: install_lipase_libs -install_lipase_libs: $(FIJI_ROOT_PATH)/jars/Lib/fr.univ-rennes1.ip.lipase.lib.jar install_ij_opencv +$(PACKAGE_FILE_PATH): $(BUILD_ROOT_PATH)/jars/Lib/fr.univ-rennes1.ipr.lipase.lib.jar + mkdir -p $(BUILD_ROOT_PATH)/plugins/Ipr ; \ + rsync -a ./src/ij-plugins/Ipr/ $(BUILD_ROOT_PATH)/plugins/Ipr/ ; \ + zip -r $(PACKAGE_FILE_PATH) $(BUILD_ROOT_PATH) -.PHONY: install_lipase_plugins -install_lipase_plugins: - mkdir -p $(FIJI_ROOT_PATH)/plugins/Ipr ; \ - rsync -a ./src/ij-plugins/Ipr/ $(FIJI_ROOT_PATH)/plugins/Ipr/ +.PHONY: package +package: $(PACKAGE_FILE_PATH) .PHONY: install -install: install_lipase_libs install_lipase_plugins +install: $(PACKAGE_FILE_PATH) install_ij_opencv + pushd $(FIJI_ROOT_PATH); unzip $(PACKAGE_FILE_PATH); popd .PHONY: test0001 test0001: install @@ -81,3 +86,8 @@ test0001: install .PHONY: test test: test0001 + +.PHONY: clean +clean: + rm -Rf $(BUILD_ROOT_PATH) + rm -Rf $(PACKAGE_FILE_PATH) diff --git a/scripts/cleanup.bash b/scripts/cleanup.bash index 733cfce..b392fd6 100755 --- a/scripts/cleanup.bash +++ b/scripts/cleanup.bash @@ -1,2 +1,4 @@ #!/bin/bash +make clean rm -Rf './Fiji.app' +rm -Rf './python.virtualenv' diff --git a/scripts/release_lipase_package.bash b/scripts/release_lipase_package.bash new file mode 100755 index 0000000..50361be --- /dev/null +++ b/scripts/release_lipase_package.bash @@ -0,0 +1,15 @@ +#!/bin/bash +LIPASE_PACKAGE_FILE_PATH=$(ls lipase*.zip) +echo "LIPASE_PACKAGE_FILE_PATH=$LIPASE_PACKAGE_FILE_PATH" +if [ "$GRAFFY_OWNCLOUD_JENKINS_PWD" = '' ] +then + echo "the value of the environment variable GRAFFY_OWNCLOUD_JENKINS_PWD is empty, while its contents are expected to come from JenkinsFile (this script is designed to be called from the accompanying JenkinsFile)" + exit 1 +fi + +virtualenv ./python.virtualenv +source ./python.virtualenv/bin/activate +pip install pyocclient # installs python owncloud module + +python -c "import owncloud; oc = owncloud.Client('https://cloud.ipr.univ-rennes1.fr'); oc.login('graffy','$GRAFFY_OWNCLOUD_JENKINS_PWD'); oc.put_file('downloads/$LIPASE_PACKAGE_FILE_PATH', r'$LIPASE_PACKAGE_FILE_PATH')" +