diff --git a/ppg/timescaledb.groovy b/ppg/timescaledb.groovy new file mode 100644 index 0000000000..3a275cfa35 --- /dev/null +++ b/ppg/timescaledb.groovy @@ -0,0 +1,276 @@ +library changelog: false, identifier: 'lib@master', retriever: modernSCM([ + $class: 'GitSCMSource', + remote: 'https://github.com/Percona-Lab/jenkins-pipelines.git' +]) _ + +void buildStage(String DOCKER_OS, String STAGE_PARAM) { + sh """ + set -o xtrace + mkdir test + wget \$(echo ${GIT_REPO} | sed -re 's|github.com|raw.githubusercontent.com|; s|\\.git\$||')/${GIT_BRANCH}/timescaledb/timescaledb_builder.sh -O builder.sh + pwd -P + ls -laR + export build_dir=\$(pwd -P) + docker run -u root -v \${build_dir}:\${build_dir} ${DOCKER_OS} sh -c " + set -o xtrace + cd \${build_dir} + bash -x ./builder.sh --builddir=\${build_dir}/test --install_deps=1 + bash -x ./builder.sh --builddir=\${build_dir}/test --branch=${PG_BRANCH} --rpm_release=${RPM_RELEASE} --deb_release=${DEB_RELEASE} ${STAGE_PARAM}" + """ +} + +void cleanUpWS() { + sh """ + sudo rm -rf ./* + """ +} + +def AWS_STASH_PATH + +pipeline { + agent { + label 'docker' + } + parameters { + string( + defaultValue: 'https://github.com/percona/postgres-packaging.git', + description: 'URL for timescaledb repository', + name: 'GIT_REPO') + string( + defaultValue: '2.15.2', + description: 'Tag/Branch for timescaledb repository', + name: 'PG_BRANCH') + string( + defaultValue: '16.3', + description: 'Tag/Branch for timescaledb packaging repository', + name: 'GIT_BRANCH') + string( + defaultValue: '1', + description: 'RPM release value', + name: 'RPM_RELEASE') + string( + defaultValue: '1', + description: 'DEB release value', + name: 'DEB_RELEASE') + string( + defaultValue: 'ppg-16-extras', + description: 'PPG repo name', + name: 'PPG_REPO') + choice( + choices: 'laboratory\ntesting\nexperimental', + description: 'Repo component to push packages to', + name: 'COMPONENT') + } + options { + skipDefaultCheckout() + disableConcurrentBuilds() + buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) + } + stages { + stage('Create timescaledb source tarball') { + steps { + slackNotify("#releases-ci", "#00FF00", "[${JOB_NAME}]: starting build for ${GIT_BRANCH} - [${BUILD_URL}]") + cleanUpWS() + buildStage("centos:7", "--get_sources=1") + sh ''' + REPO_UPLOAD_PATH=$(grep "UPLOAD" test/timescaledb.properties | cut -d = -f 2 | sed "s:$:${BUILD_NUMBER}:") + AWS_STASH_PATH=$(echo ${REPO_UPLOAD_PATH} | sed "s:UPLOAD/experimental/::") + echo ${REPO_UPLOAD_PATH} > uploadPath + echo ${AWS_STASH_PATH} > awsUploadPath + cat test/timescaledb.properties + cat uploadPath + ''' + script { + AWS_STASH_PATH = sh(returnStdout: true, script: "cat awsUploadPath").trim() + } + stash includes: 'uploadPath', name: 'uploadPath' + pushArtifactFolder("source_tarball/", AWS_STASH_PATH) + uploadTarballfromAWS("source_tarball/", AWS_STASH_PATH, 'source') + } + } + stage('Build timescaledb generic source packages') { + parallel { + stage('Build timescaledb generic source rpm') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("source_tarball/", AWS_STASH_PATH) + buildStage("centos:7", "--build_src_rpm=1") + + pushArtifactFolder("srpm/", AWS_STASH_PATH) + uploadRPMfromAWS("srpm/", AWS_STASH_PATH) + } + } + stage('Build timescaledb generic source deb') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("source_tarball/", AWS_STASH_PATH) + buildStage("ubuntu:focal", "--build_src_deb=1") + + pushArtifactFolder("source_deb/", AWS_STASH_PATH) + uploadDEBfromAWS("source_deb/", AWS_STASH_PATH) + } + } + } //parallel + } // stage + stage('Build timescaledb RPMs/DEBs/Binary tarballs') { + parallel { + stage('Centos 7') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("srpm/", AWS_STASH_PATH) + buildStage("centos:7", "--build_rpm=1") + + pushArtifactFolder("rpm/", AWS_STASH_PATH) + uploadRPMfromAWS("rpm/", AWS_STASH_PATH) + } + } + stage('Oracle Linux 8') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("srpm/", AWS_STASH_PATH) + buildStage("oraclelinux:8", "--build_rpm=1") + + pushArtifactFolder("rpm/", AWS_STASH_PATH) + uploadRPMfromAWS("rpm/", AWS_STASH_PATH) + } + } + stage('Oracle Linux 9') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("srpm/", AWS_STASH_PATH) + buildStage("oraclelinux:9", "--build_rpm=1") + + pushArtifactFolder("rpm/", AWS_STASH_PATH) + uploadRPMfromAWS("rpm/", AWS_STASH_PATH) + } + } + stage('Ubuntu Focal(20.04)') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("source_deb/", AWS_STASH_PATH) + buildStage("ubuntu:focal", "--build_deb=1") + + pushArtifactFolder("deb/", AWS_STASH_PATH) + uploadDEBfromAWS("deb/", AWS_STASH_PATH) + } + } + stage('Ubuntu Jammy(22.04)') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("source_deb/", AWS_STASH_PATH) + buildStage("ubuntu:jammy", "--build_deb=1") + + pushArtifactFolder("deb/", AWS_STASH_PATH) + uploadDEBfromAWS("deb/", AWS_STASH_PATH) + } + } + stage('Ubuntu Noble(24.04)') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("source_deb/", AWS_STASH_PATH) + buildStage("ubuntu:noble", "--build_deb=1") + + pushArtifactFolder("deb/", AWS_STASH_PATH) + uploadDEBfromAWS("deb/", AWS_STASH_PATH) + } + } + stage('Debian Buster(10)') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("source_deb/", AWS_STASH_PATH) + buildStage("debian:buster", "--build_deb=1") + + pushArtifactFolder("deb/", AWS_STASH_PATH) + uploadDEBfromAWS("deb/", AWS_STASH_PATH) + } + } + stage('Debian Bullseye(11)') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("source_deb/", AWS_STASH_PATH) + buildStage("debian:bullseye", "--build_deb=1") + + pushArtifactFolder("deb/", AWS_STASH_PATH) + uploadDEBfromAWS("deb/", AWS_STASH_PATH) + } + } + stage('Debian bookworm(12)') { + agent { + label 'docker' + } + steps { + cleanUpWS() + popArtifactFolder("source_deb/", AWS_STASH_PATH) + buildStage("debian:bookworm", "--build_deb=1") + + pushArtifactFolder("deb/", AWS_STASH_PATH) + uploadDEBfromAWS("deb/", AWS_STASH_PATH) + } + } + } + } + + stage('Sign packages') { + steps { + signRPM() + signDEB() + } + } + stage('Push to public repository') { + steps { + // sync packages + sync2ProdAutoBuild(PPG_REPO, COMPONENT) + } + } + + } + post { + success { + slackNotify("#releases-ci", "#00FF00", "[${JOB_NAME}]: build has been finished successfully for ${GIT_BRANCH} - [${BUILD_URL}]") + script { + currentBuild.description = "Built on ${GIT_BRANCH}" + } + deleteDir() + } + failure { + slackNotify("#releases-ci", "#FF0000", "[${JOB_NAME}]: build failed for ${GIT_BRANCH} - [${BUILD_URL}]") + deleteDir() + } + always { + sh ''' + sudo rm -rf ./* + ''' + deleteDir() + } + } +} diff --git a/ppg/timescaledb.yml b/ppg/timescaledb.yml new file mode 100644 index 0000000000..22fb8cde7b --- /dev/null +++ b/ppg/timescaledb.yml @@ -0,0 +1,15 @@ +- job: + name: timescaledb-RELEASE + project-type: pipeline + description: | + Do not edit this job through the web! + pipeline-scm: + scm: + - git: + url: https://github.com/Percona-Lab/jenkins-pipelines.git + branches: + - 'master' + wipe-workspace: false + lightweight-checkout: true + script-path: ppg/timescaledb.groovy +