Skip to content

Commit

Permalink
[mq] working branch - merge c9b482b on top of main at 4b4112f
Browse files Browse the repository at this point in the history
{"baseBranch":"main","baseCommit":"4b4112f5f64d18c33cc15eb1bc8eccb603b71a93","createdAt":"2024-12-17T14:59:31.778582Z","headSha":"c9b482bfed9e80da854eb598310a7c12aa14e9a4","id":"0089f678-dfc7-4115-a46c-d0ab2d02fb9f","priority":"200","pullRequestNumber":"1306","queuedAt":"2024-12-17T14:59:31.777989Z","status":"STATUS_QUEUED"}
  • Loading branch information
dd-mergequeue[bot] authored Dec 17, 2024
2 parents 5563a73 + c9b482b commit c592eab
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,19 @@ bump-version-on-datadog-agent:
stage: post-release
image: ${CI_REGISTRY_IMAGE_TEST}:${CI_COMMIT_SHORT_SHA}
tags: ["arch:amd64"]
needs: ["release-runner-image"]
rules:
- if: $CI_COMMIT_BRANCH == "main"
needs: ["release-runner-image"]
when: on_success
- if: $CI_COMMIT_BRANCH =~ /^mq-working-branch-/
when: never
- when: manual
needs: ["build-runner-image"]
allow_failure: true
variables:
EXTRA_UPDATE_ARGS: "--is-dev-image"
variables:
EXTRA_UPDATE_ARGS: ""
before_script:
- set +x
- export GITHUB_APP_USER_ID=153269286 # Can be found on https://api.github.com/users/agent-platform-auto-pr[bot]
Expand All @@ -126,8 +135,9 @@ bump-version-on-datadog-agent:
- pushd datadog-agent
- git checkout -b auto-bump/bump-test-infra-$CI_COMMIT_SHORT_SHA
- export PREVIOUS_SHA=$(cat .gitlab/common/test_infra_version.yml | grep 'TEST_INFRA_DEFINITIONS_BUILDIMAGES:' | awk -F " " '{print $NF}')
- inv -e buildimages.update-test-infra-definitions --commit-sha $CI_COMMIT_SHA
- git add test/new-e2e/go.mod test/new-e2e/go.sum .gitlab/common/test_infra_version.yml
- inv -e buildimages.update-test-infra-definitions --commit-sha $CI_COMMIT_SHA $EXTRA_UPDATE_ARGS
- inv -e tidy
- git add -u
- git commit -m "[test-infra-definitions][automated] Bump test-infra-definitions to $CI_COMMIT_SHORT_SHA"
- git push -f origin auto-bump/bump-test-infra-$CI_COMMIT_SHORT_SHA
- popd
Expand Down
8 changes: 8 additions & 0 deletions tasks/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@

@task
def create_bump_pr_and_close_stale_ones_on_datadog_agent(ctx, branch: str, new_commit_sha: str, old_commit_sha: str):
is_dev_branch = False
if os.getenv("CI") != "true":
print("This task should only be run in CI")
return
if os.getenv("GITHUB_TOKEN") is None:
print("GITHUB_TOKEN is not set")
return
if os.getenv("CI_COMMIT_BRANCH") != "main":
print("Running on a dev branch")
is_dev_branch = True

repo = Github(auth=Auth.Token(os.environ["GITHUB_TOKEN"])).get_repo("DataDog/datadog-agent")
pr_body = f"""
Expand All @@ -36,6 +40,10 @@ def create_bump_pr_and_close_stale_ones_on_datadog_agent(ctx, branch: str, new_c

print(f"PR created: {new_pr.html_url}")

if is_dev_branch:
print("Skipping stale PRs check since this is a dev branch")
return

print("Looking for stale auto bump PRs...")

issues = repo.get_issues(state="open", labels=["automatic/test-infra-bump"])
Expand Down

0 comments on commit c592eab

Please sign in to comment.