gitlab-backup

command module
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

README

gitlab-backup

This project is for backup gitlab projects. I'm an ops, not a dev, the code will be improved soon.

Usage

To download every projects of a group :

export GITLAB_TOKEN="...."
export GITLAB_URI="https://your-gitlab-uri"  # Optional, default https://gitlab.com
gitlab-backup -gid <main_group_id> [-o <path_to_save_archives>]

To download a single backup porject :

export GITLAB_TOKEN="...."
export GITLAB_URI="https://your-gitlab-uri"  # Optional, default https://gitlab.com
gitlab-backup -pid <project_id> [-o <path_to_save_archives>]

Build

cd src
go build . -o gitlab-backup

Test

Not yet.

Gitlab API examples

Get the list of subgroups:

curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/groups/**id_of_group**/subgroups

Get the list of projects of a group:

curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/groups/**id_of_group**/projects

Ask an export:

curl --request POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/projects/**id_of_project**/export

Get the status of the export:

curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/projects/**id_of_project**/export

When the status is finished, download the backup:

curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" --remote-header-name --remote-name https://gitlab.com/api/v4/projects/**id_of_project**/export/download

Docker Image

The Docker image is sgaunet/gitlab-backup:version

There is a docker-compose.yml file example.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL