Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sdarwin committed Oct 17, 2024
0 parents commit 39f2e4c
Show file tree
Hide file tree
Showing 6 changed files with 282 additions and 0 deletions.
23 changes: 23 additions & 0 deletions LICENSE_1_0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

## Jenkins CI Jobs

The repository contains the Jenkinfiles used to build documentation previews for Boost and The C++ Alliance.

In addition to doc previews there may also be benchmarking automation and other types of CI jobs.

See the [jenkinsfiles](jenkinsfiles) directory for file content.

The [scripts](scripts) directory will have scripts used by the jobs. prebuild, postbuild.

The [docs](docs) directory will cover more information about how the server was installed and about specific target repositories and jobs.

4 changes: 4 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

## Docs

TODO
228 changes: 228 additions & 0 deletions jenkinsfiles/standard_libraries_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
pipeline {

// agent {
// node {
// label 'jenkinspool1'
// }
// }

agent {
docker {
image 'cppalliance/boost_superproject_build:24.04-v1'
// label 'jenkinspool1'
}
}

stages {
stage('Preclean Workspace') {
steps {
sh """#!/bin/bash
set -xe
rm -rf *
"""
checkout scm
}
}

stage('Set Variables') {
steps {
sh '''#!/bin/bash -xe
echo "" > jenkinsjobinfo.sh
chmod 777 jenkinsjobinfo.sh
REPONAME=$(basename -s .git "$(git config --get remote.origin.url)")
# REPONAME=$(basename `git rev-parse --show-toplevel`)
DNSREPONAME=$(echo $REPONAME | tr '_' '-')
ORGANIZATION=$(basename $(dirname "${GIT_URL}"))
echo "JENKINS_CI_REPO=cppalliance/jenkins-ci" >> jenkinsjobinfo.sh
echo "PRTEST=prtest" >> jenkinsjobinfo.sh
echo "REPONAME=${REPONAME}" >> jenkinsjobinfo.sh
echo "DNSREPONAME=${DNSREPONAME}" >> jenkinsjobinfo.sh
echo "ORGANIZATION=${ORGANIZATION}" >> jenkinsjobinfo.sh
'''
}
}

stage('Diagnostics') {
steps {
sh '''#!/bin/bash
set -x
# not set -e. errors may occur in diagnostics
cat jenkinsjobinfo.sh
. jenkinsjobinfo.sh
ls -al
cat /etc/os-release
pwd
env
whoami
touch $(date "+%A-%B-%d-%T-%y")
mount | grep ^/dev/ | grep -v /etc | awk '{print \$3}'
git branch
git branch -avv
true
'''
}
}

stage('Prebuild script') {
when {
anyOf{
branch 'develop'
branch 'master'
expression { env.CHANGE_ID != null }
}
}
steps {
sh '''#!/bin/bash
set -xe
. jenkinsjobinfo.sh
curl -f -o jenkins_prebuild_script.sh https://raw.githubusercontent.com/${JENKINS_CI_REPO}/master/scripts/${ORGANIZATION}_${REPONAME}_prebuild.sh || true
if [ -f jenkins_prebuild_script.sh ]; then
chmod 755 jenkins_prebuild_script.sh
./jenkins_prebuild_script.sh
fi
'''
}
}

stage('Build docs') {
when {
anyOf{
branch 'develop'
branch 'master'
expression { env.CHANGE_ID != null }
}
}

steps {
sh '''#!/bin/bash
set -xe
. jenkinsjobinfo.sh
export pythonvirtenvpath=/opt/venvboostdocs
if [ -f ${pythonvirtenvpath}/bin/activate ]; then
source ${pythonvirtenvpath}/bin/activate
fi

curl -s -S --retry 10 -L -o linuxdocs.sh https://github.com/boostorg/release-tools/raw/develop/build_docs/linuxdocs.sh
chmod 755 linuxdocs.sh
./linuxdocs.sh --debug --boostrootsubdir --skip-packages
# debugging:
# mkdir -p boost-root/libs/${REPONAME}/doc/html
# echo "qwerty" > boost-root/libs/${REPONAME}/doc/html/index.html
# mkdir -p boost-root/doc
# echo "qwerty" > boost-root/doc/index.html
'''
}
}

stage('Postbuild script') {
when {
anyOf{
branch 'develop'
branch 'master'
expression { env.CHANGE_ID != null }
}
}
steps {
sh '''#!/bin/bash
set -xe

. jenkinsjobinfo.sh
curl -f -o jenkins_postbuild_script.sh https://raw.githubusercontent.com/${JENKINS_CI_REPO}/master/scripts/${ORGANIZATION}_${REPONAME}_postbuild.sh || true
if [ -f jenkins_postbuild_script.sh ]; then
chmod 755 jenkins_postbuild_script.sh
./jenkins_postbuild_script.sh
fi
'''
}
}

stage('Main branches: Upload to S3') {
when {
anyOf{
branch 'develop'
branch 'master'
}
}

environment {
// See https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
REPONAME = """${sh(
returnStdout: true,
script: '#!/bin/bash \n' + 'source jenkinsjobinfo.sh; echo -n "${REPONAME}"'
)}"""
DNSREPONAME = """${sh(
returnStdout: true,
script: '#!/bin/bash \n' + 'source jenkinsjobinfo.sh; echo -n "${DNSREPONAME}"'
)}"""

}

steps {
withAWS(region:'us-east-1', credentials: 'cppalliance-bot-aws-user') {
s3Upload(bucket:"cppalliance-websites", path:"${BRANCH_NAME}.${DNSREPONAME}.cpp.al", workingDir: "boost-root/libs/${REPONAME}/doc/html", includePathPattern:"**")
}
}
}


stage('Pull requests: Upload to S3') {
when {
anyOf{
expression { env.CHANGE_ID != null }
}
}

environment {
// See https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
REPONAME = """${sh(
returnStdout: true,
script: '#!/bin/bash \n' + 'source jenkinsjobinfo.sh; echo -n "${REPONAME}"'
)}"""
DNSREPONAME = """${sh(
returnStdout: true,
script: '#!/bin/bash \n' + 'source jenkinsjobinfo.sh; echo -n "${DNSREPONAME}"'
)}"""
PRTEST = """${sh(
returnStdout: true,
script: '#!/bin/bash \n' + 'source jenkinsjobinfo.sh; echo -n "${PRTEST}"'
)}"""

}

steps {
withAWS(region:'us-east-1', credentials: 'cppalliance-bot-aws-user') {

// s3Upload(bucket:"cppalliance-previews", path:"${DNSREPONAME}/${CHANGE_ID}/doc/", workingDir: "boost-root/doc" , includePathPattern:"**")
s3Upload(bucket:"cppalliance-previews", path:"${DNSREPONAME}/${CHANGE_ID}/doc/src/", workingDir: "boost-root/doc/src" , includePathPattern:"**")
s3Upload(bucket:"cppalliance-previews", path:"${DNSREPONAME}/${CHANGE_ID}/libs/${REPONAME}/doc/", workingDir: "boost-root/libs/${REPONAME}/doc", includePathPattern:"**")
s3Upload(bucket:"cppalliance-previews", path:"${DNSREPONAME}/${CHANGE_ID}/", workingDir: "boost-root", includePathPattern:"boost.png")

}
script {
pullRequest.comment("An automated preview of the documentation is available at [https://${env.CHANGE_ID}.${env.DNSREPONAME}.${env.PRTEST}.cppalliance.org/libs/${env.REPONAME}/doc/html/index.html](https://${env.CHANGE_ID}.${env.DNSREPONAME}.${env.PRTEST}.cppalliance.org/libs/${env.REPONAME}/doc/html/index.html)")
}
}
}

stage('Post Diagnostics') {
steps {
sh '''#!/bin/bash
set -x
# not set -e. errors may occur in diagnostics
cat jenkinsjobinfo.sh
. jenkinsjobinfo.sh
ls -al
cat /etc/os-release
pwd
env
whoami
touch $(date "+%A-%B-%d-%T-%y")
mount | grep ^/dev/ | grep -v /etc | awk '{print \$3}'
git branch
git branch -avv
true
'''
}
}
}
}
10 changes: 10 additions & 0 deletions scripts/cppalliance_crypt_postbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -xe
pwd
sourcefile=boost-root/libs/crypt/doc/html/crypt.html
destfile=boost-root/libs/crypt/doc/html/index.html

if [ ! -f $destfile ]; then
cp $sourcefile $destfile
fi
4 changes: 4 additions & 0 deletions scripts/cppalliance_crypt_prebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

set -xe
echo "PRTEST=prtest2" >> jenkinsjobinfo.sh

0 comments on commit 39f2e4c

Please sign in to comment.