SERVER-90928 Remove lines other than commit title from syncing (#22589)
# Issue
Remove lines other than commit title from syncing
# Description
SERVER-90928 Remove lines other than commit title from syncing to the
public repo
# Testing
This was tested locally. I tested on the commits in this PR and it seems
to be synced correctly. The staging file I used was
```
# This configuration is for migrating code from one Git repository to another using Copybara.
# It selectively copies content, excluding specific paths and preserving authorship.
# To test locally
sourceUrl = "/Users/alexander.neben/workspace/mongo2"
destinationUrl = "/Users/alexander.neben/workspace/mongodb-mongo"
# sourceUrl = "git@github.com:10gen/mongo.git"
# destinationUrl = "git@github.com:10gen/mongo-copybara.git"
core.workflow(
name = "default",
origin = git.origin(
url = sourceUrl,
ref = "IamXander/prune_commit",
),
destination = git.destination(
url = destinationUrl,
fetch = "IamXander/prune_commit",
push = "IamXander/prune_commit",
),
# Change path to the folder you want to publish publicly
origin_files = glob(["**"], exclude = ["src/mongo/db/modules/**"]),
authoring = authoring.pass_thru("MongoDB <mongodb@mongodb.com>"),
mode = "ITERATIVE",
# Change the path here to the folder you want to publish publicly
transformations = [
metadata.scrubber("(^.*?)\n((\n|.)*)", replacement = "$1"),
],
)
```
Running git log on `/Users/alexander.neben/workspace/mongodb-mongo`
returns the following
```
commit 8a4879557893ae942f793ad707d56e255bebc72d (HEAD -> IamXander/prune_commit)
Author: Alex Neben <alex.neben@mongodb.com>
Date: Tue May 28 08:55:38 2024 -0700
fixes
GitOrigin-RevId: 3ffa6b95d44ec3fef7e715a3f24652966861f4e1
commit 66cdb3631be92ced2123c7e3fab39e24bed91b2b
Author: Alex Neben <alex.neben@mongodb.com>
Date: Tue May 28 08:50:07 2024 -0700
SERVER-90928 Remove lines other than commit title from syncing
GitOrigin-RevId: 7d90f0f69a17943fb68ba23e2f135d08c00c4943
commit 0063834a4fa519727cc6b816995ea56d9b3328fe
Author: Alex Neben <alex.neben@mongodb.com>
Date: Tue May 28 08:12:24 2024 -0700
SERVER-XYZ asdasdkjfhaskdf akjdhkjashdkjashd example
GitOrigin-RevId: 298831cd1d55319ea368fdd2f1dc604368d94889
commit fc7f29486d762a740c3ebe01c3b7d69a477abe75
Author: Alex Neben <alex.neben@mongodb.com>
Date: Fri May 24 13:55:21 2024 -0700
prune commit message
GitOrigin-RevId: 43692434bf664fe593ee7eb5f53372ca331ecec9
```
Which shows no data after the newline. It also does not include
enterprise code.
GitOrigin-RevId: f78828e412e3ac510c6e56feb541146c688b7603
This commit is contained in:
committed by
MongoDB Bot
parent
f5fa7bc707
commit
73c2d9e977
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -21,7 +21,7 @@ OWNERS.yml @IamXander
|
||||
.pylintrc @10gen/devprod-build @10gen/devprod-correctness
|
||||
.style.yapf @10gen/devprod-build @10gen/devprod-correctness
|
||||
BUILD.bazel @10gen/devprod-build
|
||||
copybara.sky @IamXander
|
||||
copy.bara.sky @IamXander
|
||||
copybara.staging.sky @10gen/devprod-correctness
|
||||
jsconfig.json @10gen/devprod-correctness
|
||||
package.json @10gen/devprod-correctness
|
||||
|
||||
@@ -47,7 +47,7 @@ filters:
|
||||
- "BUILD.bazel":
|
||||
approvers:
|
||||
- 10gen/devprod-build
|
||||
- "copybara.sky":
|
||||
- "copy.bara.sky":
|
||||
approvers:
|
||||
- IamXander
|
||||
- "copybara.staging.sky":
|
||||
|
||||
@@ -342,6 +342,11 @@ def main():
|
||||
else:
|
||||
run_command("git clone https://github.com/10gen/copybara.git")
|
||||
|
||||
# Pin to a specific commit
|
||||
# This commit is arbitrary and could be updated however, once updated we should confirm it works
|
||||
# rather than just letting copybara roll under our feet
|
||||
run_command("git reset --hard e346cf9d3dcc49dedbf7209060099290a114031e")
|
||||
|
||||
# Navigate to the Copybara directory and build the Copybara Docker image
|
||||
run_command("cd copybara && docker build --rm -t copybara .")
|
||||
|
||||
@@ -358,7 +363,7 @@ def main():
|
||||
create_mongodb_bot_gitconfig()
|
||||
|
||||
current_dir = os.getcwd()
|
||||
config_file = f"{current_dir}/copybara.sky"
|
||||
config_file = f"{current_dir}/copy.bara.sky"
|
||||
git_destination_url_with_token = (
|
||||
f"https://x-access-token:{access_token_copybara_syncer}@github.com/mongodb/mongo.git"
|
||||
)
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# This configuration is for migrating code from one Git repository to another using Copybara.
|
||||
# It selectively copies content, excluding specific paths and preserving authorship.
|
||||
|
||||
# To test locally
|
||||
# sourceUrl = "/path/to/source"
|
||||
# destinationUrl = "/path/to/dest"
|
||||
|
||||
sourceUrl = "git@github.com:10gen/mongo.git"
|
||||
destinationUrl = "git@github.com:mongodb/mongo.git"
|
||||
|
||||
@@ -8,7 +13,6 @@ core.workflow(
|
||||
origin = git.origin(
|
||||
url = sourceUrl,
|
||||
ref = "master",
|
||||
# VersionSelector
|
||||
),
|
||||
destination = git.destination(
|
||||
url = destinationUrl,
|
||||
@@ -20,7 +24,11 @@ core.workflow(
|
||||
authoring = authoring.pass_thru("MongoDB <mongodb@mongodb.com>"),
|
||||
mode = "ITERATIVE",
|
||||
# Change the path here to the folder you want to publish publicly
|
||||
# transformations = [
|
||||
# core.move("path/to/folder/you/want/exported", ""),
|
||||
# ],
|
||||
transformations = [
|
||||
# (^.*?) - matches the first line (without the newline char)
|
||||
# \n - matches the first newline (or nothing at all if there is no newline). If there is no match then nopthing happens
|
||||
# ((\n|.)*) - matches everything after
|
||||
# Overall, this copies only the first line of the commit rather than the body
|
||||
metadata.scrubber("(^.*?)\n((\n|.)*)", replacement = "$1"),
|
||||
],
|
||||
)
|
||||
Reference in New Issue
Block a user