blob: e6c949988dffca429d684d65c3ae1e9bcd607074 [file] [log] [blame]
Copybara botca5ce642024-11-08 17:38:08 +01001load("test_repos_config", "test_origin_url", "test_destination_url")
2
3def export_workflow(name, description, mode, authoring_value, is_test):
4 if not is_test:
5 origin_url = "https://gerrit.avm99963.com/a/private/dotfiles"
6 destination_url = "https://gerrit.avm99963.com/a/dotfiles-external"
7 else:
8 origin_url = test_origin_url
9 destination_url = test_destination_url
10
11 core.workflow(
12 name = name,
13 description = description,
14 origin = git.origin(
15 url = origin_url,
16 ref = "HEAD",
17 submodules = "NO",
18 ),
19 destination = git.destination(
20 url = destination_url,
21 push = "main",
22 ),
23 mode = mode,
24
25 origin_files = glob(
26 ["**"],
27 exclude = [
28 # Internal README
29 "README.md",
30
31 # Internal (dummy) license
32 "LICENSE",
33
34 # SSH configuration (it only includes the configuration for some
35 # hosts I connect to, which I don't want to be public).
36 "private_dot_ssh/**",
37
38 # .gitreview file only used for the private/dotfiles repo for the
39 # `git review` tool (https://docs.opendev.org/opendev/git-review/).
40 ".gitreview",
41 ],
42 ),
43
44 authoring = authoring_value,
45
46 transformations = [
47 core.rename('README.public.md', 'README.md'),
48 core.rename('LICENSE.public', 'LICENSE'),
49 core.replace(
50 before="private/dotfiles",
51 after="dotfiles-external",
52 paths = glob(
53 ["**"],
54 exclude = [".copybara/**"],
55 ),
56 ),
57 core.replace(
58 before = "${internalCode}",
59 after = "",
60 multiline = True,
61 regex_groups = {
62 },
63 ),
64 metadata.remove_label('Change-Id'),
65 ],
66 )
67
68export_workflow(
69 name = "firstExport",
70 description = "Moves code from the private repo (the SoT) to the public one. NOTE: This must only be used for the first migration.",
71 mode = "SQUASH",
72 authoring_value = authoring.overwrite("Copybara bot <copybara-bot@avm99963.com>"),
73 is_test = False,
74)
75
76export_workflow(
77 name = "exportCommits",
78 description = "Moves code from the private repo (the SoT) to the public one.",
79 mode = "ITERATIVE",
80 authoring_value = authoring.pass_thru("Copybara bot <copybara-bot@avm99963.com>"),
81 is_test = False,
82)
83
84# Local tests workflows
85export_workflow(
86 name = "firstExportTest",
87 description = "Test locally the first migration from the private repo to the public one. See README.md for more details.",
88 mode = "SQUASH",
89 authoring_value = authoring.overwrite("Copybara bot <copybara-bot@avm99963.com>"),
90 is_test = True,
91)
92
93export_workflow(
94 name = "exportCommitsTest",
95 description = "Test locally the migration from the private repo to the public one. See README.md for more details.",
96 mode = "ITERATIVE",
97 authoring_value = authoring.pass_thru("Copybara bot <copybara-bot@avm99963.com>"),
98 is_test = True,
99)
100
101# vim: set ft=bzl: