Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: apk support #207

Merged
merged 72 commits into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
eb63ae4
first attempt at apk, built from Issue #39
bhamail Mar 27, 2020
b479842
inspector cleanups
bhamail Mar 27, 2020
15274ea
read the contrib note, ran linter, fixes made. Noice!
bhamail Mar 27, 2020
d6cd823
linter went wonky
bhamail Mar 27, 2020
2b1eaf8
linter went wonky
bhamail Mar 27, 2020
1ce7cbf
fix some lint issues
bhamail Mar 27, 2020
6d73b5f
fix some lint issues
bhamail Mar 27, 2020
7525df7
lightweight file validation, while I try to refactor method into smal…
bhamail Apr 1, 2020
1fc689d
refactorings to get `make ci` to pass. ain't pretty, but hopefully do…
bhamail Apr 1, 2020
ce3bcbe
add ignore file to get workdir created in CI
bhamail Apr 1, 2020
2e45354
try to get a successful test run on CI (file sizes differ on CI).
bhamail Apr 1, 2020
6d496bc
must remember to run liner (make ci) before pushing
bhamail Apr 1, 2020
8158ecf
Doh! Detect CI via correct env var name
bhamail Apr 1, 2020
d0109c0
tweak CI expected file sizes
bhamail Apr 1, 2020
74f95d2
blech. try to get a range of values for CI
bhamail Apr 1, 2020
8925fa4
better message if value fails conditions
bhamail Apr 1, 2020
10aa704
better message if value fails conditions
bhamail Apr 1, 2020
0f04fe2
initial impl of Package interface - just hoping I don't already have …
bhamail Apr 3, 2020
c25f529
missed non-altered arch case
bhamail Apr 3, 2020
8a5192f
ci failures
bhamail Apr 3, 2020
5e1c383
refactor io.File to Writer
bhamail Apr 6, 2020
3373cc3
add note about command to test apk install in docker
bhamail Apr 6, 2020
d4ad43a
remove absolute paths from test (prep for replacement with info.Files).
bhamail Apr 6, 2020
6738d52
rename test files folder
bhamail Apr 6, 2020
d209a26
get ci file size ranges happy after path changes
bhamail Apr 6, 2020
b4daea6
get ci file size ranges happy after path changes
bhamail Apr 6, 2020
b190238
move COPY towards end, allowing more caching of layers - feedback fro…
bhamail Apr 7, 2020
b63d79d
remove Gz from function name
bhamail Apr 7, 2020
9d5bbd8
rename combine function
bhamail Apr 7, 2020
0645f99
add skipVerify flag to preserve generated .apk file for use in docker…
bhamail Apr 7, 2020
e4bd5ce
make ci is my friend
bhamail Apr 7, 2020
0206c26
remove useless comment
bhamail Apr 7, 2020
b4a35d9
start conversion to nfpm.Info
bhamail Apr 7, 2020
ccceb07
use base64 encoded string for private signing key
bhamail Apr 8, 2020
d81bbfa
remove old runit() method, as we can now test using Default.Package.
bhamail Apr 8, 2020
df4ccc6
duck and cover: register the apk packager
bhamail Apr 8, 2020
578572a
use the metadata from nfpm (does not handle scripts/pre/post, etc)
bhamail Apr 8, 2020
78d38d0
getting closer to removing size assertions, but not just yet
bhamail Apr 8, 2020
dde248e
getting closer to removing size assertions, but not just yet
bhamail Apr 8, 2020
2f5f982
Merge branch 'master' into apk_play
bhamail Apr 9, 2020
d2afd2f
add niffty import for init - Blank identifier comes to the rescue. Th…
bhamail Apr 9, 2020
6138745
I will very much enjoy deleting this assertion...soon, soon.
bhamail Apr 9, 2020
1439ab2
add PrivateKeyFile option, which is subordinate to PrivateKey
bhamail Apr 9, 2020
04e4a77
move PrivateKey configs to root config struct. expand PrivateKey conf…
bhamail Apr 9, 2020
91baaad
provide the user a hint if privatekey config is missing for .apk pack…
bhamail Apr 9, 2020
89f04ae
lovin' the linter now. learning language from linter loudness. didn't…
bhamail Apr 9, 2020
aa4a865
add support for 'scripts' in control file
bhamail Apr 10, 2020
f3d0d6f
fix control metadata
bhamail Apr 10, 2020
769b4ad
make signing keyname configurable
bhamail Apr 10, 2020
d23caba
goofy size fix
bhamail Apr 10, 2020
0891398
remove temporary test and related files
bhamail Apr 13, 2020
d544ebb
fix template copy/pasta error
bhamail Apr 13, 2020
9af3e19
remove old print statements
bhamail Apr 14, 2020
406d967
first take at integration tests. should remove need for --allow-untru…
bhamail Apr 14, 2020
50bf4c4
Merge branch 'master' into apk_play
caarlos0 Aug 16, 2020
2d9dd6d
fix: merge issues, remove signature support
caarlos0 Aug 16, 2020
e5f62fa
fix: tests
caarlos0 Aug 16, 2020
5e793d0
fix: lint issues
caarlos0 Aug 16, 2020
262b675
Merge remote-tracking branch 'origin/master' into apk_play
caarlos0 Aug 16, 2020
73a5452
fix: tests
caarlos0 Aug 16, 2020
dcff16f
test: meta
caarlos0 Aug 16, 2020
d9f325c
fix: datahash seems unused
caarlos0 Aug 16, 2020
57f1c61
fix: improve test code
caarlos0 Aug 16, 2020
f0476bc
fix: unused params
caarlos0 Aug 16, 2020
0cbea1a
fix: tests
caarlos0 Aug 17, 2020
8c6f1de
Merge remote-tracking branch 'origin/master' into apk_play
caarlos0 Aug 17, 2020
60259bc
test: changelog test
caarlos0 Aug 17, 2020
ba03ac1
test: fix
caarlos0 Aug 17, 2020
b26e013
fix: img
caarlos0 Aug 17, 2020
aaaf6a4
test: symlink
caarlos0 Aug 17, 2020
85e0e6c
fix: uneeded deletes
caarlos0 Aug 17, 2020
c23e600
feat: symlinks
caarlos0 Aug 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import (

"github.com/goreleaser/nfpm"
// shut up
_ "github.com/goreleaser/nfpm/apk"
_ "github.com/goreleaser/nfpm/deb"
_ "github.com/goreleaser/nfpm/rpm"
)

// nolint: gochecknoglobals
var formats = []string{"deb", "rpm"}
var formats = []string{"deb", "rpm", "apk"}

func TestSimple(t *testing.T) {
for _, format := range formats {
Expand Down Expand Up @@ -261,6 +262,7 @@ func accept(t *testing.T, params acceptParms) {
require.NoError(t, err)
var packageName = params.Name + "." + params.Format
var target = filepath.Join(tmp, packageName)
t.Log("package: " + target)

require.NoError(t, os.MkdirAll(tmp, 0700))

Expand Down
27 changes: 27 additions & 0 deletions acceptance/testdata/apk.386.complex.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
RUN test -e /usr/local/bin/fake
RUN test -f /etc/foo/whatever.conf
RUN test -d /usr/share/whatever/
RUN test -d /usr/share/whatever/folder
RUN test -f /usr/share/whatever/folder/file1
RUN test -f /usr/share/whatever/folder/file2
RUN test -d /usr/share/whatever/folder/folder2
RUN test -f /usr/share/whatever/folder/folder2/file1
RUN test -f /usr/share/whatever/folder/folder2/file2
RUN test -d /usr/share/foo
RUN test -d /usr/share/whatever
RUN test -f /tmp/preinstall-proof
RUN test -f /tmp/postinstall-proof
RUN test ! -f /tmp/preremove-proof
RUN test ! -f /tmp/postremove-proof
RUN echo wat >> /etc/foo/whatever.conf
RUN apk del foo
RUN test -f /etc/foo/whatever.conf
RUN test ! -f /usr/local/bin/fake
RUN test -f /tmp/preremove-proof
RUN test -f /tmp/postremove-proof
RUN test ! -d /usr/share/foo
RUN test ! -d /usr/share/whatever
10 changes: 10 additions & 0 deletions acceptance/testdata/apk.386.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
RUN test -e /usr/local/bin/fake
RUN test -f /etc/foo/whatever.conf
RUN echo wat >> /etc/foo/whatever.conf
RUN apk del foo
RUN test -f /etc/foo/whatever.conf
RUN test ! -f /usr/local/bin/fake
10 changes: 10 additions & 0 deletions acceptance/testdata/apk.arm64.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
RUN test -e /usr/local/bin/fake
RUN test -f /etc/foo/whatever.conf
RUN echo wat >> /etc/foo/whatever.conf
RUN apk del foo
RUN test -f /etc/foo/whatever.conf
RUN test ! -f /usr/local/bin/fake
5 changes: 5 additions & 0 deletions acceptance/testdata/apk.changelog.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
# TODO: seems like there is no changelog support on apk
27 changes: 27 additions & 0 deletions acceptance/testdata/apk.complex.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
RUN test -e /usr/local/bin/fake
RUN test -f /etc/foo/whatever.conf
RUN test -d /usr/share/whatever/
RUN test -d /usr/share/whatever/folder
RUN test -f /usr/share/whatever/folder/file1
RUN test -f /usr/share/whatever/folder/file2
RUN test -d /usr/share/whatever/folder/folder2
RUN test -f /usr/share/whatever/folder/folder2/file1
RUN test -f /usr/share/whatever/folder/folder2/file2
RUN test -d /var/log/whatever
RUN test -d /usr/share/foo
RUN test -f /tmp/preinstall-proof
RUN test -f /tmp/postinstall-proof
RUN test ! -f /tmp/preremove-proof
RUN test ! -f /tmp/postremove-proof
RUN echo wat >> /etc/foo/whatever.conf
RUN apk del foo
RUN test -f /etc/foo/whatever.conf
RUN test ! -f /usr/local/bin/fake
RUN test -f /tmp/preremove-proof
RUN test -f /tmp/postremove-proof
RUN test ! -d /var/log/whatever
RUN test ! -d /usr/share/foo
10 changes: 10 additions & 0 deletions acceptance/testdata/apk.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
RUN test -e /usr/local/bin/fake
RUN test -f /etc/foo/whatever.conf
RUN echo wat >> /etc/foo/whatever.conf
RUN apk del foo
RUN test -f /etc/foo/whatever.conf
RUN test ! -f /usr/local/bin/fake
9 changes: 9 additions & 0 deletions acceptance/testdata/apk.env-var-version.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
ENV EXPECTVER="foo-1.0.0~0.1.b1 description:"
RUN apk info foo | grep "foo-" | grep " description:" > found
RUN export FOUND_VER="$(cat found)" && \
echo "Expected: '${EXPECTVER}' :: Found: '${FOUND_VER}'" && \
test "${FOUND_VER}" = "${EXPECTVER}"
6 changes: 6 additions & 0 deletions acceptance/testdata/apk.meta.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
RUN command -v zsh
RUN command -v fish
4 changes: 4 additions & 0 deletions acceptance/testdata/apk.min.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
16 changes: 16 additions & 0 deletions acceptance/testdata/apk.overrides.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add -vvv --allow-untrusted /tmp/foo.apk
RUN test -e /usr/local/bin/fake
RUN test -f /etc/foo/whatever.conf
RUN test ! -f /tmp/preinstall-proof
RUN test -f /tmp/postinstall-proof
RUN test ! -f /tmp/preremove-proof
RUN test ! -f /tmp/postremove-proof
RUN echo wat >> /etc/foo/whatever.conf
RUN apk del foo
RUN test -f /etc/foo/whatever.conf
RUN test ! -f /usr/local/bin/fake
RUN test -f /tmp/preremove-proof
RUN test ! -f /tmp/postremove-proof
10 changes: 10 additions & 0 deletions acceptance/testdata/apk.ppc64le.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
RUN test -e /usr/local/bin/fake
RUN test -f /etc/foo/whatever.conf
RUN echo wat >> /etc/foo/whatever.conf
RUN apk del foo
RUN test -f /etc/foo/whatever.conf
RUN test ! -f /usr/local/bin/fake
5 changes: 5 additions & 0 deletions acceptance/testdata/apk.symlink.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM alpine
ARG package
COPY ${package} /tmp/foo.apk
RUN apk add --allow-untrusted /tmp/foo.apk
RUN ls -l /path/to/symlink | grep "/path/to/symlink -> /etc/foo/whatever.conf"
1 change: 1 addition & 0 deletions acceptance/testdata/complex.386.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ scripts:
postinstall: ./testdata/scripts/postinstall.sh
preremove: ./testdata/scripts/preremove.sh
postremove: ./testdata/scripts/postremove.sh

1 change: 0 additions & 1 deletion acceptance/testdata/deb.changelog.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ RUN zcat "/usr/share/doc/foo/changelog.gz" | grep "Carlos A Becker <pkg@carlosbe
RUN zcat "/usr/share/doc/foo/changelog.gz" | grep "note 1"
RUN zcat "/usr/share/doc/foo/changelog.gz" | grep "note 2"
RUN zcat "/usr/share/doc/foo/changelog.gz" | grep "note 3"
RUN dpkg -r foo
1 change: 0 additions & 1 deletion acceptance/testdata/deb.min.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ FROM ubuntu
ARG package
COPY ${package} /tmp/foo.deb
RUN dpkg -i /tmp/foo.deb
RUN dpkg -r foo
1 change: 0 additions & 1 deletion acceptance/testdata/deb.symlink.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ARG package
COPY ${package} /tmp/foo.deb
RUN dpkg -i /tmp/foo.deb
RUN ls -l /path/to/symlink | grep "/path/to/symlink -> /etc/foo/whatever.conf"
RUN dpkg -r foo
3 changes: 0 additions & 3 deletions acceptance/testdata/deb.triggers.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@ RUN dpkg -i /tmp/foo.deb
# simulate another package that activates the trigger
RUN dpkg-trigger --by-package foo manual-trigger
RUN dpkg --triggers-only foo

RUN test -f /tmp/trigger-proof

RUN dpkg -r foo
4 changes: 4 additions & 0 deletions acceptance/testdata/overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ overrides:
scripts:
postinstall: ./testdata/scripts/postinstall.sh
preremove: ./testdata/scripts/preremove.sh
apk:
scripts:
postinstall: ./testdata/scripts/postinstall.sh
preremove: ./testdata/scripts/preremove.sh
1 change: 0 additions & 1 deletion acceptance/testdata/rpm.changelog.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ RUN rpm -q foo --changelog | grep "Carlos A Becker <pkg@carlosbecker.com>"
RUN rpm -q foo --changelog | grep -E "^- note 1$"
RUN rpm -q foo --changelog | grep -E "^- note 2$"
RUN rpm -q foo --changelog | grep -E "^- note 3$"
RUN rpm -e foo
2 changes: 0 additions & 2 deletions acceptance/testdata/rpm.config-noreplace.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ RUN cat /etc/regular.conf.rpmsave | grep modified
RUN cat /etc/noreplace.conf | grep modified
RUN test -f /etc/noreplace.conf.rpmnew
RUN cat /etc/noreplace.conf.rpmnew | grep foo=baz

RUN rpm -e foo
1 change: 0 additions & 1 deletion acceptance/testdata/rpm.symlink.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ARG package
COPY ${package} /tmp/foo.rpm
RUN rpm -ivh /tmp/foo.rpm
RUN ls -l /path/to/symlink | grep "/path/to/symlink -> /etc/foo/whatever.conf"
RUN rpm -e foo
Loading