Skip to content

Commit

Permalink
Merge pull request #1056 from Iristyle/enable-buildkit
Browse files Browse the repository at this point in the history
  • Loading branch information
Iristyle authored Apr 29, 2020
2 parents 9ef35e4 + 0ced697 commit b2bce62
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
language: ruby
services:
- docker
bundler_args: "--without system"
script: "bundle exec rspec --color --format documentation spec/unit"
notifications:
Expand All @@ -25,10 +23,20 @@ matrix:
- stage: r10k tests
rvm: jruby
- stage: r10k container tests
dist: bionic
language: ruby
rvm: 2.5.5
services:
# bionic uses 18.06 but need 19.03+ for buildkit so upgrade later in relevant cell
- docker
rvm: 2.6.5
env:
# necessary to prevent overwhelming TravisCI build output limits
- DOCKER_BUILD_FLAGS="--progress plain"
script:
- |
set -ex
sudo apt update -y && sudo apt install -y docker.io
sudo systemctl unmask docker.service
sudo systemctl start docker
cd docker && make lint build test
set +x
3 changes: 2 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ variables:
NAMESPACE: puppet
CONTAINER_NAME: r10k
CONTAINER_BUILD_PATH: .
LINT_IGNORES: DL3008 DL3018 DL4000 DL4001 DL3028
LINT_IGNORES:
DOCKER_BUILDKIT: 1

workspace:
clean: resources
Expand Down
4 changes: 3 additions & 1 deletion docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ git_describe = $(shell git describe)
vcs_ref := $(shell git rev-parse HEAD)
build_date := $(shell date -u +%FT%T)
hadolint_available := $(shell hadolint --help > /dev/null 2>&1; echo $$?)
hadolint_command := hadolint --ignore DL3008 --ignore DL3018 --ignore DL3028 --ignore DL4000 --ignore DL4001
hadolint_command := hadolint
hadolint_container := hadolint/hadolint:latest
export BUNDLE_PATH = $(PWD)/.bundle/gems
export BUNDLE_BIN = $(PWD)/.bundle/bin
export GEMFILE = $(PWD)/Gemfile
export DOCKER_BUILDKIT = 1

ifeq ($(IS_RELEASE),true)
VERSION ?= $(shell echo $(git_describe) | sed 's/-.*//')
Expand Down Expand Up @@ -36,6 +37,7 @@ endif

build: prep
docker build \
${DOCKER_BUILD_FLAGS} \
--pull \
--build-arg vcs_ref=$(vcs_ref) \
--build-arg build_date=$(build_date) \
Expand Down
7 changes: 5 additions & 2 deletions docker/r10k/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM alpine:3.9 as build

# hadolint ignore=DL3018
RUN apk add --no-cache ruby git && \
mkdir /workspace
WORKDIR /workspace
Expand Down Expand Up @@ -39,13 +40,15 @@ LABEL org.label-schema.version="$version" \
org.label-schema.build-date="$build_date"

COPY --from=build /workspace/r10k.gem /
# ignore apk and gem pinning
# hadolint ignore=DL3018,DL3028
RUN chmod a+x /adduser.sh && \
# Add a puppet user to run r10k as for consistency with puppetserver
/adduser.sh && \
chmod +x /docker-entrypoint.sh && \
chown -R puppet: /docker-entrypoint.d /docker-entrypoint.sh && \
apk add --no-cache ruby openssh-client git ruby-rugged curl ruby-dev make gcc musl-dev && \
gem install --no-doc /r10k.gem json etc && \
apk add --no-cache ruby openssh-client git ruby-rugged curl ruby-json ruby-etc && \
gem install --no-doc /r10k.gem && \
rm -f /r10k.gem

USER puppet
Expand Down

0 comments on commit b2bce62

Please sign in to comment.