Skip to content

Commit 29e3946

Browse files
author
Jef Spaleta
authored
Merge pull request #113 from sensu-plugins/bonsai
add bonsai.yml and travis deploy steps
2 parents b7647ed + 3bff214 commit 29e3946

File tree

9 files changed

+165
-1
lines changed

9 files changed

+165
-1
lines changed

.bonsai.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
description: "#{repo}"
3+
builds:
4+
- platform: "debian"
5+
arch: "amd64"
6+
asset_filename: "#{repo}_#{version}_debian_linux_amd64.tar.gz"
7+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
8+
filter:
9+
- "entity.system.os == 'linux'"
10+
- "entity.system.arch == 'amd64'"
11+
- "entity.system.platform_family == 'debian'"
12+
- platform: "centos"
13+
arch: "amd64"
14+
asset_filename: "#{repo}_#{version}_centos_linux_amd64.tar.gz"
15+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
16+
filter:
17+
- "entity.system.os == 'linux'"
18+
- "entity.system.arch == 'amd64'"
19+
- "entity.system.platform_family == 'rhel'"
20+
- platform: "centos6"
21+
arch: "amd64"
22+
asset_filename: "#{repo}_#{version}_centos6_linux_amd64.tar.gz"
23+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
24+
filter:
25+
- "entity.system.os == 'linux'"
26+
- "entity.system.arch == 'amd64'"
27+
- "entity.system.platform_family == 'rhel'"
28+
- "parseInt(entity.system.platform_version.split('.')[0]) > 6"
29+
- platform: "centos7"
30+
arch: "amd64"
31+
asset_filename: "#{repo}_#{version}_centos7_linux_amd64.tar.gz"
32+
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
33+
filter:
34+
- "entity.system.os == 'linux'"
35+
- "entity.system.arch == 'amd64'"
36+
- "entity.system.platform_family == 'rhel'"
37+
- "parseInt(entity.system.platform_version.split('.')[0]) > 7"

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ script:
2424
- bundle exec rake kitchen:ruby-`echo $TRAVIS_RUBY_VERSION | sed -e "s/\.//g"`-debian-8
2525
- gem build sensu-plugins-postgres.gemspec
2626
- gem install sensu-plugins-postgres-*.gem
27+
before_deploy:
28+
- bash -c "[ ! -d bonsai/ ] && git clone https://github.com/sensu/sensu-go-bonsai-asset.git bonsai || echo 'bonsai/ exists, skipping git clone' ; cp asset_build_scripts/Dockerfile.* bonsai/ruby-runtime/"
2729
deploy:
28-
provider: rubygems
30+
- provider: rubygems
2931
api_key:
3032
secure: L3ot3q90Sz+1dhi1Lxg4rvxZ0AEUCq2dL55Gzau48wou72T3GYSDBoqVGnZPmQcS9miNy4J7NZMxUgfoycnceqUkkue8+ss4c42NtrYs+SLU+rnmB/cwLTBQJ1ERRNXqgOYTwWt8EuIy6Dong1oCu8voFSj7NH4sXxTTO7RFho8=
3133
gem: sensu-plugins-postgres
@@ -34,3 +36,10 @@ deploy:
3436
all_branches: true
3537
rvm: 2.4.1
3638
repo: sensu-plugins/sensu-plugins-postgres
39+
- provider: script
40+
script: bonsai/ruby-runtime/travis-build-ruby-plugin-assets.sh sensu-plugins-postgres
41+
skip_cleanup: true
42+
on:
43+
tags: true
44+
all_branches: true
45+
rvm: 2.4.1

asset_build_scripts/Dockerfile.alpine

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM sensu/sensu-ruby-runtime-2.4.4-alpine:latest as builder
2+
ARG ASSET_GEM
3+
ARG GIT_REF
4+
ARG GIT_REPO
5+
WORKDIR /assets/build/
6+
RUN apk add git
7+
RUN apk add postgresql-client postgresql-dev
8+
RUN \
9+
gem install --no-ri --no-doc bundler && \
10+
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
11+
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
12+
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
13+
14+
FROM scratch
15+
ARG ASSET_GEM
16+
COPY --from=builder /assets/${ASSET_GEM}.tar.gz /
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM sensu/sensu-ruby-runtime-2.4.4-alpine3.8:latest as builder
2+
ARG ASSET_GEM
3+
ARG GIT_REF
4+
ARG GIT_REPO
5+
WORKDIR /assets/build/
6+
RUN apk add git
7+
RUN apk add postgresql-client postgresql-dev
8+
RUN \
9+
gem install --no-ri --no-doc bundler && \
10+
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
11+
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
12+
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
13+
14+
FROM scratch
15+
ARG ASSET_GEM
16+
COPY --from=builder /assets/${ASSET_GEM}.tar.gz /

asset_build_scripts/Dockerfile.centos

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM sensu/sensu-ruby-runtime-2.4.4-centos:latest as builder
2+
ARG ASSET_GEM
3+
ARG GIT_REF
4+
ARG GIT_REPO
5+
WORKDIR /assets/build/
6+
RUN yum install -y git
7+
RUN yum install -y http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-3.noarch.rpm
8+
RUN yum install -y postgresql95 postgresql95-libs postgresql95-devel
9+
ENV CONFIGURE_ARGS="with-pg-config=/usr/pgsql-9.5/bin/pg_config"
10+
RUN \
11+
gem install --no-ri --no-doc bundler && \
12+
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
13+
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
14+
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
15+
16+
FROM scratch
17+
ARG ASSET_GEM
18+
COPY --from=builder /assets/${ASSET_GEM}.tar.gz /
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM sensu/sensu-ruby-runtime-2.4.4-centos6:latest as builder
2+
ARG ASSET_GEM
3+
ARG GIT_REF
4+
ARG GIT_REPO
5+
WORKDIR /assets/build/
6+
RUN yum install -y git
7+
RUN yum install -y http://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/pgdg-redhat95-9.5-3.noarch.rpm
8+
RUN yum install -y postgresql95 postgresql95-libs postgresql95-devel
9+
ENV CONFIGURE_ARGS="with-pg-config=/usr/pgsql-9.5/bin/pg_config"
10+
RUN \
11+
gem install --no-ri --no-doc bundler && \
12+
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
13+
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
14+
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
15+
16+
FROM scratch
17+
ARG ASSET_GEM
18+
COPY --from=builder /assets/${ASSET_GEM}.tar.gz /
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM sensu/sensu-ruby-runtime-2.4.4-centos7:latest as builder
2+
ARG ASSET_GEM
3+
ARG GIT_REF
4+
ARG GIT_REPO
5+
WORKDIR /assets/build/
6+
RUN yum install -y git
7+
RUN yum install -y http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-3.noarch.rpm
8+
RUN yum install -y postgresql95 postgresql95-libs postgresql95-devel
9+
ENV CONFIGURE_ARGS="with-pg-config=/usr/pgsql-9.5/bin/pg_config"
10+
RUN \
11+
gem install --no-ri --no-doc bundler && \
12+
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
13+
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
14+
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
15+
16+
FROM scratch
17+
ARG ASSET_GEM
18+
COPY --from=builder /assets/${ASSET_GEM}.tar.gz /

asset_build_scripts/Dockerfile.debian

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM sensu/sensu-ruby-runtime-2.4.4-debian:latest as builder
2+
ARG ASSET_GEM
3+
ARG GIT_REF
4+
ARG GIT_REPO
5+
WORKDIR /assets/build/
6+
RUN apt-get update && apt-get install -y git
7+
RUN apt-get install -y libpq-dev
8+
RUN \
9+
gem install --no-ri --no-doc bundler && \
10+
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
11+
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
12+
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
13+
14+
FROM scratch
15+
ARG ASSET_GEM
16+
COPY --from=builder /assets/${ASSET_GEM}.tar.gz /
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM sensu/sensu-ruby-runtime-2.4.4-debian9:latest as builder
2+
ARG ASSET_GEM
3+
ARG GIT_REF
4+
ARG GIT_REPO
5+
WORKDIR /assets/build/
6+
RUN apt-get update && apt-get install -y git
7+
RUN apt-get install -y libpq-dev
8+
RUN \
9+
gem install --no-ri --no-doc bundler && \
10+
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
11+
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
12+
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
13+
14+
FROM scratch
15+
ARG ASSET_GEM
16+
COPY --from=builder /assets/${ASSET_GEM}.tar.gz /

0 commit comments

Comments
 (0)