Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test copybara export pr #3308

Open
wants to merge 12 commits into
base: raine/copybara-test
Choose a base branch
from
Open
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
64 changes: 64 additions & 0 deletions .buildkite/scripts/copy.bara.sky
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This is a configuration file for Copybara that defines the workflow for syncing changes between the OSS and monorepo.

MONOREPO_URL = "[email protected]:squareup/cash-server.git"
OSS_REPO_URL = "[email protected]:cashapp/misk.git"

MONOREPO_BRANCH = "raine/misk-copybara" #main
OSS_REPO_BRANCH = "raine/copybara-test" #master

MONOREPO_INCLUDES = ["misk/**"]
MONOREPO_EXCLUDES = ["misk/copy.bara.sky", "misk/.buildkite/*"]

OSS_REPO_INCLUDES = ["**"]
OSS_REPO_EXCLUDES = []

transforms = [
core.move("", "misk", glob(["**"])),
]

author = authoring.pass_thru("CashApp Copybara <[email protected]>")

# Push changes from the monorepo to the OSS repo
core.workflow(
name = "push",
origin = git.origin(
url = MONOREPO_URL,
ref = MONOREPO_BRANCH,
),
origin_files = glob(MONOREPO_INCLUDES, exclude = MONOREPO_EXCLUDES),

destination = git.destination(
url = OSS_REPO_URL,
push = OSS_REPO_BRANCH,
),
destination_files = glob(OSS_REPO_INCLUDES, exclude = OSS_REPO_EXCLUDES),
mode = "ITERATIVE",
authoring = author,
transformations = [
metadata.restore_author("ORIGINAL_AUTHOR", search_all_changes = True),
#used when a PR is created in the OSS and we want to do a fake-merge
metadata.expose_label("COPYBARA_INTEGRATE_REVIEW"),
] + core.reverse(transforms),
)

# Pull changes from the OSS to the monorepo (This is just for reference, the SoT is the monorepo)
core.workflow(
name = "pull",
origin = git.origin(
url = OSS_REPO_URL,
ref = OSS_REPO_BRANCH,
),
origin_files = glob(OSS_REPO_INCLUDES, exclude = OSS_REPO_EXCLUDES),

destination = git.destination(
url = MONOREPO_URL,
push = MONOREPO_BRANCH,
),
destination_files = glob(MONOREPO_INCLUDES, exclude = MONOREPO_EXCLUDES),
mode = "ITERATIVE",
authoring = author,
transformations = [
metadata.restore_author("ORIGINAL_AUTHOR", search_all_changes = True),
metadata.expose_label("COPYBARA_INTEGRATE_REVIEW"),
] + transforms,
)
27 changes: 27 additions & 0 deletions .buildkite/scripts/run_copybara
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -eo pipefail

# Check if the workflow name is provided
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <run_copybara workflow_name>"
exit 1
fi

WORKFLOW=$1
echo "Running Copybara migration $WORKFLOW"
../bin/copybara .buildkite/scripts/copy.bara.sky $WORKFLOW --git-committer-name Copybara \
--git-committer-email [email protected] -v || status=$?

echo "Copybara returned status: ${status:-0}"
# Check the exit status
if [[ "$status" -eq 4 ]]; then
echo "Copybara finished without changes made to the OSS repository."
exit 0
elif [[ "$status" -ne 0 ]]; then
echo "Copybara failed with status $status."
exit $status
else
echo "Copybara migration successful."
exit 0
fi
1 change: 1 addition & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- raine/copybara-test
paths-ignore:
- "docs/**"
- "*.md"
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ misk-hibernate tests expect a mysql server running on `localhost:3306` with no p
the root user. You might stand up a server with a docker image, e.g.

```shell
docker run -d --rm --name "mysql-57" -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_LOG_CONSOLE=true mysql:5.7 --sql-mode=""
docker run -d --rm --name "mysql-57" -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_LOG_CONSOLE=true mysql:8.0.36 --sql-mode=""
```

Misk may download these Docker images as part of its tests. Because tests can time out, pre-downloading these can help resolve timeouts.
Expand Down
1 change: 1 addition & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This repository is set up with an automated workflow using GitHub Actions.

# Troubleshooting


While our release process is designed to be seamless, occasionally, issues may arise that require attention.
Here are some tips to help diagnose:

Expand Down
Loading