Skip to content

Instantly share code, notes, and snippets.

@leapar
Created August 10, 2017 03:00
Show Gist options
  • Save leapar/fff04935e07bb7b92a7f3b468029310e to your computer and use it in GitHub Desktop.
Save leapar/fff04935e07bb7b92a7f3b468029310e to your computer and use it in GitHub Desktop.
build datadog agent
@leapar
Copy link
Author

leapar commented Aug 10, 2017

PLATFORM="rpm-x64" # must be in "deb-x64", "deb-i386", "rpm-x64", "rpm-i386"
TRACE_AGENT_BRANCH="master" # Branch of the datadog-trace-agent repo to use, default "master"
PROCESS_AGENT_BRANCH="master" # Branch of the datadog-process-agent repo to use, default "master"
AGENT_BRANCH="master" # Branch of dd-agent repo to use, default "master"
OMNIBUS_BRANCH="master" # Branch of dd-agent-omnibus repo to use, default "master"
AGENT_VERSION="5.16.0" # default to the latest tag on that branch
LOG_LEVEL="debug" # default to "info"
#LOCAL_AGENT_REPO="~/dd-agent" # Path to a local repo of the agent to build from. Defaut is not set and the build will be done against the github repo

# The passphrase of the key you want to use to sign your .rpm package (if
# building an RPM package). If you don't set this variable, the RPM won't be
# signed but the build should succeed. Note that you must also mount a volume
# under /keys and bind it to a folder containing an RPM-SIGNING-KEY.private
# file containing your exported signing key. Finally, be aware that the
# package_maintainer DSL defined in config/projects/datadog_agent.rb and the
# full key name (My Name (comments) <[email protected]>) must match.
RPM_SIGNING_PASSPHRASE="my_super_secret_passphrase"

mkdir -p pkg
mkdir -p "cache/$PLATFORM"
docker run --name "dd-agent-build-$PLATFORM" \
  -e OMNIBUS_BRANCH=$OMNIBUS_BRANCH \
  -e LOG_LEVEL=$LOG_LEVEL \
  -e http_proxy=http://172.29.226.207:8123 \
  -e https_proxy=http://172.29.226.207:8123 \
  -e AGENT_BRANCH=$AGENT_BRANCH \
  -e AGENT_VERSION=$AGENT_VERSION \
  -e TRACE_AGENT_BRANCH=$TRACE_AGENT_BRANCH \
  -e PROCESS_AGENT_BRANCH=$PROCESS_AGENT_BRANCH \
  -v `pwd`/pkg:/dd-agent-omnibus/pkg \
  -v "`pwd`/cache/$PLATFORM:/var/cache/omnibus" \
  "datadog/docker-dd-agent-build-$PLATFORM"

# Cleanup (necessary to launch another build)
docker rm dd-agent-build-$PLATFORM
  1. 拉取文件

把http_proxy https_proxy去掉,执行build.sh。经过一段时间会报错,因为需要翻墙。

  1. 打包

把http_proxy https_proxy加上,执行build.sh,最后再pkg里面就会有文件生成。

  1. 本地dd-agent

如果dd-agent修改了,请参配置

-e LOCAL_AGENT_REPO=$LOCAL_AGENT_REPO # Only to use if you want to build from a local repo
-v $LOCAL_AGENT_REPO:/dd-agent-repo # Only to use if you want to build from a local repo \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment