Skip to content

Commit

Permalink
Merge pull request #300 from splunk/feature/emit-version
Browse files Browse the repository at this point in the history
Add version to DockerFile and echo at startup
  • Loading branch information
Ryan Faircloth authored and GitHub committed Feb 3, 2020
2 parents ea19c97 + 9727a8f commit 0b87ff0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
- versioning/define_version
- versioning/create_version_file:
version_file_path: /tmp/workspace/VERSION

- versioning/create_version_file:
version_file_path: package/VERSION
- docker/install-docker
- docker/check:
registry: $REGISTRY
Expand Down
4 changes: 0 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ services:
links:
- splunk
- sc4s
volumes:
- sc4s-results:/work/test-results
environment:
- SPLUNK_USER=admin
- SPLUNK_PASSWORD=${SPLUNK_PASSWORD}
Expand Down Expand Up @@ -85,7 +83,5 @@ services:
- ./replay:/work

volumes:
sc4s-results:
external: true
splunk-etc:
external: true
2 changes: 2 additions & 0 deletions package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ COPY sbin/entrypoint.sh /
RUN mkdir -p /opt/syslog-ng/var/data/disk-buffer
RUN source scl_source enable rh-python36 ;/opt/syslog-ng/sbin/syslog-ng -V

COPY VERSION /

EXPOSE 514
EXPOSE 601/tcp
EXPOSE 6514/tcp
Expand Down
1 change: 1 addition & 0 deletions package/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UNKNOWN
4 changes: 3 additions & 1 deletion package/sbin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ for file in /opt/syslog-ng/etc/conf.d/local/context/*.example ; do cp --verbose
cp --verbose -R /opt/syslog-ng/etc/local_config/* /opt/syslog-ng/etc/conf.d/local/config/

echo syslog-ng checking config
/opt/syslog-ng/sbin/syslog-ng -s >/var/log/syslog-ng.out 2>/var/log/syslog-ng.err
echo sc4s version=$(cat /version)
echo sc4s version=$(cat /version) >/var/log/syslog-ng.out
/opt/syslog-ng/sbin/syslog-ng -s >>/var/log/syslog-ng.out 2>/var/log/syslog-ng.err

echo syslog-ng starting
exec /opt/syslog-ng/sbin/syslog-ng $@
11 changes: 11 additions & 0 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,14 @@ def test_check_config_version_multiple(record_property, setup_wordlist, setup_sp
record_property("resultCount", resultCount)

assert resultCount == 0

def test_check_sc4s_version(record_property, setup_wordlist, setup_splunk):

st = env.from_string("search index=main sourcetype=\"sc4s:events:startup:out\" \"sc4s version=\" NOT \"UNKNOWN\"")
search = st.render()

resultCount, eventCount = splunk_single(setup_splunk, search)

record_property("resultCount", resultCount)

assert resultCount == 0

0 comments on commit 0b87ff0

Please sign in to comment.