Skip to content

Commit

Permalink
[CI] Rename codecov invoke task
Browse files Browse the repository at this point in the history
  • Loading branch information
amenasria committed Jun 19, 2024
1 parent 783d38c commit f82c05f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitlab/source_test/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
- inv -e test $FLAVORS --include-sds --race --profile --rerun-fails=2 --python-runtimes "$PYTHON_RUNTIMES" --coverage --cpus $KUBERNETES_CPU_REQUEST $EXTRA_OPTS --save-result-json $TEST_OUTPUT_FILE --junit-tar "junit-${CI_JOB_NAME}.tgz" --build-stdlib $FAST_TESTS_FLAG --test-washer
# Upload coverage files to Codecov. Never fail on coverage upload.
- export CODECOV_TOKEN=$($CI_PROJECT_DIR/tools/ci/aws_ssm_get_wrapper.sh $CODECOV_TOKEN_SSM_NAME)
- inv -e codecov $COVERAGE_CACHE_FLAG --debug || true
- inv -e coverage.upload-to-codecov $COVERAGE_CACHE_FLAG || true
- inv -e gitlab.generate-ci-visibility-links --output=$EXTERNAL_LINKS_PATH
artifacts:
expire_in: 2 weeks
Expand Down
6 changes: 2 additions & 4 deletions tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
cluster_agent,
cluster_agent_cloudfoundry,
components,
coverage,
cws_instrumentation,
devcontainer,
diff,
Expand Down Expand Up @@ -51,7 +52,6 @@
vscode,
)
from tasks.build_tags import audit_tag_impact, print_default_build_tags
from tasks.codecov import apply_missing_coverage, codecov, upload_coverage_to_s3
from tasks.components import lint_components, lint_fxutil_oneshot_test
from tasks.custom_task.custom_task import custom__call__
from tasks.fuzz import fuzz
Expand Down Expand Up @@ -102,9 +102,6 @@

# add single tasks to the root
ns.add_task(test)
ns.add_task(codecov)
ns.add_task(upload_coverage_to_s3)
ns.add_task(apply_missing_coverage)
ns.add_task(integration_tests)
ns.add_task(deps)
ns.add_task(deps_vendored)
Expand Down Expand Up @@ -150,6 +147,7 @@
ns.add_collection(cluster_agent)
ns.add_collection(cluster_agent_cloudfoundry)
ns.add_collection(components)
ns.add_collection(coverage)
ns.add_collection(docs)
ns.add_collection(bench)
ns.add_collection(trace_agent)
Expand Down
4 changes: 1 addition & 3 deletions tasks/codecov.py → tasks/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __exit__(self, *_):


@task
def codecov(
def upload_to_codecov(
ctx: Context,
pull_coverage_cache: bool = False,
push_coverage_cache: bool = False,
Expand Down Expand Up @@ -143,7 +143,6 @@ def _get_coverage_cache_uri():
return f"{os.environ[BUCKET_CI_VAR]}/coverage-cache"


@task
def upload_coverage_to_s3(ctx: Context):
"""
Create an archive with all the coverage.out files from the inv test --coverage command.
Expand Down Expand Up @@ -174,7 +173,6 @@ def upload_coverage_to_s3(ctx: Context):
print(color_message(f'Successfully removed the local {COV_ARCHIVE_NAME}', Color.GREEN))


@task
def apply_missing_coverage(ctx: Context, from_commit_sha: str, debug: bool = False):
"""
Download the coverage cache archive from S3 for the given commit SHA
Expand Down
2 changes: 1 addition & 1 deletion tasks/gotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from tasks.agent import integration_tests as agent_integration_tests
from tasks.build_tags import compute_build_tags_for_flavor
from tasks.cluster_agent import integration_tests as dca_integration_tests
from tasks.codecov import PROFILE_COV, CodecovWorkaround
from tasks.coverage import PROFILE_COV, CodecovWorkaround
from tasks.devcontainer import run_on_devcontainer
from tasks.dogstatsd import integration_tests as dsd_integration_tests
from tasks.flavor import AgentFlavor
Expand Down
2 changes: 1 addition & 1 deletion tasks/winbuildscripts/unittests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if($err -ne 0){

# Upload coverage reports to Codecov
$Env:CODECOV_TOKEN=$(& "$UT_BUILD_ROOT\tools\ci\aws_ssm_get_wrapper.ps1" $Env:CODECOV_TOKEN_SSM_NAME)
& inv -e codecov $Env:COVERAGE_CACHE_FLAG --debug
& inv -e coverage.upload-to-codecov $Env:COVERAGE_CACHE_FLAG

$ErrorActionPreference = "Continue" # Ignore upload errors now, until we change the logic to ignore empty files in the upload script
$Env:DATADOG_API_KEY=$(& "$UT_BUILD_ROOT\tools\ci\aws_ssm_get_wrapper.ps1" $Env:API_KEY_ORG2_SSM_NAME)
Expand Down

0 comments on commit f82c05f

Please sign in to comment.