Skip to content

Commit

Permalink
Merge pull request #314 from rhmdnd/add-remote-detection-to-release-p…
Browse files Browse the repository at this point in the history
…rocess

Use remote detection in release process
  • Loading branch information
openshift-merge-robot authored Mar 7, 2023
2 parents 20eea34 + 0d3eb6e commit 59fe4dc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ endif

# Git options.
GIT_OPTS?=
# Set this to the remote used for the upstream repo (for release). Use an
# absolute reference since we don't know if origin is the contributor's fork or
# if it's the upstream repository.
GIT_REMOTE?=git@github.com:openshift/file-integrity-operator.git
# Set this to the remote used for the upstream repo (for release). Different
# maintainers might use different names for the upstream repository. Since our
# release process expects maintainers to propose release patches directly to
# the upstream repository, let's make sure we're proposing it to the right one.
# We rely on a bash script for this since it's simplier than interating over a
# list with conditionals in GNU make.
GIT_REMOTE?=$(shell ./utils/git-remote.sh)

# Image tag to use. Set this if you want to use a specific tag for building
# or your e2e tests.
Expand Down
16 changes: 16 additions & 0 deletions utils/git-remote.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# git-remote.sh prints the remote associated with the upstream
# openshift/file-integrity-operator repository. If it can't determine the
# appropriate remote based on a known URL, it defaults to using "origin", which
# is backwards compatible with the release process.

REMOTE_URL=origin
for REMOTE in `git remote`; do
URL=`git config --get remote.$REMOTE.url`
if [[ "$URL" = "https://github.com/openshift/file-integrity-operator" ]]; then
REMOTE_URL=$REMOTE
break
fi
done
echo $REMOTE_URL

0 comments on commit 59fe4dc

Please sign in to comment.