Skip to content
Snippets Groups Projects
Commit 30a693d2 authored by Walter Lozano's avatar Walter Lozano Committed by Dylan Aïssi
Browse files

manage-repo: Allow functions to be called from gitlab.sh


This script severs as a collections of functions that are used by other
scripts, however, in some cases, some of these functions can be called
directly from command line. To make this use case simpler add a new script
which give access to the required functionality.

Adding a new wrapper script makes things less confusing, as it uses the
same approach that in other use cases, allowing to easy debug issues.

Signed-off-by: default avatarWalter Lozano <walter.lozano@collabora.com>
parent 20d5630a
No related branches found
No related tags found
1 merge request!230Improve gitlab.sh
......@@ -105,6 +105,21 @@ get-repo-triggers(){
}
merge-mr(){
# Merge a MR from a repo
set -e
usage () {
echo "Usage: merge-mr <package> <mr-id>" >&2
echo "" >&2
echo "Example: merge-mr libfoo 1" >&2
}
if [ "$#" -ne 2 ]; then
usage
exit 1
fi
repoid=$(get-id $1)
mr_id=$2
......@@ -133,3 +148,4 @@ trigger-pipeline(){
request=POST api /projects/$repoid/pipeline?ref=$ref
}
#!/bin/bash
## INFO
# Script should be run from the apertis-infrastructure/release-scripts
set -e
BASEDIR=`dirname $0`
. $BASEDIR/gitlab.sh
usage(){
>&2 echo "Usage: manage-repo [get-repo-head|merge-mr|trigger-pipeline]"
>&2 echo "Example: manage-repo merge-mr libfoo 1"
}
if [ "$#" -eq 0 ]; then
usage
exit 1
fi
COMMAND=$1
shift 1
case $COMMAND in
get-repo-head)
get-repo-head $@
;;
merge-mr)
merge-mr $@
;;
trigger-pipeline)
trigger-pipeline $@
;;
*)
usage
;;
esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment