Skip to main content

Automatisieren der Migration mit GitHub Actions Importer

Verwenden Sie GitHub Actions Importer, um die Migration zu GitHub Actions zu planen und zu automatisieren.

Rechtliche Hinweise

Informationen zu GitHub Actions Importer

Sie können GitHub Actions Importer verwenden, um die Migration Ihrer CI/CD-Pipelines zu GitHub Actions zu planen und zu automatisieren.

GitHub Actions Importer wird als Docker-Container verteilt und verwendet eine GitHub-CLI-Erweiterung für die Interaktion mit dem Container.

Jeder Workflow, der von GitHub Actions Importer konvertiert wird, sollte auf seine Korrektheit überprüft werden, bevor er als Produktionsworkload verwendet wird. Das Ziel besteht darin, eine Konvertierungsrate von 80 % für jeden Workflow zu erzielen. Die tatsächliche Konvertierungsrate hängt jedoch von der Zusammensetzung jeder einzelnen Pipeline ab, die konvertiert wird.

Unterstützte CI-Plattformen

Sie können GitHub Actions Importer verwenden, um von den folgenden Plattformen zu migrieren:

  • Azure DevOps
  • Bamboo
  • Bitbucket-Pipelines
  • CircleCI
  • GitLab
  • Jenkins
  • Travis CI

Voraussetzungen

Für GitHub Actions Importer gelten die folgenden Voraussetzungen:

  • Eine Umgebung, in der du Linux-basierte Container ausführen und die erforderlichen Tools installieren kannst:

    Hinweis: Der GitHub Actions Importer-Container und die CLI müssen nicht auf demselben Server wie deine CI-Plattform installiert werden.

Installieren der GitHub Actions Importer-CLI-Erweiterung

  1. So installierst du die GitHub Actions Importer-CLI-Erweiterung:

    Bash
    gh extension install github/gh-actions-importer
    
  2. Überprüfe, ob die Erweiterung installiert ist:

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

Aktualisieren der GitHub Actions Importer-CLI

Vergewissern Sie sich regelmäßig, dass die aktuelle Version von GitHub Actions Importer ausgeführt wird, indem Sie den Befehl update ausführen:

gh actions-importer update

Authentifizieren über die Befehlszeile

Sie müssen Anmeldeinformationen konfigurieren, die es GitHub Actions Importer ermöglichen, mit GitHub und Ihrem aktuellen CI-Server zu kommunizieren. Sie können diese Anmeldeinformationen mithilfe von Umgebungsvariablen oder einer .env.local-Datei konfigurieren. Die Umgebungsvariablen können in einer interaktiven Eingabeaufforderung konfiguriert werden, indem Sie den folgenden Befehl ausführen:

gh actions-importer configure

Verwenden der GitHub Actions Importer-CLI

Verwenden Sie die Unterbefehle von gh actions-importer, um die Migration zu GitHub Actions zu beginnen, einschließlich audit, forecast, dry-run und migrate.

Überwachen vorhandener CI-Pipelines

Der Unterbefehl audit kann verwendet werden, um die CI/CD-Migration zu planen, indem der aktuelle CI/CD-Speicherbedarf analysiert wird. Diese Analyse kann verwendet werden, um eine Zeitachse für die Migration zu GitHub Actions zu entwerfen.

Um eine Überwachung auszuführen, verwende den folgenden Befehl, um die verfügbaren Optionen zu ermitteln:

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

Vorhersagen der Nutzung

Der Unterbefehl forecast überprüft die Pipelinenutzung in der Vergangenheit, um eine Prognose der GitHub Actions-Nutzung zu erstellen.

Um eine Vorhersage auszuführen, verwende den folgenden Befehl, um die verfügbaren Optionen zu ermitteln:

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

Testen des Migrationsprozesses

Der Unterbefehl dry-run kann verwendet werden, um eine Pipeline in ihre GitHub Actions-Entsprechung zu konvertieren und dann den Workflow in das lokale Dateisystem zu schreiben.

Um einen Testlauf auszuführen, verwende den folgenden Befehl, um die verfügbaren Optionen zu ermitteln:

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

Migrieren einer Pipeline zu GitHub Actions

Der Unterbefehl migrate kann verwendet werden, um eine Pipeline in ihre GitHub Actions-Entsprechung zu konvertieren und dann einen Pull Request mit dem Inhalt zu erstellen.

Um eine Migration auszuführen, verwende den folgenden Befehl, um die verfügbaren Optionen zu ermitteln:

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

Durchführen von Self-Service-Migrationen mithilfe von IssueOps

Sie können GitHub Actions und GitHub Issues verwenden, um CLI-Befehle für GitHub Actions Importer auszuführen. Dadurch können Sie Ihre CI/CD-Workflows migrieren, ohne Software auf Ihrem lokalen Computer zu installieren. Dieser Ansatz eignet sich besonders für Organisationen, die Self-Service-Migrationen zu GitHub Actions aktivieren möchten. Sobald IssueOps konfiguriert ist, können Benutzer ein Issue mit der entsprechenden Vorlage öffnen, um Pipelines zu GitHub Actions zu migrieren.

Weitere Informationen zum Einrichten von Self-Service-Migrationen mit IssueOps finden Sie im Vorlagenrepository actions/importer-issue-ops.

Verwenden des Repositorys mit GitHub Actions Importer-Labs

Das Repository mit GitHub Actions Importer-Labs enthält plattformspezifische Lernpfade, in denen Sie die Verwendung von GitHub Actions Importer und Ansätze der Migration zu GitHub Actions kennenlernen. Anhand dieses Repositorys erfahren Sie, wie GitHub Actions Importer verwendet wird, um Ihre Migration zu GitHub Actions zu planen, vorherzusagen und zu automatisieren.

Weitere Informationen finden Sie im Repository zu GitHub Actions Importer-Labs.

Teile wurden von https://github.com/github/gh-actions-importer/ unter der MIT-Lizenz übernommen:

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.