2020-07-30 04:12:40 +02:00
|
|
|
//+build acceptance
|
|
|
|
|
2018-03-11 18:58:53 +01:00
|
|
|
package acceptance
|
|
|
|
|
2018-03-11 19:14:24 +01:00
|
|
|
import (
|
2018-06-04 14:08:27 +02:00
|
|
|
"fmt"
|
2018-03-11 19:14:24 +01:00
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
|
|
"github.com/goreleaser/nfpm"
|
|
|
|
// shut up
|
feat: apk support (#207)
* first attempt at apk, built from Issue #39
* inspector cleanups
* read the contrib note, ran linter, fixes made. Noice!
* linter went wonky
* linter went wonky
* fix some lint issues
* fix some lint issues
* lightweight file validation, while I try to refactor method into smaller chunks
* refactorings to get `make ci` to pass. ain't pretty, but hopefully doesn't make things worse.
* add ignore file to get workdir created in CI
* try to get a successful test run on CI (file sizes differ on CI).
* must remember to run liner (make ci) before pushing
* Doh! Detect CI via correct env var name
* tweak CI expected file sizes
* blech. try to get a range of values for CI
* better message if value fails conditions
* better message if value fails conditions
* initial impl of Package interface - just hoping I don't already have the arch mapping backwards.
* missed non-altered arch case
* ci failures
* refactor io.File to Writer
* add note about command to test apk install in docker
* remove absolute paths from test (prep for replacement with info.Files).
* rename test files folder
* get ci file size ranges happy after path changes
* get ci file size ranges happy after path changes
* move COPY towards end, allowing more caching of layers - feedback from @tcurdt
* remove Gz from function name
* rename combine function
* add skipVerify flag to preserve generated .apk file for use in dockerfile manual test. Thanks @tcurdt
* make ci is my friend
* remove useless comment
* start conversion to nfpm.Info
* use base64 encoded string for private signing key
* remove old runit() method, as we can now test using Default.Package.
add some tests lifted from deb_test.go.
* duck and cover: register the apk packager
* use the metadata from nfpm (does not handle scripts/pre/post, etc)
* getting closer to removing size assertions, but not just yet
* getting closer to removing size assertions, but not just yet
* add niffty import for init - Blank identifier comes to the rescue. Thanks @tcurdt.
add apk to overrides parse test.
* I will very much enjoy deleting this assertion...soon, soon.
* add PrivateKeyFile option, which is subordinate to PrivateKey
* move PrivateKey configs to root config struct. expand PrivateKey configs from env vars if set.
* provide the user a hint if privatekey config is missing for .apk packager
* lovin' the linter now. learning language from linter loudness. didn't know switch could work like that.
* add support for 'scripts' in control file
* fix control metadata
* make signing keyname configurable
* goofy size fix
* remove temporary test and related files
* fix template copy/pasta error
* remove old print statements
* first take at integration tests. should remove need for --allow-untrusted in `apk add` command.
* fix: merge issues, remove signature support
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: lint issues
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: meta
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: datahash seems unused
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: improve test code
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: unused params
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: changelog test
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: fix
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: img
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: symlink
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: uneeded deletes
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* feat: symlinks
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
Co-authored-by: Dan Rollo <danrollo@gmail.com>
2020-08-17 22:28:38 +02:00
|
|
|
_ "github.com/goreleaser/nfpm/apk"
|
2018-03-11 19:14:24 +01:00
|
|
|
_ "github.com/goreleaser/nfpm/deb"
|
|
|
|
_ "github.com/goreleaser/nfpm/rpm"
|
|
|
|
)
|
|
|
|
|
2019-03-04 14:14:05 +01:00
|
|
|
// nolint: gochecknoglobals
|
feat: apk support (#207)
* first attempt at apk, built from Issue #39
* inspector cleanups
* read the contrib note, ran linter, fixes made. Noice!
* linter went wonky
* linter went wonky
* fix some lint issues
* fix some lint issues
* lightweight file validation, while I try to refactor method into smaller chunks
* refactorings to get `make ci` to pass. ain't pretty, but hopefully doesn't make things worse.
* add ignore file to get workdir created in CI
* try to get a successful test run on CI (file sizes differ on CI).
* must remember to run liner (make ci) before pushing
* Doh! Detect CI via correct env var name
* tweak CI expected file sizes
* blech. try to get a range of values for CI
* better message if value fails conditions
* better message if value fails conditions
* initial impl of Package interface - just hoping I don't already have the arch mapping backwards.
* missed non-altered arch case
* ci failures
* refactor io.File to Writer
* add note about command to test apk install in docker
* remove absolute paths from test (prep for replacement with info.Files).
* rename test files folder
* get ci file size ranges happy after path changes
* get ci file size ranges happy after path changes
* move COPY towards end, allowing more caching of layers - feedback from @tcurdt
* remove Gz from function name
* rename combine function
* add skipVerify flag to preserve generated .apk file for use in dockerfile manual test. Thanks @tcurdt
* make ci is my friend
* remove useless comment
* start conversion to nfpm.Info
* use base64 encoded string for private signing key
* remove old runit() method, as we can now test using Default.Package.
add some tests lifted from deb_test.go.
* duck and cover: register the apk packager
* use the metadata from nfpm (does not handle scripts/pre/post, etc)
* getting closer to removing size assertions, but not just yet
* getting closer to removing size assertions, but not just yet
* add niffty import for init - Blank identifier comes to the rescue. Thanks @tcurdt.
add apk to overrides parse test.
* I will very much enjoy deleting this assertion...soon, soon.
* add PrivateKeyFile option, which is subordinate to PrivateKey
* move PrivateKey configs to root config struct. expand PrivateKey configs from env vars if set.
* provide the user a hint if privatekey config is missing for .apk packager
* lovin' the linter now. learning language from linter loudness. didn't know switch could work like that.
* add support for 'scripts' in control file
* fix control metadata
* make signing keyname configurable
* goofy size fix
* remove temporary test and related files
* fix template copy/pasta error
* remove old print statements
* first take at integration tests. should remove need for --allow-untrusted in `apk add` command.
* fix: merge issues, remove signature support
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: lint issues
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: meta
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: datahash seems unused
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: improve test code
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: unused params
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: changelog test
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: fix
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: img
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: symlink
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: uneeded deletes
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* feat: symlinks
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
Co-authored-by: Dan Rollo <danrollo@gmail.com>
2020-08-17 22:28:38 +02:00
|
|
|
var formats = []string{"deb", "rpm", "apk"}
|
2018-06-04 14:08:27 +02:00
|
|
|
|
|
|
|
func TestSimple(t *testing.T) {
|
|
|
|
for _, format := range formats {
|
2019-03-04 14:14:05 +01:00
|
|
|
format := format
|
2019-10-09 21:10:05 +02:00
|
|
|
t.Run(fmt.Sprintf("amd64-%s", format), func(t *testing.T) {
|
2018-07-09 04:20:39 +02:00
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("simple_%s", format),
|
|
|
|
Conf: "simple.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.dockerfile", format),
|
|
|
|
})
|
2018-06-04 14:08:27 +02:00
|
|
|
})
|
2019-10-09 21:10:05 +02:00
|
|
|
t.Run(fmt.Sprintf("i386-%s", format), func(t *testing.T) {
|
2018-07-09 04:20:39 +02:00
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("simple_%s_386", format),
|
|
|
|
Conf: "simple.386.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.386.dockerfile", format),
|
|
|
|
})
|
2018-06-04 14:08:27 +02:00
|
|
|
})
|
2019-10-09 21:10:05 +02:00
|
|
|
t.Run(fmt.Sprintf("ppc64le-%s", format), func(t *testing.T) {
|
2019-03-20 01:54:42 +01:00
|
|
|
t.Skip("for some reason travis fails to run those")
|
2019-03-20 01:34:06 +01:00
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("simple_%s_ppc64le", format),
|
|
|
|
Conf: "simple.ppc64le.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.ppc64le.dockerfile", format),
|
|
|
|
})
|
|
|
|
})
|
2019-10-09 21:10:05 +02:00
|
|
|
t.Run(fmt.Sprintf("arm64-%s", format), func(t *testing.T) {
|
2019-06-28 19:14:45 +02:00
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("simple_%s_arm64", format),
|
|
|
|
Conf: "simple.arm64.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.arm64.dockerfile", format),
|
|
|
|
})
|
|
|
|
})
|
2018-06-04 14:08:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestComplex(t *testing.T) {
|
|
|
|
for _, format := range formats {
|
2019-03-04 14:14:05 +01:00
|
|
|
format := format
|
2019-10-09 21:10:05 +02:00
|
|
|
t.Run(fmt.Sprintf("amd64-%s", format), func(t *testing.T) {
|
2018-07-09 04:20:39 +02:00
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("complex_%s", format),
|
|
|
|
Conf: "complex.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.complex.dockerfile", format),
|
|
|
|
})
|
2018-06-04 14:08:27 +02:00
|
|
|
})
|
2019-10-09 21:10:05 +02:00
|
|
|
t.Run(fmt.Sprintf("i386-%s", format), func(t *testing.T) {
|
2018-07-09 04:20:39 +02:00
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("complex_%s_386", format),
|
|
|
|
Conf: "complex.386.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.386.complex.dockerfile", format),
|
|
|
|
})
|
2018-06-04 14:08:27 +02:00
|
|
|
})
|
|
|
|
}
|
2019-10-10 03:11:58 +02:00
|
|
|
}
|
|
|
|
|
2020-08-04 19:44:13 +02:00
|
|
|
func TestConfigNoReplace(t *testing.T) {
|
|
|
|
var target = "./testdata/tmp/noreplace_old_rpm.rpm"
|
|
|
|
require.NoError(t, os.MkdirAll("./testdata/tmp", 0700))
|
|
|
|
|
|
|
|
config, err := nfpm.ParseFile("./testdata/config-noreplace-old.yaml")
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
info, err := config.Get("rpm")
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.NoError(t, nfpm.Validate(info))
|
|
|
|
|
|
|
|
pkg, err := nfpm.Get("rpm")
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
f, err := os.Create(target)
|
|
|
|
require.NoError(t, err)
|
|
|
|
info.Target = target
|
|
|
|
require.NoError(t, pkg.Package(nfpm.WithDefaults(info), f))
|
|
|
|
|
|
|
|
t.Run("noreplace-rpm", func(t *testing.T) {
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: "noreplace_rpm",
|
|
|
|
Conf: "config-noreplace.yaml",
|
|
|
|
Format: "rpm",
|
|
|
|
Dockerfile: "rpm.config-noreplace.dockerfile",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-10-10 03:11:58 +02:00
|
|
|
func TestEnvVarVersion(t *testing.T) {
|
|
|
|
for _, format := range formats {
|
|
|
|
format := format
|
|
|
|
t.Run(fmt.Sprintf("amd64-%s", format), func(t *testing.T) {
|
|
|
|
os.Setenv("SEMVER", "v1.0.0-0.1.b1+git.abcdefgh")
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("env-var-version_%s", format),
|
|
|
|
Conf: "env-var-version.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.env-var-version.dockerfile", format),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
2018-06-04 14:08:27 +02:00
|
|
|
}
|
|
|
|
|
2019-10-09 21:10:05 +02:00
|
|
|
func TestComplexOverrides(t *testing.T) {
|
2018-06-04 14:08:27 +02:00
|
|
|
for _, format := range formats {
|
2019-03-04 14:14:05 +01:00
|
|
|
format := format
|
2019-10-09 21:10:05 +02:00
|
|
|
t.Run(fmt.Sprintf("amd64-%s", format), func(t *testing.T) {
|
2018-07-09 04:20:39 +02:00
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("overrides_%s", format),
|
|
|
|
Conf: "overrides.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.overrides.dockerfile", format),
|
|
|
|
})
|
2018-06-04 14:08:27 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-09 21:10:05 +02:00
|
|
|
func TestMin(t *testing.T) {
|
2018-06-04 14:08:27 +02:00
|
|
|
for _, format := range formats {
|
2019-03-04 14:14:05 +01:00
|
|
|
format := format
|
2019-10-09 21:10:05 +02:00
|
|
|
t.Run(fmt.Sprintf("amd64-%s", format), func(t *testing.T) {
|
2018-07-09 04:20:39 +02:00
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("min_%s", format),
|
|
|
|
Conf: "min.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.min.dockerfile", format),
|
|
|
|
})
|
2018-06-04 14:08:27 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-10 07:05:33 +02:00
|
|
|
func TestMeta(t *testing.T) {
|
|
|
|
for _, format := range formats {
|
|
|
|
format := format
|
|
|
|
t.Run(fmt.Sprintf("amd64-%s", format), func(t *testing.T) {
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("meta_%s", format),
|
|
|
|
Conf: "meta.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.meta.dockerfile", format),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-23 15:49:04 +02:00
|
|
|
func TestRPMCompression(t *testing.T) {
|
|
|
|
compressFormats := []string{"gzip", "xz", "lzma"}
|
|
|
|
for _, format := range compressFormats {
|
|
|
|
format := format
|
|
|
|
t.Run(format, func(t *testing.T) {
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("%s_compression_rpm", format),
|
|
|
|
Conf: fmt.Sprintf("%s.compression.yaml", format),
|
|
|
|
Format: "rpm",
|
|
|
|
Dockerfile: fmt.Sprintf("%s.rpm.compression.dockerfile", format),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-25 17:12:38 +02:00
|
|
|
func TestRPMRelease(t *testing.T) {
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: "release_rpm",
|
|
|
|
Conf: "release.rpm.yaml",
|
|
|
|
Format: "rpm",
|
|
|
|
Dockerfile: "release.rpm.dockerfile",
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-08-31 15:21:28 +02:00
|
|
|
func TestDebRules(t *testing.T) {
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: "rules.deb",
|
|
|
|
Conf: "rules.deb.yaml",
|
|
|
|
Format: "deb",
|
|
|
|
Dockerfile: "rules.deb.dockerfile",
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-07-13 17:10:03 +02:00
|
|
|
func TestChangelog(t *testing.T) {
|
|
|
|
for _, format := range formats {
|
|
|
|
format := format
|
|
|
|
t.Run(fmt.Sprintf("changelog-%s", format), func(t *testing.T) {
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("changelog_%s", format),
|
|
|
|
Conf: "withchangelog.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.changelog.dockerfile", format),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-27 18:22:06 +02:00
|
|
|
func TestDebTriggers(t *testing.T) {
|
|
|
|
t.Run("triggers-deb", func(t *testing.T) {
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: "triggers-deb",
|
|
|
|
Conf: "triggers.yaml",
|
|
|
|
Format: "deb",
|
|
|
|
Dockerfile: "deb.triggers.dockerfile",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-07-30 04:20:50 +02:00
|
|
|
func TestSymlink(t *testing.T) {
|
|
|
|
for _, format := range formats {
|
|
|
|
format := format
|
|
|
|
t.Run(fmt.Sprintf("symlink-%s", format), func(t *testing.T) {
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("symlink_%s", format),
|
|
|
|
Conf: "symlink.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.symlink.dockerfile", format),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-01 21:27:29 +02:00
|
|
|
func TestDebBreaks(t *testing.T) {
|
|
|
|
t.Run("breaks-deb", func(t *testing.T) {
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: "breaks-deb",
|
|
|
|
Conf: "breaks.yaml",
|
|
|
|
Format: "deb",
|
|
|
|
Dockerfile: "deb.breaks.dockerfile",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-09-17 14:18:44 +02:00
|
|
|
func TestSignatures(t *testing.T) {
|
|
|
|
for _, format := range formats {
|
|
|
|
format := format
|
|
|
|
t.Run("signed", func(t *testing.T) {
|
|
|
|
accept(t, acceptParms{
|
|
|
|
Name: fmt.Sprintf("signed_%s", format),
|
|
|
|
Conf: "signed.yaml",
|
|
|
|
Format: format,
|
|
|
|
Dockerfile: fmt.Sprintf("%s.signed.dockerfile", format),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-09 04:20:39 +02:00
|
|
|
type acceptParms struct {
|
|
|
|
Name string
|
|
|
|
Conf string
|
|
|
|
Format string
|
|
|
|
Dockerfile string
|
|
|
|
}
|
|
|
|
|
2020-08-16 18:13:00 +02:00
|
|
|
type testWriter struct {
|
|
|
|
t *testing.T
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t testWriter) Write(p []byte) (n int, err error) {
|
|
|
|
t.t.Logf(string(p))
|
|
|
|
return len(p), nil
|
|
|
|
}
|
|
|
|
|
2018-07-09 04:20:39 +02:00
|
|
|
func accept(t *testing.T, params acceptParms) {
|
|
|
|
var configFile = filepath.Join("./testdata", params.Conf)
|
2018-03-11 19:14:24 +01:00
|
|
|
tmp, err := filepath.Abs("./testdata/tmp")
|
|
|
|
require.NoError(t, err)
|
2018-07-09 04:20:39 +02:00
|
|
|
var packageName = params.Name + "." + params.Format
|
2018-03-11 19:24:44 +01:00
|
|
|
var target = filepath.Join(tmp, packageName)
|
feat: apk support (#207)
* first attempt at apk, built from Issue #39
* inspector cleanups
* read the contrib note, ran linter, fixes made. Noice!
* linter went wonky
* linter went wonky
* fix some lint issues
* fix some lint issues
* lightweight file validation, while I try to refactor method into smaller chunks
* refactorings to get `make ci` to pass. ain't pretty, but hopefully doesn't make things worse.
* add ignore file to get workdir created in CI
* try to get a successful test run on CI (file sizes differ on CI).
* must remember to run liner (make ci) before pushing
* Doh! Detect CI via correct env var name
* tweak CI expected file sizes
* blech. try to get a range of values for CI
* better message if value fails conditions
* better message if value fails conditions
* initial impl of Package interface - just hoping I don't already have the arch mapping backwards.
* missed non-altered arch case
* ci failures
* refactor io.File to Writer
* add note about command to test apk install in docker
* remove absolute paths from test (prep for replacement with info.Files).
* rename test files folder
* get ci file size ranges happy after path changes
* get ci file size ranges happy after path changes
* move COPY towards end, allowing more caching of layers - feedback from @tcurdt
* remove Gz from function name
* rename combine function
* add skipVerify flag to preserve generated .apk file for use in dockerfile manual test. Thanks @tcurdt
* make ci is my friend
* remove useless comment
* start conversion to nfpm.Info
* use base64 encoded string for private signing key
* remove old runit() method, as we can now test using Default.Package.
add some tests lifted from deb_test.go.
* duck and cover: register the apk packager
* use the metadata from nfpm (does not handle scripts/pre/post, etc)
* getting closer to removing size assertions, but not just yet
* getting closer to removing size assertions, but not just yet
* add niffty import for init - Blank identifier comes to the rescue. Thanks @tcurdt.
add apk to overrides parse test.
* I will very much enjoy deleting this assertion...soon, soon.
* add PrivateKeyFile option, which is subordinate to PrivateKey
* move PrivateKey configs to root config struct. expand PrivateKey configs from env vars if set.
* provide the user a hint if privatekey config is missing for .apk packager
* lovin' the linter now. learning language from linter loudness. didn't know switch could work like that.
* add support for 'scripts' in control file
* fix control metadata
* make signing keyname configurable
* goofy size fix
* remove temporary test and related files
* fix template copy/pasta error
* remove old print statements
* first take at integration tests. should remove need for --allow-untrusted in `apk add` command.
* fix: merge issues, remove signature support
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: lint issues
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: meta
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: datahash seems unused
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: improve test code
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: unused params
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: changelog test
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: fix
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: img
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* test: symlink
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* fix: uneeded deletes
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
* feat: symlinks
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
Co-authored-by: Dan Rollo <danrollo@gmail.com>
2020-08-17 22:28:38 +02:00
|
|
|
t.Log("package: " + target)
|
2018-03-11 19:14:24 +01:00
|
|
|
|
|
|
|
require.NoError(t, os.MkdirAll(tmp, 0700))
|
|
|
|
|
2018-04-19 03:15:58 +02:00
|
|
|
config, err := nfpm.ParseFile(configFile)
|
2018-03-11 19:14:24 +01:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
2018-07-09 04:20:39 +02:00
|
|
|
info, err := config.Get(params.Format)
|
2018-03-11 19:14:24 +01:00
|
|
|
require.NoError(t, err)
|
2018-04-05 04:13:47 +02:00
|
|
|
require.NoError(t, nfpm.Validate(info))
|
|
|
|
|
2018-07-09 04:20:39 +02:00
|
|
|
pkg, err := nfpm.Get(params.Format)
|
2018-03-11 19:14:24 +01:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
f, err := os.Create(target)
|
|
|
|
require.NoError(t, err)
|
2019-11-11 22:57:10 +01:00
|
|
|
info.Target = target
|
2018-03-11 19:14:24 +01:00
|
|
|
require.NoError(t, pkg.Package(nfpm.WithDefaults(info), f))
|
2018-09-12 18:17:59 +02:00
|
|
|
//nolint:gosec
|
2018-03-11 19:14:24 +01:00
|
|
|
cmd := exec.Command(
|
2018-05-17 02:00:11 +02:00
|
|
|
"docker", "build", "--rm", "--force-rm",
|
2018-07-09 04:20:39 +02:00
|
|
|
"-f", params.Dockerfile,
|
2018-05-17 01:36:03 +02:00
|
|
|
"--build-arg", "package="+filepath.Join("tmp", packageName),
|
|
|
|
".",
|
2018-03-11 19:14:24 +01:00
|
|
|
)
|
2018-05-17 01:36:03 +02:00
|
|
|
cmd.Dir = "./testdata"
|
2020-08-16 18:13:00 +02:00
|
|
|
cmd.Stderr = testWriter{t}
|
|
|
|
cmd.Stdout = cmd.Stderr
|
2019-10-09 21:10:05 +02:00
|
|
|
|
2020-08-16 18:13:00 +02:00
|
|
|
t.Log("will exec:", cmd.Args)
|
|
|
|
require.NoError(t, cmd.Run())
|
2018-03-11 18:58:53 +01:00
|
|
|
}
|