-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3749492
Showing
7 changed files
with
466 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
ARG RUBY_IMAGE | ||
FROM ${RUBY_IMAGE:-ruby:latest} | ||
|
||
RUN gem update --system && gem install bundler \ | ||
&& ruby --version && gem --version && bundle --version \ | ||
&& echo "--- :package: Installing system deps" \ | ||
# Postgres apt sources | ||
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ | ||
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ | ||
# Node apt sources | ||
&& curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \ | ||
&& echo "deb http://deb.nodesource.com/node_10.x stretch main" > /etc/apt/sources.list.d/nodesource.list \ | ||
# Yarn apt sources | ||
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ | ||
&& echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ | ||
# Install all the things | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
postgresql-client mysql-client sqlite3 \ | ||
git nodejs yarn lsof \ | ||
ffmpeg mupdf mupdf-tools poppler-utils \ | ||
# await (for waiting on dependent services) | ||
&& cd /tmp \ | ||
&& wget -qc https://github.com/betalo-sweden/await/releases/download/v0.4.0/await-linux-amd64 \ | ||
&& install await-linux-amd64 /usr/local/bin/await \ | ||
# clean up | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* \ | ||
&& mkdir /rails | ||
|
||
WORKDIR /rails | ||
ENV RAILS_ENV=test RACK_ENV=test | ||
ENV JRUBY_OPTS="--dev -J-Xmx1024M" | ||
|
||
ADD .buildkite/await-all /usr/local/bin/ | ||
|
||
ADD actioncable/package.json actioncable/ | ||
ADD actiontext/package.json actiontext/ | ||
ADD actionview/package.json actionview/ | ||
ADD activestorage/package.json activestorage/ | ||
ADD package.json yarn.lock .yarnrc ./ | ||
|
||
RUN echo "--- :javascript: Installing JavaScript deps" \ | ||
&& yarn install \ | ||
&& yarn cache clean | ||
|
||
ADD */*.gemspec tmp/ | ||
ADD railties/exe/ railties/exe/ | ||
ADD Gemfile Gemfile.lock RAILS_VERSION rails.gemspec ./ | ||
|
||
RUN echo "--- :bundler: Installing Ruby deps" \ | ||
&& (cd tmp && for f in *.gemspec; do d="$(basename -s.gemspec "$f")"; mkdir -p "../$d" && mv "$f" "../$d/"; done) \ | ||
&& rm Gemfile.lock && bundle install -j 8 && cp Gemfile.lock tmp/Gemfile.lock.updated \ | ||
&& rm -rf /usr/local/bundle/gems/cache \ | ||
&& echo "--- :floppy_disk: Copying repository contents" | ||
|
||
ADD . ./ | ||
|
||
RUN mv -f tmp/Gemfile.lock.updated Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM alpine | ||
|
||
RUN apk add --no-cache beanstalkd | ||
|
||
EXPOSE 11300 | ||
ENTRYPOINT ["/usr/bin/beanstalkd"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
exec await $( | ||
getent hosts $( | ||
for v in ${!AWAIT_*}; do echo ${v#AWAIT_}; done | ||
) | while read ip name; do v="AWAIT_${name}"; echo ${!v}; done | ||
) -- "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
version: "3.6" | ||
|
||
services: | ||
base: | ||
build: | ||
context: ../ | ||
dockerfile: .buildkite/Dockerfile | ||
args: | ||
- RUBY_IMAGE | ||
|
||
default: &default | ||
image: "${IMAGE_NAME-buildkite_base}" | ||
environment: | ||
CI: | ||
BUILDKITE_PARALLEL_JOB: | ||
BUILDKITE_PARALLEL_JOB_COUNT: | ||
|
||
# Sauce Labs username and access key. Obfuscated, purposefully not encrypted. | ||
ENCODED: "U0FVQ0VfQUNDRVNTX0tFWT1hMDM1MzQzZi1lOTIyLTQwYjMtYWEzYy0wNmIzZWE2MzVjNDggU0FVQ0VfVVNFUk5BTUU9cnVieW9ucmFpbHM=" | ||
|
||
BEANSTALK_URL: "beanstalk://beanstalkd" | ||
MEMCACHE_SERVERS: "memcached:11211" | ||
MYSQL_HOST: "${MYSQL_SERVICE-mysql}" | ||
PGHOST: postgres | ||
PGUSER: postgres | ||
QC_DATABASE_URL: "postgres://postgres@postgres/active_jobs_qc_int_test" | ||
QUE_DATABASE_URL: "postgres://postgres@postgres/active_jobs_que_int_test" | ||
RABBITMQ_URL: "amqp://guest:guest@rabbitmq:5672" | ||
REDIS_URL: "redis://redis:6379/1" | ||
SELENIUM_DRIVER_URL: "http://chrome:4444/wd/hub" | ||
|
||
AWAIT_redis: tcp://redis:6379 | ||
AWAIT_memcached: tcp://memcached:11211 | ||
AWAIT_mysql: tcp://mysql:3306 | ||
AWAIT_mariadb: tcp://mariadb:3306 | ||
AWAIT_postgres: postgres://postgres@postgres:5432/postgres | ||
AWAIT_rabbitmq: tcp://rabbitmq:5672 | ||
AWAIT_beanstalkd: tcp://beanstalkd:11300 | ||
AWAIT_chrome: tcp://chrome:4444 | ||
|
||
entrypoint: await-all | ||
|
||
depends_on: | ||
- redis | ||
- memcached | ||
|
||
postgresdb: | ||
<<: *default | ||
depends_on: | ||
- redis | ||
- memcached | ||
- postgres | ||
|
||
mysqldb: | ||
<<: *default | ||
depends_on: | ||
- redis | ||
- memcached | ||
- "${MYSQL_SERVICE-mysql}" | ||
|
||
railties: | ||
<<: *default | ||
depends_on: | ||
- redis | ||
- memcached | ||
- "${MYSQL_SERVICE-mysql}" | ||
- postgres | ||
|
||
activejob: | ||
<<: *default | ||
depends_on: | ||
- redis | ||
- memcached | ||
- postgres | ||
- rabbitmq | ||
- beanstalkd | ||
|
||
actionview: | ||
<<: *default | ||
depends_on: | ||
- redis | ||
- memcached | ||
- chrome | ||
|
||
memcached: | ||
image: memcached:alpine | ||
|
||
redis: | ||
image: redis:alpine | ||
|
||
mysql: &mysql | ||
image: mysql:latest | ||
command: "--default-authentication-plugin=mysql_native_password" | ||
environment: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | ||
volumes: | ||
- "./mysql-initdb.d:/docker-entrypoint-initdb.d" | ||
|
||
mariadb: | ||
<<: *mysql | ||
image: mariadb:latest | ||
|
||
postgres: | ||
image: postgres:alpine | ||
|
||
rabbitmq: | ||
image: rabbitmq:alpine | ||
|
||
beanstalkd: | ||
build: | ||
context: ./ | ||
dockerfile: Dockerfile.beanstalkd | ||
|
||
chrome: | ||
image: selenium/standalone-chrome:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# This file is never read -- it's just a copy of the pipeline's | ||
# configuration in the Buildkite UI. | ||
|
||
steps: | ||
- name: ":pipeline:" | ||
command: | | ||
PATH=/bin:/usr/bin | ||
treesha="$$(git ls-tree -d HEAD .buildkite | awk '{print $$3}')" | ||
if [ -z "$${treesha}" ]; then | ||
echo "+++ No .buildkite/; using fallback repository" | ||
rm -rf .buildkite | ||
git clone "https://github.com/rails/buildkite-config" .buildkite | ||
sh -c "$$PIPELINE_COMMAND" | ||
elif [ "$${#treesha}" -lt 40 ]; then | ||
echo "Short SHA for .buildkite/" | ||
exit 1 | ||
elif curl -s -S "https://gist.githubusercontent.com/matthewd/3f98bcc9957c8ddf2204a390bf3a6cdd/raw/list" | grep -a -F -x "$${treesha}"; then | ||
echo "+++ Known tree; generating pipeline" | ||
echo ".buildkite/ tree is $${treesha}" | ||
sh -c "$$PIPELINE_COMMAND" | ||
else | ||
echo "+++ Unknown tree; requesting approval" | ||
echo ".buildkite/ tree is $${treesha}" | ||
buildkite-agent pipeline upload <<'NESTED' | ||
steps: | ||
- block: "Review Build Script" | ||
prompt: | | ||
This commit uses new build configuration. Please review the changes in .buildkite/ carefully before unblocking. | ||
- name: ":pipeline:" | ||
command: >- | ||
$$PIPELINE_COMMAND | ||
timeout_in_minutes: 5 | ||
NESTED | ||
fi | ||
env: | ||
PIPELINE_COMMAND: >- | ||
docker run --rm | ||
-v "$$PWD":/app:ro -w /app | ||
-e CI | ||
-e BUILDKITE_BRANCH | ||
-e BUILDKITE_BUILD_ID | ||
-e BUILDKITE_PULL_REQUEST | ||
-e BUILDKITE_PULL_REQUEST_BASE_BRANCH | ||
-e BUILDKITE_REBUILT_FROM_BUILD_ID | ||
ruby:latest | ||
.buildkite/pipeline-generate | | ||
buildkite-agent pipeline upload | ||
timeout_in_minutes: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
create user rails@'%'; | ||
grant all privileges on activerecord_unittest.* to rails@'%'; | ||
grant all privileges on activerecord_unittest2.* to rails@'%'; | ||
grant all privileges on inexistent_activerecord_unittest.* to rails@'%'; | ||
create database activerecord_unittest default character set utf8mb4; | ||
create database activerecord_unittest2 default character set utf8mb4; |
Oops, something went wrong.