Bump build scripts to 1.1.8

This commit is contained in:
Christopher Hoskin 2018-07-17 10:51:15 +01:00
parent f0cf8e6622
commit 4784ae33a2
4 changed files with 49 additions and 7 deletions

View file

@ -3,12 +3,33 @@ String cron_string = BRANCH_NAME == "master" ? "@daily" : ""
pipeline { pipeline {
agent any agent any
environment {
GIT_PROJECT = "filestore/-sharelatex"
JENKINS_WORKFLOW = "filestore/-sharelatex"
TARGET_URL = "${env.JENKINS_URL}blue/organizations/jenkins/${JENKINS_WORKFLOW}/detail/$BRANCH_NAME/$BUILD_NUMBER/pipeline"
GIT_API_URL = "https://api.github.com/repos/sharelatex/${GIT_PROJECT}/statuses/$GIT_COMMIT"
}
triggers { triggers {
pollSCM('* * * * *') pollSCM('* * * * *')
cron(cron_string) cron(cron_string)
} }
stages { stages {
stage('Install') {
steps {
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
sh "curl $GIT_API_URL \
--data '{ \
\"state\" : \"pending\", \
\"target_url\": \"$TARGET_URL\", \
\"description\": \"Your build is underway\", \
\"context\": \"ci/jenkins\" }' \
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
}
}
}
stage('Build') { stage('Build') {
steps { steps {
sh 'make build' sh 'make build'
@ -62,11 +83,32 @@ pipeline {
sh 'make clean' sh 'make clean'
} }
success {
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
sh "curl $GIT_API_URL \
--data '{ \
\"state\" : \"success\", \
\"target_url\": \"$TARGET_URL\", \
\"description\": \"Your build succeeded!\", \
\"context\": \"ci/jenkins\" }' \
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
}
}
failure { failure {
mail(from: "${EMAIL_ALERT_FROM}", mail(from: "${EMAIL_ALERT_FROM}",
to: "${EMAIL_ALERT_TO}", to: "${EMAIL_ALERT_TO}",
subject: "Jenkins build failed: ${JOB_NAME}:${BUILD_NUMBER}", subject: "Jenkins build failed: ${JOB_NAME}:${BUILD_NUMBER}",
body: "Build: ${BUILD_URL}") body: "Build: ${BUILD_URL}")
withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
sh "curl $GIT_API_URL \
--data '{ \
\"state\" : \"failure\", \
\"target_url\": \"$TARGET_URL\", \
\"description\": \"Your build failed\", \
\"context\": \"ci/jenkins\" }' \
-u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
}
} }
} }

View file

@ -1,11 +1,11 @@
# This file was auto-generated, do not edit it directly. # This file was auto-generated, do not edit it directly.
# Instead run bin/update_build_scripts from # Instead run bin/update_build_scripts from
# https://github.com/sharelatex/sharelatex-dev-environment # https://github.com/sharelatex/sharelatex-dev-environment
# Version: 1.1.7 # Version: 1.1.8
BUILD_NUMBER ?= local BUILD_NUMBER ?= local
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD) BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
PROJECT_NAME = filestore PROJECT_NAME = filestore/
DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml
DOCKER_COMPOSE := BUILD_NUMBER=$(BUILD_NUMBER) \ DOCKER_COMPOSE := BUILD_NUMBER=$(BUILD_NUMBER) \
BRANCH_NAME=$(BRANCH_NAME) \ BRANCH_NAME=$(BRANCH_NAME) \
@ -26,16 +26,16 @@ clean:
test: test_unit test_acceptance test: test_unit test_acceptance
test_unit: test_unit:
@[ ! -d test/unit ] && echo "filestore has no unit tests" || $(DOCKER_COMPOSE) run --rm test_unit @[ ! -d test/unit ] && echo "filestore/ has no unit tests" || $(DOCKER_COMPOSE) run --rm test_unit
test_acceptance: test_clean test_acceptance_pre_run # clear the database before each acceptance test run test_acceptance: test_clean test_acceptance_pre_run # clear the database before each acceptance test run
@[ ! -d test/acceptance ] && echo "filestore has no acceptance tests" || $(DOCKER_COMPOSE) run --rm test_acceptance @[ ! -d test/acceptance ] && echo "filestore/ has no acceptance tests" || $(DOCKER_COMPOSE) run --rm test_acceptance
test_clean: test_clean:
$(DOCKER_COMPOSE) down -v -t 0 $(DOCKER_COMPOSE) down -v -t 0
test_acceptance_pre_run: test_acceptance_pre_run:
@[ ! -f test/acceptance/scripts/pre-run ] && echo "filestore has no pre acceptance tests task" || $(DOCKER_COMPOSE) run --rm test_acceptance test/acceptance/scripts/pre-run @[ ! -f test/acceptance/scripts/pre-run ] && echo "filestore/ has no pre acceptance tests task" || $(DOCKER_COMPOSE) run --rm test_acceptance test/acceptance/scripts/pre-run
build: build:
docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \
--tag gcr.io/csh-gcdm-test/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/csh-gcdm-test/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \

View file

@ -1,7 +1,7 @@
# This file was auto-generated, do not edit it directly. # This file was auto-generated, do not edit it directly.
# Instead run bin/update_build_scripts from # Instead run bin/update_build_scripts from
# https://github.com/sharelatex/sharelatex-dev-environment # https://github.com/sharelatex/sharelatex-dev-environment
# Version: 1.1.7 # Version: 1.1.8
version: "2" version: "2"

View file

@ -1,7 +1,7 @@
# This file was auto-generated, do not edit it directly. # This file was auto-generated, do not edit it directly.
# Instead run bin/update_build_scripts from # Instead run bin/update_build_scripts from
# https://github.com/sharelatex/sharelatex-dev-environment # https://github.com/sharelatex/sharelatex-dev-environment
# Version: 1.1.7 # Version: 1.1.8
version: "2" version: "2"