Skip to main content

Автоматизация миграции с помощью средства импорта GitHub Actions

Используйте GitHub Actions Importer для планирования и автоматизации миграции на GitHub Actions.

Юридическое уведомление

О GitHub Actions Importer

Вы можете использовать GitHub Actions Importer для планирования и автоматической миграции поддерживаемых конвейеров CI/CD в GitHub Actions.

GitHub Actions Importer распространяется в виде контейнера Docker и использует расширение CLI GitHub CLI для взаимодействия с контейнером.

Любой рабочий процесс, преобразованный GitHub Actions Importer, следует проверить правильность перед использованием его в качестве рабочей рабочей нагрузки. Цель состоит в том, чтобы достичь скорости преобразования 80 % для каждого рабочего процесса, однако фактический коэффициент преобразования будет зависеть от состава каждого преобразованного конвейера.

Поддерживаемые платформы CI

Для миграции с следующих платформ можно использовать GitHub Actions Importer:

  • Azure DevOps
  • Bamboo
  • Конвейеры Bitbucket
  • CircleCI
  • GitLab
  • Jenkins
  • Travis CI

Необходимые компоненты

GitHub Actions Importer имеет следующие требования:

Установка расширения CLI GitHub Actions Importer

  1. Установите расширение CLI GitHub Actions Importer :

    Bash
    gh extension install github/gh-actions-importer
    
  2. Убедитесь, что расширение установлено:

    $ gh actions-importer -h
    Options:
      -?, -h, --help  Show help and usage information
    
    Commands:
      update     Update to the latest version of GitHub Actions Importer.
      version    Display the version of GitHub 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 GitHub Actions usage from historical pipeline utilization.
      dry-run    Convert a pipeline to a GitHub Actions workflow and output its yaml file.
      migrate    Convert a pipeline to a GitHub Actions workflow and open a pull request with the changes.
    

Обновление интерфейса командной строки GitHub Actions Importer

Чтобы убедиться, что вы используете последнюю версию GitHub Actions Importer, следует регулярно выполнять update команду:

gh actions-importer update

Проверка подлинности в командной строке

Необходимо настроить учетные данные, позволяющие GitHub Actions Importer взаимодействовать с GitHub и текущим сервером CI. Эти учетные данные можно настроить с помощью переменных среды или .env.local файла. Переменные среды можно настроить в интерактивной строке, выполнив следующую команду:

gh actions-importer configure

Использование интерфейса командной строки командной строки GitHub Actions Importer

Используйте вложенные команды gh actions-importer для начала миграции на GitHub Actions, включая audit, и forecast``dry-run.migrate

Аудит существующих конвейеров CI

audit Подкоманда может использоваться для планирования миграции CI/CD путем анализа текущего следа CI/CD. Этот анализ можно использовать для планирования временная шкала для миграции на GitHub Actions.

Чтобы выполнить аудит, используйте следующую команду, чтобы определить доступные параметры:

$ 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.

Прогнозирование использования

Подкоманда forecast проверяет использование исторического конвейера для создания прогноза использования GitHub Actions .

Чтобы выполнить прогноз, используйте следующую команду, чтобы определить доступные параметры:

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

[...]

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

Тестирование процесса миграции

dry-run Подкоманда может использоваться для преобразования конвейера в его эквивалент GitHub Actions, а затем записать рабочий процесс в локальную файловую систему.

Чтобы выполнить сухой запуск, используйте следующую команду, чтобы определить доступные варианты:

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

[...]

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

Перенос конвейера в GitHub Actions

migrate Подкоманда может использоваться для преобразования конвейера в эквивалент GitHub Actions, а затем создать запрос на вытягивание с содержимым.

Чтобы выполнить миграцию, используйте следующую команду, чтобы определить доступные параметры:

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

[...]

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

Выполнение самостоятельной миграции с помощью IssueOps

Можно использовать GitHub Actions и GitHub Issues для выполнения команд CLI для GitHub Actions Importer. Это позволяет перенести рабочие процессы CI/CD без установки программного обеспечения на локальном компьютере. Этот подход особенно полезен для организаций, которые хотят включить самостоятельные миграции на GitHub Actions. После настройки IssueOps пользователи могут открыть проблему с соответствующим шаблоном для переноса конвейеров в GitHub Actions.

Дополнительные сведения о настройке самостоятельной миграции с помощью IssueOps см. в репозитории actions/importer-issue-ops шаблонов.

Использование репозитория лабораторий GitHub Actions Importer

Репозиторий лабораторий GitHub Actions Importer содержит путь обучения для конкретной платформы, который учит вас использовать GitHub Actions Importer и способы перехода на GitHub Actions. Этот репозиторий позволяет узнать, как использовать GitHub Actions Importer для планирования, прогнозирования и автоматизации миграции на GitHub Actions.

Дополнительные сведения см. в репозитории лабораторий GitHub Actions Importer.

Части были адаптированы в соответствии с https://github.com/github/gh-actions-importer/ лицензией MIT:

MIT License

Copyright (c) 2022 GitHub

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.