Commit fc7a79c0 authored by Morag Jean Williams's avatar Morag Jean Williams
Browse files

Merge branch 'extend_ci' into 'master'

Extend CI

See merge request !61
parents b5a5a90d d4c48624
Pipeline #585635 failed with stages
in 15 minutes and 2 seconds
#!/usr/bin/env python
import os
import json
import sys
# Check if we got token:
if len(sys.argv) != 4:
sys.exit(1)
api_token = sys.argv[1]
ci_project_id = sys.argv[2]
ci_pipeline_id = sys.argv[3]
print "Downloading job list"
data = json.load(os.popen("curl -g --header \"PRIVATE-TOKEN:%s\" \"https://gitlab.cern.ch/api/v4/projects/%s/pipelines/%s/jobs?scope[]=success&per_page=100\"" % (api_token, ci_project_id, ci_pipeline_id)))
# Find last passed builds
for i in range(0, len(data)):
if "pkg:" not in data[i]['name']:
continue
print "Downloading artifact for job %s" % data[i]['id']
os.system("curl --location --header \"PRIVATE-TOKEN:%s\" \"https://gitlab.cern.ch/api/v4/projects/%s/jobs/%s/artifacts\" -o artifact.zip" % (api_token, ci_project_id, data[i]['id']))
os.system("unzip -j artifact.zip; rm artifact.zip")
#!/bin/bash
#Get the line for the CVMFS status and chech if server is transaction
clicdp_status=`cvmfs_server list | grep clicdp`
if [[ $clicdp_status == *"(stratum0 / local)"* ]]; then
echo "I am not in transaction"
# Start transaction
cvmfs_server transaction clicdp.cern.ch
# Deploy the latest Corryvreckan build
echo "Deploying build: $2"
if [[ $2 =~ v(.+?) ]]; then
tag=${BASH_REMATCH[1]}
else
tag=$2
fi
cd /home/cvclicdp/
# Extract artifact tars
echo "Extract artifact tarballs"
for filename in $1/*.tar.gz; do
echo " - $filename"
if [[ $filename =~ corryvreckan-(.+?)-x ]]; then
version=${BASH_REMATCH[1]}
if [ "$version" != "$tag" ]; then
echo "Build version does not match: $version"
continue
fi
else
echo "Unable to parse string $filename"
continue
fi
if [[ $filename =~ $version-(.+?)\.tar ]]; then
flavor=${BASH_REMATCH[1]}
echo "Found build flavor: $flavor"
else
echo "Unable to parse string $filename"
continue
fi
# Create target directory and untar:
mkdir -p /home/cvclicdp/release/$version/$flavor
tar --strip-components=1 -xf $filename -C /home/cvclicdp/release/$version/$flavor/
done
# Check if we found any version and flavor to be installed:
if [[ -z $version || -z $flavor ]]; then
echo "Did not find suitable version or flavor to install."
cvmfs_server abort clicdp.cern.ch
exit 1
fi
# Deleting old nightly build if it is not a tag
if [ "$tag" == "latest" ]; then
echo "Deleting old \"latest\" build"
rm -rf /cvmfs/clicdp.cern.ch/software/corryvreckan/latest
fi
# Move new build into place
echo "Moving new build into place"
mv /home/cvclicdp/release/$tag /cvmfs/clicdp.cern.ch/software/corryvreckan/
# Clean up old stuff
rm -rf /home/cvclicdp/release
# Publish changes
cvmfs_server publish clicdp.cern.ch
exit 0
else
(>&2 echo "#################################")
(>&2 echo "### CVMFS Transastion ongoing ###")
(>&2 echo "### Nightly deploy cancelled ###")
(>&2 echo "#################################")
exit 1
fi
......@@ -64,6 +64,13 @@ if [ ${COMPILER_TYPE} == "llvm" ]; then
source ${CLICREPO}/compilers/llvm/4.0.0/x86_64-${OS}/setup.sh
fi
#--------------------------------------------------------------------------------
# Python
#--------------------------------------------------------------------------------
export PYTHONDIR=${CLICREPO}/software/Python/2.7.13/${BUILD_FLAVOUR}
export PATH=${PYTHONDIR}/bin:$PATH
export LD_LIBRARY_PATH=${PYTHONDIR}/lib:${LD_LIBRARY_PATH}
#--------------------------------------------------------------------------------
# CMake
#--------------------------------------------------------------------------------
......
variables:
EOS_PATH: "/eos/project/c/corryvreckan/www/"
DOCKER_FILE: etc/docker/Dockerfile
stages:
......@@ -133,6 +134,19 @@ fmt:slc6-llvm-format:
- cd build/
- ninja check-format
fmt:slc6-llvm-lint:
stage: formatting
tags:
- docker
dependencies:
- cmp:slc6-llvm
image: clicdp/slc6-base
script:
- export COMPILER_TYPE="llvm"
- source .gitlab-ci.d/init_x86_64.sh
- cd build/
- ninja check-lint
# CentOS 7
fmt:centos7-llvm-format:
......@@ -148,6 +162,19 @@ fmt:centos7-llvm-format:
- cd build/
- ninja check-format
fmt:cc7-llvm-lint:
stage: formatting
tags:
- docker
dependencies:
- cmp:cc7-llvm
image: clicdp/cc7-base
script:
- export COMPILER_TYPE="llvm"
- source .gitlab-ci.d/init_x86_64.sh
- cd build/
- ninja check-lint
#############################
# Documentation Compilation #
......@@ -249,6 +276,69 @@ pkg:cc7-gcc:
# Automatic Deployment #
########################
# Automatically deploy documentation to the website
# Deployment job only executed for new tag pushs, not for every commit.
deploy-documentation:
stage: deployment
tags:
- docker
variables:
GIT_STRATEGY: none
# Only run for new tags:
only:
- tags
dependencies:
- cmp:usermanual
- cmp:doxygen
# Docker image with tools to deploy to EOS
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
script:
- deploy-eos
# do not run any globally defined before_script or after_script for this step
before_script: []
after_script: []
deploy-eos:
stage: deployment
tags:
- docker
variables:
GIT_STRATEGY: none
# Only run for new tags:
only:
- tags
- schedules # Only execute this on scheduled "nightly" pipelines
dependencies:
- pkg:cc7-gcc
- pkg:slc6-gcc
# Docker image with tools to deploy to EOS
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
script:
- deploy-eos
# do not run any globally defined before_script or after_script for this step
before_script: []
after_script: []
deploy-cvmfs:
stage: deployment
dependencies:
- pkg:cc7-gcc
- pkg:slc6-gcc
variables:
GIT_STRATEGY: none
tags:
- cvmfs-deploy
only:
- tags
- schedules # Only execute this on scheduled "nightly" pipelines
script:
- ./.gitlab-ci.d/download_artifacts.py $API_TOKEN $CI_PROJECT_ID $CI_PIPELINE_ID
- export RUNNER_LOCATION=$(pwd)
- if [ -z ${CI_COMMIT_TAG} ]; then export BUILD_PATH='latest'; else export BUILD_PATH=${CI_COMMIT_TAG}; fi
- sudo -u cvclicdp -i $RUNNER_LOCATION/.gitlab-ci.d/gitlab_deploy.sh $RUNNER_LOCATION $BUILD_PATH
- rm -f corryvreckan-*.tar.gz
retry: 1
deploy-docker-latest:
stage: deployment
tags:
......
......@@ -32,7 +32,8 @@
using namespace corryvreckan;
// Default constructor
ModuleManager::ModuleManager(std::string config_file_name, std::vector<std::string> options) : m_terminate(false) {
ModuleManager::ModuleManager(std::string config_file_name, std::vector<std::string> options)
: m_reference(nullptr), m_terminate(false) {
LOG(TRACE) << "Loading Corryvreckan";
......@@ -109,9 +110,6 @@ void ModuleManager::load() {
void ModuleManager::load_detectors() {
// Flag for the reference detector
bool found_reference = false;
std::vector<std::string> detectors_files = global_config.getPathArray("detectors_file");
for(auto& detectors_file : detectors_files) {
......@@ -135,13 +133,12 @@ void ModuleManager::load_detectors() {
auto det_parm = std::make_shared<Detector>(detector);
// Check if we already found a reference plane:
if(found_reference && det_parm->isReference()) {
if(m_reference != nullptr && det_parm->isReference()) {
throw InvalidValueError(global_config, "detectors_file", "Found more than one reference detector");
}
// Switch flag if we found the reference plane:
if(det_parm->isReference()) {
found_reference = true;
m_reference = det_parm;
}
......@@ -151,7 +148,7 @@ void ModuleManager::load_detectors() {
}
// Check that exactly one detector is marked as reference:
if(!found_reference) {
if(m_reference == nullptr) {
throw InvalidValueError(global_config, "detectors_file", "Found no detector marked as reference");
}
......
......@@ -102,8 +102,8 @@ StatusCode TrackingSpatial::run(std::shared_ptr<Clipboard> clipboard) {
}
// If there are no detectors then stop trying to track
if(detectors.empty()) {
return StatusCode::Success;
if(detectors.empty() || referenceClusters == nullptr) {
return StatusCode::NoData;
}
// Output track container
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment