blablacar / dgr

Container build and runtime tool
Apache License 2.0
248 stars 21 forks source link

build failed with invalid option -- 'k' #207

Closed f0 closed 7 years ago

f0 commented 7 years ago

Hi, i try to build with dgr version 77 on a centos host, got this error:

2016-11-08 17:59:53 DEBUG     dgr/bin-dgr/common/exec.go:16  Running external command                     command=gzip   -k /var/lib/jenkins/workspace/uilds_aci-centos-dgr_master-MX2QQ6FLPWJNCAVFJVTVA6LSLNDH4EFIUZJMEFH7NFEL466FNLSQ/target/image.aci
2016-11-08 17:59:53 DEBUG     dgr/bin-dgr/common/exec.go:56  Running external command                     command=chown   -R 5000:5000 /var/lib/jenkins/workspace/uilds_aci-centos-dgr_master-MX2QQ6FLPWJNCAVFJVTVA6LSLNDH4EFIUZJMEFH7NFEL466FNLSQ/target
2016-11-08 17:59:53 FATAL         dgr/bin-dgr/command.go:236 Push command failed                         
                                      dgr/bin-dgr/aci.go:124 Failed to zip aci                            aci=aci.example.net/aci-test:1 path=/var/lib/jenkins/workspace/uilds_aci-centos-dgr_master-MX2QQ6FLPWJNCAVFJVTVA6LSLNDH4EFIUZJMEFH7NFEL466FNLSQ/target/image.aci stderr=gzip: invalid option -- 'k'
Try `gzip --help' for more information. stdout=
                                                             exit status 1
n0rad commented 7 years ago

During normal build, the aci is just a tar to get result fast. When you push, the aci is zipped to upload faster and take less spaces on the remote storage.

We are zipping the aci by calling exec gzip -k $aci. gzip on your host probably do not have the -k option. This should be replaced by a pure go implementation. It was done like that to be feature complete faster.

f0 commented 7 years ago

@n0rad seems that centos7 gzip does not know the -k (Debian does)

bash-4.2# /usr/bin/gzip --help                                                                                      
Usage: gzip [OPTION]... [FILE]...
Compress or uncompress FILEs (by default, compress FILES in-place).

Mandatory arguments to long options are mandatory for short options too.

  -c, --stdout      write on standard output, keep original files unchanged
  -d, --decompress  decompress
  -f, --force       force overwrite of output file and compress links
  -h, --help        give this help
  -l, --list        list compressed file contents
  -L, --license     display software license
  -n, --no-name     do not save or restore the original name and time stamp
  -N, --name        save or restore the original name and time stamp
  -q, --quiet       suppress all warnings
  -r, --recursive   operate recursively on directories
  -S, --suffix=SUF  use suffix SUF on compressed files
  -t, --test        test compressed file integrity
  -v, --verbose     verbose mode
  -V, --version     display version number
  -1, --fast        compress faster
  -9, --best        compress better
    --rsyncable   Make rsync-friendly archive

With no FILE, or when FILE is -, read standard 
n0rad commented 7 years ago

Yep this is why it definitly need to be replaced by a pure go version.

Build should not be host dependent

n0rad commented 7 years ago

fixed in v78 by using pure go gzip implementation