Compare commits

...

4 Commits

Author SHA1 Message Date
Juan Gu
8e07c8f0a8 SERVER-83283 Modify copybara script to send slack message on failure (#17021)
GitOrigin-RevId: 95cb69586f2d7f5930c8f22ea8ec6b6617a94080
2023-11-21 00:28:10 +00:00
Juan Gu
10715f5f38 SERVER-83354 Schedule copybara instance after each commit made (#17020)
GitOrigin-RevId: f70b17b6ae151ab93e9133e30eea4d7bc09f2c47
2023-11-21 00:28:00 +00:00
Gregory Noma
45cb15ef20 SERVER-63865 Handle missing index idents during standalone startup recovery
(cherry picked from commit 0b5f72d6e2)

GitOrigin-RevId: 9ea3bde687924531047c52d5041e5d3c7073ace1
2023-11-21 00:27:50 +00:00
Juan Gu
68412d4c3b SERVER-83413 Turn on copybara sync (#17015)
GitOrigin-RevId: 03fc20a99533806b2c50a7874246d12243bea683
2023-11-21 00:27:39 +00:00
4 changed files with 28 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ from typing import Optional
from github import GithubIntegration
from buildscripts.util.read_config import read_config_file
from evergreen.api import RetryingEvergreenApi
def run_command(command): # noqa: D406,D407
@@ -73,6 +74,24 @@ def get_installation_access_token(app_id: int, private_key: str,
return None
def send_failure_message_to_slack(expansions):
"""
Send a failure message to a specific Slack channel when the Copybara task fails.
:param expansions: Dictionary containing various expansion data.
"""
current_version_id = expansions.get("version_id", None)
error_msg = (
"Evergreen task '* Copybara Sync Between Repos' failed\n"
f"For more details: <https://spruce.mongodb.com/version/{current_version_id}|here>.")
evg_api = RetryingEvergreenApi.get_api(config_file=".evergreen.yml")
evg_api.send_slack_message(
target="#sdp-triager",
msg=error_msg,
)
def main():
"""Clone the Copybara repo, build its Docker image, and set up and run migrations."""
parser = argparse.ArgumentParser()
@@ -104,6 +123,7 @@ def main():
git_destination_url_with_token = f"https://x-access-token:{access_token_copybara_syncer}@github.com/mongodb/mongo.git"
# Set up the Docker command and execute it
# --last-rev Defines the last revision that was migrated to the destination during the initial synchronization between repositories using Copybara
docker_cmd = [
"docker run",
"-v ~/.ssh:/root/.ssh",
@@ -111,7 +131,7 @@ def main():
f'-v "{current_dir}/copybara.sky":/usr/src/app/copy.bara.sky',
"-e COPYBARA_CONFIG='copy.bara.sky'",
"-e COPYBARA_SUBCOMMAND='migrate'",
f"-e COPYBARA_OPTIONS='-v --git-destination-url={git_destination_url_with_token}'",
f"-e COPYBARA_OPTIONS='-v --last-rev=0dd92d9 --git-destination-url={git_destination_url_with_token}'",
"copybara copybara",
]
@@ -130,7 +150,8 @@ def main():
for acceptable_message in acceptable_error_messages):
return
raise
# Send a failure message to #sdp-triager if the Copybara sync task fails.
send_failure_message_to_slack(expansions)
if __name__ == "__main__":

View File

@@ -5339,6 +5339,7 @@ tasks:
- *git_get_project
- *set_task_expansion_macros
- *set_up_virtualenv
- func: "configure evergreen api credentials"
- command: expansions.write
params:
file: src/expansions.yml
@@ -12483,9 +12484,10 @@ buildvariants:
modules:
- enterprise
display_name: "* Copybara Sync Between Repos"
cron: "0 4 * * *" # From the ${project_nightly_cron} parameter.
activate: true
run_on:
- ubuntu2204-small
stepback: false
tasks:
- name: sync_repo_with_copybara
priority: 50

View File

@@ -1,5 +1,5 @@
click ~= 7.0
dataclasses; python_version < "3.7"
GitPython ~= 3.1.7
pydantic ~= 1.7.3
pydantic ~= 1.8.2
structlog ~= 19.2.0

View File

@@ -1,5 +1,5 @@
PyKMIP == 0.4.0 # It's now 0.8.0. We're far enough back to have API conflicts.
evergreen.py == 2.1.0
evergreen.py == 3.1.0
jinja2 <= 2.11.3
MarkupSafe == 1.1.0 # See SERVER-57036, this is a transitive dependency of jinja2
mock <= 4.0.3