Dropstone Docs

GitLab

Utilisez Dropstone dans les problèmes et les demandes de fusion GitLab.

Dropstone s'intègre à votre flux de travail GitLab via votre pipeline GitLab CI/CD ou avec GitLab Duo.

Dans les deux cas, Dropstone s'exécutera sur vos exécuteurs GitLab.


GitLab CI

Dropstone fonctionne dans un pipeline GitLab régulier. Vous pouvez l'intégrer dans un pipeline en tant que composant CI

Ici, nous utilisons un composant CI/CD créé par la communauté pour Dropstone : nagyv/gitlab-dropstone.


Fonctionnalités

  • Utilisez une configuration personnalisée par travail : Configurez Dropstone avec un répertoire de configuration personnalisé, par exemple ./config/#custom-directory pour activer ou désactiver les fonctionnalités par invocation de Dropstone.
  • Configuration minimale : Le composant CI configure Dropstone en arrière-plan, vous devez uniquement créer la configuration Dropstone et l'invite initiale.
  • Flexible : Le composant CI prend en charge plusieurs entrées pour personnaliser son comportement

Configuration

  1. Stockez votre JSON d'authentification Dropstone en tant que variable d'environnement CI de type Fichier sous Settings > CI/CD > Variables. Assurez-vous de les marquer comme « Masked and hidden ».

  2. Ajoutez ce qui suit à votre fichier .gitlab-ci.yml.

    include:
      - component: $CI_SERVER_FQDN/nagyv/gitlab-dropstone/dropstone@2
        inputs:
          config_dir: ${CI_PROJECT_DIR}/dropstone-config
          auth_json: $DROPSTONE_AUTH_JSON # The variable name for your Dropstone authentication JSON
          command: optional-custom-command
          message: "Your prompt here"
    

Pour plus d'entrées et de cas d'usage, consultez la documentation de ce composant.


GitLab Duo

Dropstone s'intègre à votre flux de travail GitLab. Mentionnez @dropstone dans un commentaire, et Dropstone exécutera des tâches dans votre pipeline GitLab CI.


Fonctionnalités

  • Triez les problèmes : Demandez à Dropstone d'examiner un problème et de vous l'expliquer.
  • Corriger et implémenter : Demandez à Dropstone de corriger un problème ou d'implémenter une fonctionnalité. Il créera une nouvelle branche et lèvera une demande de fusion avec les modifications.
  • Sécurisé : Dropstone s'exécute sur vos exécuteurs GitLab.

Configuration

Dropstone s'exécute dans votre pipeline GitLab CI/CD, voici ce dont vous aurez besoin pour le configurer :

Conseil:

Consultez la documentation GitLab pour les instructions à jour.

  1. Configurez votre environnement GitLab
  2. Configurez CI/CD
  3. Obtenez une clé API Dropstone (voir Quickstart)
  4. Créez un compte de service
  5. Configurez les variables CI/CD
  6. Créez un fichier de configuration de flux. Exemple :
image: node:22-slim
commands:
  - echo "Installing Dropstone"
  - curl -fsSL https://dropstone.io/install | bash
  - echo "Installing glab"
  - export GITLAB_TOKEN=$GITLAB_TOKEN_DROPSTONE
  - apt-get update --quiet && apt-get install --yes curl wget gpg git && rm --recursive --force /var/lib/apt/lists/*
  - curl --silent --show-error --location "https://raw.githubusercontent.com/upciti/wakemeops/main/assets/install_repository" | bash
  - apt-get install --yes glab
  - echo "Configuring glab"
  - echo $GITLAB_HOST
  - echo "Creating Dropstone auth configuration"
  - mkdir --parents ~/.local/share/dropstone
  - |
    cat > ~/.local/share/dropstone/auth.json << EOF
    {
      "dropstone": {
        "type": "api",
        "key": "$DROPSTONE_API_KEY"
      }
    }
    EOF
  - echo "Configuring git"
  - git config --global user.email "dropstone@gitlab.com"
  - git config --global user.name "Dropstone"
  - echo "Testing glab"
  - glab issue list
  - echo "Running Dropstone"
  - |
    dropstone run "
    You are an AI assistant helping with GitLab operations.

    Context: $AI_FLOW_CONTEXT
    Task: $AI_FLOW_INPUT
    Event: $AI_FLOW_EVENT

    Please execute the requested task using the available GitLab tools.
    Be thorough in your analysis and provide clear explanations.

    Use the glab CLI to access data from GitLab. The glab CLI is already authenticated.

    If you are asked to summarize an MR or issue, or provide more information,
    post back a note to the MR/Issue so the user can see it.
    "
  - git checkout --branch $CI_WORKLOAD_REF origin/$CI_WORKLOAD_REF
  - echo "Checking for git changes and pushing if any exist"
  - |
    if ! git diff --quiet || ! git diff --cached --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; then
      echo "Git changes detected, adding and pushing..."
      git add .
      if git diff --cached --quiet; then
        echo "No staged changes to commit"
      else
        echo "Committing changes to branch: $CI_WORKLOAD_REF"
        git commit --message "Dropstone changes"
        echo "Pushing changes up to $CI_WORKLOAD_REF"
        git push "https://gitlab-ci-token:$GITLAB_TOKEN@$GITLAB_HOST/$CI_PROJECT_PATH.git" $CI_WORKLOAD_REF
        echo "Changes successfully pushed"
      fi
    else
      echo "No git changes detected, skipping push"
    fi
variables:
  - DROPSTONE_API_KEY
  - GITLAB_TOKEN_DROPSTONE
  - GITLAB_HOST

Vous pouvez vous référer à la documentation de la plateforme GitLab Duo Agent pour des instructions détaillées.


Exemples

Voici quelques exemples de comment vous pouvez utiliser Dropstone dans GitLab.

Conseil:

Vous pouvez configurer une phrase de déclenchement différente de @dropstone.

  • Expliquer un problème

    Ajoutez ce commentaire dans un problème GitLab.

    @dropstone explain this issue
    

    Dropstone lira le problème et répondra avec une explication claire.

  • Corriger un problème

    Dans un problème GitLab, dites :

    @dropstone fix this
    

    Dropstone créera une nouvelle branche, implémentera les modifications et ouvrira une demande de fusion avec les modifications.

  • Examiner les demandes de fusion

    Laissez le commentaire suivant sur une demande de fusion GitLab.

    @dropstone review this merge request
    

    Dropstone examinera la demande de fusion et fournira des commentaires.

Ctrl+I