Skip to content

Commit

Permalink
Fix tar packages permissions
Browse files Browse the repository at this point in the history
When Docker is run in Mac under Virtualbox, volumes in docker don't have
the expected uid=0,gid=0 permissions, but those that Docker is using
inside it's VM (uid=1000(docker) gid=50(staff). This caused files in the
TAR archives to have wrong permissions, triggering a packaging test error
later on.
  • Loading branch information
adriansr committed Jun 19, 2018
1 parent 25b08b5 commit b9112f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions dev-tools/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func checkConfigOwner(t *testing.T, p *packageFile) {
for _, entry := range p.Contents {
if configFilePattern.MatchString(entry.File) {
if expectedConfigUID != entry.UID {
t.Errorf("file %v should be owned by user %v, owner=%v", entry.File, expectedConfigGID, entry.UID)
t.Errorf("file %v should be owned by user %v, owner=%v", entry.File, expectedConfigUID, entry.UID)
}
if expectedConfigGID != entry.GID {
t.Errorf("file %v should be owned by group %v, group=%v", entry.File, expectedConfigGID, entry.GID)
Expand Down Expand Up @@ -182,7 +182,7 @@ func checkManifestOwner(t *testing.T, p *packageFile) {
for _, entry := range p.Contents {
if manifestFilePattern.MatchString(entry.File) {
if expectedConfigUID != entry.UID {
t.Errorf("file %v should be owned by user %v, owner=%v", entry.File, expectedConfigGID, entry.UID)
t.Errorf("file %v should be owned by user %v, owner=%v", entry.File, expectedConfigUID, entry.UID)
}
if expectedConfigGID != entry.GID {
t.Errorf("file %v should be owned by group %v, group=%v", entry.File, expectedConfigGID, entry.GID)
Expand Down Expand Up @@ -219,7 +219,7 @@ func checkModulesOwner(t *testing.T, p *packageFile) {
for _, entry := range p.Contents {
if modulesFilePattern.MatchString(entry.File) || modulesDirPattern.MatchString(entry.File) {
if expectedConfigUID != entry.UID {
t.Errorf("file %v should be owned by user %v, owner=%v", entry.File, expectedConfigGID, entry.UID)
t.Errorf("file %v should be owned by user %v, owner=%v", entry.File, expectedConfigUID, entry.UID)
}
if expectedConfigGID != entry.GID {
t.Errorf("file %v should be owned by group %v, group=%v", entry.File, expectedConfigGID, entry.GID)
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/packer/platforms/binary/run.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
cp fields.yml /{{.beat_name}}-${VERSION}-linux-{{.bin_arch}}/
cp -a modules.d-linux/ /{{.beat_name}}-${VERSION}-linux-{{.bin_arch}}/modules.d || true

tar czvf /upload/{{.beat_name}}{{.beat_pkg_suffix}}-${VERSION}-linux-{{.bin_arch}}.tar.gz /{{.beat_name}}-${VERSION}-linux-{{.bin_arch}}
tar czvf /upload/{{.beat_name}}{{.beat_pkg_suffix}}-${VERSION}-linux-{{.bin_arch}}.tar.gz --owner=0 --group=0 /{{.beat_name}}-${VERSION}-linux-{{.bin_arch}}
echo "Created /upload/{{.beat_name}}{{.beat_pkg_suffix}}--${VERSION}-linux-{{.bin_arch}}.tar.gz"

cd /upload
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/packer/platforms/darwin/run.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fi
cp fields.yml /{{.beat_name}}-${VERSION}-darwin-x86_64/
cp -a modules.d-darwin/ /{{.beat_name}}-${VERSION}-darwin-x86_64/modules.d || true

tar czvf /upload/{{.beat_name}}{{.beat_pkg_suffix}}-${VERSION}-darwin-x86_64.tar.gz /{{.beat_name}}-${VERSION}-darwin-x86_64
tar czvf /upload/{{.beat_name}}{{.beat_pkg_suffix}}-${VERSION}-darwin-x86_64.tar.gz --owner=0 --group=0 /{{.beat_name}}-${VERSION}-darwin-x86_64
echo "Created /upload/{{.beat_name}}-${VERSION}-darwin-x86_64.tar.gz"

cd /upload
Expand Down

0 comments on commit b9112f3

Please sign in to comment.