Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
c2057775
Commit
c2057775
authored
Aug 21, 2018
by
Yann Bizeul
Browse files
Better integration with acme.sh utils
parent
e5e57e68
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/gitlab.sh
View file @
c2057775
#!/usr/bin/env sh
#!/usr/bin/env sh
-x
# Script to deploy certificate to a Gitlab hosted page
...
...
@@ -54,8 +54,29 @@ gitlab_deploy() {
_savedomainconf Le_Deploy_gitlab_domain
"
$Le_Deploy_gitlab_domain
"
fi
curl
-s
--fail
--request
PUT
--header
"PRIVATE-TOKEN:
$Le_Deploy_gitlab_token
"
--form
"certificate=@
$_cfullchain
"
--form
"key=@
$_ckey
"
"https://gitlab.com/api/v4/projects/
$Le_Deploy_gitlab_project_id
/pages/domains/
$Le_Deploy_gitlab_domain
"
>
/dev/null
&&
exit
0
#curl -s --fail --request PUT --header "PRIVATE-TOKEN: $Le_Deploy_gitlab_token" --form "certificate=@$_cfullchain" --form "key=@$_ckey" "https://gitlab.com/api/v4/projects/$Le_Deploy_gitlab_project_id/pages/domains/$Le_Deploy_gitlab_domain" >/dev/null && exit 0
string_fullchain
=
$(
_url_encode <
$_cfullchain
)
string_key
=
$(
_url_encode <
$_ckey
)
body
=
"certificate=
$string_fullchain
&key=
$string_key
"
export
_H1
=
"PRIVATE-TOKEN:
$Le_Deploy_gitlab_token
"
# Exit curl status code if curl didn't work
exit
$?
gitlab_url
=
"https://gitlab.com/api/v4/projects/
$Le_Deploy_gitlab_project_id
/pages/domains/
$Le_Deploy_gitlab_domain
"
_response
=
$(
_post
"
$body
"
"
$gitlab_url
"
0 PUT | _dbase64
"multiline"
)
error_response
=
"error"
if
test
"
${
_response
#*
$error_response
}
"
!=
"
$_response
"
;
then
_err
"Error in deploying certificate:"
_err
"
$_response
"
return
1
fi
_debug response
"
$_response
"
_info
"Certificate successfully deployed"
return
0
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment