Skip to content

Commit

Permalink
Ensure that additional tars are passed through in a correct fashion
Browse files Browse the repository at this point in the history
  • Loading branch information
rmohr committed Nov 15, 2018
1 parent 32befa1 commit 2f876f4
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rpm/rpm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _rpms_impl(ctx, rpms = None):
)
tars = [finaltar]
if ctx.attr.tars:
tars = tars + ctx.attr.tars
tars = tars + ctx.files.tars
return _container.image.implementation(ctx, tars = tars)

_rpms_layer = rule(
Expand Down
6 changes: 6 additions & 0 deletions test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ container_test(
configs = ["configs/allinone.yaml"],
image = "//testdata:allinone_no_base",
)

container_test(
name = "image_with_extra_tar_test",
configs = ["configs/image_with_extra_tar.yaml"],
image = "//testdata:image_with_extra_tar",
)
5 changes: 4 additions & 1 deletion test/configs/allinone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ fileExistenceTests:
- name: 'readme from ca-certificates'
path: '/usr/share/pki/ca-trust-source/README'
shouldExist: true
permissions: '-rw-r--r--'
permissions: '-rw-r--r--'
- name: '/etc/test/foo should be there'
path: '/etc/test/foo'
shouldExist: false
21 changes: 21 additions & 0 deletions test/configs/image_with_extra_tar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
schemaVersion: '2.0.0'
fileExistenceTests:
- name: 'ldconfig binary from glibc'
path: '/sbin/ldconfig'
shouldExist: true
permissions: '-rwxr-xr-x'
- name: 'rpm database file'
path: '/var/lib/rpm/Packages'
shouldExist: true
permissions: '-rw-r--r--'
- name: 'readme from ca-certificates should not be there'
path: '/usr/share/pki/ca-trust-source/README'
shouldExist: false
- name: '/foo should be there'
path: '/foo'
shouldExist: true
permissions: '-rw-r--r--'
- name: '/etc/test/foo should be there'
path: '/etc/test/foo'
shouldExist: true
permissions: '-rw-r--r--'
16 changes: 16 additions & 0 deletions testdata/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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",
Expand Down Expand Up @@ -38,3 +40,17 @@ rpm_image(
base = ":files_base",
rpms = ["@glibc//file"],
)

rpm_image(
name = "image_with_extra_tar",
base = ":files_base",
rpms = ["@glibc//file"],
tars = [":foo_tar"],
)

pkg_tar(
name = "foo_tar",
srcs = ["foo"],
mode = "0o644",
package_dir = "/etc/test",
)

0 comments on commit 2f876f4

Please sign in to comment.