Skip to content
Snippets Groups Projects
Commit ebcd28b0 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

Merge branch 'feat/18357/develop' into 'develop'

feat/18357/develop

See merge request maarch/MaarchParapheur!95
parents bdf606c3 ba30efe9
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ variables: ...@@ -5,6 +5,7 @@ variables:
stages: stages:
- logs - logs
- new_branch
- test - test
- synchronization - synchronization
...@@ -173,3 +174,17 @@ logs: ...@@ -173,3 +174,17 @@ logs:
- BODY="{\"issue\":{\"notes\":\"$NOTE\",\"private_notes\":false}}" - BODY="{\"issue\":{\"notes\":\"$NOTE\",\"private_notes\":false}}"
- echo "$BODY" - echo "$BODY"
- curl -v -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 - curl -v -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment