Skip to content

Commit

Permalink
added integration tests for non hauler tarballs (#325)
Browse files Browse the repository at this point in the history
* added tests for tarballs
* updated tests for tarball changes
* fixed tests/build for latest changes
  • Loading branch information
zackbradys authored Sep 27, 2024
1 parent 41d8895 commit 8a53a26
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
8 changes: 0 additions & 8 deletions .dockerignore

This file was deleted.

24 changes: 21 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ jobs:
- name: Verify - hauler store extract
run: |
hauler store extract --help
# verify via hauler store content
# verify via extracting hauler store content
hauler store extract hauler/hauler-manifest-local.yaml:latest
# view extracted content from store
cat hauler-manifest-local.yaml
- name: Verify - hauler store info
run: |
Expand All @@ -209,6 +211,8 @@ jobs:
hauler store save
# verify via save with filename
hauler store save --filename store.tar.zst
# verify via save with filename and platform (amd64)
hauler store save --filename store-amd64.tar.zst --platform linux/amd64
- name: Remove Hauler Store Contents
run: |
Expand All @@ -220,8 +224,10 @@ jobs:
hauler store load --help
# verify via load
hauler store load haul.tar.zst
# verify via load with different temp directory
# verify via load with filename and temp directory
hauler store load store.tar.zst --tempdir /opt
# verify via load with filename and platform (amd64)
hauler store load store-amd64.tar.zst
- name: Verify Hauler Store Contents
run: |
Expand All @@ -230,9 +236,21 @@ jobs:
# verify store directory structure
tree -hC store
- name: Verify - docker load
run: |
docker load --help
# verify via load
docker load --input store-amd64.tar.zst
- name: Verify Docker Images Contents
run: |
docker images --help
# verify images
docker images --all
- name: Remove Hauler Store Contents
run: |
rm -rf store haul.tar.zst store.tar.zst
rm -rf store haul.tar.zst store.tar.zst store-amd64.tar.zst
hauler store info
- name: Verify - hauler store sync
Expand Down
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ FROM registry.suse.com/bci/golang:1.23 AS builder

RUN zypper --non-interactive install make bash wget ca-certificates

RUN go install github.com/goreleaser/goreleaser/v2@latest

COPY . /build
WORKDIR /build
RUN make build
Expand All @@ -17,6 +19,8 @@ RUN echo "hauler:x:1001:1001::/home/hauler:" > /etc/passwd \
# release stage
FROM scratch AS release

ARG TARGETARCH

COPY --from=builder /var/lib/ca-certificates/ca-bundle.pem /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
Expand All @@ -25,19 +29,21 @@ COPY --from=builder --chown=hauler:hauler /tmp/. /tmp
COPY --from=builder --chown=hauler:hauler /store/. /store
COPY --from=builder --chown=hauler:hauler /registry/. /registry
COPY --from=builder --chown=hauler:hauler /fileserver/. /fileserver
COPY --from=builder --chown=hauler:hauler /build/bin/hauler /
COPY --from=builder --chown=hauler:hauler /build/dist/hauler_linux_${TARGETARCH}/hauler /

USER hauler
ENTRYPOINT [ "/hauler" ]

# debug stage
FROM alpine AS debug

ARG TARGETARCH

COPY --from=builder /var/lib/ca-certificates/ca-bundle.pem /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder --chown=hauler:hauler /home/hauler/. /home/hauler
COPY --from=builder --chown=hauler:hauler /build/bin/hauler /bin/hauler
COPY --from=builder --chown=hauler:hauler /build/dist/hauler_linux_${TARGETARCH}/hauler /

RUN apk --no-cache add curl

Expand Down
Binary file modified testdata/haul.tar.zst
Binary file not shown.

0 comments on commit 8a53a26

Please sign in to comment.