Skip to content

Commit

Permalink
Official support for Ruby 2.5 and 2.6 (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc authored Sep 4, 2019
1 parent 67ea666 commit cf2846e
Show file tree
Hide file tree
Showing 7 changed files with 658 additions and 8 deletions.
159 changes: 153 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ ruby_containers: &ruby_containers
image: palazzem/docker-library:ddtrace_rb_2_4_6
environment:
- BUNDLE_GEMFILE=/app/Gemfile
- &container-2_5
image: marcotc/docker-library:ddtrace_rb_2_5_6
environment:
- BUNDLE_GEMFILE=/app/Gemfile
- &container-2_6
image: marcotc/docker-library:ddtrace_rb_2_6_4
environment:
- BUNDLE_GEMFILE=/app/Gemfile

test_containers: &test_containers
- &container_postgres
Expand Down Expand Up @@ -399,10 +407,125 @@ jobs:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-2.4-{{ checksum ".circleci/bundle_checksum" }}'
- *step_run_all_tests

checkout-2.5:
<<: *job_defaults
docker:
- *container-2_5
steps:
- checkout
- save_cache:
key: '{{ .Environment.CIRCLE_CACHE_VERSION }}-repo-2.5-{{ .Environment.CIRCLE_SHA1 }}'
paths:
- /app
build-2.5:
<<: *job_defaults
docker:
- *container-2_5
steps:
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-2.5-{{ .Environment.CIRCLE_SHA1 }}'
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-repo-2.5-{{ .Environment.CIRCLE_SHA1 }}'
- *step_init_bundle_checksum
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-2.5-{{ checksum ".circleci/bundle_checksum" }}'
- *step_bundle_install
- *step_rubocop
- *step_appraisal_install
- *step_compute_bundle_checksum
- save_cache:
key: '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-2.5-{{ .Environment.CIRCLE_SHA1 }}'
paths:
- /app
- save_cache:
key: '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-2.5-{{ checksum ".circleci/bundle_checksum" }}'
paths:
- /usr/local/bundle
test-2.5:
<<: *job_defaults
docker:
- <<: *container-2_5
environment:
- TEST_DATADOG_INTEGRATION: 1
- *container_postgres
- *container_mysql
- *container_elasticsearch
- *container_redis
- *container_mongo
- *container_memcached
- *container_agent
steps:
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-2.5-{{ .Environment.CIRCLE_SHA1 }}'
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-2.5-{{ checksum ".circleci/bundle_checksum" }}'
- *step_run_all_tests

checkout-2.6:
<<: *job_defaults
docker:
- *container-2_6
steps:
- checkout
- save_cache:
key: '{{ .Environment.CIRCLE_CACHE_VERSION }}-repo-2.6-{{ .Environment.CIRCLE_SHA1 }}'
paths:
- /app
build-2.6:
<<: *job_defaults
docker:
- *container-2_6
steps:
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-2.6-{{ .Environment.CIRCLE_SHA1 }}'
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-repo-2.6-{{ .Environment.CIRCLE_SHA1 }}'
- *step_init_bundle_checksum
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-2.6-{{ checksum ".circleci/bundle_checksum" }}'
- *step_bundle_install
- *step_rubocop
- *step_appraisal_install
- *step_compute_bundle_checksum
- save_cache:
key: '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-2.6-{{ .Environment.CIRCLE_SHA1 }}'
paths:
- /app
- save_cache:
key: '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-2.6-{{ checksum ".circleci/bundle_checksum" }}'
paths:
- /usr/local/bundle
test-2.6:
<<: *job_defaults
docker:
- <<: *container-2_6
environment:
- TEST_DATADOG_INTEGRATION: 1
- *container_postgres
- *container_mysql
- *container_elasticsearch
- *container_redis
- *container_mongo
- *container_memcached
- *container_agent
steps:
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-2.6-{{ .Environment.CIRCLE_SHA1 }}'
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-2.6-{{ checksum ".circleci/bundle_checksum" }}'
- *step_run_all_tests

"deploy release":
<<: *job_defaults
docker:
- *container-2_4
- *container-2_5
steps:
- checkout
- run:
Expand All @@ -420,7 +543,7 @@ jobs:
"deploy prerelease Gem":
<<: *job_defaults
docker:
- *container-2_4
- *container-2_5
steps:
- checkout
- run:
Expand All @@ -431,10 +554,10 @@ jobs:
- run:
name: Rename to pre-release version based on branch name and build number
command: |
# create safe version string
PRE=$(echo "${CIRCLE_BRANCH:-unknown}.${CIRCLE_BUILD_NUM:-R$RANDOM}" | sed -e 's/[^a-zA-Z0-9+]\{1,\}/./g')
echo PRE=$PRE
sed lib/ddtrace/version.rb -i -e "s/^\([\t ]*PRE\) *=*/\1 = \'${PRE}\' #/g"
# create safe version string
PRE=$(echo "${CIRCLE_BRANCH:-unknown}.${CIRCLE_BUILD_NUM:-R$RANDOM}" | sed -e 's/[^a-zA-Z0-9+]\{1,\}/./g')
echo PRE=$PRE
sed lib/ddtrace/version.rb -i -e "s/^\([\t ]*PRE\) *=*/\1 = \'${PRE}\' #/g"
- run:
name: Upload prereleas Gem and rebuild index
command: S3_DIR=prerelease bundle exec rake release:gem
Expand Down Expand Up @@ -500,6 +623,26 @@ workflows:
<<: *filters_all_branches_and_tags
requires:
- build-2.4
- checkout-2.5:
<<: *filters_all_branches_and_tags
- build-2.5:
<<: *filters_all_branches_and_tags
requires:
- checkout-2.5
- test-2.5:
<<: *filters_all_branches_and_tags
requires:
- build-2.5
- checkout-2.6:
<<: *filters_all_branches_and_tags
- build-2.6:
<<: *filters_all_branches_and_tags
requires:
- checkout-2.6
- test-2.6:
<<: *filters_all_branches_and_tags
requires:
- build-2.6
- "deploy prerelease Gem":
<<: *filters_all_branches_and_tags
requires:
Expand All @@ -508,6 +651,8 @@ workflows:
- test-2.2
- test-2.3
- test-2.4
- test-2.5
- test-2.6
- "deploy release":
<<: *filters_only_release_tags
requires:
Expand All @@ -516,3 +661,5 @@ workflows:
- test-2.2
- test-2.3
- test-2.4
- test-2.5
- test-2.6
73 changes: 73 additions & 0 deletions .circleci/images/primary/Dockerfile-2.5.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Current version: https://github.com/docker-library/ruby/blob/6a7df7a72b4a3d1b3e06ead303841b3fdaca560e/2.5/buster/Dockerfile
FROM ruby:2.5.6

# Make apt non-interactive
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
&& echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci

ENV DEBIAN_FRONTEND=noninteractive

# Install required packages
RUN set -ex; \
apt-get update; \
mkdir -p /usr/share/man/man1; \
apt-get install -y --no-install-recommends \
git mercurial xvfb \
locales sudo openssh-client ca-certificates tar gzip parallel \
net-tools netcat unzip zip bzip2 gnupg curl wget \
tzdata rsync vim; \
rm -rf /var/lib/apt/lists/*;

# Set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime

# Set language
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en

# Install jq
RUN JQ_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/jq-latest" \
&& curl --silent --show-error --location --fail --retry 3 --output /usr/bin/jq $JQ_URL \
&& chmod +x /usr/bin/jq \
&& jq --version

# Install Docker
RUN set -ex \
&& export DOCKER_VERSION=$(curl --silent --fail --retry 3 https://download.docker.com/linux/static/stable/x86_64/ | grep -o -e 'docker-[.0-9]*-ce\.tgz' | sort -r | head -n 1) \
&& DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/${DOCKER_VERSION}" \
&& echo Docker URL: $DOCKER_URL \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/docker.tgz "${DOCKER_URL}" \
&& ls -lha /tmp/docker.tgz \
&& tar -xz -C /tmp -f /tmp/docker.tgz \
&& mv /tmp/docker/* /usr/bin \
&& rm -rf /tmp/docker /tmp/docker.tgz \
&& which docker \
&& (docker version || true)

# Install Docker Compose
RUN COMPOSE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/docker-compose-latest" \
&& curl --silent --show-error --location --fail --retry 3 --output /usr/bin/docker-compose $COMPOSE_URL \
&& chmod +x /usr/bin/docker-compose \
&& docker-compose version

# Install Dockerize
RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/dockerize-latest.tar.gz" \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/dockerize-linux-amd64.tar.gz $DOCKERIZE_URL \
&& tar -C /usr/local/bin -xzvf /tmp/dockerize-linux-amd64.tar.gz \
&& rm -rf /tmp/dockerize-linux-amd64.tar.gz \
&& dockerize --version

# Install RubyGems
RUN gem update --system
RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"

# Install RubyGems
RUN gem update --system
RUN gem install bundler
ENV BUNDLE_SILENCE_ROOT_WARNING 1

RUN mkdir /app
WORKDIR /app

CMD ["/bin/sh"]
73 changes: 73 additions & 0 deletions .circleci/images/primary/Dockerfile-2.6.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Current version: https://github.com/docker-library/ruby/blob/6a7df7a72b4a3d1b3e06ead303841b3fdaca560e/2.6/buster/Dockerfile
FROM ruby:2.6.4

# Make apt non-interactive
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
&& echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci

ENV DEBIAN_FRONTEND=noninteractive

# Install required packages
RUN set -ex; \
apt-get update; \
mkdir -p /usr/share/man/man1; \
apt-get install -y --no-install-recommends \
git mercurial xvfb \
locales sudo openssh-client ca-certificates tar gzip parallel \
net-tools netcat unzip zip bzip2 gnupg curl wget \
tzdata rsync vim; \
rm -rf /var/lib/apt/lists/*;

# Set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime

# Set language
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en

# Install jq
RUN JQ_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/jq-latest" \
&& curl --silent --show-error --location --fail --retry 3 --output /usr/bin/jq $JQ_URL \
&& chmod +x /usr/bin/jq \
&& jq --version

# Install Docker
RUN set -ex \
&& export DOCKER_VERSION=$(curl --silent --fail --retry 3 https://download.docker.com/linux/static/stable/x86_64/ | grep -o -e 'docker-[.0-9]*-ce\.tgz' | sort -r | head -n 1) \
&& DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/${DOCKER_VERSION}" \
&& echo Docker URL: $DOCKER_URL \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/docker.tgz "${DOCKER_URL}" \
&& ls -lha /tmp/docker.tgz \
&& tar -xz -C /tmp -f /tmp/docker.tgz \
&& mv /tmp/docker/* /usr/bin \
&& rm -rf /tmp/docker /tmp/docker.tgz \
&& which docker \
&& (docker version || true)

# Install Docker Compose
RUN COMPOSE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/docker-compose-latest" \
&& curl --silent --show-error --location --fail --retry 3 --output /usr/bin/docker-compose $COMPOSE_URL \
&& chmod +x /usr/bin/docker-compose \
&& docker-compose version

# Install Dockerize
RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/dockerize-latest.tar.gz" \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/dockerize-linux-amd64.tar.gz $DOCKERIZE_URL \
&& tar -C /usr/local/bin -xzvf /tmp/dockerize-linux-amd64.tar.gz \
&& rm -rf /tmp/dockerize-linux-amd64.tar.gz \
&& dockerize --version

# Install RubyGems
RUN gem update --system
RUN mkdir -p "$GEM_HOME" && chmod -R 777 "$GEM_HOME"

# Install RubyGems
RUN gem update --system
RUN gem install bundler
ENV BUNDLE_SILENCE_ROOT_WARNING 1

RUN mkdir /app
WORKDIR /app

CMD ["/bin/sh"]
Loading

0 comments on commit cf2846e

Please sign in to comment.