diff --git a/Jenkinsfile b/Jenkinsfile index 1a66420..213837e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,19 +23,13 @@ pipeline { } } stage('deploy') { - agent { - dockerfile { - dir 'jenkins' - label 'docker-4x' - additionalBuildArgs '--build-arg DOCKER_GID=$(stat -c %g /var/run/docker.sock) --build-arg JENKINS_UID=$(id -u jenkins) --build-arg JENKINS_GID=$(id -g jenkins)' - args '-v /var/run/docker.sock:/var/run/docker.sock --group-add docker' - } - } + agent none when { branch 'master' } steps { - sh 'make serverless-deploy.production' + build(job: 'hostedapps/deploy/r-builds', wait: true, + parameters: [string(name: 'ENVIRONMENT', value: 'staging')]) } } } diff --git a/deploy.Jenkinsfile b/deploy.Jenkinsfile new file mode 100644 index 0000000..f4f873e --- /dev/null +++ b/deploy.Jenkinsfile @@ -0,0 +1,27 @@ +pipeline { + agent { + dockerfile { + dir 'jenkins' + label 'docker' + additionalBuildArgs '--build-arg DOCKER_GID=$(stat -c %g /var/run/docker.sock) --build-arg JENKINS_UID=$(id -u jenkins) --build-arg JENKINS_GID=$(id -g jenkins)' + args '-v /var/run/docker.sock:/var/run/docker.sock --group-add docker' + } + } + environment { + HOME = "." + } + options { + ansiColor('xterm') + } + parameters { + choice(name: 'ENVIRONMENT', choices: ['staging', 'production'], + description: 'The target environment to deploy to.') + } + stages { + stage('deploy') { + steps { + sh "make serverless-deploy.${params.ENVIRONMENT}" + } + } + } +}