Skip to content

Commit

Permalink
Permit specifying agent base image via command-line option when build…
Browse files Browse the repository at this point in the history
…ing (#3048)

Co-authored-by: Oleg Pudeyev <[email protected]>
  • Loading branch information
p-datadog and p authored Sep 17, 2024
1 parent 1e5becc commit 45f9664
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions utils/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if [[ -f "./.env" ]]; then
fi

WEBLOG_VARIANT=${WEBLOG_VARIANT:-${HTTP_FRAMEWORK:-}}
AGENT_BASE_IMAGE=

readonly DOCKER_REGISTRY_CACHE_PATH="${DOCKER_REGISTRY_CACHE_PATH:-ghcr.io/datadog/system-tests}"
readonly ALIAS_CACHE_FROM="R" #read cache
Expand Down Expand Up @@ -62,6 +63,7 @@ print_usage() {
echo -e " ${CYAN}--default-weblog${NC} Prints the name of the default weblog for a given library and exits."
echo -e " ${CYAN}--binary-path${NC} Optional. Path of a directory binaries will be copied from. Should be used for local development only."
echo -e " ${CYAN}--binary-url${NC} Optional. Url of the client library redistributable. Should be used for local development only."
echo -e " ${CYAN}--agent-base-image${NC} Optional. Base image of docker agent to use, default: datadog/agent"
echo -e " ${CYAN}--help${NC} Prints this message and exits."
echo
echo -e "${WHITE_BOLD}EXAMPLES${NC}"
Expand Down Expand Up @@ -178,10 +180,12 @@ build() {
.

elif [[ $IMAGE_NAME == agent ]]; then
if [ -f ./binaries/agent-image ]; then
AGENT_BASE_IMAGE=$(cat ./binaries/agent-image)
else
AGENT_BASE_IMAGE="datadog/agent"
if test -z "$AGENT_BASE_IMAGE"; then
if [ -f ./binaries/agent-image ]; then
AGENT_BASE_IMAGE=$(cat ./binaries/agent-image)
else
AGENT_BASE_IMAGE="datadog/agent"
fi
fi

echo "using $AGENT_BASE_IMAGE image for datadog agent"
Expand Down Expand Up @@ -297,6 +301,7 @@ while [[ "$#" -gt 0 ]]; do
--list-weblogs) COMMAND=list-weblogs ;;
--default-weblog) COMMAND=default-weblog ;;
-h|--help) print_usage; exit 0 ;;
--agent-base-image) AGENT_BASE_IMAGE="$2"; shift ;;
*) echo "Invalid argument: ${1:-}"; echo; print_usage; exit 1 ;;
esac
shift
Expand Down

0 comments on commit 45f9664

Please sign in to comment.