Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
c010fb1c
Unverified
Commit
c010fb1c
authored
7 years ago
by
Daniel Nelson
Browse files
Options
Downloads
Patches
Plain Diff
Fix build versioning; add dev.docker file
parent
08c197f7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+7
-3
7 additions, 3 deletions
Makefile
cmd/telegraf/telegraf.go
+1
-1
1 addition, 1 deletion
cmd/telegraf/telegraf.go
scripts/build.py
+20
-11
20 additions, 11 deletions
scripts/build.py
scripts/dev.docker
+8
-0
8 additions, 0 deletions
scripts/dev.docker
with
36 additions
and
15 deletions
Makefile
+
7
−
3
View file @
c010fb1c
...
...
@@ -49,12 +49,16 @@ test-all: lint
go
test
./...
package
:
./scripts/build.py
--package
--version
=
"
$(
VERSION
)
"
--platform
=
linux
--arch
=
all
--upload
./scripts/build.py
--package
--platform
=
all
--arch
=
all
clean
:
-
rm
-f
telegraf
-
rm
-f
telegraf.exe
docker-image
:
./scripts/build.py
--package
--platform
=
linux
--arch
=
amd64
cp
build/telegraf
*
$(
COMMIT
)
*
.deb .
docker build
-f
scripts/dev.docker
--build-arg
"package=telegraf*
$(
COMMIT
)
*.deb"
-t
"telegraf-dev:
$(
COMMIT
)
"
.
# Run all docker containers necessary for integration tests
docker-run
:
docker run
--name
aerospike
-p
"3000:3000"
-d
aerospike/aerospike-server:3.9.0
...
...
@@ -114,4 +118,4 @@ docker-kill:
openldap postgres rabbitmq redis riemann zookeeper
.PHONY
:
deps telegraf telegraf.exe install test test-windows lint test-all
\
package clean docker-run docker-run-circle docker-kill
package clean docker-run docker-run-circle docker-kill
docker-image
This diff is collapsed.
Click to expand it.
cmd/telegraf/telegraf.go
+
1
−
1
View file @
c010fb1c
...
...
@@ -268,7 +268,7 @@ func (p *program) Stop(s service.Service) error {
func
displayVersion
()
string
{
if
version
==
""
{
return
fmt
.
Sprintf
(
"v%s~
pre
%s"
,
nextVersion
,
commit
)
return
fmt
.
Sprintf
(
"v%s~%s"
,
nextVersion
,
commit
)
}
return
"v"
+
version
}
...
...
This diff is collapsed.
Click to expand it.
scripts/build.py
+
20
−
11
View file @
c010fb1c
...
...
@@ -95,6 +95,8 @@ supported_packages = {
"
freebsd
"
:
[
"
tar
"
]
}
next_version
=
'
1.5.0
'
################
#### Telegraf Functions
################
...
...
@@ -158,7 +160,8 @@ def go_get(branch, update=False, no_uncommitted=False):
get_command
=
"
go get github.com/sparrc/gdm
"
run
(
get_command
)
logging
.
info
(
"
Retrieving dependencies with `gdm`...
"
)
run
(
"
{}/bin/gdm restore -v
"
.
format
(
os
.
environ
.
get
(
"
GOPATH
"
)))
run
(
"
{}/bin/gdm restore -v
"
.
format
(
os
.
environ
.
get
(
"
GOPATH
"
,
os
.
path
.
expanduser
(
"
~/go
"
))))
return
True
def
run_tests
(
race
,
parallel
,
timeout
,
no_vet
):
...
...
@@ -223,13 +226,16 @@ def increment_minor_version(version):
def
get_current_version_tag
():
"""
Retrieve the raw git version tag.
"""
version
=
run
(
"
git describe --always --tags --abbrev=0
"
)
version
=
run
(
"
git describe --exact-match --tags 2>/dev/null
"
,
allow_failure
=
True
,
shell
=
True
)
return
version
def
get_current_version
():
"""
Parse version information from git tag output.
"""
version_tag
=
get_current_version_tag
()
if
not
version_tag
:
return
None
# Remove leading 'v'
if
version_tag
[
0
]
==
'
v
'
:
version_tag
=
version_tag
[
1
:]
...
...
@@ -474,12 +480,17 @@ def build(version=None,
if
len
(
tags
)
>
0
:
build_command
+=
"
-tags {}
"
.
format
(
'
,
'
.
join
(
tags
))
build_command
+=
"
-ldflags=
\"
-w -s -X main.version={} -X main.branch={} -X main.commit={}
\"
"
.
format
(
version
,
get_current_branch
(),
get_current_commit
())
ldflags
=
[
'
-w
'
,
'
-s
'
,
'
-X
'
,
'
main.branch={}
'
.
format
(
get_current_branch
()),
'
-X
'
,
'
main.commit={}
'
.
format
(
get_current_commit
(
short
=
True
))]
if
version
:
ldflags
.
append
(
'
-X
'
)
ldflags
.
append
(
'
main.version={}
'
.
format
(
version
))
build_command
+=
'
-ldflags=
"
{}
"
'
.
format
(
'
'
.
join
(
ldflags
))
if
static
:
build_command
+=
"
-a -installsuffix cgo
"
build_command
+=
"
-a -installsuffix cgo
"
build_command
+=
path
start_time
=
datetime
.
utcnow
()
run
(
build_command
,
shell
=
True
)
...
...
@@ -575,10 +586,8 @@ def package(build_output, pkg_name, version, nightly=False, iteration=1, static=
package_arch
=
'
armv6hl
'
else
:
package_arch
=
arch
if
not
release
and
not
nightly
:
# For non-release builds, just use the commit hash as the version
package_version
=
"
{}~{}
"
.
format
(
version
,
get_current_commit
(
short
=
True
))
if
not
version
:
package_version
=
"
{}~{}
"
.
format
(
next_version
,
get_current_commit
(
short
=
True
))
package_iteration
=
"
0
"
package_build_root
=
build_root
current_location
=
build_output
[
platform
][
arch
]
...
...
This diff is collapsed.
Click to expand it.
scripts/dev.docker
0 → 100644
+
8
−
0
View file @
c010fb1c
FROM
debian:stretch
ARG
package
ADD
${package} ${package}
RUN
dpkg
-i
${
package
}
EXPOSE
8125/udp 8092/udp 8094
CMD
["telegraf"]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment