Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
51174d26
Commit
51174d26
authored
3 years ago
by
Alex ORLUC
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #18357 TIME 0:10 create script
parent
b5107ce5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+17
-1
17 additions, 1 deletion
.gitlab-ci.yml
ci/create_mr.sh
+52
-0
52 additions, 0 deletions
ci/create_mr.sh
with
69 additions
and
1 deletion
.gitlab-ci.yml
+
17
−
1
View file @
51174d26
...
...
@@ -5,10 +5,11 @@ variables:
stages
:
-
logs
-
new_branch
-
test
before_script
:
-
apt-get update > /dev/null
-
apt-get update
-yqq
> /dev/null
-
mkdir -p /usr/share/man/man1
-
mkdir -p /usr/share/man/man7
#- apt-get install apt-utils -yqq > /dev/null
...
...
@@ -136,3 +137,18 @@ logs:
-
BODY="{\"issue\":{\"notes\":\"$NOTE\",\"private_notes\":false}}"
-
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
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
This diff is collapsed.
Click to expand it.
ci/create_mr.sh
0 → 100644
+
52
−
0
View file @
51174d26
#!/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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment