Skip to content
Draft
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
3 changes: 0 additions & 3 deletions .gitlab/.pre/common/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
.setup_github_token_write:
- export GITHUB_TOKEN=$(dd-octo-sts token --scope DataDog/datadog-agent --policy self.gitlab.write)

.setup_github_ci_platform_machine_images_token:
- export GITHUB_TOKEN=$(dd-octo-sts token --scope ddoghq/ci-platform-machine-images --policy self.datadog-agent.trigger-agent-bump)

# Sets up a cache for gems used by Omnibus
# Usage:
# !reference [.cache_omnibus_ruby_deps, setup] somewhere ahead of invoking bundle
Expand Down
1 change: 0 additions & 1 deletion .gitlab/JOBOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ deploy_containers-secret-generic-connector* @DataDog/fleet-automation
# Trigger release
trigger_manual_prod_release* @DataDog/agent-delivery
trigger_auto_staging_release* @DataDog/agent-delivery
generate_windows_gitlab_runner_bump_pr* @DataDog/agent-delivery

# Trigger distribution
trigger_distribution* @DataDog/agent-delivery
Expand Down
40 changes: 0 additions & 40 deletions .gitlab/distribute/trigger_release/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,43 +53,3 @@ trigger_manual_prod_release:
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+-v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+){0,1}$/
when: never
- !reference [.on_deploy_stable_or_beta_manual_auto_on_stable]

generate_windows_gitlab_runner_bump_pr:
stage: trigger_release
image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX
needs: ["trigger_auto_staging_release"]
tags: ["arch:arm64", "specific:true"]
extends: .dd_octo_sts
rules:
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+-v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+){0,1}$/
when: never
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$/
before_script:
- !reference [.setup_github_ci_platform_machine_images_token]
script:
# We are using the agent platform auto PR github app to access the ci-platform-machine-images repository
- dda self dep sync -f legacy-tasks
- $S3_CP_CMD $S3_ARTIFACTS_URI/agent-version.cache .
- SLACK_DATADOG_AGENT_BOT_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SLACK_AGENT token) || exit $?; export SLACK_DATADOG_AGENT_BOT_TOKEN
- dda inv -- -e github.update-windows-runner-version

# Manual job to generate the gitlab bump pr on ci-platform-machine-images if trigger_auto_staging_release fails
generate_windows_gitlab_runner_bump_pr_manual:
stage: trigger_release
image: registry.ddbuild.io/ci/datadog-agent-buildimages/linux$CI_IMAGE_LINUX_SUFFIX:$CI_IMAGE_LINUX
needs: ["trigger_auto_staging_release"]
tags: ["arch:arm64", "specific:true"]
extends: .dd_octo_sts
rules:
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+-v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+){0,1}$/
when: never
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$/
when: manual
before_script:
- !reference [.setup_github_ci_platform_machine_images_token]
script:
# We are using the agent platform auto PR github app to access the ci-platform-machine-images repository
- dda self dep sync -f legacy-tasks
- $S3_CP_CMD $S3_ARTIFACTS_URI/agent-version.cache .
- SLACK_DATADOG_AGENT_BOT_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SLACK_AGENT token) || exit $?; export SLACK_DATADOG_AGENT_BOT_TOKEN
- dda inv -- -e github.update-windows-runner-version
69 changes: 0 additions & 69 deletions tasks/github_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
from invoke.exceptions import Exit
from invoke.tasks import task

from tasks.libs.ciproviders.github_actions_tools import (
download_artifacts,
download_with_retry,
follow_workflow_run,
print_failed_jobs_logs,
print_workflow_conclusion,
trigger_windows_bump_workflow,
)
from tasks.libs.common.color import Color, color_message
from tasks.libs.common.datadog_api import send_event
from tasks.libs.owners.linter import (
Expand All @@ -27,55 +19,11 @@
)
from tasks.libs.owners.parsing import read_owners
from tasks.libs.pipeline.notifications import DEFAULT_SLACK_CHANNEL, GITHUB_SLACK_MAP
from tasks.libs.releasing.version import current_version
from tasks.libs.types.types import PermissionCheck

ALL_TEAMS = '@datadog/agent-community-eng'


def _update_windows_runner_version(new_version=None, repo="ci-platform-machine-images"):
if new_version is None:
raise Exit(message="workflow needs the 'new_version' field value to be not None")
args_per_repo = {
"ci-platform-machine-images": {
"workflow_name": "windows-runner-agent-bump.yml",
"github_action_ref": "main",
},
}

run = trigger_windows_bump_workflow(
repo=repo,
workflow_name=args_per_repo[repo]["workflow_name"],
github_action_ref=args_per_repo[repo]["github_action_ref"],
new_version=new_version,
)
full_repo = f"ddoghq/{repo}"
workflow_conclusion, workflow_url = follow_workflow_run(run, full_repo, 0.5)

if workflow_conclusion != "success":
if workflow_conclusion == "failure":
print_failed_jobs_logs(run)
return workflow_conclusion

print_workflow_conclusion(workflow_conclusion, workflow_url)

download_with_retry(download_artifacts, run, ".", 3, 5, full_repo)

with open("PR_URL_ARTIFACT") as f:
PR_URL = f.read().strip()

if not PR_URL:
raise Exit(message="Failed to fetch artifact from the workflow. (Empty artifact)")

message = f":robobits: A new windows-runner bump PR to {new_version} has been generated. Please take a look :frog-review:\n:pr: {PR_URL} :ty:"

from slack_sdk import WebClient

client = WebClient(token=os.environ["SLACK_DATADOG_AGENT_BOT_TOKEN"])
client.chat_postMessage(channel="ci-infra-support", text=message)
return workflow_conclusion


@task
def is_pr_ready(ctx, git_ref: str, target_branch: str | None = None):
"""Exit with code 0 if the PR for the given branch exists and is ready (not draft), 1 otherwise.
Expand All @@ -98,23 +46,6 @@ def is_pr_ready(ctx, git_ref: str, target_branch: str | None = None):
print(color_message(f"PR for branch {git_ref!r} is ready", "green"))


@task
def update_windows_runner_version(
ctx,
new_version=None,
):
"""
Trigger a workflow on the ci-platform-machine-images repository to bump windows gitlab runner
"""
if new_version is None:
new_version = str(current_version(ctx, "7"))

repo = "ci-platform-machine-images"
conclusion = _update_windows_runner_version(new_version, repo)
if conclusion != "success":
raise Exit(message=f"Windows runner bump workflow {conclusion} for {repo}", code=1)


@task
def lint_codeowner(ctx, owners_file=".github/CODEOWNERS"):
"""
Expand Down
235 changes: 0 additions & 235 deletions tasks/libs/ciproviders/github_actions_tools.py

This file was deleted.

Loading
Loading