Skip to content
Snippets Groups Projects
Commit 2c5b848d authored by Viktor Vorobev's avatar Viktor Vorobev Committed by Ugo Albanese
Browse files

Merged in NRRPLT-8093-ci-for-ubuntu20 (pull request #49)

[NRRPLT-8093] Ubuntu 20.04 Jenkins CI

Approved-by: Ugo Albanese
Approved-by: Krzysztof Lebioda
parent 4b753e79
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
set -e
set -o xtrace
whoami
env | sort
pwd
if [ -f .ci/env ]; then
# add quotes to all vars (but do it once)
sudo sed -i -E 's/="*(.*[^"])"*$/="\1"/' .ci/env
source '.ci/env'
fi
sudo apt-get update && sudo apt-get install -y cmake
# Declare nvm
. $HOME/.nvm/nvm.sh
. $HOME/.bashrc
# Make gazebo discoverable
export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH
npm install -g bower
rm -rf build/
rm -rf gzbridge/build
sudo chown -R bbpnrsoa:bbp-ext $WORKSPACE/$GIT_CHECKOUT_DIR/http
./deploy-gzbridge-nrp.sh
npm dedupe
npm install --no-save
cd gz3d/utils
npm dedupe
npm install --no-save
// Load shared library at master branch
// the path to the repo with this library should be specified in Jenkins
// https://tomd.xyz/jenkins-shared-library/
// https://www.jenkins.io/doc/book/pipeline/shared-libraries/
@Library('nrp-shared-libs@master') _
pipeline {
environment {
USER_SCRIPTS_DIR = "user-scripts"
ADMIN_SCRIPTS_DIR = "admin-scripts"
GZWEB_DIR = "gzweb"
// GIT_CHECKOUT_DIR is a dir of the main project (that was pushed)
GIT_CHECKOUT_DIR = "${env.GZWEB_DIR}"
// define topic branch name
TOPIC_BRANCH = selectTopicBranch(env.BRANCH_NAME, env.CHANGE_BRANCH)
DEFAULT_BRANCH = 'development'
HBP = "/home/bbpnrsoa/nrp/src"
}
agent {
docker {
// NEXUS_REGISTRY_IP and NEXUS_REGISTRY_PORT are Jenkins global variables
image "${env.NEXUS_REGISTRY_IP}:${env.NEXUS_REGISTRY_PORT}/nrp:development"
args '--entrypoint="" -u root --privileged'
}
}
options {
// Skip code checkout prior running pipeline (only Jenkinsfile is checked out)
skipDefaultCheckout true
}
stages {
stage('Code checkout') {
steps {
// Notify BitBucket on the start of the job
// The Bitbucket Build Status Notifier is used
// REF: https://plugins.jenkins.io/bitbucket-build-status-notifier/
bitbucketStatusNotify(buildState: 'INPROGRESS', buildName: 'Code checkout')
// Debug information on available environment
echo sh(script: 'env|sort', returnStdout: true)
// Checkout main project to GIT_CHECKOUT_DIR
dir(env.GIT_CHECKOUT_DIR) {
checkout scm
sh 'sudo chown -R "${USER}" ./'
}
}
}
stage('Build and Test gzweb') {
steps {
bitbucketStatusNotify(buildState: 'INPROGRESS', buildName: 'Building gzweb')
// Build operations (starting in .ci directory)
dir( env.GIT_CHECKOUT_DIR){
// Determine explicitly the shell as bash
sh 'env > .ci/env'
sh 'sudo -H -u ${USER} bash ./.ci/build.bash'
}
}
}
}
post {
always {
cleanWs()
}
aborted {
bitbucketStatusNotify(buildState: 'FAILED', buildDescription: 'Build aborted!')
}
failure {
bitbucketStatusNotify(buildState: 'FAILED', buildDescription: 'Build failed, see console output!')
}
success{
bitbucketStatusNotify(buildState: 'SUCCESSFUL', buildDescription: 'branch ' + env.BRANCH_NAME)
}
}
}
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