Skip to main content

Automatisieren der Migration mit Actions Importer

Hinweis

Auf gehostete Runner werden aktuell nicht auf Enterprise Server unterstützt. Weitere Informationen zur geplanten zukünftigen Unterstützung findest Du in der public roadmap.

Rechtliche Hinweise

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

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

Jeder Workflow, der von 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.

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

  • Azure DevOps
  • Bamboo
  • Bitbucket-Pipelines
  • CircleCI
  • GitLab (sowohl Cloud als auch selbst gehostet)
  • Jenkins
  • Travis CI

Für Actions Importer gelten die folgenden Voraussetzungen:

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

    Hinweis

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

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

    Bash
    gh extension install /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  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.
    

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

gh actions-importer update

Sie müssen Anmeldeinformationen konfigurieren, die es Actions Importer ermöglichen, mit 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 Sie die Unterbefehle von gh actions-importer, um die Migration zu Actions zu beginnen, einschließlich audit, forecast, dry-run und migrate.

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

Der Unterbefehl forecast überprüft die Pipelinenutzung in der Vergangenheit, um eine Prognose der 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  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.

Der Unterbefehl dry-run kann verwendet werden, um eine Pipeline in ihre 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  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.

Der Unterbefehl migrate kann verwendet werden, um eine Pipeline in ihre 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  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.

Sie können Actions und Issues verwenden, um CLI-Befehle für 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 Actions aktivieren möchten. Sobald IssueOps konfiguriert ist, können Benutzer ein Issue mit der entsprechenden Vorlage öffnen, um Pipelines zu Actions zu migrieren.

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

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

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

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

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.