Skip to content

Commit

Permalink
Fix package tests for elastic-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano committed Aug 17, 2020
1 parent 38085a8 commit f978f4a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dev-tools/packaging/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const (
)

var (
configFilePattern = regexp.MustCompile(`.*beat\.yml$|apm-server\.yml$`)
configFilePattern = regexp.MustCompile(`.*beat\.yml$|apm-server\.yml|elastic-agent\.yml$`)
manifestFilePattern = regexp.MustCompile(`manifest.yml`)
modulesDirPattern = regexp.MustCompile(`module/.+`)
modulesDDirPattern = regexp.MustCompile(`modules.d/$`)
Expand Down
6 changes: 6 additions & 0 deletions dev-tools/packaging/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ shared:
/usr/share/{{.BeatName}}/LICENSE.txt:
source: '{{ repo.RootDir }}/LICENSE.txt'
mode: 0644
/usr/share/{{.BeatName}}/NOTICE.txt:
source: '{{ repo.RootDir }}/NOTICE.txt'
mode: 0644
/usr/share/{{.BeatName}}/README.md:
template: '{{ elastic_beats_dir }}/dev-tools/packaging/templates/common/README.md.tmpl'
mode: 0644
Expand Down Expand Up @@ -117,6 +120,9 @@ shared:
/Library/Application Support/{{.BeatVendor}}/{{.BeatName}}/LICENSE.txt:
source: '{{ repo.RootDir }}/LICENSE.txt'
mode: 0644
/Library/Application Support/{{.BeatVendor}}/{{.BeatName}}/NOTICE.txt:
source: '{{ repo.RootDir }}/NOTICE.txt'
mode: 0644
/Library/Application Support/{{.BeatVendor}}/{{.BeatName}}/README.md:
template: '{{ elastic_beats_dir }}/dev-tools/packaging/templates/common/README.md.tmpl'
mode: 0644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ RUN mkdir -p {{ $beatHome }}/data {{ $beatHome }}/logs && \

FROM {{ .from }}

# Installing jq needs to be installed after epel-release and cannot be in the same yum install command.
{{- if contains .from "ubi-minimal" }}
RUN for iter in {1..10}; do microdnf update --setopt=tsflags=nodocs -y && microdnf install --setopt=tsflags=nodocs -y epel-release && microdnf clean all && exit_code=0 && break || exit_code=$? && echo "microdnf error: retry $iter in 10s" && sleep 10; done; (exit $exit_code)
RUN for iter in {1..10}; do microdnf update -y && microdnf install -y jq shadow-utils && microdnf clean all && exit_code=0 && break || exit_code=$? && echo "microdnf error: retry $iter in 10s" && sleep 10; done; (exit $exit_code)
# TODO Install or replace jq
RUN for iter in {1..10}; do microdnf update -y && microdnf install -y shadow-utils && microdnf clean all && exit_code=0 && break || exit_code=$? && echo "microdnf error: retry $iter in 10s" && sleep 10; done; (exit $exit_code)
{{- else }}
# Installing jq needs to be installed after epel-release and cannot be in the same yum install command.
RUN for iter in {1..10}; do yum update --setopt=tsflags=nodocs -y && yum install --setopt=tsflags=nodocs -y epel-release && yum clean all && exit_code=0 && break || exit_code=$? && echo "yum error: retry $iter in 10s" && sleep 10; done; (exit $exit_code)
RUN for iter in {1..10}; do yum update -y && yum install -y jq && yum clean all && exit_code=0 && break || exit_code=$? && echo "yum error: retry $iter in 10s" && sleep 10; done; (exit $exit_code)
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions x-pack/elastic-agent/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func requiredPackagesPresent(basePath, beat, version string, requiredPackages []

// TestPackages tests the generated packages (i.e. file modes, owners, groups).
func TestPackages() error {
return devtools.TestPackages()
return devtools.TestPackages(devtools.WithRootUserContainer())
}

// RunGo runs go command and output the feedback to the stdout and the stderr.
Expand Down Expand Up @@ -572,7 +572,7 @@ func packageAgent(requiredPackages []string, packagingFn func()) {

mg.Deps(Update)
mg.Deps(CrossBuild, CrossBuildGoDaemon)
mg.SerialDeps(devtools.Package)
mg.SerialDeps(devtools.Package, TestPackages)
}

func copyAll(from, to string) error {
Expand Down

0 comments on commit f978f4a

Please sign in to comment.