Skip to content

Commit

Permalink
contrib: Support alternative orgs in get_remote
Browse files Browse the repository at this point in the history
This commit adds a optional positional argument to `get_remote` to allow
obtaining the remote of Cilium forks in other organizations than the
default `cilium` one.

Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
  • Loading branch information
gandro authored and aanm committed Feb 18, 2021
1 parent c7e2573 commit bbf5b20
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contrib/backporting/common.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright 2019 Authors of Cilium
# Copyright 2019-2021 Authors of Cilium
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,11 +18,12 @@ set -e

get_remote () {
local remote
local org=${1:-cilium}
remote=$(git remote -v | \
grep "github.com[/:]cilium/cilium" | \
grep "github.com[/:]${org}/cilium" | \
head -n1 | cut -f1)
if [ -z "$remote" ]; then
echo "No remote git@github.com:cilium/cilium.git or https://github.com/cilium/cilium found" 1>&2
echo "No remote git@github.com:${org}/cilium.git or https://github.com/${org}/cilium found" 1>&2
return 1
fi
echo "$remote"
Expand Down

0 comments on commit bbf5b20

Please sign in to comment.