Skip to content

Commit

Permalink
Merge pull request #1 from rmohr/travis
Browse files Browse the repository at this point in the history
add travis tests
  • Loading branch information
rmohr authored Nov 15, 2018
2 parents db5229d + 90b47ab commit 3aa3469
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 11 deletions.
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
dist: trusty
sudo: required

os:
- linux

language: go
go: 1.10.x
install: true

services:
- docker

addons:
apt:
sources:
- sourceline: 'deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8'
key_url: 'https://bazel.build/bazel-release.pub.gpg'
packages:
- bazel
- rpm2cpio
- rpm

install:
- go get -u github.com/bazelbuild/buildifier/buildifier

script:
# Check for issues with the format of our bazel config files.
- buildifier -mode=check $(find . -name BUILD -type f)
- buildifier -mode=check $(find . -name WORKSPACE -type f)
- buildifier -mode=check $(find . -name '*.bzl' -type f)

- bazel test //test:*
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# rules_container_rpm

[![Build Status](https://travis-ci.org/rmohr/rules_container_rpm.svg?branch=master)](https://travis-ci.org/rmohr/rules_container_rpm)

Bazel rules to install and manage rpms inside of containers.

These rules can be used to install RPM packages into a cointainer and update its included RPM database without the need to run the container.
Expand Down
12 changes: 6 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ load(
container_repositories()

http_file(
name = "glibc",
url = "https://dl.fedoraproject.org/pub/fedora/linux/releases/28/Everything/x86_64/os/Packages/g/glibc-2.27-8.fc28.x86_64.rpm",
sha256 = "573ceb6ad74b919b06bddd7684a29ef75bc9f3741e067fac1414e05c0087d0b6"
name = "glibc",
sha256 = "573ceb6ad74b919b06bddd7684a29ef75bc9f3741e067fac1414e05c0087d0b6",
url = "https://dl.fedoraproject.org/pub/fedora/linux/releases/28/Everything/x86_64/os/Packages/g/glibc-2.27-8.fc28.x86_64.rpm",
)

http_file(
name = "ca_certificates",
url = "https://dl.fedoraproject.org/pub/fedora/linux/releases/28/Everything/x86_64/os/Packages/c/ca-certificates-2018.2.22-3.fc28.noarch.rpm",
sha256 = "dfc3d2bf605fbea7db7f018af53fe0563628f788a40cb1e7f84434606b7b6a12"
name = "ca_certificates",
sha256 = "dfc3d2bf605fbea7db7f018af53fe0563628f788a40cb1e7f84434606b7b6a12",
url = "https://dl.fedoraproject.org/pub/fedora/linux/releases/28/Everything/x86_64/os/Packages/c/ca-certificates-2018.2.22-3.fc28.noarch.rpm",
)
2 changes: 1 addition & 1 deletion rpm/install_rpms.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def main():
# Extract the rpms into the shared folder
for rpm in args.rpm:
p1 = subprocess.Popen(["rpm2cpio", rpm], stdout=subprocess.PIPE)
p2 = subprocess.Popen(["cpio", "-i", "-d", "-m", "-v", "-D", dirpath], stdin=p1.stdout, stdout=subprocess.PIPE)
p2 = subprocess.Popen(["cpio", "-i", "-d", "-m", "-v"], stdin=p1.stdout, stdout=subprocess.PIPE, cwd=dirpath)
p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits.
p2.communicate()

Expand Down
12 changes: 8 additions & 4 deletions testdata/BUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package(default_visibility = ["//visibility:public"])

load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")

load(
"@io_bazel_rules_docker//container:container.bzl",
"container_image",
)

load(
"//rpm:rpm.bzl",
"rpm_image",
Expand All @@ -21,12 +19,18 @@ container_image(
rpm_image(
name = "allinone",
base = ":files_base",
rpms = ["@glibc//file", "@ca_certificates//file"],
rpms = [
"@glibc//file",
"@ca_certificates//file",
],
)

rpm_image(
name = "allinone_no_base",
rpms = ["@glibc//file", "@ca_certificates//file"],
rpms = [
"@glibc//file",
"@ca_certificates//file",
],
)

rpm_image(
Expand Down

0 comments on commit 3aa3469

Please sign in to comment.