2020-01-19 12:34:13 +00:00
|
|
|
def lastStage = ''
|
2018-04-25 19:04:12 +01:00
|
|
|
node('node') {
|
2018-12-17 20:33:59 +00:00
|
|
|
properties([disableConcurrentBuilds()])
|
2018-04-25 19:04:12 +01:00
|
|
|
try {
|
2018-08-22 14:18:50 +01:00
|
|
|
currentBuild.result = "SUCCESS"
|
2018-04-25 19:04:12 +01:00
|
|
|
|
2018-07-13 16:02:33 +01:00
|
|
|
stage('Checkout') {
|
2020-01-19 12:34:13 +00:00
|
|
|
lastStage = env.STAGE_NAME
|
2018-08-22 14:18:50 +01:00
|
|
|
checkout scm
|
|
|
|
|
|
|
|
echo "Current build result: ${currentBuild.result}"
|
2018-07-13 16:02:33 +01:00
|
|
|
}
|
2020-12-28 21:59:06 +00:00
|
|
|
if (env.BRANCH_NAME == "main") {
|
2020-01-09 13:38:17 +00:00
|
|
|
stage('Run Versions Test') {
|
2020-01-19 12:34:13 +00:00
|
|
|
lastStage = env.STAGE_NAME
|
2020-01-09 13:38:17 +00:00
|
|
|
try {
|
|
|
|
echo "Running Versions test"
|
|
|
|
|
|
|
|
env.STORJ_SIM_POSTGRES = 'postgres://postgres@postgres:5432/teststorj?sslmode=disable'
|
|
|
|
env.STORJ_SIM_REDIS = 'redis:6379'
|
|
|
|
|
|
|
|
echo "STORJ_SIM_POSTGRES: $STORJ_SIM_POSTGRES"
|
|
|
|
echo "STORJ_SIM_REDIS: $STORJ_SIM_REDIS"
|
2020-06-25 18:17:39 +01:00
|
|
|
sh 'docker run --rm -d -e POSTGRES_HOST_AUTH_METHOD=trust --name postgres-$BUILD_NUMBER postgres:12.3'
|
2020-01-09 13:38:17 +00:00
|
|
|
sh 'docker run --rm -d --name redis-$BUILD_NUMBER redis:latest'
|
|
|
|
|
|
|
|
sh '''until $(docker logs postgres-$BUILD_NUMBER | grep "database system is ready to accept connections" > /dev/null)
|
|
|
|
do printf '.'
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
'''
|
|
|
|
sh 'docker exec postgres-$BUILD_NUMBER createdb -U postgres teststorj'
|
2020-12-28 21:59:06 +00:00
|
|
|
// fetch the remote main branch
|
|
|
|
sh 'git fetch --no-tags --progress -- https://github.com/storj/storj.git +refs/heads/main:refs/remotes/origin/main'
|
2023-01-20 21:19:15 +00:00
|
|
|
sh 'docker run -u $(id -u):$(id -g) --rm -i -v $PWD:$PWD -w $PWD --entrypoint $PWD/scripts/tests/testversions/test-sim-versions.sh -e STORJ_SIM_POSTGRES -e STORJ_SIM_REDIS --link redis-$BUILD_NUMBER:redis --link postgres-$BUILD_NUMBER:postgres -e CC=gcc storjlabs/golang:1.19.5'
|
2020-01-09 13:38:17 +00:00
|
|
|
}
|
|
|
|
catch(err){
|
|
|
|
throw err
|
|
|
|
}
|
|
|
|
finally {
|
|
|
|
sh 'docker stop postgres-$BUILD_NUMBER || true'
|
|
|
|
sh 'docker rm postgres-$BUILD_NUMBER || true'
|
|
|
|
sh 'docker stop redis-$BUILD_NUMBER || true'
|
|
|
|
sh 'docker rm redis-$BUILD_NUMBER || true'
|
|
|
|
}
|
2019-12-19 05:29:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-02 19:16:46 +00:00
|
|
|
stage('Run Rolling Upgrade Test') {
|
2020-01-19 12:34:13 +00:00
|
|
|
lastStage = env.STAGE_NAME
|
2020-01-02 19:16:46 +00:00
|
|
|
try {
|
|
|
|
echo "Running Rolling Upgrade test"
|
|
|
|
|
|
|
|
env.STORJ_SIM_POSTGRES = 'postgres://postgres@postgres:5432/teststorj?sslmode=disable'
|
|
|
|
env.STORJ_SIM_REDIS = 'redis:6379'
|
2021-03-19 10:11:37 +00:00
|
|
|
env.STORJ_MIGRATION_DB = 'postgres://postgres@postgres:5432/teststorj?sslmode=disable&options=--search_path=satellite/0/meta'
|
2020-01-02 19:16:46 +00:00
|
|
|
|
|
|
|
echo "STORJ_SIM_POSTGRES: $STORJ_SIM_POSTGRES"
|
|
|
|
echo "STORJ_SIM_REDIS: $STORJ_SIM_REDIS"
|
2021-03-19 10:11:37 +00:00
|
|
|
echo "STORJ_MIGRATION_DB: $STORJ_MIGRATION_DB"
|
2020-06-25 18:17:39 +01:00
|
|
|
sh 'docker run --rm -d -e POSTGRES_HOST_AUTH_METHOD=trust --name postgres-$BUILD_NUMBER postgres:12.3'
|
2020-01-07 17:06:59 +00:00
|
|
|
sh 'docker run --rm -d --name redis-$BUILD_NUMBER redis:latest'
|
2020-01-02 19:16:46 +00:00
|
|
|
|
2020-01-07 17:06:59 +00:00
|
|
|
sh '''until $(docker logs postgres-$BUILD_NUMBER | grep "database system is ready to accept connections" > /dev/null)
|
2020-01-02 19:16:46 +00:00
|
|
|
do printf '.'
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
'''
|
2020-01-07 17:06:59 +00:00
|
|
|
sh 'docker exec postgres-$BUILD_NUMBER createdb -U postgres teststorj'
|
2020-12-28 21:59:06 +00:00
|
|
|
// fetch the remote main branch
|
|
|
|
sh 'git fetch --no-tags --progress -- https://github.com/storj/storj.git +refs/heads/main:refs/remotes/origin/main'
|
2023-01-20 21:19:15 +00:00
|
|
|
sh 'docker run -u $(id -u):$(id -g) --rm -i -v $PWD:$PWD -w $PWD --entrypoint $PWD/scripts/tests/rollingupgrade/test-sim-rolling-upgrade.sh -e BRANCH_NAME -e STORJ_SIM_POSTGRES -e STORJ_SIM_REDIS -e STORJ_MIGRATION_DB --link redis-$BUILD_NUMBER:redis --link postgres-$BUILD_NUMBER:postgres -e CC=gcc storjlabs/golang:1.19.5'
|
2020-01-02 19:16:46 +00:00
|
|
|
}
|
|
|
|
catch(err){
|
|
|
|
throw err
|
|
|
|
}
|
|
|
|
finally {
|
2020-01-07 17:06:59 +00:00
|
|
|
sh 'docker stop postgres-$BUILD_NUMBER || true'
|
|
|
|
sh 'docker rm postgres-$BUILD_NUMBER || true'
|
|
|
|
sh 'docker stop redis-$BUILD_NUMBER || true'
|
|
|
|
sh 'docker rm redis-$BUILD_NUMBER || true'
|
2020-01-02 19:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-03 19:14:38 +01:00
|
|
|
stage('Build Binaries') {
|
2020-01-19 12:34:13 +00:00
|
|
|
lastStage = env.STAGE_NAME
|
2019-05-03 19:14:38 +01:00
|
|
|
sh 'make binaries'
|
2018-08-22 14:18:50 +01:00
|
|
|
|
2019-10-08 12:51:22 +01:00
|
|
|
stash name: "storagenode-binaries", includes: "release/**/storagenode*.exe"
|
|
|
|
|
|
|
|
echo "Current build result: ${currentBuild.result}"
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Build Windows Installer') {
|
2020-01-19 12:34:13 +00:00
|
|
|
lastStage = env.STAGE_NAME
|
2019-11-12 18:33:47 +00:00
|
|
|
node('windows') {
|
2019-10-08 12:51:22 +01:00
|
|
|
checkout scm
|
|
|
|
|
|
|
|
unstash "storagenode-binaries"
|
|
|
|
|
2020-01-03 13:28:04 +00:00
|
|
|
bat 'installer\\windows\\buildrelease.bat'
|
2019-10-08 12:51:22 +01:00
|
|
|
|
|
|
|
stash name: "storagenode-installer", includes: "release/**/storagenode*.msi"
|
|
|
|
|
|
|
|
echo "Current build result: ${currentBuild.result}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Sign Windows Installer') {
|
2020-01-19 12:34:13 +00:00
|
|
|
lastStage = env.STAGE_NAME
|
2019-10-08 12:51:22 +01:00
|
|
|
unstash "storagenode-installer"
|
|
|
|
|
|
|
|
sh 'make sign-windows-installer'
|
|
|
|
|
2018-08-22 14:18:50 +01:00
|
|
|
echo "Current build result: ${currentBuild.result}"
|
2018-07-13 16:02:33 +01:00
|
|
|
}
|
2018-04-25 19:04:12 +01:00
|
|
|
|
2019-05-03 19:14:38 +01:00
|
|
|
stage('Build Images') {
|
2020-01-19 12:34:13 +00:00
|
|
|
lastStage = env.STAGE_NAME
|
2019-05-03 19:14:38 +01:00
|
|
|
sh 'make images'
|
2018-08-31 16:21:44 +01:00
|
|
|
|
|
|
|
echo "Current build result: ${currentBuild.result}"
|
|
|
|
}
|
|
|
|
|
2018-08-14 16:00:39 +01:00
|
|
|
stage('Push Images') {
|
2020-01-19 12:34:13 +00:00
|
|
|
lastStage = env.STAGE_NAME
|
2018-09-18 14:46:04 +01:00
|
|
|
sh 'make push-images'
|
2020-01-28 19:35:17 +00:00
|
|
|
|
2018-08-22 14:18:50 +01:00
|
|
|
echo "Current build result: ${currentBuild.result}"
|
2018-08-14 16:00:39 +01:00
|
|
|
}
|
|
|
|
|
2018-09-18 14:46:04 +01:00
|
|
|
stage('Upload') {
|
2020-01-19 12:34:13 +00:00
|
|
|
lastStage = env.STAGE_NAME
|
2018-09-18 14:46:04 +01:00
|
|
|
sh 'make binaries-upload'
|
2020-01-28 19:35:17 +00:00
|
|
|
|
2018-09-18 14:46:04 +01:00
|
|
|
echo "Current build result: ${currentBuild.result}"
|
|
|
|
}
|
2021-11-30 19:50:56 +00:00
|
|
|
stage('Draft Release') {
|
|
|
|
withCredentials([string(credentialsId: 'GITHUB_RELEASE_TOKEN', variable: 'GITHUB_TOKEN')]) {
|
|
|
|
lastStage = env.STAGE_NAME
|
|
|
|
sh 'make draft-release'
|
|
|
|
|
|
|
|
echo "Current build result: ${currentBuild.result}"
|
|
|
|
}
|
|
|
|
}
|
2018-04-25 19:04:12 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
catch (err) {
|
2018-08-22 14:18:50 +01:00
|
|
|
echo "Caught errors! ${err}"
|
|
|
|
echo "Setting build result to FAILURE"
|
2018-04-25 19:04:12 +01:00
|
|
|
currentBuild.result = "FAILURE"
|
|
|
|
|
2020-01-19 12:34:13 +00:00
|
|
|
slackSend color: 'danger', message: "@build-team ${env.BRANCH_NAME} build failed during stage ${lastStage} ${env.BUILD_URL}"
|
2019-08-29 16:35:02 +01:00
|
|
|
|
2023-02-02 12:42:52 +00:00
|
|
|
throw err
|
2018-07-13 16:02:33 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
finally {
|
|
|
|
stage('Cleanup') {
|
2018-09-13 17:55:14 +01:00
|
|
|
sh 'make clean-images'
|
2018-07-13 16:02:33 +01:00
|
|
|
deleteDir()
|
|
|
|
}
|
|
|
|
|
2018-04-25 19:04:12 +01:00
|
|
|
}
|
|
|
|
}
|