Skip to main content

GitHub Actions Importer を使用した移行の自動化

GitHub Actions Importer を使って、GitHub Actions への移行を計画し自動化します。

法的通知

GitHub Actions Importer について

GitHub Actions Importer を使用して、 CI/CD がサポートする パイプラインを計画して GitHub Actions に自動的に移行することができます。

GitHub Actions Importer は Docker コンテナーとして配布され、GitHub CLI 拡張機能を使用してコンテナーとやりとりします。

GitHub Actions Importer によって変換されたワークフローは、運用ワークロードとして使用する前に、正確性を検査する必要があります。 目標は、すべてのワークフローで 80% の変換率を達成することですが、実際の変換率は、変換される各パイプラインの構成によって異なります。

サポートされている CI プラットフォーム

GitHub Actions Importer を使用すると、次のプラットフォームから移行することができます。

  • Azure DevOps
  • Bamboo
  • Bitbucket パイプライン
  • CircleCI
  • GitLab
  • Jenkins
  • Travis CI

前提条件

GitHub Actions Importer には、次の要件があります。

  • Linux ベースのコンテナーを実行し、必要なツールをインストールできる環境。

    : GitHub Actions Importer コンテナーと CLI は、CI プラットフォームと同じサーバーにインストールする必要はありません。

GitHub Actions Importer CLI 拡張機能のインストール

  1. GitHub Actions Importer CLI 拡張機能のインストール

    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 CLI の更新

最新バージョンの GitHub Actions Importer を実行していることを確認するには、update コマンドを定期的に実行する必要があります。

gh actions-importer update

コマンドラインで認証する

GitHub Actions Importer が GitHub および現在の CI サーバーと通信できるようにする資格情報を構成する必要があります。 これらの資格情報は、環境変数または .env.local ファイルを使用して構成できます。 環境変数は、次のコマンドを実行して、対話型プロンプトで構成できます。

gh actions-importer configure

GitHub Actions Importer CLI の使用

gh actions-importer のサブコマンドを使って、GitHub Actions への移行を始めます。auditforecastdry-runmigrate が含まれます。

既存の 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 に変換し、その内容を含む pull request を作成できます。

移行を実行するには、次のコマンドを使用して、使用可能なオプションを決定します。

$ 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 を使って、GitHub Actions Importer の CLI コマンドを実行できます。 これにより、ローカル コンピューターにソフトウェアをインストールすることなく、CI/CD ワークフローを移行できます。 このアプローチは、GitHub Actions のセルフサービス移行を有効にする組織に特に役立ちます。 IssueOps を構成すると、ユーザーは関連するテンプレートで issue を開いて、パイプラインを 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 ラボ リポジトリをご覧ください。

MIT ライセンスのもとで https://github.com/github/gh-actions-importer/ から一部を引用しています。

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.