Commit 51213a8d authored by Alex ORLUC's avatar Alex ORLUC
Browse files

Merge branch 'feat/18357/1.8' into '1.8'

feat/18357/1.8

See merge request maarch/MaarchCapture!28
parents dd33143b d7590e95
......@@ -2,4 +2,5 @@ files/
config/Capture.xml
*.log
*.sh
!ci/*.sh
*.xml
......@@ -9,6 +9,7 @@ variables:
stages:
- logs
- new_branch
- test
before_script:
......@@ -87,3 +88,17 @@ logs:
- BODY="{\"issue\":{\"notes\":\"$NOTE\",\"private_notes\":false}}"
- echo "$BODY"
- curl -v -f -H 'Content-Type:application/json' -H "X-Redmine-API-Key:$REDMINE_API_KEY" -d "$BODY" -X PUT https://forge.maarch.org/issues/$ISSUE_ID.json
new_branch:
image: debian:10-slim
stage: new_branch
only:
- branches
before_script:
# Install git and curl command
- apt-get update -yqq > /dev/null
- apt install -y curl
- apt install -y jq
script:
- chmod +x ./ci/create_mr.sh
- ./ci/create_mr.sh
#!/bin/bash
structures=$(echo $CI_COMMIT_REF_NAME | tr "/" "\n")
TRACKER=""
US=""
BRANCH=""
IT=1
for item in $structures
do
if [ $IT = 1 ]; then
TRACKER=$item
fi
if [ $IT = 2 ]; then
US=$item
fi
if [ $IT = 3 ]; then
BRANCH=$item
fi
IT=$((IT+1))
done
if [[ -z $TRACKER ]] || [[ -z $US ]] || [[ -z $BRANCH ]]
then
echo "Bad structure to find US ! => [TRACKER]/[US_ID]/[TARGET_BRANCH]"
else
echo $TRACKER
echo $US
echo $BRANCH
echo "GET https://forge.maarch.org/issues/$US.json"
curl -H "X-Redmine-API-Key: ${REDMINE_API_KEY}" -H 'Content-Type: application/json' -X GET https://forge.maarch.org/issues/$US.json > issue_$US.json
SUBJECT=`cat issue_$US.json | jq -r '.issue.subject'`
BODY="{\"id\":\"$CI_PROJECT_ID\",\"source_branch\":\"$CI_COMMIT_REF_NAME\",\"target_branch\":\"$BRANCH\",\"title\":\"WIP:$CI_COMMIT_REF_NAME\",\"description\":\"$SUBJECT\n=> https://forge.maarch.org/issues/$US\",\"remove_source_branch\":\"true\"}"
echo $BODY
echo "POST https://labs.maarch.org/api/v4/projects/$CI_PROJECT_ID/merge_requests"
curl -v -H "PRIVATE-TOKEN: $TOKEN_GITLAB" -H "Content-Type: application/json" -X POST -d "$BODY" "https://labs.maarch.org/api/v4/projects/$CI_PROJECT_ID/merge_requests"
fi
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment