Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit 35717b8

Browse files
authored
Merge pull request #102 from NYULibraries/chore/jenkins_deploy
Chore/jenkins deploy
2 parents cc43860 + 5c8c9b6 commit 35717b8

File tree

7 files changed

+25
-8
lines changed

7 files changed

+25
-8
lines changed

.circleci/config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ jobs:
3939
- run:
4040
name: Deploy into staging via Jenkins
4141
command: |
42-
docker run --rm appropriate/curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/Privileges%20Guide/job/Privileges%20Guide%20Development%20Deploy/build/api
42+
#docker run --rm appropriate/curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/Privileges%20Guide/job/Privileges%20Guide%20Development%20Deploy/build/api
43+
docker run --rm -e JOB_NAME=Privileges%20Deploy -e DEPLOY_ENV=staging -e TIMEOUT=10m -e JENKINS_CI_HOST=jenkinsci.library.nyu.edu -e JENKINS_CI_USERNAME -e JENKINS_CI_API_KEY -e CIRCLE_SHA1 quay.io/nyulibraries/jenkins_build
4344
4445
deploy-prod:
4546
<<: *docker-defaults
@@ -48,7 +49,8 @@ jobs:
4849
- run:
4950
name: Deploy into production via Jenkins
5051
command: |
51-
docker run --rm appropriate/curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/Privileges%20Guide/job/Privileges%20Guide%20Production%20Deploy/build/api
52+
#docker run --rm appropriate/curl -u $JENKINS_USERNAME:$JENKINS_API_KEY -X POST http://jenkins.library.nyu.edu/view/Privileges%20Guide/job/Privileges%20Guide%20Production%20Deploy/build/api
53+
docker run --rm -e JOB_NAME=Privileges%20Deploy -e DEPLOY_ENV=production -e TIMEOUT=10m -e JENKINS_CI_HOST=jenkinsci.library.nyu.edu -e JENKINS_CI_USERNAME -e JENKINS_CI_API_KEY -e CIRCLE_SHA1 quay.io/nyulibraries/jenkins_build
5254
5355
workflows:
5456
version: 2

Dockerfile.test

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ COPY --chown=docker:docker script/docker/wait-for.sh ./
1313

1414
COPY --chown=docker:docker bin/ bin/
1515
COPY --chown=docker:docker Gemfile Gemfile.lock ./
16-
#ARG RUN_PACKAGES="nodejs ruby-mysql2 default-libmysqlclient-dev"
17-
ARG RUN_PACKAGES="nodejs ruby-mysql2 default-libmysqlclient-dev"
18-
ARG BUILD_PACKAGES="build-essential zlib1g-dev git"
16+
ARG RUN_PACKAGES="nodejs ruby-mysql2 default-libmysqlclient-dev ssh git"
17+
ARG BUILD_PACKAGES="build-essential zlib1g-dev"
1918
RUN apt-get update && apt-get -y --no-install-recommends install $BUILD_PACKAGES $RUN_PACKAGES \
2019
&& gem install bundler -v '1.16.6' \
2120
&& bundle config --local github.https true \
@@ -28,6 +27,9 @@ RUN apt-get update && apt-get -y --no-install-recommends install $BUILD_PACKAGES
2827

2928
USER docker
3029

30+
# avoid ssh key verification failures on runtime
31+
RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && ssh-keyscan github.com >> ~/.ssh/known_hosts
32+
3133
COPY --chown=docker:docker . .
3234
RUN bin/rails assets:precompile
3335

config/deploy.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@
1414
set :app_title, "privileges"
1515
set :rvm_ruby_string, "ruby-2.6.2"
1616
set :assets_gem, ["nyulibraries_stylesheets.git", "nyulibraries_javascripts.git"]
17+
18+
set :scm, :git
19+
set(:branch, (ENV["GIT_COMMIT"] || ENV["GIT_BRANCH"]).gsub(/remotes\//,"").gsub(/origin\//,""))

config/deploy/production.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
set :rails_env, "production"
2-
set :branch, "master"

config/deploy/qa.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
set :rails_env, "qa"
2-
set(:branch, ENV["GIT_BRANCH"].gsub(/remotes\//,"").gsub(/origin\//,""))
32
set :app_title, "privileges_qa"
43
set :repository, "git@github.com:NYULibraries/privileges.git"

config/deploy/staging.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
set :rails_env, "staging"
2-
set(:branch, ENV["GIT_BRANCH"].gsub(/remotes\//,"").gsub(/origin\//,""))

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,16 @@ services:
124124
depends_on:
125125
- setup_dbs
126126
- memcached
127+
128+
deploy:
129+
<<: *build_test
130+
tty: true
131+
stdin_open: true
132+
command: "mkdir -p ~/.ssh && touch ~/.ssh/known_hosts && ssh-keyscan github.com >> ~/.ssh/known_hosts && \
133+
bundle exec cap $DEPLOY_ENV deploy:setup && bundle exec cap $DEPLOY_ENV deploy"
134+
user: root
135+
environment:
136+
SSH_AUTH_SOCK: '/ssh-agent'
137+
GIT_COMMIT: "$GIT_COMMIT"
138+
volumes:
139+
- "${HOST_SSH_AUTH_SOCK}:/ssh-agent"

0 commit comments

Comments
 (0)