Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/setup-go-5…
Browse files Browse the repository at this point in the history
….2.0
  • Loading branch information
chouetz authored Dec 19, 2024
2 parents b7bf759 + 76af2ec commit 9a8b986
Show file tree
Hide file tree
Showing 113 changed files with 1,178 additions and 552 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/serverless-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
persist-credentials: false

- name: Set up Node 20
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20

Expand Down
12 changes: 0 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -623,18 +623,6 @@ workflow:
- <<: *if_main_branch
- <<: *if_release_branch

.on_main_or_release_branch_or_all_builds_or_pkg_installer_changes:
- <<: *if_main_branch
- <<: *if_release_branch
- <<: *if_run_all_builds
- <<: *if_run_all_unit_tests
- changes:
paths:
- pkg/fleet/**/*
compare_to: main
variables:
FAST_TESTS: "true"

.only_main:
- <<: *if_not_main_branch
when: never
Expand Down
3 changes: 1 addition & 2 deletions .gitlab/.ci-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ needs-rules:
- setup_agent_version
- tests_ebpf_arm64
- tests_ebpf_x64
- tests_macos_gitlab_amd64
- tests_windows_secagent_x64
- tests_windows_sysprobe_x64
- trigger_auto_staging_release
Expand All @@ -56,8 +57,6 @@ job-owners:
- build_otel_agent_binary_arm64
- build_otel_agent_binary_x64
- cancel-prev-pipelines
- check_pkg_size-amd64-a7
- check_pkg_size-arm64-a7
- close_failing_tests_stale_issues
- compute_gitlab_ci_config
- deploy_cluster_agent_cloudfoundry
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/JOBOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ iot_agent_suse* @DataDog/agent-delivery
dogstatsd_suse* @DataDog/agent-delivery
agent_oci* @DataDog/agent-delivery
installer_oci* @DataDog/agent-delivery
new_check_pkg_size @DataDog/agent-delivery
check_pkg_size @DataDog/agent-delivery

# Testing package deploy
deploy_deb_testing* @DataDog/agent-delivery
Expand Down
18 changes: 18 additions & 0 deletions .gitlab/dev_container_deploy/docker_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,24 @@ dev_master-a7:
- IMG_SOURCES: ${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx-amd64,${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-jmx-arm64
IMG_DESTINATIONS: agent-dev:master-py3-jmx

dev_master-fips:
extends: .docker_publish_job_definition
stage: dev_container_deploy
rules: !reference [.on_main]
needs:
- docker_build_fips_agent7
- docker_build_fips_agent7_arm64
- docker_build_fips_agent7_jmx
- docker_build_fips_agent7_arm64_jmx
variables:
IMG_REGISTRIES: dev
parallel:
matrix:
- IMG_SOURCES: ${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-fips-amd64,${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-fips-arm64
IMG_DESTINATIONS: agent-dev:master-fips
- IMG_SOURCES: ${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-fips-jmx-amd64,${SRC_AGENT}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}-7-fips-jmx-arm64
IMG_DESTINATIONS: agent-dev:master-fips-jmx

dev_master-dogstatsd:
extends: .docker_publish_job_definition
stage: dev_container_deploy
Expand Down
106 changes: 1 addition & 105 deletions .gitlab/pkg_metrics/pkg_metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,118 +76,14 @@ send_pkg_size:

- inv package.send-size --flavor "agent" --package-os "suse" --package-path $OMNIBUS_PACKAGE_DIR_SUSE/datadog-agent-7.*.aarch64.rpm --major-version "7" --git-ref "${CI_COMMIT_REF_SLUG}" --bucket-branch "${BUCKET_BRANCH}" --arch arm64

.check_pkg_size:
stage: pkg_metrics
image: registry.ddbuild.io/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES
tags: ["arch:amd64"]
script:
- ls -l $OMNIBUS_PACKAGE_DIR
- if [[ "${ARCH}" == "amd64" ]]; then ls -l $OMNIBUS_PACKAGE_DIR_SUSE; fi

- export failures=0
- export last_stable=$(inv release.get-release-json-value "last_stable::${MAJOR_VERSION}" --no-worktree)
# Get stable packages from S3 buckets, send new package sizes & compare stable and new package sizes
# The loop assumes that all flavors start with "da", which is currently the case
# We want to run all package size comparisons before failing, so we set +e while doing the comparisons
# to get the error codes without exiting the shell.
- |
if [[ "${ARCH}" == "amd64" ]]; then ARCH_RPM_EXT="x86_64"; else ARCH_RPM_EXT="aarch64"; fi
for flavor in ${FLAVORS}; do
if [[ "${ARCH}" == "amd64" && "$flavor" != "datadog-heroku-agent" ]]; then
mkdir -p "/tmp/stable/${flavor}/suse"
curl -sSL "https://s3.amazonaws.com/yum.datadoghq.com/suse/stable/${MAJOR_VERSION}/${ARCH_RPM_EXT}/${flavor}-${last_stable}-1.${ARCH_RPM_EXT}.rpm" -o "/tmp/stable/${flavor}/suse/${flavor}-${last_stable}-1.${ARCH_RPM_EXT}.rpm"
set +e
inv package.compare-size --package-type "${flavor} suse rpm" --last-stable "${last_stable}" --threshold "${max_sizes[${flavor}]}" --new-package "$OMNIBUS_PACKAGE_DIR_SUSE/${flavor}-${MAJOR_VERSION}.*.${ARCH_RPM_EXT}.rpm" --stable-package "/tmp/stable/${flavor}/suse/${flavor}-${last_stable}-1.${ARCH_RPM_EXT}.rpm"
failures=$((${failures}+$?))
set -e
fi
mkdir -p "/tmp/stable/${flavor}"
curl -sSL "https://s3.amazonaws.com/apt.datadoghq.com/pool/d/da/${flavor}_${last_stable}-1_${ARCH}.deb" -o "/tmp/stable/${flavor}/${flavor}_${last_stable}-1_${ARCH}.deb"
set +e
inv package.compare-size --package-type "${flavor} deb" --last-stable "${last_stable}" --threshold "${max_sizes[${flavor}]}" --new-package "$OMNIBUS_PACKAGE_DIR/${flavor}_${MAJOR_VERSION}*_${ARCH}.deb" --stable-package "/tmp/stable/${flavor}/${flavor}_${last_stable}-1_${ARCH}.deb"
failures=$((${failures}+$?))
set -e
if [[ "$flavor" != "datadog-heroku-agent" && ( "${ARCH}" == "amd64" || "$flavor" != "datadog-dogstatsd") ]]; then
# We don't build RPM packages for the heroku flavor
curl -sSL "https://s3.amazonaws.com/yum.datadoghq.com/stable/${MAJOR_VERSION}/${ARCH_RPM_EXT}/${flavor}-${last_stable}-1.${ARCH_RPM_EXT}.rpm" -o "/tmp/stable/${flavor}/${flavor}-${last_stable}-1.${ARCH_RPM_EXT}.rpm"
set +e
inv package.compare-size --package-type "${flavor} rpm" --last-stable "${last_stable}" --threshold "${max_sizes[${flavor}]}" --new-package "$OMNIBUS_PACKAGE_DIR/${flavor}-${MAJOR_VERSION}.*.${ARCH_RPM_EXT}.rpm" --stable-package "/tmp/stable/${flavor}/${flavor}-${last_stable}-1.${ARCH_RPM_EXT}.rpm"
failures=$((${failures}+$?))
set -e
fi
done
# Make the job fail if at least one package is above threshold
- if [ "${failures}" -ne "0" ]; then false; fi

check_pkg_size-amd64-a7:
extends: .check_pkg_size
rules:
- !reference [.except_mergequeue]
- when: on_success
needs:
- agent_deb-x64-a7
- iot_agent_deb-x64
- dogstatsd_deb-x64
- agent_heroku_deb-x64-a7
- agent_rpm-x64-a7
- iot_agent_rpm-x64
- dogstatsd_rpm-x64
- agent_suse-x64-a7
- dogstatsd_suse-x64
- iot_agent_suse-x64
variables:
MAJOR_VERSION: 7
FLAVORS: "datadog-agent datadog-iot-agent datadog-dogstatsd datadog-heroku-agent"
ARCH: "amd64"
before_script:
# FIXME: ["datadog-agent"]="140000000" and ["datadog-heroku-agent"]="140000000" should
# be replaced by "50000000"
# "70000000" is needed as of now because of multiple large additions in 7.45
- |
declare -Ar max_sizes=(
["datadog-agent"]="140000000"
["datadog-iot-agent"]="10000000"
["datadog-dogstatsd"]="10000000"
["datadog-heroku-agent"]="70000000"
)
check_pkg_size-arm64-a7:
extends: .check_pkg_size
rules: !reference [.on_all_builds]
needs:
- agent_deb-arm64-a7
- iot_agent_deb-arm64
- dogstatsd_deb-arm64
- agent_rpm-arm64-a7
- iot_agent_rpm-arm64
variables:
MAJOR_VERSION: 7
FLAVORS: "datadog-agent datadog-iot-agent datadog-dogstatsd"
ARCH: "arm64"
before_script:
# FIXME: ["datadog-agent"]="140000000" should be replaced by "70000000"
# "140000000" is needed as of now because of multiple large additions in 7.45
- |
declare -Ar max_sizes=(
["datadog-agent"]="140000000"
["datadog-iot-agent"]="10000000"
["datadog-dogstatsd"]="10000000"
)

new_check_pkg_size:
check_pkg_size:
stage: pkg_metrics
image: registry.ddbuild.io/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES
tags: ["arch:amd64"]
rules:
- !reference [.except_mergequeue]
- when: on_success
allow_failure: true
needs:
- agent_deb-x64-a7
- iot_agent_deb-x64
Expand Down
36 changes: 0 additions & 36 deletions .gitlab/source_test/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,8 @@
include:
- .gitlab/common/macos.yml

tests_macos:
stage: source_test
# HACK: Run macOS unit tests only on full pipelines, to limit the use of macOS GitHub runners.
rules:
- !reference [.on_main_or_release_branch_or_all_builds_or_pkg_installer_changes]
- when: manual
allow_failure: true
image: registry.ddbuild.io/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES
tags: ["arch:amd64"]
needs: ["setup_agent_version"]
script:
- !reference [.setup_macos_github_app]
- $S3_CP_CMD $S3_ARTIFACTS_URI/agent-version.cache .
- export VERSION_CACHE_CONTENT=$(cat agent-version.cache | base64 -)
# Python 3.12 changes default behavior how packages are installed.
# In particular, --break-system-packages command line option is
# required to use the old behavior or use a virtual env. https://github.com/actions/runner-images/issues/8615
- python3 -m pip install -r tasks/libs/requirements-github.txt --break-system-packages
- FAST_TESTS_FLAG=""
- if [[ "$FAST_TESTS" = "true" ]]; then FAST_TESTS_FLAG="--fast-tests true"; fi
- inv -e github.trigger-macos --workflow-type "test" --datadog-agent-ref "$CI_COMMIT_SHA" --version-cache "$VERSION_CACHE_CONTENT" $FAST_TESTS_FLAG --test-washer
timeout: 6h
after_script:
- $CI_PROJECT_DIR/tools/ci/junit_upload.sh "junit-*-repacked.tgz"
artifacts:
expire_in: 2 weeks
when: always
paths:
- test_output.json
- junit-*-repacked.tgz
reports:
junit: "**/junit-out-*.xml"

.tests_macos_gitlab:
stage: source_test
rules:
- !reference [.except_mergequeue]
- when: on_success
extends: .macos_gitlab
needs: ["go_deps", "go_tools_deps"]
variables:
Expand Down
5 changes: 5 additions & 0 deletions cmd/process-agent/subcommands/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ func getConfigValue(deps dependencies, args []string) error {
}

func getClient(cfg model.Reader) (settings.Client, error) {
err := util.SetAuthToken(cfg)
if err != nil {
return nil, err
}

httpClient := apiutil.GetClient(false)
ipcAddress, err := pkgconfigsetup.GetIPCAddress(pkgconfigsetup.Datadog())

Expand Down
6 changes: 6 additions & 0 deletions cmd/process-agent/subcommands/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
log "github.com/DataDog/datadog-agent/comp/core/log/def"
compStatus "github.com/DataDog/datadog-agent/comp/core/status"
"github.com/DataDog/datadog-agent/comp/process"
"github.com/DataDog/datadog-agent/pkg/api/util"
apiutil "github.com/DataDog/datadog-agent/pkg/api/util"
"github.com/DataDog/datadog-agent/pkg/collector/python"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
Expand Down Expand Up @@ -147,6 +148,11 @@ func runStatus(deps dependencies) error {
return err
}

err = util.SetAuthToken(deps.Config)
if err != nil {
return err
}

getAndWriteStatus(deps.Log, statusURL, os.Stdout)
return nil
}
5 changes: 5 additions & 0 deletions cmd/process-agent/subcommands/taggerlist/tagger_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core/config"
log "github.com/DataDog/datadog-agent/comp/core/log/def"
"github.com/DataDog/datadog-agent/comp/core/tagger/api"
"github.com/DataDog/datadog-agent/pkg/api/util"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
)
Expand Down Expand Up @@ -58,6 +59,10 @@ func taggerList(deps dependencies) error {
return err
}

err = util.SetAuthToken(deps.Config)
if err != nil {
return err
}
return api.GetTaggerList(color.Output, taggerURL)
}

Expand Down
8 changes: 5 additions & 3 deletions comp/core/status/render_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import (
"github.com/fatih/color"
"github.com/spf13/cast"

"golang.org/x/text/cases"
"golang.org/x/text/language"
"golang.org/x/text/unicode/norm"
)

Expand Down Expand Up @@ -290,8 +288,12 @@ func formatTitle(title string) string {
}
title = strings.Join(words, " ")

if title == "" {
return ""
}

// Capitalize the first letter
return cases.Title(language.English, cases.NoLower).String(title)
return strings.ToUpper(string(title[0])) + title[1:]
}

func status(check map[string]interface{}) string {
Expand Down
4 changes: 2 additions & 2 deletions comp/forwarder/defaultforwarder/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ require (
github.com/stretchr/testify v1.10.0
go.uber.org/atomic v1.11.0
go.uber.org/fx v1.23.0
golang.org/x/text v0.21.0
)

require (
Expand Down Expand Up @@ -146,8 +145,9 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20241210194714-1829a127f884 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/protobuf v1.35.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions comp/forwarder/defaultforwarder/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions comp/forwarder/defaultforwarder/internal/retry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import (
"expvar"
"strings"

"golang.org/x/text/cases"
"golang.org/x/text/language"

"github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder/transaction"
"github.com/DataDog/datadog-agent/pkg/telemetry"
)
Expand Down Expand Up @@ -308,11 +305,14 @@ func (t onDiskRetryQueueTelemetry) addDeserializeTransactionsCount(count int) {
}

func toCamelCase(s string) string {
caser := cases.Title(language.English)
parts := strings.Split(s, "_")
var camelCase string
for _, p := range parts {
camelCase += caser.String(p)
if p == "" {
continue
}
camelCase += strings.ToUpper(string(p[0]))
camelCase += string(p[1:])
}
return camelCase
}
2 changes: 1 addition & 1 deletion comp/forwarder/orchestrator/orchestratorinterface/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20241210194714-1829a127f884 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/protobuf v1.35.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions comp/forwarder/orchestrator/orchestratorinterface/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9a8b986

Please sign in to comment.