X-Git-Url: https://gerrit.nordix.org/gitweb?a=blobdiff_plain;f=jjb%2Fopendaylight%2Fpush-upstream-jobs.sh;h=19bfc4edaf11f163c1123d797acccff2210b82b2;hb=9610398296d99e9e6abeeb98a1ab1c3e950b239f;hp=a7122ab8e5bc2d3129d02318660b91b0ddc3581b;hpb=a2b190c0e73453a7e9f948aa14a486f735117755;p=infra%2Fcicd.git diff --git a/jjb/opendaylight/push-upstream-jobs.sh b/jjb/opendaylight/push-upstream-jobs.sh index a7122ab8e..19bfc4eda 100755 --- a/jjb/opendaylight/push-upstream-jobs.sh +++ b/jjb/opendaylight/push-upstream-jobs.sh @@ -23,8 +23,7 @@ # and push it, and all its ancestor commit till $GERRIT_BRANCH, to OpenDaylight # Gerrit. # Pre-requisites for script to run successfully: -# - The Gerrit username in Nordix needs to match with the Gerrit username in -# OpenDaylight +# - Author name in Nordix Gerrit equals LFID i.e. need to run "git config --global user.name " # - infra public key on build server needs to be added to your users SSH # Public Keys in OpenDaylight Gerrit # @@ -43,13 +42,25 @@ commit_hash="$GERRIT_PATCHSET_REVISION" # GERRIT_PROJECT is in the form of opendaylight/ opendaylight_project=$(echo "$GERRIT_PROJECT" | cut -d/ -f2- ) +# original way to get user name based on nordix id replaced by method below # Nordix Gerrit can map the email address of the user pushed the change to # the review to the Gerrit username of the account in Nordix Gerrit. This # should match with the Gerrit username in the OpenDaylight Gerrit. -username=$( - curl -s -H 'Accept: application/json' \ - "$nordix_gerrit_rest/accounts/?q=email:$GERRIT_EVENT_ACCOUNT_EMAIL&o=DETAILS" \ - | tee /dev/stderr | tail -1 | jq -r '.[0].username') +#username=$( +# curl -s -H 'Accept: application/json' \ +# "$nordix_gerrit_rest/accounts/?q=email:$GERRIT_EVENT_ACCOUNT_EMAIL&o=DETAILS" \ +# | tee /dev/stderr | tail -1 | jq -r '.[0].username') + +# read user name from the commit details which allows nordix user name to be different to lfid +username=$(git show -s --pretty=%an) + +pattern=" " +if [[ "$username" =~ $pattern ]] +then + echo "Incorrect username, use Linux Foundation ID as git user.name when pushing to Nordix" + echo "Use command git config --global user.name " + exit 1 +fi opendaylight_remote_url="ssh://$username@$opendaylight_gerrit_base/$opendaylight_project"