Documentation officielle : Package Registry | GitLab
Activation
Vérifier que la fonctionnalité Packages est activée dans Settings → General → Visibility, project features, permissions.
Pousser un package
Documentation officielle : GitLab Generic Packages Repository | GitLab
- Créer un authentication token (project access token, ou personal/group access token) ou un deploy token (project ou groupe).
-
curl --header "PRIVATE-TOKEN: <token>" --upload-file <local file to publish> https://plmlab.math.cnrs.fr/api/v4/projects/<id>/packages/generic/<package name>/<version>/<name of published file>
où<id>
est leproject id
indiqué juste sous le nom du projet. Si c’est unDEPLOY-TOKEN
, il faut remplacerPRIVATE-TOKEN:
parDEPLOY-TOKEN:
dans le curl précédent.
Pousser un fichier dans un package dans un job CI
Documentation officielle : GitLab Generic Packages Repository | GitLab
Un exemple : dans le .gitlab-ci.yml
variables:
PACKAGE_REGISTRY_URL: "$CI_API_V4_URL/projects/<nom du groupe>%2F<nom du projet>/packages/generic"
script:
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file personnes.ldif $PACKAGE_REGISTRY_URL/<nom du package>/latest/<nom du fichier>'
$CI_JOB_TOKEN
est automatiquement alimentée par l’intégration continue.
Récupérer un fichier dans un package
Documentation officielle : GitLab Generic Packages Repository | GitLab
- Par l’interface web : Packages & Registries > Package Registry
- Via l’API :
curl --header "DEPLOY-TOKEN: ${DEPLOY_TOKEN}" https://plmlab.math.cnrs.fr/api/v4/projects/<nom du groupe>%2F<nom du projet>/packages/generic/<nom du package>/latest/<nom du fichier> -o <nom du fichier>