Hello,
i have the following scenario. I want to sync our internal bitbucket repo with an external public github repo and migrate pull requests from public github repo to our internal bitbucket repo. But I don’t want to sync all the stuff from internal repo to outside (we have some interal dirs which I do not want to sync to public) Source of truth will be the internal repo.
Following repo structure:
Internal bitbucketrepo a.git:
private/somefile
public/somefilesA
public/somefilesB
public githubrepo a.git: (everything from interal public will be moved to .)
somefilesA
somefilesB
here is my initial sync sky file and command for private -> public initial sync
* docker run -e COPYBARA_CONFIG='copy.bara.sky' -e COPYBARA_OPTIONS='--force' -v ~/.ssh:/root/.ssh -v ~/.gitconfig:/root/.gitconfig -v "$(pwd)":/usr/src/app -it copybara copybara
--
# Update these references to your orginzations repos
sourceUrl = "ssh://g...@bitbucket.xxx/a.git"
destinationUrl = "g...@github.com:some_user/a.git"
core.workflow(
name = "default",
#mode="ITERATIVE",
origin = git.origin(
url = sourceUrl,
ref = "master",
),
destination = git.destination(
url = destinationUrl,
fetch = "master",
push = "master",
),
# Change path to the folder you want to publish publicly
origin_files = glob(["public/**"]),
authoring = authoring.pass_thru("a.d. <a.d.@someurl.com>"),
# Change the path here to the folder you want to publish publicly
transformations = [
core.move("public", ""),
],
)
--
here is my integrate sky file and command for private -> public migration
* docker run -e COPYBARA_CONFIG='copy.bara.sky' -v ~/.ssh:/root/.ssh -v ~/.gitconfig:/root/.gitconfig -v "$(pwd)":/usr/src/app -it copybara copybara
--
sourceUrl = "ssh://g...@bitbucket.xxx/a.git"
destinationUrl = "g...@github.com:some_user/a.git"
core.workflow(
name = "default",
mode="ITERATIVE",
origin = git.origin(
url = sourceUrl,
ref = "master",
),
destination = git.destination(
url = destinationUrl,
fetch = "master",
push = "master",
),
# Change path to the folder you want to publish publicly
origin_files = glob(["public/**"]),
authoring = authoring.pass_thru("a.d. <a.d.@someurl.com>"),
# Change the path here to the folder you want to publish publicly
transformations = [
core.move("public", ""),
],
)
--
And now this should do the PR stuff from public github to private bitbucket repo
(all sync stuff from previous is fine, so I created a PR and try to integrate it in my repo)
BUT if I run this command everything get’s deleted in my private repo except the changes in public folder.
(the PR contains only one change in the file ‘somefilesA’)
docker run -e COPYBARA_CONFIG='copy.bara.sky' -e COPYBARA_SOURCEREF='1' -v ~/.ssh:/root/.ssh -v ~/.gitconfig:/root/.gitconfig -v "$(pwd)":/usr/src/app -it copybara copybara
--
sourceUrl = "g...@github.com:some_user/a.git"
destinationUrl = "ssh://g...@bitbucket.xxx/a.git"
core.workflow(
name = "default",
origin = git.github_pr_origin(
url = sourceUrl,
use_merge = True,
),
destination = git.destination(
url = destinationUrl,
fetch = "master",
push = "master",
integrates = []
),
mode = "CHANGE_REQUEST",
set_rev_id = False,
# Change path to the folder you want to publish publicly
origin_files = glob(["**"], exclude = ["private/**"]),
authoring = authoring.pass_thru("a.d. <a.d.@someurl.com>"),
transformations = [
metadata.save_author(),
metadata.expose_label("COPYBARA_INTEGRATE_REVIEW"),
metadata.expose_label("GITHUB_PR_NUMBER", new_name ="Closes", separator=" #"),
core.move("", "public")
],
)
--
What I’m doing wrong? For me it would be nice, that if I’m migrating a PR to the internal bitbucket, there also a PR will be created to verify it. I do not want to commit it directly to master. (but if isn’t possible, maybe bitbucket api missing, I prefere to commit the PR to a dedicated PR branch, maybe PR_1..) So how to I configure this PR merge from public to private correctly?
Thx! Andreas
--
You received this message because you are subscribed to the Google Groups "Copybara OSS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to copybara-discu...@googlegroups.com.
To post to this group, send email to copybara...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/copybara-discuss/0871d16d-55d3-41f6-a9b3-c44456a01a80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
authoring = authoring.pass_thru("a.d. <a....@someurl.com>"),
transformations = [metadata.save_author(),metadata.expose_label("COPYBARA_INTEGRATE_REVIEW"),metadata.expose_label("GITHUB_PR_NUMBER", new_name ="Closes", separator=" #"),core.move("", "public")],)
To view this discussion on the web visit https://groups.google.com/d/msgid/copybara-discuss/f0081132-d16f-41a8-8594-6ded06883a9a%40googlegroups.com.