diff --git a/.gitlab/source_test/macos.yml b/.gitlab/source_test/macos.yml index d20acf5ffb6f02..efe673b5da86ea 100644 --- a/.gitlab/source_test/macos.yml +++ b/.gitlab/source_test/macos.yml @@ -27,3 +27,22 @@ tests_macos: - junit-*-repacked.tgz reports: junit: "**/junit-out-*.xml" + +lint_macos: + stage: source_test + rules: + !reference [.on_a6] + image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES + tags: ["arch:amd64"] + variables: + PYTHON_RUNTIMES: '3' + script: + - source /root/.bashrc + - export GITHUB_KEY_B64=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.macos_github_key_b64 --with-decryption --query "Parameter.Value" --out text) + - export GITHUB_APP_ID=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.macos_github_app_id --with-decryption --query "Parameter.Value" --out text) + - export GITHUB_INSTALLATION_ID=$(aws ssm get-parameter --region us-east-1 --name ci.datadog-agent.macos_github_installation_id --with-decryption --query "Parameter.Value" --out text) + - $S3_CP_CMD $S3_ARTIFACTS_URI/agent-version.cache . + - export VERSION_CACHE_CONTENT=$(cat agent-version.cache | base64 -) + - !reference [.setup_python_mirror_linux] + - python3 -m pip install -r tasks/libs/requirements-github.txt + - inv -e github.trigger-macos-lint --datadog-agent-ref "$CI_COMMIT_SHA" --python-runtimes "$PYTHON_RUNTIMES" --version-cache "$VERSION_CACHE_CONTENT" diff --git a/tasks/github_tasks.py b/tasks/github_tasks.py index 26832abda6927a..e2a7815ebbfff5 100644 --- a/tasks/github_tasks.py +++ b/tasks/github_tasks.py @@ -14,7 +14,7 @@ from .utils import DEFAULT_BRANCH -def _trigger_macos_workflow(release, destination, retry_download, retry_interval, **kwargs): +def _trigger_macos_workflow(release, destination=None, retry_download=0, retry_interval=0, **kwargs): github_action_ref = _get_release_json_value(f'{release}::MACOS_BUILD_VERSION') run = trigger_macos_workflow( @@ -29,7 +29,8 @@ def _trigger_macos_workflow(release, destination, retry_download, retry_interval print_workflow_conclusion(workflow_conclusion, workflow_url) - download_with_retry(download_artifacts, run, destination, retry_download, retry_interval) + if destination: + download_with_retry(download_artifacts, run, destination, retry_download, retry_interval) if workflow_conclusion != "success": raise Exit(code=1) @@ -91,6 +92,23 @@ def trigger_macos_test( ) +@task +def trigger_macos_lint( + _, + datadog_agent_ref=DEFAULT_BRANCH, + release_version="nightly-a7", + python_runtimes="3", + version_cache=None, +): + _trigger_macos_workflow( + release_version, + workflow_name="lint.yaml", + datadog_agent_ref=datadog_agent_ref, + python_runtimes=python_runtimes, + version_cache_file_content=version_cache, + ) + + @task def lint_codeowner(_): """