2020-03-23 13:15:27 +00:00
|
|
|
pipeline {
|
|
|
|
agent {
|
|
|
|
node {
|
|
|
|
label 'node'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2020-03-26 09:46:41 +00:00
|
|
|
stage('Install dependencies') {
|
2020-04-07 10:19:28 +00:00
|
|
|
parallel {
|
|
|
|
stage('JavaScript') {
|
|
|
|
steps {
|
|
|
|
sh 'CI=true npm_config_python=/usr/local/bin/python2.7 yarn --no-progress --non-interactive --skip-integrity-check --frozen-lockfile install'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Python') {
|
|
|
|
steps {
|
2023-03-09 23:04:44 +00:00
|
|
|
sh 'poetry install'
|
2020-04-07 10:19:28 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-23 13:15:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-07 10:19:28 +00:00
|
|
|
stage('Type checks') {
|
|
|
|
parallel {
|
|
|
|
stage('TypeScript') {
|
|
|
|
steps {
|
|
|
|
sh 'node_modules/.bin/tsc -p tsconfig.json --noEmit --extendedDiagnostics'
|
|
|
|
}
|
|
|
|
}
|
2020-04-13 16:40:03 +00:00
|
|
|
stage('MyPy (stateserver)') {
|
2020-04-07 10:19:28 +00:00
|
|
|
steps {
|
2023-03-09 23:04:44 +00:00
|
|
|
sh 'poetry run mypy stateserver.py'
|
2020-04-13 16:40:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('MyPy (shittyserver)') {
|
|
|
|
steps {
|
2023-03-09 23:04:44 +00:00
|
|
|
sh 'poetry run mypy shittyserver.py'
|
2020-04-07 10:19:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-26 09:46:41 +00:00
|
|
|
stage('Build and deploy to dev instance') {
|
2020-04-13 16:45:02 +00:00
|
|
|
when {
|
|
|
|
anyOf {
|
|
|
|
branch 'master'
|
|
|
|
branch 'production'
|
|
|
|
}
|
|
|
|
}
|
2021-05-13 11:09:04 +00:00
|
|
|
environment {
|
|
|
|
SENTRY_AUTH_TOKEN = credentials('sentry-auth-token')
|
|
|
|
SENTRY_ORG = 'university-radio-york'
|
|
|
|
SENTRY_PROJECT = 'webstudio'
|
|
|
|
SENTRY_ENVIRONMENT = 'webstudio-dev'
|
|
|
|
}
|
2020-03-23 13:15:27 +00:00
|
|
|
steps {
|
2021-09-08 22:27:54 +00:00
|
|
|
sh 'newpkgjson=$(jq \'.homepage = "https://ury.org.uk/webstudio-dev"\' package.json) && echo "${newpkgjson}" > package.json'
|
2020-04-23 20:14:32 +00:00
|
|
|
sh 'REACT_APP_GIT_SHA=`git rev-parse --short HEAD` yarn build'
|
2020-03-23 13:15:27 +00:00
|
|
|
sshagent(credentials: ['ury']) {
|
2020-03-26 09:46:41 +00:00
|
|
|
sh 'rsync -av --delete-after build/ deploy@ury:/usr/local/www/webstudio-dev'
|
2020-03-23 13:15:27 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-13 11:09:04 +00:00
|
|
|
post {
|
|
|
|
success {
|
|
|
|
sh '''
|
|
|
|
export SENTRY_RELEASE="$(jq -r '.version' package.json)-$(git rev-parse --short HEAD)"
|
|
|
|
sentry-cli releases new -p $SENTRY_PROJECT $SENTRY_RELEASE
|
|
|
|
sentry-cli releases set-commits $SENTRY_RELEASE --auto
|
2021-05-13 11:12:16 +00:00
|
|
|
sentry-cli releases files $SENTRY_RELEASE upload-sourcemaps build/static/js --url-prefix '/webstudio-dev/static/js'
|
2021-05-13 11:09:04 +00:00
|
|
|
sentry-cli releases finalize $SENTRY_RELEASE
|
|
|
|
sentry-cli releases deploys $SENTRY_RELEASE new -e $SENTRY_ENVIRONMENT
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
2020-03-23 13:15:27 +00:00
|
|
|
}
|
2020-04-07 10:19:28 +00:00
|
|
|
|
2020-03-26 09:46:41 +00:00
|
|
|
stage('Build and deploy for production') {
|
|
|
|
when {
|
|
|
|
branch 'production'
|
|
|
|
}
|
2021-05-13 11:09:04 +00:00
|
|
|
environment {
|
|
|
|
SENTRY_AUTH_TOKEN = credentials('sentry-auth-token')
|
|
|
|
SENTRY_ORG = 'university-radio-york'
|
|
|
|
SENTRY_PROJECT = 'webstudio'
|
|
|
|
SENTRY_ENVIRONMENT = 'production'
|
|
|
|
}
|
2020-03-31 18:43:38 +00:00
|
|
|
parallel {
|
|
|
|
stage('Deploy prod client') {
|
|
|
|
environment {
|
|
|
|
REACT_APP_MYRADIO_NONAPI_BASE = 'https://ury.org.uk/myradio'
|
|
|
|
REACT_APP_MYRADIO_BASE = 'https://ury.org.uk/api/v2'
|
2020-06-14 17:12:56 +00:00
|
|
|
REACT_APP_WS_URL = 'wss://ury.org.uk/webstudio/api/stream'
|
2020-03-31 18:43:38 +00:00
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh 'sed -i -e \'s/ury.org.uk\\/webstudio-dev/ury.org.uk\\/webstudio/\' package.json'
|
2020-09-19 13:07:21 +00:00
|
|
|
sh 'REACT_APP_GIT_SHA=`git rev-parse --short HEAD` REACT_APP_PRODUCTION=true yarn build'
|
2020-03-31 18:43:38 +00:00
|
|
|
sshagent(credentials: ['ury']) {
|
|
|
|
sh 'rsync -av --delete-after build/ deploy@ury:/usr/local/www/webstudio'
|
|
|
|
}
|
|
|
|
}
|
2021-05-13 11:09:04 +00:00
|
|
|
post {
|
|
|
|
success {
|
|
|
|
sh '''
|
|
|
|
export SENTRY_RELEASE="$(jq -r '.version' package.json)-$(git rev-parse --short HEAD)"
|
|
|
|
sentry-cli releases new -p $SENTRY_PROJECT $SENTRY_RELEASE
|
|
|
|
sentry-cli releases set-commits $SENTRY_RELEASE --auto
|
|
|
|
sentry-cli releases files $SENTRY_RELEASE upload-sourcemaps build/static/js --url-prefix '/webstudio/static/js'
|
|
|
|
sentry-cli releases finalize $SENTRY_RELEASE
|
|
|
|
sentry-cli releases deploys $SENTRY_RELEASE new -e $SENTRY_ENVIRONMENT
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
2020-03-31 18:43:38 +00:00
|
|
|
}
|
|
|
|
stage('Deploy server') {
|
|
|
|
steps {
|
|
|
|
sshagent(credentials: ['ury']) {
|
2020-04-13 16:40:03 +00:00
|
|
|
sh 'scp -v -o StrictHostKeyChecking=no stateserver.py liquidsoap@dolby.ury:/opt/webstudioserver/stateserver.py'
|
|
|
|
sh 'scp -v -o StrictHostKeyChecking=no shittyserver.py liquidsoap@dolby.ury:/opt/webstudioserver/shittyserver.py'
|
2023-03-09 23:04:44 +00:00
|
|
|
sh 'scp -v -o StrictHostKeyChecking=no pyproject.toml liquidsoap@dolby.ury:/opt/webstudioserver/pyproject.toml'
|
|
|
|
sh 'scp -v -o StrictHostKeyChecking=no poetry.lock liquidsoap@dolby.ury:/opt/webstudioserver/poetry.lock'
|
2020-03-31 18:43:38 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-26 09:46:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-03-23 13:15:27 +00:00
|
|
|
}
|
|
|
|
}
|