Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F8424924
Add a file to every repo
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
Tgr
Jun 9 2017, 10:42 AM
2017-06-09 10:42:46 (UTC+0)
Size
1009 B
Referenced Files
None
Subscribers
None
Add a file to every repo
View Options
#!/bin/bash
FILE
=
/home/foo/file.ext
TASK
=
T12345
USER
=
foo
PASSWORD
=
s3cr3t
SKIP
=(
foo bar/boom baz
)
# space-delimited list
for
project in
`
curl -s https://gerrit.wikimedia.org/r/projects/?type
=
CODE
|
tail -n+2
|
jq --raw-output
'keys[]'
`
;
do
if
[[
"
${
SKIP
[@]
}
"
=
~
"
${
project
}
"
]]
;
then
continue
fi
dir
=
${
project
//
\/
/_
}
filename
=
`
basename
"
$FILE
"
`
repo
=
"https://
$USER
:
$PASS
@gerrit.wikimedia.org/r/a/
$project
"
mkdir
$dir
cd
$dir
echo
"==>
$project
"
git clone --depth
1
$repo
.
||
{
cd
..
&&
echo
"**ERROR*** in
$project
"
;
continue
;
}
if
[[
-f
$FILE
]]
;
then
continue
fi
cp
"
$FILE
"
.
\
&&
git add
"
$filename
"
\
&&
git commit -m
'
Add '
"
$filename
"
'
Bug: '
$TASK
'
Change-Id: I'
`
cat /dev/urandom
|
base64
|
tr -dc
'a-f0-9'
|
head -c40
`
\
&&
git push
$repo
HEAD:refs/for/
`
git rev-parse --abbrev-ref HEAD
`
%topic
=
coc,submit
&&
cd
..
\
&&
rm -rf
$dir
\
||
{
cd
..
&&
echo
"**ERROR*** in
$project
"
;
}
done
;
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4702729
Default Alt Text
Add a file to every repo (1009 B)
Attached To
Mode
P5546 Add a file to every repo
Attached
Detach File
Event Timeline
Log In to Comment