Skip to main content

Automatización de la migración con el Importador de Acciones de

Aviso legal

Puede usar el Actions Importer para planificar las canalizaciones admitidasde CI/CD y migrarlas automáticamente a Actions.

El Actions Importer se distribuye como contenedor Docker y usa una extensión de la CLI de para interactuar con el contenedor.

Cualquier flujo de trabajo que el Actions Importer haya convertido debe inspeccionarse para comprobar si es correcto antes de usarlo como una carga de trabajo de producción. El objetivo es lograr una tasa de conversión del 80 % para cada flujo de trabajo. Sin embargo, la tasa de conversión real dependerá de la composición de cada canalización individual que se convierta.

Puedes usar el Actions Importer para migrar desde las plataformas siguientes:

  • Azure DevOps
  • Bamboo
  • Bitbucket Pipelines
  • CircleCI
  • GitLab (tanto en la nube como hospedado internamente)
  • Jenkins
  • Travis CI

El Actions Importer tiene los requisitos siguientes:

  • Un entorno en el que puedas ejecutar contenedores basados en Linux e instalar las herramientas necesarias.

    Nota:

    El contenedor y la CLI de Actions Importer no deben estar instalados en el mismo servidor que tu plataforma de CI.

  1. Instala la extensión de la CLI del Actions Importer:

    Bash
    gh extension install /gh-actions-importer
    
  2. Comprueba que la extensión está instalada:

    $ gh actions-importer -h
    Options:
      -?, -h, --help  Show help and usage information
    
    Commands:
      update     Update to the latest version of  Actions Importer.
      version    Display the version of  Actions Importer.
      configure  Start an interactive prompt to configure credentials used to authenticate with your CI server(s).
      audit      Plan your CI/CD migration by analyzing your current CI/CD footprint.
      forecast   Forecast  Actions usage from historical pipeline utilization.
      dry-run    Convert a pipeline to a  Actions workflow and output its yaml file.
      migrate    Convert a pipeline to a  Actions workflow and open a pull request with the changes.
    

Para asegurarte de que ejecutas la versión más reciente del Actions Importer, debes ejecutar periódicamente el comando update:

gh actions-importer update

Debes configurar credenciales que permitan que el Actions Importer se comunique con y el servidor de CI actual. Puedes usar variables de entorno o un archivo .env.local para configurar estas credenciales. Las variables de entorno se pueden configurar en un símbolo del sistema interactivo mediante la ejecución del comando siguiente:

gh actions-importer configure

Usa los subcomandos de gh actions-importer para iniciar la migración a Actions, incluidos audit, forecast, dry-run y migrate.

El subcomando audit se puede usar para planificar la migración de CI/CD mediante el análisis de la superficie actual de CI/CD. Este análisis se puede usar para planificar una escala de tiempo para migrar a Actions.

Para ejecutar una auditoría, usa el siguiente comando para determinar las opciones disponibles:

$ gh actions-importer audit -h
Description:
  Plan your CI/CD migration by analyzing your current CI/CD footprint.

[...]

Commands:
  azure-devops  An audit will output a list of data used in an Azure DevOps instance.
  bamboo        An audit will output a list of data used in a Bamboo instance.
  circle-ci     An audit will output a list of data used in a CircleCI instance.
  gitlab        An audit will output a list of data used in a GitLab instance.
  jenkins       An audit will output a list of data used in a Jenkins instance.
  travis-ci     An audit will output a list of data used in a Travis CI instance.

El subcomando forecast revisa la utilización histórica de la canalización para crear una previsión de la utilización de Actions.

Para ejecutar una previsión, usa el siguiente comando para determinar las opciones disponibles:

$ gh actions-importer forecast -h
Description:
  Forecasts  Actions usage from historical pipeline utilization.

[...]

Commands:
  azure-devops  Forecasts  Actions usage from historical Azure DevOps pipeline utilization.
  bamboo        Forecasts  Actions usage from historical Bamboo pipeline utilization.
  jenkins       Forecasts  Actions usage from historical Jenkins pipeline utilization.
  gitlab        Forecasts  Actions usage from historical GitLab pipeline utilization.
  circle-ci     Forecasts  Actions usage from historical CircleCI pipeline utilization.
  travis-ci     Forecasts  Actions usage from historical Travis CI pipeline utilization.
          Forecasts  Actions usage from historical  pipeline utilization.

El subcomando dry-run se puede usar para convertir una canalización en su equivalente de Actions y, a continuación, escribir el flujo de trabajo en el sistema de archivos local.

Para realizar un simulacro, usa el siguiente comando para determinar las opciones disponibles:

$ gh actions-importer dry-run -h
Description:
  Convert a pipeline to a  Actions workflow and output its yaml file.

[...]

Commands:
  azure-devops  Convert an Azure DevOps pipeline to a  Actions workflow and output its yaml file.
  bamboo        Convert a Bamboo pipeline to  Actions workflows and output its yaml file.
  circle-ci     Convert a CircleCI pipeline to  Actions workflows and output the yaml file(s).
  gitlab        Convert a GitLab pipeline to a  Actions workflow and output the yaml file.
  jenkins       Convert a Jenkins job to a  Actions workflow and output its yaml file.
  travis-ci     Convert a Travis CI pipeline to a  Actions workflow and output its yaml file.

El subcomando migrate se puede usar para convertir una canalización en su equivalente de Acciones de y, a continuación, crear una solicitud de incorporación de cambios con el contenido.

Para ejecutar una migración, usa el siguiente comando para determinar las opciones disponibles:

$ gh actions-importer migrate -h
Description:
  Convert a pipeline to a  Actions workflow and open a pull request with the changes.

[...]

Commands:
  azure-devops  Convert an Azure DevOps pipeline to a  Actions workflow and open a pull request with the changes.
  bamboo        Convert a Bamboo pipeline to  Actions workflows and open a pull request with the changes.
  circle-ci     Convert a CircleCI pipeline to  Actions workflows and open a pull request with the changes.
  gitlab        Convert a GitLab pipeline to a  Actions workflow and open a pull request with the changes.
  jenkins       Convert a Jenkins job to a  Actions workflow and open a pull request with the changes.
  travis-ci     Convert a Travis CI pipeline to a  Actions workflow and open a pull request with the changes.

Puede usar Actions y Issues a fin de ejecutar comandos de la CLI para Actions Importer. Esto te permite migrar los flujos de trabajo de CI/CD sin instalar software en el equipo local. Este enfoque es especialmente útil para las organizaciones que quieren habilitar migraciones de autoservicio a Actions. Una vez que se configura IssueOps, los usuarios pueden abrir una incidencia con la plantilla pertinente para migrar canalizaciones a Actions.

Para más información sobre cómo configurar migraciones de autoservicio con IssueOps, consulta el repositorio de plantillas actions/importer-issue-ops.

El repositorio de laboratorios de Actions Importer contiene rutas de aprendizaje específicas de la plataforma en las que se enseña cómo usar Actions Importer y cómo abordar las migraciones a Actions. Puedes utilizar este repositorio para aprender a usar Actions Importer para ayudar a planear, predecir y automatizar la migración a Actions.

Para más información, consulta el repositorio de laboratorios Importer de Acciones de .

Algunas partes se han adaptado a partir de https://.com//gh-actions-importer/ con licencia MIT:

MIT License

Copyright (c) 2022 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.