Created
June 3, 2016 10:05
-
-
Save hguemar/8e4929db2a28faedf94b713f4b4fb141 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -x | |
GH_API_KEY= | |
RPMF_HOST=review.rdoproject.org | |
[email protected] | |
GERRIT_USER=hguemar | |
GERRIT_PASS= | |
GERRIT_ADMIN_PASS= | |
PROJECT=$1 | |
UPSTREAM_PROJECT=${2:-$PROJECT} | |
SSH_KEY_FULL_NAME=/home/gerrit/.ssh/alias_gh_openstack_$PROJECT-distgit.key | |
./rdo-create.py --gerrit-password $GERRIT_PASS \ | |
--gerrit-user $GERRIT_USER \ | |
--gerrit-email $EMAIL \ | |
--gerrit-url https://$RPMF_HOST \ | |
--gerrit-admin-password $GERRIT_ADMIN_PASS \ | |
create --project-name openstack/$PROJECT \ | |
--upstream-url https://github.com/openstack/$UPSTREAM_PROJECT.git | |
SSH_KEY=$(./rdo-create-github.py --token $GH_API_KEY --org rdo-packages create \ | |
--name $PROJECT-distgit | awk '/to configure/ { print $2 }') | |
scp $SSH_KEY root@$RPMF_HOST:$SSH_KEY_FULL_NAME | |
ssh root@$RPMF_HOST chown gerrit:gerrit $SSH_KEY_FULL_NAME | |
ssh root@$RPMF_HOST chmod 0600 gerrit:gerrit $SSH_KEY_FULL_NAME | |
ssh root@$RPMF_HOST cat ">>" /home/gerrit/.ssh/config <<EOF | |
Host "alias_gh_openstack_$PROJECT-distgit" | |
Hostname github.com | |
IdentityFile ~/.ssh/alias_gh_openstack_$PROJECT-distgit.key | |
PreferredAuthentications publickey | |
StrictHostKeyChecking no | |
EOF | |
ssh root@$RPMF_HOST cat ">>" /home/gerrit/site_path/etc/replication.config <<EOF | |
[remote "openstack_$PROJECT-distgit"] | |
url = git@alias_gh_openstack_$PROJECT-distgit:rdo-packages/$PROJECT-distgit.git | |
projects = openstack/$PROJECT-distgit | |
EOF | |
ssh root@$RPMF_HOST systemctl restart gerrit | |
ssh root@$RPMF_HOST tailf /home/gerrit/site_path/logs/replication_log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment