Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a43d52e5
Commit
a43d52e5
authored
Jun 11, 2018
by
James Ramsay
Committed by
James Ramsay
Jun 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use regex to whitelist branches to proxy
parent
90205cc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
doc/workflow/repository_mirroring.md
doc/workflow/repository_mirroring.md
+4
-9
No files found.
doc/workflow/repository_mirroring.md
View file @
a43d52e5
...
@@ -333,8 +333,7 @@ A sample `pre-recieve` hook is provided below.
...
@@ -333,8 +333,7 @@ A sample `pre-recieve` hook is provided below.
#!/usr/bin/env bash
#!/usr/bin/env bash
# --- Assume only one push mirror target
# --- Assume only one push mirror target
# Push mirroring remotes are named `remote_mirror_<id>`, this finds the first
# Push mirroring remotes are named `remote_mirror_<id>`, this finds the first remote and uses that.
# remote and uses that.
TARGET_REPO
=
$(
git remote |
grep
-m
1 remote_mirror
)
TARGET_REPO
=
$(
git remote |
grep
-m
1 remote_mirror
)
proxy_push
()
proxy_push
()
...
@@ -344,14 +343,14 @@ proxy_push()
...
@@ -344,14 +343,14 @@ proxy_push()
NEWREV
=
$(
git rev-parse
$2
)
NEWREV
=
$(
git rev-parse
$2
)
REFNAME
=
"
$3
"
REFNAME
=
"
$3
"
# --- TODO: only mirror protected branches
# --- Pattern of branches to proxy pushes
whitelisted
=
$(
expr
"
$branch
"
:
"
\(
master
\)
"
)
case
"
$refname
"
in
case
"
$refname
"
in
refs/heads/
*
)
refs/heads/
*
)
branch
=
$(
expr
"
$refname
"
:
"refs/heads/
\(
.*
\)
"
)
branch
=
$(
expr
"
$refname
"
:
"refs/heads/
\(
.*
\)
"
)
sandboxbranch
=
$(
expr
"
$branch
"
:
"
\(
sandbox/.*
\)
"
)
if
[
"
$
sandboxbranch
"
!
=
"
$branch
"
]
;
then
if
[
"
$
whitelisted
"
=
"
$branch
"
]
;
then
error
=
"
$(
git push
--quiet
$TARGET_REPO
$NEWREV
:
$REFNAME
2>&1
)
"
error
=
"
$(
git push
--quiet
$TARGET_REPO
$NEWREV
:
$REFNAME
2>&1
)
"
fail
=
$?
fail
=
$?
...
@@ -365,10 +364,6 @@ proxy_push()
...
@@ -365,10 +364,6 @@ proxy_push()
fi
fi
fi
fi
;;
;;
refs/tags/
*
)
tag
=
$(
expr
"
$refname
"
:
"refs/tags/
\(
.*
\)
"
)
# --- TODO: handle tags
;;
esac
esac
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment