Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Remove the GitHub macOS tests workflow #32151

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -619,18 +619,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
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]
amenasria marked this conversation as resolved.
Show resolved Hide resolved
- 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:
amenasria marked this conversation as resolved.
Show resolved Hide resolved
stage: source_test
rules:
- !reference [.except_mergequeue]
- when: on_success
extends: .macos_gitlab
needs: ["go_deps", "go_tools_deps"]
variables:
Expand Down
25 changes: 2 additions & 23 deletions tasks/github_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from tasks.libs.common.constants import DEFAULT_INTEGRATIONS_CORE_BRANCH
from tasks.libs.common.datadog_api import create_gauge, send_event, send_metrics
from tasks.libs.common.git import get_default_branch
from tasks.libs.common.junit_upload_core import repack_macos_junit_tar
from tasks.libs.common.utils import get_git_pretty_ref
from tasks.libs.owners.linter import codeowner_has_orphans, directory_has_packages_without_owner
from tasks.libs.owners.parsing import read_owners
Expand Down Expand Up @@ -76,8 +75,6 @@ def trigger_macos(
version_cache=None,
retry_download=3,
retry_interval=10,
fast_tests=None,
test_washer=False,
integrations_core_ref=DEFAULT_INTEGRATIONS_CORE_BRANCH,
):
"""
Expand Down Expand Up @@ -107,26 +104,8 @@ def trigger_macos(
version_cache_file_content=version_cache,
integrations_core_ref=integrations_core_ref,
)
elif workflow_type == "test":
conclusion = _trigger_macos_workflow(
release_version,
destination,
retry_download,
retry_interval,
workflow_name="test.yaml",
datadog_agent_ref=datadog_agent_ref,
version_cache_file_content=version_cache,
fast_tests=fast_tests,
test_washer=test_washer,
)
repack_macos_junit_tar(conclusion, "junit-tests_macos.tgz", "junit-tests_macos-repacked.tgz")
elif workflow_type == "lint":
conclusion = _trigger_macos_workflow(
release_version,
workflow_name="lint.yaml",
datadog_agent_ref=datadog_agent_ref,
version_cache_file_content=version_cache,
)
else:
raise Exit(f"Unsupported workflow type: {workflow_type}", code=1)
if conclusion != "success":
raise Exit(message=f"Macos {workflow_type} workflow {conclusion}", code=1)

Expand Down
22 changes: 0 additions & 22 deletions tasks/libs/common/junit_upload_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,25 +377,3 @@ def produce_junit_tar(files, result_path):
job_env_info.size = job_env_file.getbuffer().nbytes
job_env_file.seek(0)
tgz.addfile(job_env_info, job_env_file)


def repack_macos_junit_tar(workflow_conclusion, infile, outfile):
"""
Repacks JUnit tgz file from macOS Github Action run, so it would
contain correct job name and job URL.
"""
if workflow_conclusion == "cancelled" and not os.path.exists(infile):
print(f"Skipping repacking of JUnit tarball due to {workflow_conclusion} workflow")
return

with tarfile.open(infile) as infp, tarfile.open(outfile, "w:gz") as outfp, tempfile.TemporaryDirectory() as tempd:
infp.extractall(tempd)

# write the proper job url and job name
with open(os.path.join(tempd, JOB_ENV_FILE_NAME), "w") as fp:
fp.write(f'CI_JOB_URL={os.environ.get("CI_JOB_URL", "")}\n')
fp.write(f'CI_JOB_NAME={os.environ.get("CI_JOB_NAME", "")}')

# pack all files to a new tarball
for f in os.listdir(tempd):
outfp.add(os.path.join(tempd, f), arcname=f)
Loading