Todos los productos
Search
Centro de documentos

Alibaba Cloud DevOps:Activador de origen de código

Última actualización: Sep 05, 2026

Configure los activadores de origen de código para su pipeline y especifique los eventos de activación y las condiciones de filtrado para controlar cuándo se inician automáticamente las ejecuciones del pipeline.

Configurar un activador de origen de código

Una vez que habilita el activador de origen de código y configura un webhook, Flow ejecuta automáticamente el pipeline cuando se confirma código en el repositorio y la rama especificados.

Alibaba Cloud DevOps Codeup

  1. En Alibaba Cloud DevOps, vaya a su pipeline, haga clic en Edit Pipeline y luego haga clic en Edit Code Source.

  2. Haga clic en Enable Code Source Trigger. Flow agrega automáticamente la URL del webhook al repositorio de código correspondiente de Alibaba Cloud DevOps Codeup.

Después de habilitar el activador, en la sección Triggering events, seleccione los tipos de eventos deseados, como code commit, tag creation, merge request completed y merge request created/updated. También puede habilitar branch or tag filtering y code path filtering. Cuando termine, haga clic en Add.

Al habilitar el activador, Flow registra automáticamente un webhook en la página de configuración Webhooks de su repositorio de código de Alibaba Cloud DevOps Codeup. El webhook cubre push events, tag push events y merge request events.

Otros orígenes de código

  1. On the pipeline's edit page, click Edit Code Source. Habilite Code Source Trigger, and copy the webhook URL.

    En la sección Triggering events, seleccione code commit y agregue la URL del webhook copiada a la configuración de activadores por webhook del repositorio de código correspondiente.

  2. Add the copied webhook URL to the settings of the corresponding code repository. Alibaba Cloud DevOps supports code source triggers for GitLab, GitHub, Gitee, and General Git repositories. Configuration methods vary by repository type.

    GitLab

    Go to your GitLab code repository and navigate to . Paste the webhook URL copied from the pipeline into the URL field.

    En la sección Trigger, seleccione Push events.

    GitHub

    Vaya a su repositorio de código en GitHub, navegue a y haga clic en Add Webhook. Pegue la URL del webhook copiada del pipeline de Flow en el campo Payload URL. Para Content Type, seleccione application/json.

    Para el activador, conserve la opción predeterminada: Just the push event..

    Gitee

    Go to your Gitee code repository and navigate to . Paste the webhook URL copied from the Flow pipeline into the URL field.

    General Git

    Using GitLab as an example, go to your GitLab code repository and navigate to . Paste the webhook URL copied from the pipeline into the URL field.

    SVN

    1. En la página de edición del pipeline, habilite el activador de origen de código y copie la URL del webhook.

      Para el evento de activación, seleccione code commit. La URL del webhook es http://flow-openapi.alibabacloud.com/scm.

    2. En el servidor SVN, vaya al directorio hooks de su repositorio. Busque las plantillas de scripts de hook. Cada plantilla corresponde a un evento. Para usar una plantilla, elimine el sufijo .tmpl.

      14:32  post-commit.tmpl
      14:32  post-lock.tmpl
      14:32  post-revprop-change.tmpl
      14:32  post-unlock.tmpl
      14:32  pre-commit.tmpl
      14:32  pre-lock.tmpl
      14:32  pre-revprop-change.tmpl
      14:32  pre-unlock.tmpl
      14:32  start-commit.tmpl
    3. Tome post-commit como ejemplo. El archivo post-commit es un script de shell. SVN ejecuta este script después de detectar un cambio, como una confirmación de código, la creación de una rama o la creación de una etiqueta. El siguiente script de ejemplo muestra cómo activar una ejecución de pipeline de Flow tras una confirmación de código:

      #!/bin/sh
      # The repository path and the commit revision number are passed to the script as arguments.
      REPOS="$1"
      REV="$2"
      # Use svnlook to find the directories changed in this commit.
      CHANGED_DIRS=$(svnlook dirs-changed -r "$REV" "$REPOS")
      # Get the first changed directory path, which is usually the top-level directory.
      FIRST_CHANGED_PATH=$(echo "$CHANGED_DIRS" | head -n 1)
      # Assume the branch structure follows the standard format (branches/branch-name). You can parse the branch name from the output.
      BRANCH_NAME=$(echo "$FIRST_CHANGED_PATH" | sed 's#.*/$branches/.*/$$\1#')
      # Construct a curl command to send a request to the webhook URL provided by the pipeline. 
      # Replace the webhook URL with the one from your pipeline, and format the request data as shown in the example.
      curl --location --request POST 'http://flow-openapi.alibabacloud.com/scm/webhook/MwfQPTyf4nif2UdWBooR' \
      --header 'Content-Type: application/json' \
      --data-raw "{
        \"ref\": \"refs/heads/$BRANCH_NAME\",
        \"repository\": {
          \"clone_url\": \"svn://8.142.XX.XXXcom/svn/repos/demo\"
        }
      }"

Eventos de activación

Use Triggering events to filter webhook events by code source. The following table lists supported events for each code source type.

Alibaba Cloud Code

Alibaba Cloud DevOps Codeup

General Git

GitHub

GitLab

Coding

Bitbucket

Self-managed GitLab

SVN

Confirmación de código

✓

✓

✓

✓

✓

✓

✘

✓

✓

Creación de etiqueta

✓

✓

✘

✘

✓

✘

✘

✓

✘

Solicitud de fusión creada o actualizada

✘

✓

✘

✘

✘

✘

✘

✘

✘

Solicitud de fusión completada

✘

✓

✘

✘

✓

✘

✘

✓

✘

Code commit: Triggered when you push a local branch to a remote branch or edit files on your code platform's web interface (for example, pushing local master to origin/master). Flow matches the target branch against the filter conditions and, if they match, triggers the pipeline using that branch.

Tag creation: Triggered when you push a local tag to the server or create a tag on your code platform's web interface (for example, pushing local tag release/0.0.1 to the server). Flow matches the tag name against the filter conditions and, if they match, triggers the pipeline using that tag as the code version.

Merge request created/updated: Triggered when you create or update a merge request on your code platform's web interface. Only Alibaba Cloud DevOps Codeup supports this event. For example, if you create a merge request from the remote dev branch (source) to master (target), Flow matches the target branch against the filter conditions and, if they match, triggers the pipeline using the source branch.

Merge request completed: Similar to the merge request created/updated event, except Flow uses the target branch for the run.

Condiciones de filtrado

Branch or tag filtering

Filter conditions support regular expressions. Enter a specific branch such as master or dev, or use Java-style regular expression syntax. For example:

  • To match multiple branches, such as master and dev, enter master|dev.

  • To match branches that start with feature, enter ^feature.*.

Code path filtering

Code path filtering lets you filter triggering events by the paths of modified files. This feature supports only Push events from Alibaba Cloud DevOps Codeup sources. Flow triggers the pipeline only when code changes match the filter rules. Filter conditions support regular expressions. For example, auth-srv/.* triggers the pipeline only when code in the auth-srv directory is updated.