Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 3531f7be authored by Christophe Chaudier's avatar Christophe Chaudier :rocket:
Browse files

feat: schedule a project export

parent c409b43e
No related branches found
No related tags found
1 merge request!5Resolve "export one project"
...@@ -95,26 +95,35 @@ _create_config() { ...@@ -95,26 +95,35 @@ _create_config() {
} }
_api() { _api() {
path=${1} action=${1}
curl -s --header "PRIVATE-TOKEN: ${gitlab_api_token}" \ path=${2}
curl --request "${action}" -s \
--header "PRIVATE-TOKEN: ${gitlab_api_token}" \
"${gitlab_url}api/v4/${path}" "${gitlab_url}api/v4/${path}"
} }
_get_projects() { _get_projects() {
_api "projects?simple=true&owned=true" | jq '.[].path_with_namespace' _api GET "projects?simple=true&owned=true" | jq '.[].path_with_namespace'
} }
_get_project_info() { _get_project_info() {
project_url_encoded="${project/\//%2F}" _api GET "projects/${project_url_encoded}" | jq
_api "projects/${project_url_encoded}" | jq }
_schedule_project_export() {
_api POST "projects/${project_url_encoded}/export" | jq | grep "202 Accepted" \
|| _fail "Can't schedule export for project [${project}]"
}
_get_project_info() {
_api GET "projects/${project_url_encoded}" | jq
} }
_export() { _export() {
_load_config _load_config
echo "My GitLab projects :" echo "My GitLab projects :"
#_get_projects | grep ${project} || _fail "Project [${project}] does not exist !" _schedule_project_export
_get_project_info
_succed "Export done" _succed "Export done"
} }
...@@ -142,6 +151,8 @@ main() { ...@@ -142,6 +151,8 @@ main() {
esac esac
done done
project_url_encoded="${project/\//%2F}"
case "${action}" in case "${action}" in
init) _create_config ;; init) _create_config ;;
export) _export ;; export) _export ;;
......
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