Report docker systems in version and user agents (#2136)
This commit is contained in:
parent
a3e5f0a3a0
commit
80de87ac34
4 changed files with 24 additions and 2 deletions
|
@ -10,7 +10,7 @@ COPY . .
|
|||
# wizard.sh requires GNU coreutils
|
||||
RUN apk add --no-cache git gcc libc-dev make bash gettext binutils-gold coreutils && \
|
||||
echo "githubciXXXXXXXXXXXXXXXXXXXXXXXX" > /etc/machine-id && \
|
||||
make clean release && \
|
||||
make clean release DOCKER_BUILD=1 && \
|
||||
cd crowdsec-v* && \
|
||||
./wizard.sh --docker-mode && \
|
||||
cd - >/dev/null && \
|
||||
|
|
|
@ -14,7 +14,7 @@ ENV DEBCONF_NOWARNINGS="yes"
|
|||
RUN apt-get update && \
|
||||
apt-get install -y -q git gcc libc-dev make bash gettext binutils-gold coreutils tzdata && \
|
||||
echo "githubciXXXXXXXXXXXXXXXXXXXXXXXX" > /etc/machine-id && \
|
||||
make clean release && \
|
||||
make clean release DOCKER_BUILD=1 && \
|
||||
cd crowdsec-v* && \
|
||||
./wizard.sh --docker-mode && \
|
||||
cd - >/dev/null && \
|
||||
|
|
4
Makefile
4
Makefile
|
@ -36,6 +36,10 @@ LD_OPTS_VARS= \
|
|||
-X '$(GO_MODULE_NAME)/pkg/csconfig.defaultConfigDir=$(DEFAULT_CONFIGDIR)' \
|
||||
-X '$(GO_MODULE_NAME)/pkg/csconfig.defaultDataDir=$(DEFAULT_DATADIR)'
|
||||
|
||||
ifneq (,$(DOCKER_BUILD))
|
||||
LD_OPTS_VARS += -X '$(GO_MODULE_NAME)/pkg/cwversion.System=docker'
|
||||
endif
|
||||
|
||||
ifdef BUILD_STATIC
|
||||
export LD_OPTS=-ldflags "-s -w $(LD_OPTS_VARS) -extldflags '-static'" -tags netgo,osusergo,sqlite_omit_load_extension
|
||||
else
|
||||
|
|
18
docker/test/tests/test_version.py
Normal file
18
docker/test/tests/test_version.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.docker
|
||||
|
||||
|
||||
def test_version_docker_platform(crowdsec, flavor):
|
||||
with crowdsec(flavor=flavor) as cs:
|
||||
for waiter in cs.log_waiters():
|
||||
with waiter as matcher:
|
||||
matcher.fnmatch_lines(["*Starting processing data*"])
|
||||
res = cs.cont.exec_run('cscli version')
|
||||
assert res.exit_code == 0
|
||||
assert 'Platform: docker' in res.output.decode()
|
||||
res = cs.cont.exec_run('crowdsec -version')
|
||||
assert res.exit_code == 0
|
||||
assert 'Platform: docker' in res.output.decode()
|
Loading…
Reference in a new issue